/[emacs]/emacs/lwlib/lwlib-Xm.c
ViewVC logotype

Diff of /emacs/lwlib/lwlib-Xm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by jhd, Mon Apr 22 18:25:55 2002 UTC revision 1.45.2.1 by miles, Fri Apr 4 06:20:42 2003 UTC
# Line 3  Line 3 
3    
4  This file is part of the Lucid Widget Library.  This file is part of the Lucid Widget Library.
5    
6  The Lucid Widget Library is free software; you can redistribute it and/or  The Lucid Widget Library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as published by  modify it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 1, or (at your option)  the Free Software Foundation; either version 1, or (at your option)
9  any later version.  any later version.
10    
11  The Lucid Widget Library is distributed in the hope that it will be useful,  The Lucid Widget Library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.  GNU General Public License for more details.
15    
# Line 72  enum do_call_type { pre_activate, select Line 72  enum do_call_type { pre_activate, select
72    
73    
74   /* Structures to keep destroyed instances */   /* Structures to keep destroyed instances */
75  typedef struct _destroyed_instance  typedef struct _destroyed_instance
76  {  {
77    char*         name;    char*         name;
78    char*         type;    char*         type;
# Line 188  make_destroyed_instance (name, type, wid Line 188  make_destroyed_instance (name, type, wid
188    instance->next = NULL;    instance->next = NULL;
189    return instance;    return instance;
190  }  }
191                            
192  static void  static void
193  free_destroyed_instance (instance)  free_destroyed_instance (instance)
194       destroyed_instance* instance;       destroyed_instance* instance;
# Line 210  Boolean Line 210  Boolean
210  lw_motif_widget_p (widget)  lw_motif_widget_p (widget)
211       Widget widget;       Widget widget;
212  {  {
213    return    return
214      XtClass (widget) == xmDialogShellWidgetClass      XtClass (widget) == xmDialogShellWidgetClass
215        || XmIsPrimitive (widget) || XmIsManager (widget) || XmIsGadget (widget);        || XmIsPrimitive (widget) || XmIsManager (widget) || XmIsGadget (widget);
216  }  }
# Line 222  resource_motif_string (widget, name) Line 222  resource_motif_string (widget, name)
222  {  {
223    XtResource resource;    XtResource resource;
224    XmString result = 0;    XmString result = 0;
225      
226    resource.resource_name = name;    resource.resource_name = name;
227    resource.resource_class = XmCXmString;    resource.resource_class = XmCXmString;
228    resource.resource_type = XmRXmString;    resource.resource_type = XmRXmString;
# Line 254  destroy_all_children (widget, first_chil Line 254  destroy_all_children (widget, first_chil
254        XtUnmanageChildren (children + first_child_to_destroy,        XtUnmanageChildren (children + first_child_to_destroy,
255                            number - first_child_to_destroy);                            number - first_child_to_destroy);
256    
257        /* Unmanage all children and destroy them.  They will only be        /* Unmanage all children and destroy them.  They will only be
258           really destroyed when we get out of DispatchEvent.  */           really destroyed when we get out of DispatchEvent.  */
259        for (i = first_child_to_destroy; i < number; i++)        for (i = first_child_to_destroy; i < number; i++)
260          {          {
# Line 265  destroy_all_children (widget, first_chil Line 265  destroy_all_children (widget, first_chil
265               XtCompositeChildren.  So get it out of the cascade button               XtCompositeChildren.  So get it out of the cascade button
266               and free it.  If this child is not a cascade button,               and free it.  If this child is not a cascade button,
267               then submenu should remain unchanged.  */               then submenu should remain unchanged.  */
268            XtSetArg (al[0], XmNsubMenuId, &submenu);            XtSetArg (al[0], XmNsubMenuId, &submenu);
269            XtGetValues (children[i], al, 1);            XtGetValues (children[i], al, 1);
270            if (submenu)            if (submenu)
271              XtDestroyWidget (submenu);              {
272                  destroy_all_children (submenu, 0);
273                  XtDestroyWidget (submenu);
274                }
275            XtDestroyWidget (children[i]);            XtDestroyWidget (children[i]);
276          }          }
277    
# Line 326  xm_arm_callback (w, client_data, call_da Line 329  xm_arm_callback (w, client_data, call_da
329     the value to update.     the value to update.
330    
331     Menus:     Menus:
332      
333     Emacs fills VAL->name with the text to display in the menu, and     Emacs fills VAL->name with the text to display in the menu, and
334     sets VAL->value to null.  Function make_menu_in_widget creates     sets VAL->value to null.  Function make_menu_in_widget creates
335     widgets with VAL->name as resource name.  This works because the     widgets with VAL->name as resource name.  This works because the
# Line 368  xm_update_label (instance, widget, val) Line 371  xm_update_label (instance, widget, val)
371              XmStringCreateLtoR (val->value, XmSTRING_DEFAULT_CHARSET);              XmStringCreateLtoR (val->value, XmSTRING_DEFAULT_CHARSET);
372            XtSetArg (al [ac], XmNlabelString, built_string); ac++;            XtSetArg (al [ac], XmNlabelString, built_string); ac++;
373          }          }
374          
375        XtSetArg (al [ac], XmNlabelType, XmSTRING); ac++;        XtSetArg (al [ac], XmNlabelType, XmSTRING); ac++;
376      }      }
377      
378    if (val->key)    if (val->key)
379      {      {
380        key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET);        key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET);
# Line 563  make_menu_in_widget (instance, widget, v Line 566  make_menu_in_widget (instance, widget, v
566        XtSetArg (al[ac], XmNsensitive, cur->enabled); ac++;        XtSetArg (al[ac], XmNsensitive, cur->enabled); ac++;
567        XtSetArg (al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;        XtSetArg (al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
568        XtSetArg (al[ac], XmNuserData, cur->call_data); ac++;        XtSetArg (al[ac], XmNuserData, cur->call_data); ac++;
569          
570        if (instance->pop_up_p && !cur->contents && !cur->call_data        if (instance->pop_up_p && !cur->contents && !cur->call_data
571            && !lw_separator_p (cur->name, &separator, 1))            && !lw_separator_p (cur->name, &separator, 1))
572          {          {
# Line 602  make_menu_in_widget (instance, widget, v Line 605  make_menu_in_widget (instance, widget, v
605                XtAddCallback (button, XmNarmCallback, xm_arm_callback, cur);                XtAddCallback (button, XmNarmCallback, xm_arm_callback, cur);
606                XtAddCallback (button, XmNdisarmCallback, xm_arm_callback, cur);                XtAddCallback (button, XmNdisarmCallback, xm_arm_callback, cur);
607              }              }
608              
609            xm_update_label (instance, button, cur);            xm_update_label (instance, button, cur);
610              
611            /* Add a callback that is called when the button is            /* Add a callback that is called when the button is
612               selected.  Toggle buttons don't support               selected.  Toggle buttons don't support
613               XmNactivateCallback, we use XmNvalueChangedCallback in               XmNactivateCallback, we use XmNvalueChangedCallback in
# Line 681  update_one_menu_entry (instance, widget, Line 684  update_one_menu_entry (instance, widget,
684    menu = NULL;    menu = NULL;
685    XtSetArg (al [ac], XmNsubMenuId, &menu); ac++;    XtSetArg (al [ac], XmNsubMenuId, &menu); ac++;
686    XtGetValues (widget, al, ac);    XtGetValues (widget, al, ac);
687      
688    contents = val->contents;    contents = val->contents;
689    
690    if (!menu)    if (!menu)
# Line 712  update_one_menu_entry (instance, widget, Line 715  update_one_menu_entry (instance, widget,
715            else            else
716              {              {
717                Widget button;                Widget button;
718                  
719                /* The current menuitem is a XmPushButtonGadget, it                /* The current menuitem is a XmPushButtonGadget, it
720                   needs to be replaced by a CascadeButtonGadget */                   needs to be replaced by a CascadeButtonGadget */
721                XtDestroyWidget (widget_list[i]);                XtDestroyWidget (widget_list[i]);
722                menu = XmCreatePulldownMenu (parent, val->name, NULL, 0);                menu = XmCreatePulldownMenu (parent, val->name, NULL, 0);
# Line 729  update_one_menu_entry (instance, widget, Line 732  update_one_menu_entry (instance, widget,
732  #endif  #endif
733                button = XmCreateCascadeButton (parent, val->name, al, ac);                button = XmCreateCascadeButton (parent, val->name, al, ac);
734                xm_update_label (instance, button, val);                xm_update_label (instance, button, val);
735                  
736                XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,                XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
737                               (XtPointer)instance);                               (XtPointer)instance);
738                XtManageChild (button);                XtManageChild (button);
739              }              }
740    
741              if (widget_list)
742                XtFree ((char*) widget_list);
743          }          }
744      }      }
745    else if (!contents)    else if (!contents)
# Line 773  xm_update_menu (instance, widget, val, d Line 779  xm_update_menu (instance, widget, val, d
779      {      {
780        if (children)        if (children)
781          {          {
782            for (i = 0, cur = val->contents;            for (i = 0, cur = val->contents;
783                 (i < num_children                 (i < num_children
784                  && cur); /* how else to ditch unwanted children ?? - mgd */                  && cur); /* how else to ditch unwanted children ?? - mgd */
785                 i++, cur = cur->next)                 i++, cur = cur->next)
# Line 813  xm_update_menu (instance, widget, val, d Line 819  xm_update_menu (instance, widget, val, d
819      {      {
820        destroy_all_children (widget, num_children_to_keep);        destroy_all_children (widget, num_children_to_keep);
821        make_menu_in_widget (instance, widget, val->contents,        make_menu_in_widget (instance, widget, val->contents,
822                             num_children_to_keep);                             num_children_to_keep);
823      }      }
824    
825    XtFree ((char *) children);    XtFree ((char *) children);
# Line 861  xm_update_one_widget (instance, widget, Line 867  xm_update_one_widget (instance, widget,
867       Boolean deep_p;       Boolean deep_p;
868  {  {
869    WidgetClass class;    WidgetClass class;
870      
871    /* Mark as not edited */    /* Mark as not edited */
872    val->edited = False;    val->edited = False;
873    
874    /* Common to all widget types */    /* Common to all widget types */
875    XtSetSensitive (widget, val->enabled);    XtSetSensitive (widget, val->enabled);
876    XtVaSetValues (widget, XmNuserData, val->call_data, NULL);    XtVaSetValues (widget, XmNuserData, val->call_data, NULL);
877      
878    /* Common to all label like widgets */    /* Common to all label like widgets */
879    if (XtIsSubclass (widget, xmLabelWidgetClass))    if (XtIsSubclass (widget, xmLabelWidgetClass))
880      xm_update_label (instance, widget, val);      xm_update_label (instance, widget, val);
881      
882    class = XtClass (widget);    class = XtClass (widget);
883    /* Class specific things */    /* Class specific things */
884    if (class == xmPushButtonWidgetClass ||    if (class == xmPushButtonWidgetClass ||
# Line 894  xm_update_one_widget (instance, widget, Line 900  xm_update_one_widget (instance, widget,
900        Boolean radiobox = 0;        Boolean radiobox = 0;
901        int ac = 0;        int ac = 0;
902        Arg al [1];        Arg al [1];
903          
904        XtSetArg (al [ac], XmNradioBehavior, &radiobox); ac++;        XtSetArg (al [ac], XmNradioBehavior, &radiobox); ac++;
905        XtGetValues (widget, al, ac);        XtGetValues (widget, al, ac);
906          
907        if (radiobox)        if (radiobox)
908          xm_update_radiobox (instance, widget, val);          xm_update_radiobox (instance, widget, val);
909        else        else
# Line 934  xm_update_one_value (instance, widget, v Line 940  xm_update_one_value (instance, widget, v
940          val->call_data = old_wv->call_data;          val->call_data = old_wv->call_data;
941          break;          break;
942        }        }
943      
944    if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass)    if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass)
945      {      {
946        XtVaGetValues (widget, XmNset, &val->selected, NULL);        XtVaGetValues (widget, XmNset, &val->selected, NULL);
# Line 959  xm_update_one_value (instance, widget, v Line 965  xm_update_one_value (instance, widget, v
965        Boolean radiobox = 0;        Boolean radiobox = 0;
966        int ac = 0;        int ac = 0;
967        Arg al [1];        Arg al [1];
968          
969        XtSetArg (al [ac], XmNradioBehavior, &radiobox); ac++;        XtSetArg (al [ac], XmNradioBehavior, &radiobox); ac++;
970        XtGetValues (widget, al, ac);        XtGetValues (widget, al, ac);
971          
972        if (radiobox)        if (radiobox)
973          {          {
974            CompositeWidget radio = (CompositeWidget)widget;            CompositeWidget radio = (CompositeWidget)widget;
# Line 971  xm_update_one_value (instance, widget, v Line 977  xm_update_one_value (instance, widget, v
977              {              {
978                int set = False;                int set = False;
979                Widget toggle = radio->composite.children [i];                Widget toggle = radio->composite.children [i];
980                  
981                XtVaGetValues (toggle, XmNset, &set, NULL);                XtVaGetValues (toggle, XmNset, &set, NULL);
982                if (set)                if (set)
983                  {                  {
# Line 1014  xm_update_one_value (instance, widget, v Line 1020  xm_update_one_value (instance, widget, v
1020  /* This function is for activating a button from a program.  It's wrong because  /* This function is for activating a button from a program.  It's wrong because
1021     we pass a NULL argument in the call_data which is not Motif compatible.     we pass a NULL argument in the call_data which is not Motif compatible.
1022     This is used from the XmNdefaultAction callback of the List widgets to     This is used from the XmNdefaultAction callback of the List widgets to
1023     have a double-click put down a dialog box like the button would do.     have a double-click put down a dialog box like the button would do.
1024     I could not find a way to do that with accelerators.     I could not find a way to do that with accelerators.
1025   */   */
1026  static void  static void
# Line 1058  make_dialog (name, parent, pop_up_p, she Line 1064  make_dialog (name, parent, pop_up_p, she
1064    Arg   al[64];                 /* Arg List */    Arg   al[64];                 /* Arg List */
1065    int   ac;                     /* Arg Count */    int   ac;                     /* Arg Count */
1066    int   i;    int   i;
1067      
1068    if (pop_up_p)    if (pop_up_p)
1069      {      {
1070        ac = 0;        ac = 0;
# Line 1083  make_dialog (name, parent, pop_up_p, she Line 1089  make_dialog (name, parent, pop_up_p, she
1089    
1090    n_children = left_buttons + right_buttons + 1;    n_children = left_buttons + right_buttons + 1;
1091    ac = 0;    ac = 0;
1092    XtSetArg(al[ac], XmNpacking, n_children == 3?    XtSetArg(al[ac], XmNpacking, n_children == 3?
1093             XmPACK_COLUMN: XmPACK_TIGHT); ac++;             XmPACK_COLUMN: XmPACK_TIGHT); ac++;
1094    XtSetArg(al[ac], XmNorientation, n_children == 3?    XtSetArg(al[ac], XmNorientation, n_children == 3?
1095             XmVERTICAL: XmHORIZONTAL); ac++;             XmVERTICAL: XmHORIZONTAL); ac++;
1096    XtSetArg(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++;    XtSetArg(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++;
1097    XtSetArg(al[ac], XmNmarginWidth, 0); ac++;    XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
# Line 1102  make_dialog (name, parent, pop_up_p, she Line 1108  make_dialog (name, parent, pop_up_p, she
1108    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1109    XtSetArg(al[ac], XmNrightOffset, 13); ac++;    XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1110    row = XmCreateRowColumn (form, "row", al, ac);    row = XmCreateRowColumn (form, "row", al, ac);
1111      
1112    n_children = 0;    n_children = 0;
1113    for (i = 0; i < left_buttons; i++)    for (i = 0; i < left_buttons; i++)
1114      {      {
# Line 1134  make_dialog (name, parent, pop_up_p, she Line 1140  make_dialog (name, parent, pop_up_p, she
1140    XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++;    XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++;
1141    children [n_children] = XmCreateLabel (row, "separator_button", al, ac);    children [n_children] = XmCreateLabel (row, "separator_button", al, ac);
1142    n_children++;    n_children++;
1143      
1144    for (i = 0; i < right_buttons; i++)    for (i = 0; i < right_buttons; i++)
1145      {      {
1146        char button_name [16];        char button_name [16];
# Line 1146  make_dialog (name, parent, pop_up_p, she Line 1152  make_dialog (name, parent, pop_up_p, she
1152        if (! button) button = children [n_children];        if (! button) button = children [n_children];
1153        n_children++;        n_children++;
1154      }      }
1155      
1156    XtManageChildren (children, n_children);    XtManageChildren (children, n_children);
1157      
1158    ac = 0;    ac = 0;
1159    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1160    XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;    XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
# Line 1244  make_dialog (name, parent, pop_up_p, she Line 1250  make_dialog (name, parent, pop_up_p, she
1250           list activate the default button */           list activate the default button */
1251        XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);        XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);
1252      }      }
1253      
1254    ac = 0;    ac = 0;
1255    XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;    XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1256    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;    XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
# Line 1259  make_dialog (name, parent, pop_up_p, she Line 1265  make_dialog (name, parent, pop_up_p, she
1265    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;    XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1266    XtSetArg(al[ac], XmNrightOffset, 13); ac++;    XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1267    message = XmCreateLabel (form, "message", al, ac);    message = XmCreateLabel (form, "message", al, ac);
1268      
1269    if (list)    if (list)
1270      XtManageChild (value);      XtManageChild (value);
1271    
# Line 1274  make_dialog (name, parent, pop_up_p, she Line 1280  make_dialog (name, parent, pop_up_p, she
1280    children [i] = icon; i++;    children [i] = icon; i++;
1281    children [i] = icon_separator; i++;    children [i] = icon_separator; i++;
1282    XtManageChildren (children, i);    XtManageChildren (children, i);
1283      
1284    if (text_input_slot || list)    if (text_input_slot || list)
1285      {      {
1286        XtInstallAccelerators (value, button);        XtInstallAccelerators (value, button);
# Line 1285  make_dialog (name, parent, pop_up_p, she Line 1291  make_dialog (name, parent, pop_up_p, she
1291        XtInstallAccelerators (form, button);        XtInstallAccelerators (form, button);
1292        XtSetKeyboardFocus (result, button);        XtSetKeyboardFocus (result, button);
1293      }      }
1294      
1295    return result;    return result;
1296  }  }
1297    
# Line 1358  recenter_widget (widget) Line 1364  recenter_widget (widget)
1364    
1365    x = (((Position)parent_width) - ((Position)child_width)) / 2;    x = (((Position)parent_width) - ((Position)child_width)) / 2;
1366    y = (((Position)parent_height) - ((Position)child_height)) / 2;    y = (((Position)parent_height) - ((Position)child_height)) / 2;
1367      
1368    XtTranslateCoords (parent, x, y, &x, &y);    XtTranslateCoords (parent, x, y, &x, &y);
1369    
1370    if (x + child_width > screen_width)    if (x + child_width > screen_width)
# Line 1398  recycle_instance (instance) Line 1404  recycle_instance (instance)
1404          focus = XtNameToWidget (widget, "*button1");          focus = XtNameToWidget (widget, "*button1");
1405        if (focus)        if (focus)
1406          XtSetKeyboardFocus (widget, focus);          XtSetKeyboardFocus (widget, focus);
1407          
1408        /* shrink the separator label back to their original size */        /* shrink the separator label back to their original size */
1409        separator = XtNameToWidget (widget, "*separator_button");        separator = XtNameToWidget (widget, "*separator_button");
1410        if (separator)        if (separator)
# Line 1466  xm_create_dialog (instance) Line 1472  xm_create_dialog (instance)
1472      shell_name = "Question";      shell_name = "Question";
1473      break;      break;
1474    }    }
1475      
1476    total_buttons = name [1] - '0';    total_buttons = name [1] - '0';
1477    
1478    if (name [3] == 'T' || name [3] == 't')    if (name [3] == 'T' || name [3] == 't')
# Line 1476  xm_create_dialog (instance) Line 1482  xm_create_dialog (instance)
1482      }      }
1483    else if (name [3])    else if (name [3])
1484      right_buttons = name [4] - '0';      right_buttons = name [4] - '0';
1485      
1486    left_buttons = total_buttons - right_buttons;    left_buttons = total_buttons - right_buttons;
1487      
1488    widget = make_dialog (name, parent, pop_up_p,    widget = make_dialog (name, parent, pop_up_p,
1489                          shell_name, icon_name, text_input_slot, radio_box,                          shell_name, icon_name, text_input_slot, radio_box,
1490                          list, left_buttons, right_buttons);                          list, left_buttons, right_buttons);
# Line 1649  make_project_display_dialog (widget_inst Line 1655  make_project_display_dialog (widget_inst
1655  #endif /* ENERGIZE */  #endif /* ENERGIZE */
1656    
1657  widget_creation_entry  widget_creation_entry
1658  xm_creation_table [] =  xm_creation_table [] =
1659  {  {
1660    {"menubar",                   make_menubar},    {"menubar",                   make_menubar},
1661    {"popup",                     make_popup_menu},    {"popup",                     make_popup_menu},
# Line 1738  xm_popup_menu (widget, event) Line 1744  xm_popup_menu (widget, event)
1744            /* This is so totally ridiculous: there's NO WAY to tell Motif            /* This is so totally ridiculous: there's NO WAY to tell Motif
1745               that *any* button can select a menu item.  Only one button               that *any* button can select a menu item.  Only one button
1746               can have that honor.  */               can have that honor.  */
1747          
1748            char *trans = 0;            char *trans = 0;
1749            if      (event->xbutton.state & Button5Mask) trans = "<Btn5Down>";            if      (event->xbutton.state & Button5Mask) trans = "<Btn5Down>";
1750            else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>";            else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>";
# Line 1748  xm_popup_menu (widget, event) Line 1754  xm_popup_menu (widget, event)
1754            if (trans) XtVaSetValues (widget, XmNmenuPost, trans, NULL);            if (trans) XtVaSetValues (widget, XmNmenuPost, trans, NULL);
1755          }          }
1756  #endif  #endif
1757          
1758        XmMenuPosition (widget, (XButtonPressedEvent *) event);        XmMenuPosition (widget, (XButtonPressedEvent *) event);
1759      }      }
1760      
1761    XtManageChild (widget);    XtManageChild (widget);
1762  }  }
1763    
# Line 1789  xm_pop_instance (instance, up) Line 1795  xm_pop_instance (instance, up)
1795        if (up)        if (up)
1796          XtManageChild (widget);          XtManageChild (widget);
1797        else        else
1798          XtUnmanageChild (widget);                XtUnmanageChild (widget);
1799      }      }
1800  }  }
1801    
1802    
1803  /* motif callback */  /* motif callback */
1804    
1805  static void  static void
1806  do_call (widget, closure, type)  do_call (widget, closure, type)
# Line 1823  do_call (widget, closure, type) Line 1829  do_call (widget, closure, type)
1829    user_data = NULL;    user_data = NULL;
1830    XtSetArg (al [ac], XmNuserData, &user_data); ac++;    XtSetArg (al [ac], XmNuserData, &user_data); ac++;
1831    XtGetValues (widget, al, ac);    XtGetValues (widget, al, ac);
1832      
1833    switch (type)    switch (type)
1834      {      {
1835      case pre_activate:      case pre_activate:
1836        if (instance->info->pre_activate_cb)        if (instance->info->pre_activate_cb)
1837          instance->info->pre_activate_cb (widget, id, user_data);          instance->info->pre_activate_cb (widget, id, user_data);
1838        break;        break;
1839          
1840      case selection:      case selection:
1841        if (instance->info->selection_cb)        if (instance->info->selection_cb)
1842          instance->info->selection_cb (widget, id, user_data);          instance->info->selection_cb (widget, id, user_data);
1843        break;        break;
1844          
1845      case no_selection:      case no_selection:
1846        if (instance->info->selection_cb)        if (instance->info->selection_cb)
1847          instance->info->selection_cb (widget, id, (XtPointer) -1);          instance->info->selection_cb (widget, id, (XtPointer) -1);
1848        break;        break;
1849          
1850      case post_activate:      case post_activate:
1851        if (instance->info->post_activate_cb)        if (instance->info->post_activate_cb)
1852          instance->info->post_activate_cb (widget, id, user_data);          instance->info->post_activate_cb (widget, id, user_data);
1853        break;        break;
1854          
1855      default:      default:
1856        abort ();        abort ();
1857      }      }
1858  }  }
1859    
1860  /* Like lw_internal_update_other_instances except that it does not do  /* Like lw_internal_update_other_instances except that it does not do
1861     anything if its shell parent is not managed.  This is to protect     anything if its shell parent is not managed.  This is to protect
1862     lw_internal_update_other_instances to dereference freed memory     lw_internal_update_other_instances to dereference freed memory
1863     if the widget was ``destroyed'' by caching it in the all_destroyed_instances     if the widget was ``destroyed'' by caching it in the all_destroyed_instances
1864     list */     list */
# Line 1918  xm_pull_down_callback (widget, closure, Line 1924  xm_pull_down_callback (widget, closure,
1924    
1925    
1926  /* XmNpopdownCallback for MenuShell widgets.  WIDGET is the MenuShell,  /* XmNpopdownCallback for MenuShell widgets.  WIDGET is the MenuShell,
1927     CLOSURE is a pointer to the widget_instance of the shell,     CLOSURE is a pointer to the widget_instance of the shell,
1928    
1929     Note that this callback is called for each cascade button in a     Note that this callback is called for each cascade button in a
1930     menu, whether or not its submenu is visible.  */     menu, whether or not its submenu is visible.  */

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.45.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26