comparison lwlib/lwlib-Xm.c @ 89909:68c22ea6027c

Sync to HEAD
author Kenichi Handa <handa@m17n.org>
date Fri, 16 Apr 2004 12:51:06 +0000
parents 375f2633d815
children 30ad2795fdab
comparison
equal deleted inserted replaced
89908:ee1402f7b568 89909:68c22ea6027c
1033 XtCallCallbacks (button, XmNactivateCallback, NULL); 1033 XtCallCallbacks (button, XmNactivateCallback, NULL);
1034 } 1034 }
1035 1035
1036 /* creation functions */ 1036 /* creation functions */
1037 1037
1038 /* Called for key press in dialogs. Used to pop down dialog on ESC. */
1039 static void
1040 dialog_key_cb (widget, closure, event, continue_to_dispatch)
1041 Widget widget;
1042 XtPointer closure;
1043 XEvent *event;
1044 Boolean *continue_to_dispatch;
1045 {
1046 KeySym sym = 0;
1047 Modifiers modif_ret;
1048
1049 XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0,
1050 &modif_ret, &sym);
1051
1052 if (sym == osfXK_Cancel)
1053 {
1054 Widget w = *((Widget *) closure);
1055
1056 while (w && ! XtIsShell (w))
1057 w = XtParent (w);
1058
1059 if (XtIsShell (w)) XtPopdown (w);
1060 }
1061
1062 *continue_to_dispatch = TRUE;
1063 }
1064
1038 /* dialogs */ 1065 /* dialogs */
1039 static Widget 1066 static Widget
1040 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, 1067 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
1041 radio_box, list, left_buttons, right_buttons) 1068 radio_box, list, left_buttons, right_buttons)
1042 char* name; 1069 char* name;
1121 XtSetArg(al[ac], XmNshowAsDefault, TRUE); ac++; 1148 XtSetArg(al[ac], XmNshowAsDefault, TRUE); ac++;
1122 } 1149 }
1123 XtSetArg(al[ac], XmNmarginWidth, 10); ac++; 1150 XtSetArg(al[ac], XmNmarginWidth, 10); ac++;
1124 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; 1151 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
1125 children [n_children] = XmCreatePushButton (row, button_name, al, ac); 1152 children [n_children] = XmCreatePushButton (row, button_name, al, ac);
1153 XtAddEventHandler (children [n_children],
1154 KeyPressMask, False, dialog_key_cb, result);
1126 1155
1127 if (i == 0) 1156 if (i == 0)
1128 { 1157 {
1129 button = children [n_children]; 1158 button = children [n_children];
1130 ac = 0; 1159 ac = 0;
1147 sprintf (button_name, "button%d", left_buttons + i + 1); 1176 sprintf (button_name, "button%d", left_buttons + i + 1);
1148 ac = 0; 1177 ac = 0;
1149 XtSetArg(al[ac], XmNmarginWidth, 10); ac++; 1178 XtSetArg(al[ac], XmNmarginWidth, 10); ac++;
1150 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++; 1179 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
1151 children [n_children] = XmCreatePushButton (row, button_name, al, ac); 1180 children [n_children] = XmCreatePushButton (row, button_name, al, ac);
1181 XtAddEventHandler (children [n_children],
1182 KeyPressMask, False, dialog_key_cb, result);
1183
1152 if (! button) button = children [n_children]; 1184 if (! button) button = children [n_children];
1153 n_children++; 1185 n_children++;
1154 } 1186 }
1155 1187
1156 XtManageChildren (children, n_children); 1188 XtManageChildren (children, n_children);
1489 shell_name, icon_name, text_input_slot, radio_box, 1521 shell_name, icon_name, text_input_slot, radio_box,
1490 list, left_buttons, right_buttons); 1522 list, left_buttons, right_buttons);
1491 1523
1492 XtAddCallback (widget, XmNpopdownCallback, xm_nosel_callback, 1524 XtAddCallback (widget, XmNpopdownCallback, xm_nosel_callback,
1493 (XtPointer) instance); 1525 (XtPointer) instance);
1526
1494 return widget; 1527 return widget;
1495 } 1528 }
1496 1529
1497 /* Create a menu bar. We turn off the f10 key 1530 /* Create a menu bar. We turn off the f10 key
1498 because we have not yet managed to make it work right in Motif. */ 1531 because we have not yet managed to make it work right in Motif. */
1974 Widget w; 2007 Widget w;
1975 Boolean flag; 2008 Boolean flag;
1976 { 2009 {
1977 XtVaSetValues (w, XtNallowShellResize, flag, NULL); 2010 XtVaSetValues (w, XtNallowShellResize, flag, NULL);
1978 } 2011 }
2012
2013 /* arch-tag: 73976f64-73b2-4600-aa13-d9ede20ee965
2014 (do not change this comment) */