MCPcopy Create free account
hub / github.com/NetHack/NetHack / CreateDialog

Function CreateDialog

win/X11/dialogs.c:102–215  ·  view source on GitHub ↗

Create a dialog widget. It is just a form widget with * a label prompt * a text response * an okay button * an optional cancel button */

Source from the content-addressed store, hash-verified

100 * an optional cancel button
101 */
102Widget
103CreateDialog(Widget parent, String name, XtCallbackProc okay_callback,
104 XtCallbackProc cancel_callback)
105{
106 Widget form, prompt, response, okay, cancel;
107 Arg args[20];
108 Cardinal num_args;
109 Dimension owidth, cwidth;
110
111 num_args = 0;
112#ifdef SPECIAL_CMAP
113 if (special_cmap) {
114 XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
115 }
116#endif
117 form = XtCreateManagedWidget(name, formWidgetClass, parent,
118 args, num_args);
119
120 num_args = 0;
121#ifdef SPECIAL_CMAP
122 if (special_cmap) {
123 XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
124 XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
125 }
126#endif
127 XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
128 XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
129 XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
130 XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
131 XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
132 XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
133 prompt = XtCreateManagedWidget("prompt", labelWidgetClass, form,
134 args, num_args);
135
136 num_args = 0;
137#ifdef SPECIAL_CMAP
138 if (special_cmap) {
139 XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
140 XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
141 }
142#endif
143 XtSetArg(args[num_args], nhStr(XtNfromVert), prompt); num_args++;
144 XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
145 XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
146 XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
147 XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
148 XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
149 XtSetArg(args[num_args], nhStr(XtNeditType), XawtextEdit); num_args++;
150 XtSetArg(args[num_args], nhStr(XtNresize), XawtextResizeWidth); num_args++;
151 XtSetArg(args[num_args], nhStr(XtNstring), ""); num_args++;
152 response = XtCreateManagedWidget("response", asciiTextWidgetClass, form,
153 args, num_args);
154
155 num_args = 0;
156#ifdef SPECIAL_CMAP
157 if (special_cmap) {
158 XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
159 XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;

Callers 8

mswin_init_text_windowFunction · 0.85
mswin_init_RIP_windowFunction · 0.85
mswin_init_menu_windowFunction · 0.85
X11_asknameFunction · 0.85
X11_getlinFunction · 0.85
mswin_init_text_windowFunction · 0.85
mswin_init_menu_windowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected