42 |
/* Create a popup menu. To use, add buttons to the returned widget. |
/* Create a popup menu. To use, add buttons to the returned widget. |
43 |
The parent is usually a text widget, but any widget can be used |
The parent is usually a text widget, but any widget can be used |
44 |
(some with difficulty). */ |
(some with difficulty). */ |
45 |
Widget |
Widget |
46 |
antiright_popup_menu(Widget parent) |
antiright_popup_menu(Widget parent) |
47 |
{ |
{ |
48 |
Widget popup_widget; |
Widget popup_widget; |
60 |
return(popup_widget); |
return(popup_widget); |
61 |
} |
} |
62 |
|
|
63 |
|
void |
64 |
|
antiright_popup_insert_cb(Widget parent, |
65 |
|
XtPointer client_data, XtPointer call_data) |
66 |
|
{ |
67 |
|
Widget work=(Widget)client_data; |
68 |
|
XmTextInsert(work, XmTextGetInsertionPosition(work), parent->core.name); |
69 |
|
} |
70 |
|
|
71 |
Widget |
Widget |
72 |
antiright_defined_popup_menu(Widget parent_widget) |
antiright_defined_popup_menu(Widget parent_widget) |
73 |
{ |
{ |
74 |
Widget popup_widget; |
Widget popup_widget; |
75 |
|
Widget submenu, ar_menu, c_menu, motif_menu, shell_menu, awk_menu; |
76 |
popup_widget=antiright_popup_menu(parent_widget); |
popup_widget=antiright_popup_menu(parent_widget); |
77 |
|
|
78 |
(Widget)antiright_button(popup_widget, |
(Widget)antiright_button(popup_widget, |
79 |
"Copy", |
"Copy", |
80 |
antiright_copy_cb, |
antiright_copy_cb, |
81 |
(Widget)parent_widget); |
(XtPointer)parent_widget); |
82 |
|
|
83 |
(Widget)antiright_button(popup_widget, |
(Widget)antiright_button(popup_widget, |
84 |
"Cut", |
"Cut", |
85 |
antiright_cut_cb, |
antiright_cut_cb, |
86 |
(Widget)parent_widget); |
(XtPointer)parent_widget); |
87 |
|
|
88 |
(Widget)antiright_button(popup_widget, |
(Widget)antiright_button(popup_widget, |
89 |
"Paste", |
"Paste", |
90 |
antiright_paste_cb, |
antiright_paste_cb, |
91 |
(Widget)parent_widget); |
(XtPointer)parent_widget); |
92 |
|
antiright_separator(popup_widget); |
93 |
|
antiright_button(popup_widget, "Comment Selected", |
94 |
|
antiright_comment_selection, (XtPointer)parent_widget); |
95 |
|
antiright_button(popup_widget, "Uncomment Selected", |
96 |
|
antiright_uncomment_selection, (XtPointer)parent_widget); |
97 |
|
antiright_separator(popup_widget); |
98 |
|
submenu=antiright_menu(popup_widget, "Insert"); |
99 |
|
ar_menu=antiright_menu(submenu, "antiright"); |
100 |
|
antiright_button(ar_menu, "antiright_button();", |
101 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
102 |
|
antiright_button(ar_menu, "antiright_label_string(,);", |
103 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
104 |
|
awk_menu=antiright_menu(submenu, "AWK"); |
105 |
|
antiright_button(awk_menu, "getline", |
106 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
107 |
|
antiright_button(awk_menu, "BEGIN {}", |
108 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
109 |
|
antiright_button(awk_menu, "END {}", |
110 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
111 |
|
antiright_button(awk_menu, "// {}", |
112 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
113 |
|
c_menu=antiright_menu(submenu, "C"); |
114 |
|
antiright_button(c_menu, "printf(\"\",); fflush(stdout);", |
115 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
116 |
|
antiright_button(awk_menu, "malloc();", |
117 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
118 |
|
antiright_button(awk_menu, "(char*)malloc(strlen()+1);", |
119 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
120 |
|
motif_menu=antiright_menu(submenu, "Motif"); |
121 |
|
antiright_button(motif_menu, "XtManageChild();", |
122 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
123 |
|
antiright_button(motif_menu, "XtUnmanageChild();", |
124 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
125 |
|
antiright_button(motif_menu, "XtVaSetValues(,NULL);", |
126 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
127 |
|
antiright_button(motif_menu, "XmCreatePushButton(,"",,);", |
128 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
129 |
|
antiright_button(motif_menu, "XtAddCallback();", |
130 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
131 |
|
shell_menu=antiright_menu(submenu, "Shell"); |
132 |
|
antiright_button(shell_menu, "#!/usr/bin/env bash", |
133 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
134 |
|
antiright_button(shell_menu, "if [ ]; then", |
135 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
136 |
|
antiright_button(shell_menu, "while [ ]; do", |
137 |
|
antiright_popup_insert_cb, (XtPointer)parent_widget); |
138 |
return(popup_widget); |
return(popup_widget); |
139 |
} |
} |