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"
31 struct gtx_frame *frameA, *frameB;
33 struct onode *objectA, *objectB;
34 struct onode *lightA, *lightB;
37 ChangeMenuCmd(awin, arock)
39 register struct gwin *awin;
41 register struct gtx_frame *tf;
42 register afs_int32 code;
49 gtxframe_ClearMenus(tf);
50 } else if (arock == 2) {
51 code = gtxframe_DeleteMenu(tf, "NewLabel");
53 gtxframe_DisplayString(tf, "Can't delete menu!");
54 } else if (arock == 3) {
55 code = gtxframe_ClearMenus(tf);
56 gtxframe_AddMenu(frameA, "FrameB", "b");
57 gtxframe_AddMenu(frameA, "NewLabel", "c");
63 ChangeListCmd(awin, arock)
65 register struct gwin *awin;
67 register struct gtx_frame *tf;
68 register afs_int32 code;
75 gtxframe_ClearList(tf);
76 } else if (arock == 2) {
77 code = gtxframe_RemoveFromList(tf, lightA);
79 gtxframe_DisplayString(tf, "Can't delete light!");
80 } else if (arock == 3) {
81 code = gtxframe_ClearList(tf);
82 gtxframe_AddToList(frameA, objectA);
83 gtxframe_AddToList(frameA, lightA);
92 gtxframe_DisplayString(awin->w_frame,
93 "Function should be mapped on '$d', not 'd'");
102 register afs_int32 code;
105 gtxframe_AskForString(awin->w_frame, "New object string: ", "TestNew",
106 tbuffer, sizeof(tbuffer));
108 /* have new value, write it to object A */
109 gator_text_Write(objectA, tbuffer, 0, 0, 0);
118 gtxframe_DisplayString(awin->w_frame,
119 "You're already showing that frame!");
127 gtxframe_SetFrame(awin, frameA);
135 gtxframe_SetFrame(awin, frameB);
139 #include "AFS_component_version_number.c"
144 struct gator_textobj_params textcrparams;
145 struct gator_light_crparams lightcrparams;
146 register struct keymap_map *tmap;
148 win = gtx_Init(0, -1);
150 /* create a couple of objects, a and b, and have the "a" and "b" keys
151 * switch the display from one to the other */
152 textcrparams.onode_params.cr_type = GATOR_OBJ_TEXT;
153 strcpy(textcrparams.onode_params.cr_name, "Text1-A");
154 textcrparams.onode_params.cr_x = 30;
155 textcrparams.onode_params.cr_y = 10;
156 textcrparams.onode_params.cr_width = 35;
157 textcrparams.onode_params.cr_height = 7;
158 textcrparams.onode_params.cr_window = win; /* ???? */
159 textcrparams.onode_params.cr_home_obj = NULL;
160 textcrparams.onode_params.cr_prev_obj = NULL;
161 textcrparams.onode_params.cr_parent_obj = NULL;
162 textcrparams.onode_params.cr_helpstring = "Help string for text";
163 textcrparams.maxEntries = 7;
164 textcrparams.maxCharsPerEntry = 35;
167 gator_objects_create((struct onode_createparams *)(&textcrparams));
168 gator_text_Write(objectA, "This is object A", 0, 0, 0);
170 /* create a couple of objects, a and b, and have the "a" and "b" keys
171 * switch the display from one to the other */
172 textcrparams.onode_params.cr_type = GATOR_OBJ_TEXT;
173 strcpy(textcrparams.onode_params.cr_name, "Text2-B");
174 textcrparams.onode_params.cr_x = 30;
175 textcrparams.onode_params.cr_y = 10;
176 textcrparams.onode_params.cr_width = 35;
177 textcrparams.onode_params.cr_height = 7;
178 textcrparams.onode_params.cr_window = win; /* ???? */
179 textcrparams.onode_params.cr_home_obj = NULL;
180 textcrparams.onode_params.cr_prev_obj = NULL;
181 textcrparams.onode_params.cr_parent_obj = NULL;
182 textcrparams.onode_params.cr_helpstring = "Help string for text";
183 textcrparams.maxEntries = 7;
184 textcrparams.maxCharsPerEntry = 35;
187 gator_objects_create((struct onode_createparams *)(&textcrparams));
188 gator_text_Write(objectB, "This is object B", 0, 0, 0);
190 lightcrparams.onode_params.cr_type = GATOR_OBJ_LIGHT;
191 lightcrparams.onode_params.cr_x = 10;
192 lightcrparams.onode_params.cr_y = 10;
193 lightcrparams.onode_params.cr_width = 10;
194 lightcrparams.onode_params.cr_height = 10;
195 lightcrparams.onode_params.cr_window = win; /* ???? */
196 lightcrparams.onode_params.cr_home_obj = NULL;
197 lightcrparams.onode_params.cr_prev_obj = NULL;
198 lightcrparams.onode_params.cr_parent_obj = NULL;
199 lightcrparams.onode_params.cr_helpstring = "Help string for text";
200 strcpy(lightcrparams.label, "Light-1");
201 lightcrparams.label_x = 0;
202 lightcrparams.label_y = 0;
203 lightcrparams.flashfreq = 100;
204 lightcrparams.appearance = GATOR_LIGHTMASK_INVVIDEO;
206 gator_objects_create((struct onode_createparams *)(&lightcrparams));
208 /* create basic frames */
209 frameA = gtxframe_Create();
210 frameB = gtxframe_Create();
212 /* setup A's frame */
213 gtxframe_ClearList(frameA);
214 gtxframe_AddToList(frameA, objectA);
215 gtxframe_AddToList(frameA, lightA);
216 keymap_BindToString(frameA->keymap, "b", SwitchToBCmd, NULL, NULL);
217 keymap_BindToString(frameA->keymap, "a", StupidCmd, NULL, NULL);
218 keymap_BindToString(frameA->keymap, "c", ChangeCmd, NULL, NULL);
219 keymap_BindToString(frameA->keymap, "\033a", ChangeMenuCmd, "ChangeMenu",
221 keymap_BindToString(frameA->keymap, "\033b", ChangeMenuCmd, "ChangeMenu",
223 keymap_BindToString(frameA->keymap, "\033c", ChangeMenuCmd, "ChangeMenu",
225 keymap_BindToString(frameA->keymap, "\0331", ChangeListCmd, "ChangeList",
227 keymap_BindToString(frameA->keymap, "\0332", ChangeListCmd, "ChangeList",
229 keymap_BindToString(frameA->keymap, "\0333", ChangeListCmd, "ChangeList",
231 gtxframe_AddMenu(frameA, "FrameB", "b");
232 gtxframe_AddMenu(frameA, "NewLabel", "c");
234 /* setup B's frame */
235 gtxframe_ClearList(frameB);
236 gtxframe_AddToList(frameB, objectB);
237 keymap_BindToString(frameB->keymap, "a", SwitchToACmd, NULL, NULL);
238 keymap_BindToString(frameB->keymap, "b", StupidCmd, NULL, NULL);
239 keymap_BindToString(frameB->keymap, "d", NoCallCmd, NULL, NULL);
240 keymap_BindToString(frameB->keymap, "d", (int (*)())0, NULL, NULL);
241 keymap_BindToString(frameB->keymap, "\033d", NoCallCmd, NULL, NULL);
242 gtxframe_AddMenu(frameB, "FrameA", "a");
244 /* finally setup the first window */
245 gtxframe_AddToList(frameA, objectA);
246 gtxframe_SetFrame(win, frameA);
248 /* play with maps for a while */
249 tmap = (struct keymap_map *)keymap_Create();
250 keymap_BindToString(tmap, "d", NoCallCmd, "test", (char *)1);
251 keymap_BindToString(tmap, "cd", NoCallCmd, "bozo", NULL);
254 gtx_InputServer(win);