home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / g / gina15.zip / demos / periodic.C < prev    next >
C/C++ Source or Header  |  1992-02-27  |  32KB  |  934 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. //   Module      : periodic.C   Version 1.8
  4. //   LastSCCS    : 1/23/92  12:34:23
  5. //   LastEdit    : "Wed Jan 22 13:08:27 1992"
  6. //   Description : 
  7. //   Author      : Andreas Baecker
  8. //   Copyright   : GMD Schloss Birlinghoven
  9.  
  10. #include <Gina/GnBasic.h>
  11. #include <Gina/GnMotif.h>
  12.  
  13. #include "face.h"
  14. #include "motif_bitmap.h"
  15.  
  16. char *fixed_font    = "fixed";
  17. char *var_font      = "variable";
  18. char *small_font    = "6x12";
  19. char *dialog_font   = "-adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-*";
  20. char *subtitle_font = "-adobe-new century schoolbook-bold-r-normal--14-*-*-*-*-*-*-*";
  21. char *heading_font  = "-adobe-new century schoolbook-bold-r-normal--14-*-*-*-*-*-*-*";
  22. char *hel_bold_font = "-adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-*";
  23.  
  24. char *hel_bold_font14          = "-adobe-helvetica-bold-r-normal--14-*-*-*-*-*-*-*";
  25. char *newcenturyschlbk_roman14 = "-adobe-new century schoolbook-medium-r-normal--14-*-*-*-*-*-*-*";
  26. char *newcenturyschlbk_roman12 = "-adobe-new century schoolbook-medium-r-normal--12-*-*-*-*-*-*-*";
  27. char *newcenturyschlbk_bold14  = "-adobe-new century schoolbook-bold-r-normal--14-*-*-*-*-*-*-*";
  28. char *newcenturyschlbk_bold24  = "-adobe-new century schoolbook-bold-r-normal--24-*-*-*-*-*-*-*";
  29. char *times_bold_font          = "-adobe-times-bold-r-normal--24-*-*-*-*-*-*-*";
  30.     
  31. int fudge           = 2;
  32. int dialog_fudge    = 10;
  33. int heading_fudge_x = 40;
  34. int heading_fudge_y = 25;
  35.  
  36. int title_x             = 270;
  37. int title_y             = 25;
  38. int subtitle_x          = title_x + 80;
  39. int subtitle_y          = title_y + 30;
  40. int dont_panic_x        = 7;
  41. int dont_panic_y        = 17;
  42. int radioactive_x       = 5;
  43. int radioactive_y       = 635;
  44. int radioactive_height  = 100;
  45. int radioactive_width   = 210;
  46. int radioactive_title_x = radioactive_x;
  47. int radioactive_title_y = radioactive_y - 35;
  48.  
  49. int table_origin_x      = 100;
  50. int table_origin_y      = 95;
  51.  
  52. int element_height      = 100;
  53. int element_width       = 100;
  54.  
  55. int element_vert_sep    = 10;
  56. int element_horiz_sep   = 10;
  57.  
  58. int centre_box_x        = table_origin_x + (element_width * 2) + fudge;
  59. int centre_box_y        = table_origin_y + (element_height * 2) + fudge;
  60. int centre_box_width    = 380;
  61. int centre_box_height   = 300 - fudge;
  62.  
  63. int legend_x            = centre_box_x + (centre_box_width/2) - 35;
  64. int legend_y            = centre_box_y - 160;
  65.  
  66. void quit_app(caddr_t)
  67. {
  68.     exit(0);
  69. }
  70.  
  71. void change_sel(GnSingleSelection *client_data, caddr_t call_data)
  72. {
  73.     GnSingleSelection *sel = (GnSingleSelection *)call_data;
  74.     client_data->Select(sel->SelectedItem(), False);
  75. }
  76.  
  77. void set_og_value(GnSelection *sel, GnPresentable *obj, caddr_t)
  78. {
  79.     sel->Select(obj, True);
  80. }
  81.  
  82. void ShowCurrentAndHistory(caddr_t call_data)
  83. {
  84.     GnSingleSelection *sel = (GnSingleSelection *)call_data;
  85.  
  86.     cerr << "Selected Item = ";
  87.     if( sel->SelectionAvailable() )
  88.     cerr << (void *)sel->SelectedItem();
  89.     else
  90.     cerr << "NIL";
  91.     cerr << " History = ";
  92.     if( sel->HistoryAvailable() )
  93.     cerr << (void *)sel->History();
  94.     else
  95.     cerr << "NIL";
  96.     cerr << "\n";
  97.     cerr.flush();
  98. }
  99.  
  100. void RemoveSelection(GnSingleSelection *selection, caddr_t)
  101. {
  102.     if( selection->SelectionAvailable() )
  103.     selection->Remove(selection->SelectedItem());
  104.     ShowCurrentAndHistory((caddr_t)selection);
  105.  
  106.     ENSURE( ! selection->SelectionAvailable(), "No selected item");
  107. }
  108.  
  109. void ShowClasses(GnSingleSelection *selection, caddr_t)
  110. {
  111.     GnClassListIterator *it = GnClass::ClassListIterator();
  112.     GnPresentableList new_items;
  113.  
  114.     for( it->Start(); ! it->Off(); it->Forth() )
  115.     new_items.Append(new GnStringItem(strdup(it->Item()->Name())));
  116.  
  117.     selection->SetItemList(&new_items);
  118. }
  119.     
  120. void call_manage(GnFormDialog *dialog, caddr_t)
  121. {
  122.     dialog->manage();
  123. }
  124.  
  125. void call_play(char *file, caddr_t)
  126. {
  127.     char s[200];
  128.  
  129.     sprintf(s, "/usr/demo/SOUND/play %s", file);
  130.     system(s);
  131. }
  132.  
  133. void fsb_dialog(GnWidget *parent, caddr_t)
  134. {
  135.     GnPathname *outp;
  136.  
  137.     if( select_old_file(*parent, &outp) == OK ) {
  138.     cout << "You selected: " << outp->abs_namestring() << endl;
  139.     delete outp;
  140.     }
  141.     
  142. }
  143.  
  144. void postmenu(void *client_data, caddr_t call_data)
  145. {
  146.     GnPopupMenuPane *menu  = (GnPopupMenuPane *)client_data;
  147.     XEvent         *event = (XEvent *)call_data;
  148.  
  149.     if( event->xbutton.button != Button3 )
  150.     return;
  151.  
  152.     menu->MenuPosition(event);
  153.     menu->manage();
  154. }
  155.  
  156. void set_dialog_args(GnMessageBox &dialog)
  157. {
  158.     dialog.setR_marginWidth(3);
  159.     dialog.setR_marginHeight(3);
  160.     dialog.setR_labelFontList(dialog_font);
  161.     dialog.setR_textFontList(newcenturyschlbk_roman12);
  162.     dialog.setR_shadowThickness(1);
  163. }
  164.  
  165. GnForm & make_element(GnWidget &parent, Position x, Position y, char *lbl,
  166.              char *name, GnPushButton **button_ret = 0,
  167.              Dimension el_width = element_width,
  168.              Dimension el_height = element_height)
  169. {
  170.     GnFrame &frame = *new GnFrame;
  171.     frame.setR_x(x);
  172.     frame.setR_y(y);
  173.     frame.create(parent, "frame");
  174.  
  175.     GnForm &form = *new GnForm;
  176.     form.setR_width(el_width);
  177.     form.setR_height(el_height);
  178.     form.create(frame, "form");
  179.  
  180.     GnLabel &label = *new GnLabel(lbl);
  181.     label.setR_fontList(newcenturyschlbk_roman14);
  182.     label.setR_shadowThickness(1);
  183.     label.setR_rightAttachment(XmATTACH_FORM);
  184.     label.setR_topAttachment(XmATTACH_FORM);
  185.     label.create(form, "label");
  186.  
  187.     GnPushButton &button = *new GnPushButton(name);
  188.     button.setR_fontList(newcenturyschlbk_roman14);
  189.     button.setR_shadowThickness(1);
  190.     button.setR_alignment(XmALIGNMENT_CENTER);
  191.     button.setR_leftAttachment(XmATTACH_FORM);
  192.     button.setR_bottomAttachment(XmATTACH_FORM);
  193.     button.setR_rightAttachment(XmATTACH_FORM);
  194.     button.create(form, "button");
  195.  
  196.     if(button_ret)
  197.     *button_ret = &button;
  198.     
  199.     return form;
  200. }
  201.  
  202. int main(Cardinal argc, char **argv)
  203. {
  204.     if( ! GnClass::IsInitialized() )
  205.     GnClass::Initialize();
  206.         
  207.     GnPushButton *dialog_parent;
  208.  
  209.     GnToolkit toolkit("Perf");
  210.  
  211.     toolkit.AppShell().setR_allowShellResize(True);
  212.     toolkit.AppShell().setR_deleteResponse(XmDO_NOTHING);
  213.     toolkit.AppInitialize(&argc, argv);
  214.  
  215.     toolkit.set_xt_error_handler((XtErrorHandler)abort);
  216.     //toolkit.set_xt_warning_handler((XtErrorHandler)abort);
  217.  
  218.     toolkit.AppShell().add_wm_closed_callback(SIMPLE_CALLBACK(quit_app));
  219.  
  220.     GnVariableMainWindow main_window;
  221.     main_window.setR_width(1000);
  222.     main_window.setR_height(802);
  223.     //main_window.setR_scrollingPolicy(XmAUTOMATIC);
  224.     main_window.create(toolkit.AppShell(), "main_window");
  225.  
  226.     GnMenuBar menu_bar_1;
  227.     menu_bar_1.create(main_window, "menu_bar_1");
  228.  
  229.     GnBulletinBoard work_area;
  230.     //work_area.setR_width(500);
  231.     //work_area.setR_height(500);
  232.     work_area.setR_borderWidth(2);
  233.     work_area.setR_labelFontList(hel_bold_font);
  234.     work_area.create(main_window, "work_area");
  235.  
  236.     GnRowColumn title_column;
  237.     title_column.setR_x(270);
  238.     title_column.setR_y(25);
  239.     title_column.setR_orientation(XmVERTICAL);
  240.     title_column.setR_entryAlignment(XmALIGNMENT_CENTER);
  241.     title_column.create(work_area, "title_column");
  242.  
  243.     GnLabelGadget title_version("Beta Version");
  244.     title_version.setR_fontList(newcenturyschlbk_roman12);
  245.     title_version.create(title_column, "title_version");
  246.     
  247.     GnLabelGadget title_1("The Periodic Table of C++ Widgets");
  248.     title_1.setR_fontList(newcenturyschlbk_bold24);
  249.     title_1.create(title_column, "title_1");
  250.     
  251.     GnLabelGadget title_2("GMD, March 1991");
  252.     title_2.setR_fontList(subtitle_font);
  253.     title_2.create(title_column, "title_2");
  254.  
  255.     GnLabelGadget heading_0("*Dialog\nBoxes");
  256.     heading_0.setR_x(radioactive_title_x);
  257.     heading_0.setR_y(radioactive_title_y);
  258.     heading_0.setR_fontList(newcenturyschlbk_roman14);
  259.     heading_0.setR_alignment(XmALIGNMENT_END);
  260.     heading_0.create(work_area, "heading_0");
  261.  
  262.     GnLabelGadget heading_legend("Key\nTo\nChart");
  263.     heading_legend.setR_x(legend_x - 55);
  264.     heading_legend.setR_y(legend_y + 15);
  265.     heading_legend.setR_fontList(newcenturyschlbk_bold14);
  266.     heading_legend.setR_alignment(XmALIGNMENT_END);
  267.     heading_legend.create(work_area, "heading_legend");
  268.  
  269.     GnLabelGadget legend_text_1("Atomic Number");
  270.     legend_text_1.setR_x(legend_x + 118);
  271.     legend_text_1.setR_y(legend_y + 3);
  272.     legend_text_1.setR_fontList(newcenturyschlbk_roman12);
  273.     legend_text_1.setR_alignment(XmALIGNMENT_CENTER);
  274.     legend_text_1.create(work_area, "legend_text_1");
  275.     
  276.     GnLabelGadget legend_text_2("Actual Widget");
  277.     legend_text_2.setR_x(legend_x + 118);
  278.     legend_text_2.setR_y(legend_y + 33);
  279.     legend_text_2.setR_fontList(newcenturyschlbk_roman12);
  280.     legend_text_2.setR_alignment(XmALIGNMENT_CENTER);
  281.     legend_text_2.create(work_area, "legend_text_2");
  282.     
  283.     GnLabelGadget legend_text_3("Widget Name");
  284.     legend_text_3.setR_x(legend_x + 118);
  285.     legend_text_3.setR_y(legend_y + 73);
  286.     legend_text_3.setR_fontList(newcenturyschlbk_roman12);
  287.     legend_text_3.setR_alignment(XmALIGNMENT_CENTER);
  288.     legend_text_3.create(work_area, "legend_text_3");
  289.  
  290.     GnLabelGadget legend_arrow_1("_");
  291.     legend_arrow_1.setR_x(legend_x + 105);
  292.     legend_arrow_1.setR_y(legend_y + 5);
  293.     legend_arrow_1.setR_fontList(var_font);
  294.     legend_arrow_1.create(work_area, "legend_arrow_1");
  295.     
  296.     GnLabelGadget legend_arrow_2("_");
  297.     legend_arrow_2.setR_x(legend_x + 105);
  298.     legend_arrow_2.setR_y(legend_y + 35);
  299.     legend_arrow_2.setR_fontList(var_font);
  300.     legend_arrow_2.create(work_area, "legend_arrow_2");
  301.     
  302.     GnLabelGadget legend_arrow_3("_");
  303.     legend_arrow_3.setR_x(legend_x + 105);
  304.     legend_arrow_3.setR_y(legend_y + 75);
  305.     legend_arrow_3.setR_fontList(var_font);
  306.     legend_arrow_3.create(work_area, "legend_arrow_3");
  307.  
  308.     GnSeparator legend_separator;
  309.     legend_separator.setR_width(80);
  310.     legend_separator.setR_x(10);
  311.     legend_separator.setR_y(40);
  312.     legend_separator.setR_orientation(XmHORIZONTAL);
  313.     legend_separator.setR_shadowThickness(4);
  314.     legend_separator.create(make_element(work_area, legend_x, legend_y,
  315.                      "1", "separator"), "legend_separator");
  316.  
  317.     // Column ONE
  318.  
  319.     GnLabel heading_1("Ia");
  320.     heading_1.setR_x(table_origin_x + heading_fudge_x);
  321.     heading_1.setR_y(table_origin_y - heading_fudge_y);
  322.     heading_1.setR_fontList(heading_font);
  323.     heading_1.setR_alignment(XmALIGNMENT_CENTER);
  324.     heading_1.create(work_area, "heading_1");
  325.     
  326.     GnSeparator separator_11;
  327.     separator_11.setR_width(80);
  328.     separator_11.setR_x(10);
  329.     separator_11.setR_y(40);
  330.     separator_11.setR_orientation(XmHORIZONTAL);
  331.     separator_11.setR_shadowThickness(4);
  332.     separator_11.create(make_element(work_area, table_origin_x, table_origin_y,
  333.                      "1", "separator"), "separator_11");
  334.  
  335.     GnArrowButton arrow_12;
  336.     arrow_12.setR_x(25);
  337.     arrow_12.setR_y(20);
  338.     arrow_12.setR_width(50);
  339.     arrow_12.setR_height(50);
  340.     arrow_12.setR_arrowDirection(XmARROW_UP);
  341.     arrow_12.create(make_element(work_area, table_origin_x,
  342.                  table_origin_y + element_height,
  343.                  "2", "arrowbutton"), "arrow_12");
  344.  
  345.     GnPushButtonGadget button_13("Explode\nBuilding");
  346.     button_13.setR_x(22);
  347.     button_13.setR_y(25);
  348.     button_13.setR_fontList(hel_bold_font);
  349.     button_13.setR_shadowThickness(1);
  350.     button_13.create(make_element(work_area, table_origin_x,
  351.                   table_origin_y + (element_height * 2),
  352.                  "3", "pushbutton"), "button_13");
  353.     button_13.add_activateCallback(SIMPLE_CALLBACK1(call_play, char *,
  354.                             "/usr/demo/SOUND/sounds/gong.au"));
  355.     GnToggleButtonGadget toggle_14("Lights");
  356.     toggle_14.setR_x(20);
  357.     toggle_14.setR_y(30);
  358.     toggle_14.setR_fontList(hel_bold_font);
  359.     toggle_14.setR_shadowThickness(1);
  360.     toggle_14.create(make_element(work_area, table_origin_x,
  361.                   table_origin_y + (element_height * 3),
  362.                   "4", "togglebutton", &dialog_parent),
  363.              "toggle_14");
  364.     
  365.     GnFormDialog toggle_14_dialog;
  366.     toggle_14_dialog.setR_dialogTitle(GnXMSTRING_LTOR("GnToggleButtonGroup"));
  367.     toggle_14_dialog.create(work_area, "toggle_14_dialog");
  368.  
  369.     GnToggleGroup toggle_23;
  370.     toggle_23.add("Front", 1, True);
  371.     toggle_23.add("Rear", 2, True);
  372.     toggle_23.add("Left", 3, False, False);
  373.     toggle_23.add("Right", 4);
  374.     toggle_23.setR_x(20);
  375.     toggle_23.setR_y(4);
  376.     toggle_23.setR_spacing(2);
  377.     toggle_23.setR_marginHeight(0);
  378.     toggle_23.setR_marginWidth(0);
  379.     toggle_23.setR_withFrame(False);
  380.     toggle_23.create(make_element(toggle_14_dialog, 0, 0,
  381.                   "4a", "togglegroup", 0, element_width+5,
  382.                   element_height + 25),
  383.              "toggle_23");
  384.  
  385.     dialog_parent->add_activateCallback(SIMPLE_CALLBACK1(call_manage,
  386.                              GnFormDialog *,
  387.                              &toggle_14_dialog));
  388.     GnLabelGadget label_15("DON'T\nPANIC");
  389.     label_15.setR_x(dont_panic_x);
  390.     label_15.setR_y(dont_panic_y);
  391.     label_15.setR_fontList(times_bold_font);
  392.     label_15.create(make_element(work_area, table_origin_x,
  393.                  table_origin_y + (element_height * 4),
  394.                  "5", "label"), "label_15");
  395.     
  396.  
  397.     // Column TWO
  398.  
  399.     GnLabel heading_2("IIa");
  400.     heading_2.setR_x(table_origin_x + element_width + heading_fudge_x);
  401.     heading_2.setR_y(table_origin_y + element_height - heading_fudge_y);
  402.     heading_2.setR_fontList(heading_font);
  403.     heading_2.setR_alignment(XmALIGNMENT_CENTER);
  404.     heading_2.create(work_area, "heading_2");
  405.  
  406.     // Items for the GnOptionGroup
  407.     GnBitmapFilePresentable item_221("xlogo11");
  408.     GnStringItem item_222("xlogo16");
  409.     GnStringItem item_223("xlogo32");
  410.     
  411.     GnOptionMenu option_22;
  412.     option_22.setR_labelString(GnXMSTRING_LTOR("RGB:"));
  413.     option_22.setR_x(0);
  414.     option_22.setR_y(30);
  415.     option_22.setR_shadowThickness(1);
  416.     option_22.create(make_element(work_area,
  417.                   table_origin_x + element_width,
  418.                   table_origin_y + element_height,
  419.                   "6", "optionmenu", &dialog_parent),
  420.              "option_22");
  421.  
  422.     GnPushButtonGadget option_button_1("bleu");
  423.     option_button_1.setR_fontList(fixed_font);
  424.     option_button_1.create(option_22, "bleu");
  425.  
  426.     GnPushButtonGadget  option_button_2("red");
  427.     option_button_2.setR_fontList(fixed_font);
  428.     option_button_2.create(option_22, "red");
  429.  
  430.     GnPushButtonGadget  option_button_3("green");
  431.     option_button_3.setR_fontList(fixed_font);
  432.     option_button_3.create(option_22, "green");
  433.  
  434.     GnFormDialog option_22_dialog;
  435.     option_22_dialog.setR_dialogTitle(GnXMSTRING_LTOR("GnOptionGroup"));
  436.     option_22_dialog.create(work_area, "option_22_dialog");
  437.  
  438.     GnPixmapOptionGroup ob_27;
  439.     ob_27.add(&item_221);
  440.     ob_27.add(&item_222);
  441.     ob_27.add(&item_223);
  442.     ob_27.setR_x(0);
  443.     ob_27.setR_y(30);
  444.     ob_27.setR_shadowThickness(1);
  445.     ob_27.setR_labelString(GnXMSTRING_LTOR("Select"));
  446.     ob_27.create(make_element(option_22_dialog, 0, 0,
  447.                   "6a", "optiongroup", 0, 130, 130), "ob_27");
  448.  
  449.     // CALLABCK(GnFormDialog, manage, &option_22_dialog) causes an error:
  450.     // "Sorry, not implemented: pointer to non first base"
  451.  
  452.     dialog_parent->add_activateCallback(SIMPLE_CALLBACK1(call_manage,
  453.                              GnFormDialog *,
  454.                              &option_22_dialog));
  455.  
  456.     // Callbacks to create the two Option menues/groups
  457.     option_button_1.add_activateCallback(SIMPLE_CALLBACK2(set_og_value,
  458.                               GnSelection *,
  459.                               &ob_27,
  460.                               GnPresentable *,
  461.                               &item_221));
  462.     option_button_2.add_activateCallback(SIMPLE_CALLBACK2(set_og_value,
  463.                               GnSelection *,
  464.                               &ob_27,
  465.                               GnPresentable *,
  466.                               &item_222));
  467.     option_button_3.add_activateCallback(SIMPLE_CALLBACK2(set_og_value,
  468.                               GnSelection *,
  469.                               &ob_27,
  470.                               GnPresentable *,
  471.                               &item_223));
  472.     GnScale scale_23;
  473.     scale_23.setR_x(3);
  474.     scale_23.setR_y(25);
  475.     scale_23.setR_width(95);
  476.     scale_23.setR_height(50);
  477.     scale_23.setR_fontList(hel_bold_font);
  478.     scale_23.setR_borderWidth(0);
  479.     scale_23.setR_value(42);
  480.     scale_23.setR_maximum(42);
  481.     scale_23.setR_minimum(0);
  482.     scale_23.setR_showValue(True);
  483.     scale_23.setR_orientation(XmHORIZONTAL);
  484.     scale_23.setR_processingDirection(XmMAX_ON_RIGHT);
  485.     scale_23.create(make_element(work_area,
  486.                 table_origin_x + element_width,
  487.                 table_origin_y + (element_height * 2),
  488.                 "7", "scale"), "scale_23");
  489.  
  490.     // The first two objects are added using a linked list
  491.     // The third is added using GnSelection::add() with an implicit creation
  492.     // of a GnIntegerItem object
  493.     
  494.     GnStringItem item_241("WFNX");
  495.     GnStringItem item_242("WCRB");
  496.     
  497.     GnPresentableList olist;
  498.     olist.Append(&item_241);
  499.     olist.Append(&item_242);
  500.     
  501.     // We use a GnRadioGroup instead of a GnRadioBox here
  502.     GnRadioGroup radio_24(False);
  503.     radio_24.add(&olist);
  504.     GnPresentable *item_243 = radio_24.add("WHKY", 3);
  505.     radio_24.setR_x(20);
  506.     radio_24.setR_y(4);
  507.     radio_24.setR_spacing(2);
  508.     radio_24.setR_marginHeight(0);
  509.     radio_24.setR_marginWidth(0);
  510.     radio_24.setR_withFrame(False);
  511.     radio_24.create(make_element(work_area, table_origin_x + element_width,
  512.                  table_origin_y + (element_height*3),
  513.                  "8", "radiobox", &dialog_parent),
  514.             "radio_24");
  515.  
  516.     GnFormDialog radio_25_dialog;
  517.     radio_25_dialog.setR_dialogTitle(GnXMSTRING_LTOR("GnRadioGroup"));
  518.     radio_25_dialog.create(work_area, "radio_25_dialog");
  519.  
  520.     // This GnRadioGroup contains the same objects as radio_24
  521.     
  522.     GnRadioGroup radio_25;
  523.     radio_25.add(&item_241);
  524.     radio_25.add(&item_242);
  525.     radio_25.add(item_243);
  526.     radio_25.setR_x(20);
  527.     radio_25.setR_y(4);
  528.     radio_25.setR_spacing(2);
  529.     radio_25.setR_marginHeight(0);
  530.     radio_25.setR_marginWidth(0);
  531.     radio_25.setR_withFrame(True);
  532.     radio_25.setR_labelString("SLCT");
  533.     radio_25.create(make_element(radio_25_dialog, 0, 0,
  534.                  "8a", "radiogroup", 0, element_width+5),
  535.             "radio_25");
  536.     radio_25.add_selectionCallback(SIMPLE_CALLBACK1(change_sel,
  537.                             GnSingleSelection *,
  538.                             &radio_24));
  539.     radio_24.add_selectionCallback(SIMPLE_CALLBACK1(change_sel,
  540.                             GnSingleSelection *,
  541.                             &radio_25));
  542.     
  543.     dialog_parent->add_activateCallback(SIMPLE_CALLBACK1(call_manage,
  544.                              GnFormDialog *,
  545.                              &radio_25_dialog));
  546.     
  547.     GnText text_25;
  548.     text_25.setR_x(15);
  549.     text_25.setR_y(25);
  550.     text_25.setR_columns(10);
  551.     text_25.setR_rows(2);
  552.     text_25.setR_value("helloworld");
  553.     text_25.setR_resizeWidth(False);
  554.     text_25.setR_resizeHeight(False);
  555.     text_25.setR_editMode(XmMULTI_LINE_EDIT);
  556.     text_25.create(make_element(work_area, table_origin_x + element_width,
  557.                 table_origin_y + (element_height*4),
  558.                 "9", "text edit"), "text_25");
  559.     
  560.  
  561.     // Center Column
  562.  
  563.     GnLabel heading_center("IIIb");
  564.     heading_center.setR_x(centre_box_x + (centre_box_width/2));
  565.     heading_center.setR_y(centre_box_y - heading_fudge_y);
  566.     heading_center.setR_fontList(heading_font);
  567.     heading_center.setR_alignment(XmALIGNMENT_CENTER);
  568.     heading_center.create(work_area, "heading_center");
  569.  
  570.     GnFrame fsb_frame;
  571.     fsb_frame.setR_x(25);
  572.     fsb_frame.setR_y(1);
  573.     fsb_frame.create(make_element(work_area, centre_box_x, centre_box_y,
  574.                   "10", "file selection*", &dialog_parent,
  575.                   centre_box_width, centre_box_height),
  576.              "fsb_frame");
  577.     
  578.     GnFileSelectionBox fsb;
  579.     fsb.setR_width(320);
  580.     fsb.setR_resizePolicy(XmRESIZE_NONE);
  581.     fsb.setR_listVisibleItemCount(2);
  582.     fsb.setR_labelFontList(hel_bold_font);
  583.     fsb.create(fsb_frame, "fsb");
  584.     fsb.add_helpCallback(SIMPLE_CALLBACK1(call_play, char *,
  585.                       "/usr/demo/SOUND/sounds/laugh.au"));
  586.     
  587.     // Column THREE
  588.  
  589.     GnLabel heading_3("IVa");
  590.     heading_3.setR_x(centre_box_x + centre_box_width + heading_fudge_x - 5);
  591.     heading_3.setR_y(table_origin_y + (element_height*2)
  592.              + fudge - heading_fudge_y);
  593.     heading_3.setR_fontList(heading_font);
  594.     heading_3.setR_alignment(XmALIGNMENT_CENTER);
  595.     heading_3.create(work_area, "heading_3");
  596.  
  597.     GnScrollBar scrollbar_32;
  598.     scrollbar_32.setR_x(10);
  599.     scrollbar_32.setR_y(30);
  600.     scrollbar_32.setR_width(75);
  601.     scrollbar_32.setR_orientation(XmHORIZONTAL);
  602.     scrollbar_32.setR_value(20);
  603.     scrollbar_32.create(make_element(work_area,
  604.                      centre_box_x + centre_box_width + fudge,
  605.                      table_origin_y + (element_height*2)+ fudge,
  606.                      "11", "scrollbar"), "scrollbar_32");
  607.  
  608.     GnFrame sl_frame_33;
  609.     sl_frame_33.setR_x(11);
  610.     sl_frame_33.setR_y(12);
  611.     sl_frame_33.create(make_element(work_area,
  612.                     centre_box_x + centre_box_width + fudge,
  613.                     table_origin_y + (element_height*3),
  614.                     "12", "scrolled list", &dialog_parent),
  615.                "sl_frame_33");
  616.     
  617.     GnScrollableSingleSelectionList scrolled_list_33;
  618.     scrolled_list_33.add("Foobar");
  619.     scrolled_list_33.add("Mumble");
  620.     scrolled_list_33.add("Lambda");
  621.     scrolled_list_33.add("Coke");
  622.     scrolled_list_33.setR_visibleItemCount(3);
  623.     scrolled_list_33.create(sl_frame_33, "scrolled_list_33");
  624.     scrolled_list_33.
  625.     AddDoubleClickCallback(SIMPLE_CALLBACK(ShowCurrentAndHistory));
  626.  
  627.     GnFormDialog scroll_33_dialog;
  628.     scroll_33_dialog.setR_dialogTitle("GnScrollableMultipleSelectionList");
  629.     scroll_33_dialog.create(work_area, "scroll_33_dialog");
  630.  
  631.     // This GnRadioGroup contains the same objects as radio_24
  632.     
  633.     GnScrollableMultipleSelectionList scrollable_33;
  634.     scrollable_33.add("At");
  635.     scrollable_33.add("Bear");
  636.     scrollable_33.add("Tilt !");
  637.     scrollable_33.add("Pink");
  638.     scrollable_33.add("Goose");
  639.     scrollable_33.add("Funny");
  640.     scrollable_33.setR_visibleItemCount(3);
  641.     scrollable_33.create(make_element(scroll_33_dialog, 0, 0,
  642.                       "12a", "scrollable", 0,
  643.                       element_width + 5),
  644.              "scrollable_33");
  645.     dialog_parent->add_activateCallback(SIMPLE_CALLBACK1(call_manage,
  646.                              GnFormDialog *,
  647.                              &scroll_33_dialog));
  648.     
  649.     GnFrame paned_frame_34;
  650.     paned_frame_34.setR_x(7);
  651.     paned_frame_34.setR_y(0);
  652.     paned_frame_34.setR_width(100);
  653.     paned_frame_34.create(make_element(work_area,
  654.                        centre_box_x + centre_box_width + fudge,
  655.                        table_origin_y + (element_height*4),
  656.                        "16", "paned window",
  657.                        0, element_width*2),
  658.               "paned_frame_34");
  659.               
  660.     GnPanedWindow paned_34;
  661.     paned_34.create(paned_frame_34, "paned_34");
  662.  
  663.     GnText paned_text_1;
  664.     paned_text_1.setR_columns(24);
  665.     paned_text_1.setR_rows(1);
  666.     paned_text_1.setR_value("GMD, F3, Project GINA");
  667.     paned_text_1.setR_resizeWidth(False);
  668.     paned_text_1.setR_resizeHeight(False);
  669.     paned_text_1.setR_editMode(XmMULTI_LINE_EDIT);
  670.     paned_text_1.create(paned_34, "paned_text_1");
  671.  
  672.     GnText paned_text_2;
  673.     paned_text_2.setR_columns(24);
  674.     paned_text_2.setR_rows(1);
  675.     paned_text_2.setR_value("GINA Beta Version");
  676.     paned_text_2.setR_resizeWidth(False);
  677.     paned_text_2.setR_resizeHeight(False);
  678.     paned_text_2.setR_editMode(XmMULTI_LINE_EDIT);
  679.     paned_text_2.create(paned_34, "paned_text_2");
  680.  
  681.     // Column FOUR
  682.  
  683.     GnLabel heading_4("Va");
  684.     heading_4.setR_x(centre_box_x + centre_box_width +
  685.              element_width + heading_fudge_x);
  686.     heading_4.setR_y(table_origin_y + element_height - heading_fudge_y);
  687.     heading_4.setR_fontList(heading_font);
  688.     heading_4.setR_alignment(XmALIGNMENT_CENTER);
  689.     heading_4.create(work_area, "heading_4");
  690.  
  691.     GnFrame frame_41;
  692.     frame_41.setR_x(5);
  693.     frame_41.setR_y(25);
  694.     frame_41.setR_shadowThickness(2);
  695.     frame_41.create(make_element(work_area,
  696.                  centre_box_x + centre_box_width +
  697.                  element_width + fudge,
  698.                  table_origin_y + element_height,
  699.                  "13", "popup menu"), "frame_41");
  700.  
  701.     GnLabel label_41("Press MB3 for\nPopup Menu");
  702.     label_41.setR_fontList(fixed_font);
  703.     label_41.create(frame_41, "label_41");
  704.     // Popup menu is defined after MENU STUFF
  705.  
  706.     GnFrame drawing_area_42_frame;
  707.     drawing_area_42_frame.setR_x(26);
  708.     drawing_area_42_frame.setR_y(28);
  709.     drawing_area_42_frame.create(make_element(work_area,
  710.                           centre_box_x + centre_box_width +
  711.                           element_width + fudge,
  712.                           table_origin_y + (element_height*2),
  713.                           "14", "drawing area"),
  714.                  "drawing_area_42_frame");
  715.     
  716.     GnDrawingArea drawing_area_42;
  717.     drawing_area_42.setR_width(44);
  718.     drawing_area_42.setR_height(36);
  719.     drawing_area_42.setR_backgroundPixmap(face_bits, face_width, face_height);
  720.     drawing_area_42.create(drawing_area_42_frame, "drawing_area_42");
  721.  
  722.     GnDrawnButton drawn_button_43;
  723.     drawn_button_43.setR_x(15);
  724.     drawn_button_43.setR_y(10);
  725.     drawn_button_43.setR_marginWidth(0);
  726.     drawn_button_43.setR_marginHeight(0);
  727.     drawn_button_43.setR_width(64);
  728.     drawn_button_43.setR_height(62);
  729.     drawn_button_43.setR_backgroundPixmap(motif_bitmap_bits, motif_bitmap_width,
  730.                       motif_bitmap_height);
  731.     drawn_button_43.setR_pushButtonEnabled(True);
  732.     drawn_button_43.create(make_element(work_area,
  733.                      centre_box_x + centre_box_width
  734.                      + element_width + fudge,
  735.                      table_origin_y + (element_height*3),
  736.                     "15", "drawnbutton"),
  737.                "drawn_button_43");
  738.  
  739.     // DIALOGS
  740.  
  741.     GnFrame dialog_frame_1;
  742.     dialog_frame_1.setR_x(radioactive_x);
  743.     dialog_frame_1.setR_y(radioactive_y);
  744.     dialog_frame_1.create(work_area, "dialog_frame_1");
  745.  
  746.     GnErrorBox error_dialog;
  747.     set_dialog_args(error_dialog);
  748.     error_dialog.
  749.     setR_messageString(GnXMSTRING_LTOR("Swap Error...\nYou Lose Your Mind."));
  750.     error_dialog.create(dialog_frame_1, "error_dialog");
  751.     error_dialog.manage();
  752.     
  753.     GnFrame dialog_frame_2;
  754.     dialog_frame_2.setR_x(radioactive_x + radioactive_width - 5);
  755.     dialog_frame_2.setR_y(radioactive_y);
  756.     dialog_frame_2.create(work_area, "dialog_frame_2");
  757.  
  758.     GnInformationBox information_dialog;
  759.     set_dialog_args(information_dialog);
  760.     information_dialog.setR_messageString(GnXMSTRING_LTOR("Information is\nPower"));
  761.     information_dialog.create(dialog_frame_2, "information_dialog");
  762.     information_dialog.manage();
  763.     
  764.     GnFrame dialog_frame_3;
  765.     dialog_frame_3.setR_x(radioactive_x + (radioactive_width*2) - 15);
  766.     dialog_frame_3.setR_y(radioactive_y);
  767.     dialog_frame_3.create(work_area, "dialog_frame_3");
  768.  
  769.     GnQuestionBox question_dialog;
  770.     set_dialog_args(question_dialog);
  771.     question_dialog.
  772.     setR_messageString(GnXMSTRING_LTOR("Question authority...\nBut raise your hand first."));
  773.     question_dialog.create(dialog_frame_3, "question_dialog");
  774.     question_dialog.manage();
  775.     
  776.     GnFrame dialog_frame_4;
  777.     dialog_frame_4.setR_x(radioactive_x + (radioactive_width*3) - 25);
  778.     dialog_frame_4.setR_y(radioactive_y);
  779.     dialog_frame_4.create(work_area, "dialog_frame_4");
  780.  
  781.     GnWarningBox warning_dialog;
  782.     set_dialog_args(warning_dialog);
  783.     warning_dialog.setR_messageString(GnXMSTRING_LTOR("Warning, Warning,\nDanger, Dr. Smith..."));
  784.     warning_dialog.create(dialog_frame_4, "warning_dialog");
  785.     warning_dialog.manage();
  786.     
  787.     GnFrame dialog_frame_5;
  788.     dialog_frame_5.setR_x(radioactive_x + (radioactive_width*4) - 35);
  789.     dialog_frame_5.setR_y(radioactive_y);
  790.     dialog_frame_5.create(work_area, "dialog_frame_5");
  791.     
  792.     GnWorkingBox working_dialog;
  793.     set_dialog_args(working_dialog);
  794.     working_dialog.setR_messageString(GnXMSTRING_LTOR("Work in Progress,\nMeditating...."));
  795.     working_dialog.create(dialog_frame_5, "working_dialog");
  796.     working_dialog.manage();
  797.     
  798.     // MENU STUFF
  799.     
  800.     GnPulldownMenuPane file_pane;
  801.     file_pane.create(menu_bar_1, "filePane");
  802.  
  803.     GnCascadeButton file_cascade("File", file_pane);
  804.     file_cascade.setR_fontList(hel_bold_font);
  805.     file_cascade.create(menu_bar_1, "fileCascade");
  806.  
  807.     GnPulldownMenuPane edit_pane;
  808.     edit_pane.create(menu_bar_1, "editPane");
  809.  
  810.     GnCascadeButton edit_cascade("Edit", edit_pane);
  811.     edit_cascade.setR_fontList(hel_bold_font);
  812.     edit_cascade.create(menu_bar_1, "editCascade");
  813.  
  814.     GnPulldownMenuPane help_pane;
  815.     help_pane.create(menu_bar_1, "helpPane");
  816.  
  817.     GnCascadeButton help_cascade("Help", help_pane);
  818.     help_cascade.setR_fontList(hel_bold_font);
  819.     help_cascade.create(menu_bar_1, "helpCascade");
  820.  
  821.     menu_bar_1.setR_menuHelpWidget(&help_cascade);
  822.     menu_bar_1.SetValues();
  823.  
  824.     // FILE MENU STUFF
  825.  
  826.     GnPushButtonGadget sample_push_button_1("New");
  827.     sample_push_button_1.setR_fontList(hel_bold_font);
  828.     sample_push_button_1.create(file_pane, "sample_push_button_1");
  829.     
  830.     GnPushButtonGadget sample_push_button_2("Open Software...");
  831.     sample_push_button_2.setR_fontList(hel_bold_font);
  832.     sample_push_button_2.create(file_pane, "sample_push_button_2");
  833.     sample_push_button_2.add_activateCallback(SIMPLE_CALLBACK1(fsb_dialog,
  834.                                    GnWidget *,
  835.                                    &work_area));
  836.  
  837.     GnPulldownMenuPane about_pane;
  838.     about_pane.create(file_pane, "about_pane");
  839.     
  840.     GnCascadeButtonGadget about("About", about_pane);
  841.     about.setR_fontList(hel_bold_font);
  842.     about.create(file_pane, "about");
  843.     
  844.     GnSeparator file_separator;
  845.     file_separator.create(file_pane, "file_separator");
  846.  
  847.     GnPushButtonGadget quit_button("Quit");
  848.     quit_button.setR_fontList(hel_bold_font);
  849.     quit_button.create(file_pane, "quit");
  850.     quit_button.add_activateCallback(SIMPLE_CALLBACK(quit_app));
  851.     
  852.     GnLabelGadget about_label("GINA Periodic Table\nBeta Version\
  853. \nCreated by Andreas Baecker\n[April 1991]");
  854.     about_label.setR_fontList(hel_bold_font);
  855.     about_label.create(about_pane, "about_label");
  856.     
  857.     // EDIT MENU STUFF
  858.  
  859.     GnPushButtonGadget s_push_button_1("Cut");
  860.     s_push_button_1.setR_fontList(hel_bold_font);
  861.     s_push_button_1.create(edit_pane, "s_push_button_1");
  862.     s_push_button_1.add_activateCallback(SIMPLE_CALLBACK1(RemoveSelection,
  863.                               GnSingleSelection *,
  864.                               (&scrolled_list_33)));
  865.  
  866.     GnPushButtonGadget s_push_button_2("Copy");
  867.     s_push_button_2.setR_fontList(hel_bold_font);
  868.     s_push_button_2.create(edit_pane, "s_push_button_2");
  869.     
  870.     GnPushButtonGadget s_push_button_3("Paste");
  871.     s_push_button_3.setR_fontList(hel_bold_font);
  872.     s_push_button_3.create(edit_pane, "s_push_button_3");
  873.     s_push_button_3.add_activateCallback(SIMPLE_CALLBACK1(ShowClasses,
  874.                               GnSingleSelection *,
  875.                               (&scrollable_33)));
  876.  
  877.     
  878.     GnPulldownMenuPane more_stuff_pane;
  879.     more_stuff_pane.setR_entryAlignment(XmALIGNMENT_CENTER);
  880.     more_stuff_pane.create(edit_pane, "more_stuff_pane");
  881.     
  882.     GnCascadeButtonGadget morestuff("morestuff", more_stuff_pane);
  883.     morestuff.setR_fontList(hel_bold_font);
  884.     morestuff.create(edit_pane, "morestuff");
  885.  
  886.     GnLabelGadget more_stuff_label("THANKS FOR\nALL THE FISH");
  887.     more_stuff_label.setR_fontList(hel_bold_font);
  888.     more_stuff_label.create(more_stuff_pane, "more_stuff_label");
  889.     
  890.     // HELP MENU STUFF
  891.  
  892.     GnPushButtonGadget overview("Overview...");
  893.     overview.setR_fontList(hel_bold_font);
  894.     overview.create(help_pane, "overview");
  895.  
  896.     GnPushButtonGadget bindings("Bindings...");
  897.     bindings.setR_fontList(hel_bold_font);
  898.     bindings.create(help_pane, "bindings");
  899.  
  900.     GnPushButtonGadget tutorial("Tutorial...");
  901.     tutorial.setR_fontList(hel_bold_font);
  902.     tutorial.create(help_pane, "tutorial");
  903.  
  904.     GnPushButtonGadget DumpOn("Dump Tree");
  905.     DumpOn.create(file_pane, "DumpOn");
  906.     DumpOn.add_activateCallback(CALLBACK1(GnWidget, dump_tree,
  907.                       &toolkit.AppShell(), int, 0));
  908.  
  909.  
  910.     // POPUP MENU FOR label_41
  911.  
  912.     GnPopupMenuPane popup_41;
  913.     popup_41.create(label_41, "popup_41");
  914.     label_41.add_event_handler(SIMPLE_CALLBACK1(postmenu,
  915.                         GnPopupMenuPane*, &popup_41),
  916.                    ButtonPressMask);
  917.  
  918.     GnLabelGadget popup_label_41("POPUP MENU");
  919.     popup_label_41.create(popup_41, "popup_label_41");
  920.     
  921.     GnSeparatorGadget popup_separator_41;
  922.     popup_separator_41.setR_separatorType(XmDOUBLE_LINE);
  923.     popup_separator_41.create(popup_41, "popup_label_41");
  924.     
  925.     GnPushButtonGadget popup_push_41("pushbutton");
  926.     popup_push_41.create(popup_41, "popup_push_41");
  927.     
  928.     GnToggleButtonGadget popup_toggle_41("togglebutton");
  929.     popup_toggle_41.create(popup_41, "popup_toggle_41");
  930.     
  931.     toolkit.AppShell().realize();
  932.     toolkit.AppMainLoop();
  933. }
  934.