Mercurial > emacs
comparison lwlib/lwlib-Xm.c @ 53564:609ef1718642
Changes for lucid popup menus (keyboard traversal enabled) and dialogs
(Xaw and Xm pop down on ESC).
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Mon, 12 Jan 2004 01:45:22 +0000 |
parents | 695cf19ef79e |
children | 68d57432d36d |
comparison
equal
deleted
inserted
replaced
53563:110584d2405e | 53564:609ef1718642 |
---|---|
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. */ |