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>
18 #include "gtxwindows.h"
19 #include "gtxobjects.h"
20 #include "gtxtextobj.h"
21 #include "gtxlightobj.h"
22 #include "gtxkeymap.h"
25 struct gtx_frame *frameA, *frameB;
27 struct onode *objectA, *objectB;
28 struct onode *lightA, *lightB;
31 ChangeMenuCmd(awin, arock)
33 register struct gwin *awin;
35 register struct gtx_frame *tf;
36 register afs_int32 code;
43 gtxframe_ClearMenus(tf);
44 } else if (arock == 2) {
45 code = gtxframe_DeleteMenu(tf, "NewLabel");
47 gtxframe_DisplayString(tf, "Can't delete menu!");
48 } else if (arock == 3) {
49 code = gtxframe_ClearMenus(tf);
50 gtxframe_AddMenu(frameA, "FrameB", "b");
51 gtxframe_AddMenu(frameA, "NewLabel", "c");
57 ChangeListCmd(awin, arock)
59 register struct gwin *awin;
61 register struct gtx_frame *tf;
62 register afs_int32 code;
69 gtxframe_ClearList(tf);
70 } else if (arock == 2) {
71 code = gtxframe_RemoveFromList(tf, lightA);
73 gtxframe_DisplayString(tf, "Can't delete light!");
74 } else if (arock == 3) {
75 code = gtxframe_ClearList(tf);
76 gtxframe_AddToList(frameA, objectA);
77 gtxframe_AddToList(frameA, lightA);
86 gtxframe_DisplayString(awin->w_frame,
87 "Function should be mapped on '$d', not 'd'");
96 register afs_int32 code;
99 gtxframe_AskForString(awin->w_frame, "New object string: ", "TestNew",
100 tbuffer, sizeof(tbuffer));
102 /* have new value, write it to object A */
103 gator_text_Write(objectA, tbuffer, 0, 0, 0);
112 gtxframe_DisplayString(awin->w_frame,
113 "You're already showing that frame!");
121 gtxframe_SetFrame(awin, frameA);
129 gtxframe_SetFrame(awin, frameB);
133 #include "AFS_component_version_number.c"
138 struct gator_textobj_params textcrparams;
139 struct gator_light_crparams lightcrparams;
140 register struct keymap_map *tmap;
142 win = gtx_Init(0, -1);
144 /* create a couple of objects, a and b, and have the "a" and "b" keys
145 * switch the display from one to the other */
146 textcrparams.onode_params.cr_type = GATOR_OBJ_TEXT;
147 strcpy(textcrparams.onode_params.cr_name, "Text1-A");
148 textcrparams.onode_params.cr_x = 30;
149 textcrparams.onode_params.cr_y = 10;
150 textcrparams.onode_params.cr_width = 35;
151 textcrparams.onode_params.cr_height = 7;
152 textcrparams.onode_params.cr_window = win; /* ???? */
153 textcrparams.onode_params.cr_home_obj = NULL;
154 textcrparams.onode_params.cr_prev_obj = NULL;
155 textcrparams.onode_params.cr_parent_obj = NULL;
156 textcrparams.onode_params.cr_helpstring = "Help string for text";
157 textcrparams.maxEntries = 7;
158 textcrparams.maxCharsPerEntry = 35;
161 gator_objects_create((struct onode_createparams *)(&textcrparams));
162 gator_text_Write(objectA, "This is object A", 0, 0, 0);
164 /* create a couple of objects, a and b, and have the "a" and "b" keys
165 * switch the display from one to the other */
166 textcrparams.onode_params.cr_type = GATOR_OBJ_TEXT;
167 strcpy(textcrparams.onode_params.cr_name, "Text2-B");
168 textcrparams.onode_params.cr_x = 30;
169 textcrparams.onode_params.cr_y = 10;
170 textcrparams.onode_params.cr_width = 35;
171 textcrparams.onode_params.cr_height = 7;
172 textcrparams.onode_params.cr_window = win; /* ???? */
173 textcrparams.onode_params.cr_home_obj = NULL;
174 textcrparams.onode_params.cr_prev_obj = NULL;
175 textcrparams.onode_params.cr_parent_obj = NULL;
176 textcrparams.onode_params.cr_helpstring = "Help string for text";
177 textcrparams.maxEntries = 7;
178 textcrparams.maxCharsPerEntry = 35;
181 gator_objects_create((struct onode_createparams *)(&textcrparams));
182 gator_text_Write(objectB, "This is object B", 0, 0, 0);
184 lightcrparams.onode_params.cr_type = GATOR_OBJ_LIGHT;
185 lightcrparams.onode_params.cr_x = 10;
186 lightcrparams.onode_params.cr_y = 10;
187 lightcrparams.onode_params.cr_width = 10;
188 lightcrparams.onode_params.cr_height = 10;
189 lightcrparams.onode_params.cr_window = win; /* ???? */
190 lightcrparams.onode_params.cr_home_obj = NULL;
191 lightcrparams.onode_params.cr_prev_obj = NULL;
192 lightcrparams.onode_params.cr_parent_obj = NULL;
193 lightcrparams.onode_params.cr_helpstring = "Help string for text";
194 strcpy(lightcrparams.label, "Light-1");
195 lightcrparams.label_x = 0;
196 lightcrparams.label_y = 0;
197 lightcrparams.flashfreq = 100;
198 lightcrparams.appearance = GATOR_LIGHTMASK_INVVIDEO;
200 gator_objects_create((struct onode_createparams *)(&lightcrparams));
202 /* create basic frames */
203 frameA = gtxframe_Create();
204 frameB = gtxframe_Create();
206 /* setup A's frame */
207 gtxframe_ClearList(frameA);
208 gtxframe_AddToList(frameA, objectA);
209 gtxframe_AddToList(frameA, lightA);
210 keymap_BindToString(frameA->keymap, "b", SwitchToBCmd, NULL, NULL);
211 keymap_BindToString(frameA->keymap, "a", StupidCmd, NULL, NULL);
212 keymap_BindToString(frameA->keymap, "c", ChangeCmd, NULL, NULL);
213 keymap_BindToString(frameA->keymap, "\033a", ChangeMenuCmd, "ChangeMenu",
215 keymap_BindToString(frameA->keymap, "\033b", ChangeMenuCmd, "ChangeMenu",
217 keymap_BindToString(frameA->keymap, "\033c", ChangeMenuCmd, "ChangeMenu",
219 keymap_BindToString(frameA->keymap, "\0331", ChangeListCmd, "ChangeList",
221 keymap_BindToString(frameA->keymap, "\0332", ChangeListCmd, "ChangeList",
223 keymap_BindToString(frameA->keymap, "\0333", ChangeListCmd, "ChangeList",
225 gtxframe_AddMenu(frameA, "FrameB", "b");
226 gtxframe_AddMenu(frameA, "NewLabel", "c");
228 /* setup B's frame */
229 gtxframe_ClearList(frameB);
230 gtxframe_AddToList(frameB, objectB);
231 keymap_BindToString(frameB->keymap, "a", SwitchToACmd, NULL, NULL);
232 keymap_BindToString(frameB->keymap, "b", StupidCmd, NULL, NULL);
233 keymap_BindToString(frameB->keymap, "d", NoCallCmd, NULL, NULL);
234 keymap_BindToString(frameB->keymap, "d", (int (*)())0, NULL, NULL);
235 keymap_BindToString(frameB->keymap, "\033d", NoCallCmd, NULL, NULL);
236 gtxframe_AddMenu(frameB, "FrameA", "a");
238 /* finally setup the first window */
239 gtxframe_AddToList(frameA, objectA);
240 gtxframe_SetFrame(win, frameA);
242 /* play with maps for a while */
243 tmap = (struct keymap_map *)keymap_Create();
244 keymap_BindToString(tmap, "d", NoCallCmd, "test", (char *)1);
245 keymap_BindToString(tmap, "cd", NoCallCmd, "bozo", NULL);
248 gtx_InputServer(win);