2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
25 #include "gtxwindows.h"
26 #include "gtxobjects.h"
27 #include "gtxtextobj.h"
28 #include "gtxlightobj.h"
29 #include "gtxkeymap.h"
32 struct gtx_frame *frameA, *frameB;
34 struct onode *objectA, *objectB;
35 struct onode *lightA, *lightB;
38 ChangeMenuCmd(awin, arock)
40 register struct gwin *awin;
42 register struct gtx_frame *tf;
43 register afs_int32 code;
50 gtxframe_ClearMenus(tf);
51 } else if (arock == 2) {
52 code = gtxframe_DeleteMenu(tf, "NewLabel");
54 gtxframe_DisplayString(tf, "Can't delete menu!");
55 } else if (arock == 3) {
56 code = gtxframe_ClearMenus(tf);
57 gtxframe_AddMenu(frameA, "FrameB", "b");
58 gtxframe_AddMenu(frameA, "NewLabel", "c");
64 ChangeListCmd(awin, arock)
66 register struct gwin *awin;
68 register struct gtx_frame *tf;
69 register afs_int32 code;
76 gtxframe_ClearList(tf);
77 } else if (arock == 2) {
78 code = gtxframe_RemoveFromList(tf, lightA);
80 gtxframe_DisplayString(tf, "Can't delete light!");
81 } else if (arock == 3) {
82 code = gtxframe_ClearList(tf);
83 gtxframe_AddToList(frameA, objectA);
84 gtxframe_AddToList(frameA, lightA);
93 gtxframe_DisplayString(awin->w_frame,
94 "Function should be mapped on '$d', not 'd'");
103 register afs_int32 code;
106 gtxframe_AskForString(awin->w_frame, "New object string: ", "TestNew",
107 tbuffer, sizeof(tbuffer));
109 /* have new value, write it to object A */
110 gator_text_Write(objectA, tbuffer, 0, 0, 0);
119 gtxframe_DisplayString(awin->w_frame,
120 "You're already showing that frame!");
128 gtxframe_SetFrame(awin, frameA);
136 gtxframe_SetFrame(awin, frameB);
140 #include "AFS_component_version_number.c"
145 struct gator_textobj_params textcrparams;
146 struct gator_light_crparams lightcrparams;
147 register struct keymap_map *tmap;
149 win = gtx_Init(0, -1);
151 /* create a couple of objects, a and b, and have the "a" and "b" keys
152 * switch the display from one to the other */
153 textcrparams.onode_params.cr_type = GATOR_OBJ_TEXT;
154 strcpy(textcrparams.onode_params.cr_name, "Text1-A");
155 textcrparams.onode_params.cr_x = 30;
156 textcrparams.onode_params.cr_y = 10;
157 textcrparams.onode_params.cr_width = 35;
158 textcrparams.onode_params.cr_height = 7;
159 textcrparams.onode_params.cr_window = win; /* ???? */
160 textcrparams.onode_params.cr_home_obj = NULL;
161 textcrparams.onode_params.cr_prev_obj = NULL;
162 textcrparams.onode_params.cr_parent_obj = NULL;
163 textcrparams.onode_params.cr_helpstring = "Help string for text";
164 textcrparams.maxEntries = 7;
165 textcrparams.maxCharsPerEntry = 35;
168 gator_objects_create((struct onode_createparams *)(&textcrparams));
169 gator_text_Write(objectA, "This is object A", 0, 0, 0);
171 /* create a couple of objects, a and b, and have the "a" and "b" keys
172 * switch the display from one to the other */
173 textcrparams.onode_params.cr_type = GATOR_OBJ_TEXT;
174 strcpy(textcrparams.onode_params.cr_name, "Text2-B");
175 textcrparams.onode_params.cr_x = 30;
176 textcrparams.onode_params.cr_y = 10;
177 textcrparams.onode_params.cr_width = 35;
178 textcrparams.onode_params.cr_height = 7;
179 textcrparams.onode_params.cr_window = win; /* ???? */
180 textcrparams.onode_params.cr_home_obj = NULL;
181 textcrparams.onode_params.cr_prev_obj = NULL;
182 textcrparams.onode_params.cr_parent_obj = NULL;
183 textcrparams.onode_params.cr_helpstring = "Help string for text";
184 textcrparams.maxEntries = 7;
185 textcrparams.maxCharsPerEntry = 35;
188 gator_objects_create((struct onode_createparams *)(&textcrparams));
189 gator_text_Write(objectB, "This is object B", 0, 0, 0);
191 lightcrparams.onode_params.cr_type = GATOR_OBJ_LIGHT;
192 lightcrparams.onode_params.cr_x = 10;
193 lightcrparams.onode_params.cr_y = 10;
194 lightcrparams.onode_params.cr_width = 10;
195 lightcrparams.onode_params.cr_height = 10;
196 lightcrparams.onode_params.cr_window = win; /* ???? */
197 lightcrparams.onode_params.cr_home_obj = NULL;
198 lightcrparams.onode_params.cr_prev_obj = NULL;
199 lightcrparams.onode_params.cr_parent_obj = NULL;
200 lightcrparams.onode_params.cr_helpstring = "Help string for text";
201 strcpy(lightcrparams.label, "Light-1");
202 lightcrparams.label_x = 0;
203 lightcrparams.label_y = 0;
204 lightcrparams.flashfreq = 100;
205 lightcrparams.appearance = GATOR_LIGHTMASK_INVVIDEO;
207 gator_objects_create((struct onode_createparams *)(&lightcrparams));
209 /* create basic frames */
210 frameA = gtxframe_Create();
211 frameB = gtxframe_Create();
213 /* setup A's frame */
214 gtxframe_ClearList(frameA);
215 gtxframe_AddToList(frameA, objectA);
216 gtxframe_AddToList(frameA, lightA);
217 keymap_BindToString(frameA->keymap, "b", SwitchToBCmd, NULL, NULL);
218 keymap_BindToString(frameA->keymap, "a", StupidCmd, NULL, NULL);
219 keymap_BindToString(frameA->keymap, "c", ChangeCmd, NULL, NULL);
220 keymap_BindToString(frameA->keymap, "\033a", ChangeMenuCmd, "ChangeMenu",
222 keymap_BindToString(frameA->keymap, "\033b", ChangeMenuCmd, "ChangeMenu",
224 keymap_BindToString(frameA->keymap, "\033c", ChangeMenuCmd, "ChangeMenu",
226 keymap_BindToString(frameA->keymap, "\0331", ChangeListCmd, "ChangeList",
228 keymap_BindToString(frameA->keymap, "\0332", ChangeListCmd, "ChangeList",
230 keymap_BindToString(frameA->keymap, "\0333", ChangeListCmd, "ChangeList",
232 gtxframe_AddMenu(frameA, "FrameB", "b");
233 gtxframe_AddMenu(frameA, "NewLabel", "c");
235 /* setup B's frame */
236 gtxframe_ClearList(frameB);
237 gtxframe_AddToList(frameB, objectB);
238 keymap_BindToString(frameB->keymap, "a", SwitchToACmd, NULL, NULL);
239 keymap_BindToString(frameB->keymap, "b", StupidCmd, NULL, NULL);
240 keymap_BindToString(frameB->keymap, "d", NoCallCmd, NULL, NULL);
241 keymap_BindToString(frameB->keymap, "d", (int (*)())0, NULL, NULL);
242 keymap_BindToString(frameB->keymap, "\033d", NoCallCmd, NULL, NULL);
243 gtxframe_AddMenu(frameB, "FrameA", "a");
245 /* finally setup the first window */
246 gtxframe_AddToList(frameA, objectA);
247 gtxframe_SetFrame(win, frameA);
249 /* play with maps for a while */
250 tmap = (struct keymap_map *)keymap_Create();
251 keymap_BindToString(tmap, "d", NoCallCmd, "test", (char *)1);
252 keymap_BindToString(tmap, "cd", NoCallCmd, "bozo", NULL);
255 gtx_InputServer(win);