1 /********************************************************************************
2 * *
3 * Button Test *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * $Id: button.cpp,v 1.22 2006/01/22 17:58:59 fox Exp $ *
9 ********************************************************************************/
10 #include "fx.h"
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14
15
16 /*******************************************************************************/
17
18
19 // Mini application object
20 class ButtonWindow : public FXMainWindow {
21 FXDECLARE(ButtonWindow)
22 protected:
23 FXButton* button; // Object being tested
24 FXStatusBar* statusbar; // Status line
25 FXHorizontalFrame* contents; // Container for button
26 FXVerticalFrame* controls; // Switchs to set various modes
27 FXGroupBox* group0;
28 FXGroupBox* group1;
29 FXGroupBox* group2;
30 FXGroupBox* group3;
31 FXGroupBox* group4;
32 FXIcon* icon;
33 protected:
ButtonWindow()34 ButtonWindow(){}
35 public:
36 enum {
37
38 // Messages to change icon/text relationship
39 ID_ICON_BEFORE_TEXT=FXMainWindow::ID_LAST,
40 ID_ICON_AFTER_TEXT,
41 ID_ICON_CENTER_HOR,
42 ID_ICON_ABOVE_TEXT,
43 ID_ICON_BELOW_TEXT,
44 ID_ICON_CENTER_VER,
45
46 // Messages to change justification
47 ID_JUST_CENTER_X,
48 ID_JUST_LEFT,
49 ID_JUST_RIGHT,
50 ID_JUST_HOR_APART,
51 ID_JUST_CENTER_Y,
52 ID_JUST_TOP,
53 ID_JUST_BOTTOM,
54 ID_JUST_VER_APART,
55
56 // Message to change style
57 ID_TOOLBAR_STYLE,
58
59 // Message to quit application
60 ID_QUIT
61 };
62 public:
63 long onCmdIconTextRelation(FXObject*,FXSelector,void*);
64 long onUpdIconTextRelation(FXObject*,FXSelector,void*);
65
66 long onCmdJustification(FXObject*,FXSelector,void*);
67 long onUpdJustification(FXObject*,FXSelector,void*);
68
69 long onCmdToolbarStyle(FXObject*,FXSelector,void*);
70
71 long onCmdQuit(FXObject*,FXSelector,void*);
72 public:
73 ButtonWindow(FXApp* a);
74 void create();
75 virtual void save(FXStream& store) const;
76 virtual void load(FXStream& store);
77 virtual ~ButtonWindow();
78 };
79
80
81 /*******************************************************************************/
82
83 // Icon data
84 const unsigned char bigpenguin[]={
85 0x47,0x49,0x46,0x38,0x37,0x61,0x30,0x00,0x39,0x00,0xf3,0x00,0x00,0xb2,0xc0,0xdc,
86 0x5a,0x52,0x41,0x0e,0x0b,0x0b,0x47,0x3b,0x26,0x71,0x6e,0x67,0xb7,0xb5,0xb0,0xd4,
87 0xd2,0xce,0xf9,0xf7,0xf7,0x99,0x8d,0x77,0xa3,0x77,0x1b,0xee,0xba,0x12,0xbe,0xa2,
88 0x14,0x8b,0x5e,0x07,0xb3,0x8b,0x27,0xee,0xc7,0x1c,0xd2,0x98,0x0f,0x2c,0x00,0x00,
89 0x00,0x00,0x30,0x00,0x39,0x00,0x00,0x04,0xfe,0x10,0xc8,0x49,0xab,0x0d,0x22,0x8b,
90 0x61,0xbb,0xff,0x20,0xa6,0x8d,0x1c,0x68,0x9e,0xd3,0x30,0xae,0x19,0x81,0xbe,0x9d,
91 0xca,0x66,0x81,0xe8,0xc2,0x38,0x31,0x6b,0x84,0x28,0xe0,0x38,0xd9,0x6e,0x15,0x00,
92 0xbe,0x84,0xc3,0x91,0x11,0x95,0x9c,0xdd,0x96,0x9f,0xe1,0x20,0x30,0x40,0x16,0xa1,
93 0x51,0x01,0xa1,0xe0,0x1b,0x14,0x0a,0x06,0x9d,0xe6,0x8a,0xed,0x6c,0x0c,0x85,0x83,
94 0xcc,0x70,0x40,0x18,0x0c,0xa4,0xb2,0x67,0x5a,0x2d,0x00,0x32,0x07,0x4c,0x40,0xad,
95 0x29,0xc9,0x2b,0x74,0x5a,0x77,0x02,0x06,0x6b,0x5d,0x7f,0x16,0x2a,0x05,0x02,0x09,
96 0x0a,0x0a,0x0b,0x0b,0x0c,0x1b,0x7c,0x19,0x7e,0x88,0x12,0x2a,0x08,0x0d,0x0a,0x0e,
97 0x9d,0x9d,0x0a,0x12,0x2b,0x97,0x14,0x18,0x09,0x0f,0x9c,0x9e,0xa9,0xa2,0xa3,0x12,
98 0x54,0x9b,0xa8,0x9e,0x0a,0x0f,0x0f,0x2b,0x4f,0x97,0x18,0x0c,0x8e,0xb1,0x0d,0xb3,
99 0xb4,0x1b,0x34,0xac,0x00,0x18,0x08,0x0c,0x0f,0x90,0x09,0xa6,0xc6,0x00,0x2a,0x45,
100 0x19,0xc1,0x3a,0x05,0x08,0xc9,0x0f,0x0d,0x0d,0x60,0x68,0x2d,0x95,0xac,0x19,0x6f,
101 0xd2,0xc8,0x0d,0x00,0x6c,0x07,0x94,0x3c,0xb7,0x93,0x68,0x5f,0x5f,0xe2,0xe3,0x8b,
102 0x71,0x88,0xdc,0xec,0xea,0xe3,0xf3,0xe3,0x48,0x82,0x72,0x2d,0xf4,0xeb,0xf4,0xec,
103 0x2c,0x72,0x32,0xfc,0x02,0xf2,0x63,0x61,0x09,0x88,0x88,0x3d,0x02,0x13,0xda,0xdb,
104 0xb0,0x44,0xcc,0x8f,0x7d,0x01,0xdf,0x48,0x44,0xe0,0xc4,0x88,0x10,0x30,0x09,0xe7,
105 0x49,0x4c,0xb3,0xf0,0x07,0x90,0x3e,0xfe,0x10,0x33,0x1e,0xe8,0x56,0x11,0x86,0x8f,
106 0x34,0x22,0x05,0xc2,0x99,0x81,0x63,0x4c,0xca,0x8c,0x77,0xec,0xd9,0x02,0xe1,0x30,
107 0xe4,0xcb,0x71,0x2b,0x7f,0x69,0x43,0x21,0x03,0xe1,0x4d,0x81,0x3b,0x5e,0x68,0x40,
108 0xf9,0x33,0x60,0xc7,0x99,0x1d,0x1c,0x16,0x55,0x38,0x83,0x4c,0x16,0x3c,0x4b,0x03,
109 0x3a,0x74,0xf7,0x41,0xc8,0x80,0xa8,0x52,0x83,0x82,0xe8,0x73,0x15,0x2b,0xbd,0x41,
110 0xfe,0xb6,0x56,0xf2,0xe9,0xf5,0xc0,0xd4,0x3e,0x26,0x04,0x30,0x48,0xa0,0xa5,0xec,
111 0x3c,0x1f,0x95,0x18,0x82,0x38,0xe5,0x48,0x00,0xd1,0xa8,0x9d,0xe0,0xfe,0x72,0x6a,
112 0x81,0x97,0x23,0x59,0x02,0x10,0x60,0x35,0xc0,0xa9,0x01,0x8b,0x04,0x0b,0x3e,0x20,
113 0x98,0xf5,0x57,0x01,0xdb,0xae,0x45,0x09,0x2b,0x90,0x34,0x82,0x41,0xa7,0x0e,0xd2,
114 0xfc,0x7e,0xe2,0xa4,0x02,0xf2,0x4d,0x00,0x8e,0x12,0x08,0xc9,0xe5,0x88,0x82,0xa6,
115 0x5e,0x8d,0x1b,0x2f,0xa8,0xf4,0xd3,0x00,0xe8,0x59,0xc8,0xd6,0xd2,0x55,0x80,0x60,
116 0x82,0xdf,0xd4,0x8d,0x3b,0xb1,0xcd,0x70,0x37,0xa1,0xeb,0x53,0xbd,0x18,0x73,0x72,
117 0x54,0x1b,0x00,0x02,0x5d,0xa9,0x1d,0xa4,0x76,0xf9,0xb2,0xc0,0x2b,0x47,0xb3,0x1b,
118 0x4b,0x58,0x3c,0x3c,0x77,0xee,0xdd,0x64,0x33,0x32,0x78,0x8e,0xbb,0x31,0x02,0xea,
119 0xdd,0xab,0x73,0x4a,0xd0,0x5b,0xe5,0x86,0xe8,0x7f,0x95,0xa7,0x06,0x8f,0x5b,0x7d,
120 0x63,0x9b,0xf4,0xda,0x05,0xa0,0xeb,0xde,0xba,0x72,0xf6,0xe1,0xab,0x27,0x10,0xe9,
121 0xb0,0x58,0xfa,0xff,0x8d,0xf1,0x67,0x82,0x1e,0x72,0xb8,0x89,0x16,0xce,0x1b,0xd1,
122 0x10,0x60,0x8f,0x7f,0xf9,0xc9,0x52,0x5b,0x70,0xe1,0xb9,0xf7,0x80,0x68,0x4d,0x64,
123 0xc0,0x60,0x7d,0x8e,0x34,0x50,0x9c,0x71,0xdf,0x04,0x27,0x5c,0x63,0x13,0xea,0xb5,
124 0xc3,0x76,0xe8,0x51,0x83,0x94,0x04,0x04,0x10,0x80,0xcc,0x8a,0x02,0xce,0xd2,0x40,
125 0x02,0x0c,0x58,0x55,0xc5,0x8c,0x55,0xd0,0x90,0x40,0x8b,0xd4,0x30,0x70,0xa2,0x05,
126 0x29,0x32,0xb0,0xd6,0x8a,0x3e,0x56,0xb1,0x23,0x05,0x03,0xfc,0x08,0xe4,0x86,0x2f,
127 0xf4,0xe0,0x63,0x90,0x7c,0x7d,0x40,0xc5,0x92,0x0c,0x34,0x39,0x41,0x04,0x00,0x3b
128 };
129
130 /*******************************************************************************/
131
132
133 // Map
134 FXDEFMAP(ButtonWindow) ButtonWindowMap[]={
135
136 // Quit
137 FXMAPFUNC(SEL_CLOSE, 0, ButtonWindow::onCmdQuit),
138 FXMAPFUNC(SEL_COMMAND, ButtonWindow::ID_QUIT, ButtonWindow::onCmdQuit),
139
140 // Change or update icon/text relationship
141 FXMAPFUNCS(SEL_COMMAND, ButtonWindow::ID_ICON_BEFORE_TEXT, ButtonWindow::ID_ICON_CENTER_VER, ButtonWindow::onCmdIconTextRelation),
142 FXMAPFUNCS(SEL_UPDATE, ButtonWindow::ID_ICON_BEFORE_TEXT, ButtonWindow::ID_ICON_CENTER_VER, ButtonWindow::onUpdIconTextRelation),
143
144 // Change or update justification
145 FXMAPFUNCS(SEL_COMMAND, ButtonWindow::ID_JUST_CENTER_X, ButtonWindow::ID_JUST_VER_APART, ButtonWindow::onCmdJustification),
146 FXMAPFUNCS(SEL_UPDATE, ButtonWindow::ID_JUST_CENTER_X, ButtonWindow::ID_JUST_VER_APART, ButtonWindow::onUpdJustification),
147
148 FXMAPFUNC(SEL_COMMAND, ButtonWindow::ID_TOOLBAR_STYLE, ButtonWindow::onCmdToolbarStyle),
149 };
150
151
152 // ButtonApp implementation
FXIMPLEMENT(ButtonWindow,FXMainWindow,ButtonWindowMap,ARRAYNUMBER (ButtonWindowMap))153 FXIMPLEMENT(ButtonWindow,FXMainWindow,ButtonWindowMap,ARRAYNUMBER(ButtonWindowMap))
154
155
156
157 // Make some windows
158 ButtonWindow::ButtonWindow(FXApp* a):FXMainWindow(a,"Button Test",NULL,NULL,DECOR_TITLE|DECOR_MINIMIZE|DECOR_MAXIMIZE|DECOR_CLOSE|DECOR_BORDER|DECOR_STRETCHABLE|DECOR_MENU,100,100,800,600){
159
160 // Tooltip
161 new FXToolTip(getApp());
162
163 // Status bar
164 statusbar=new FXStatusBar(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER);
165
166 // Controls on right
167 controls=new FXVerticalFrame(this,LAYOUT_SIDE_RIGHT|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH);
168
169 // Separator
170 new FXVerticalSeparator(this,LAYOUT_SIDE_RIGHT|LAYOUT_FILL_Y|SEPARATOR_GROOVE);
171
172 // Contents
173 contents=new FXHorizontalFrame(this,LAYOUT_SIDE_LEFT|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH,0,0,0,0,20,20,20,20);
174
175 icon=new FXGIFIcon(getApp(),bigpenguin,0,IMAGE_KEEP);
176
177 // The button
178 button=new FXButton(contents,
179 "&This is a multi-line label on\na button to show off the full\ncapabilities of the button object\tIt also has a tooltip\n[which by the way can be multi-line also]\tAnd some helpful message for the status line.",
180 icon,
181 NULL,0,
182 FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,
183 0,0,300,200);
184
185 group0=new FXGroupBox(controls,"Style",GROUPBOX_TITLE_CENTER|FRAME_RIDGE);
186 new FXCheckButton(group0,"Toolbar\tCool ``poppy'' style buttons",this,ID_TOOLBAR_STYLE);
187
188 group1=new FXGroupBox(controls,"Horizontal Placement",GROUPBOX_TITLE_CENTER|FRAME_RIDGE);
189 new FXRadioButton(group1,"Before Text",this,ID_ICON_BEFORE_TEXT);
190 new FXRadioButton(group1,"After Text",this,ID_ICON_AFTER_TEXT);
191 new FXRadioButton(group1,"Centered",this,ID_ICON_CENTER_HOR);
192
193 group2=new FXGroupBox(controls,"Vertical Placement",GROUPBOX_TITLE_CENTER|FRAME_RIDGE);
194 new FXRadioButton(group2,"Above Text",this,ID_ICON_ABOVE_TEXT);
195 new FXRadioButton(group2,"Below Text",this,ID_ICON_BELOW_TEXT);
196 new FXRadioButton(group2,"Centered",this,ID_ICON_CENTER_VER);
197
198 group3=new FXGroupBox(controls,"Horizontal Justify",GROUPBOX_TITLE_CENTER|FRAME_RIDGE);
199 new FXRadioButton(group3,"Center",this,ID_JUST_CENTER_X);
200 new FXRadioButton(group3,"Left",this,ID_JUST_LEFT);
201 new FXRadioButton(group3,"Right",this,ID_JUST_RIGHT);
202 new FXRadioButton(group3,"Apart",this,ID_JUST_HOR_APART);
203
204 group4=new FXGroupBox(controls,"Vertical Justify",GROUPBOX_TITLE_CENTER|FRAME_RIDGE);
205 new FXRadioButton(group4,"Center",this,ID_JUST_CENTER_Y);
206 new FXRadioButton(group4,"Top",this,ID_JUST_TOP);
207 new FXRadioButton(group4,"Bottom",this,ID_JUST_BOTTOM);
208 new FXRadioButton(group4,"Apart",this,ID_JUST_VER_APART);
209
210 new FXButton(controls,"&Quit",NULL,this,ID_QUIT,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_BOTTOM);
211 }
212
213
214 // Free up icon
~ButtonWindow()215 ButtonWindow::~ButtonWindow(){
216 delete icon;
217 }
218
219
220 // Start
create()221 void ButtonWindow::create(){
222 FXMainWindow::create();
223 show(PLACEMENT_SCREEN);
224 }
225
226
227 // Change the icon/text relationship
onCmdIconTextRelation(FXObject *,FXSelector sel,void *)228 long ButtonWindow::onCmdIconTextRelation(FXObject*,FXSelector sel,void*){
229 FXuint style=button->getIconPosition();
230 switch(FXSELID(sel)){
231 case ID_ICON_BEFORE_TEXT:
232 style|=ICON_BEFORE_TEXT; style&=~ICON_AFTER_TEXT;
233 break;
234 case ID_ICON_AFTER_TEXT:
235 style|=ICON_AFTER_TEXT; style&=~ICON_BEFORE_TEXT;
236 break;
237 case ID_ICON_CENTER_HOR:
238 style&=~ICON_AFTER_TEXT; style&=~ICON_BEFORE_TEXT;
239 break;
240 case ID_ICON_ABOVE_TEXT:
241 style|=ICON_ABOVE_TEXT; style&=~ICON_BELOW_TEXT;
242 break;
243 case ID_ICON_BELOW_TEXT:
244 style|=ICON_BELOW_TEXT; style&=~ICON_ABOVE_TEXT;
245 break;
246 case ID_ICON_CENTER_VER:
247 style&=~ICON_ABOVE_TEXT; style&=~ICON_BELOW_TEXT;
248 break;
249 }
250 button->setIconPosition(style);
251 return 1;
252 }
253
254
255 // Update icon/text relationship radio buttons
onUpdIconTextRelation(FXObject * sender,FXSelector sel,void *)256 long ButtonWindow::onUpdIconTextRelation(FXObject* sender,FXSelector sel,void*){
257 FXSelector updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
258 FXuint style=button->getIconPosition();
259 switch(FXSELID(sel)){
260 case ID_ICON_BEFORE_TEXT:
261 if((style&ICON_BEFORE_TEXT) && !(style&ICON_AFTER_TEXT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
262 break;
263 case ID_ICON_AFTER_TEXT:
264 if(!(style&ICON_BEFORE_TEXT) && (style&ICON_AFTER_TEXT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
265 break;
266 case ID_ICON_CENTER_HOR:
267 if(!(style&ICON_BEFORE_TEXT) && !(style&ICON_AFTER_TEXT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
268 break;
269 case ID_ICON_ABOVE_TEXT:
270 if((style&ICON_ABOVE_TEXT) && !(style&ICON_BELOW_TEXT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
271 break;
272 case ID_ICON_BELOW_TEXT:
273 if(!(style&ICON_ABOVE_TEXT) && (style&ICON_BELOW_TEXT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
274 break;
275 case ID_ICON_CENTER_VER:
276 if(!(style&ICON_ABOVE_TEXT) && !(style&ICON_BELOW_TEXT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
277 break;
278 }
279 sender->handle(this,updatemessage,NULL);
280 return 1;
281 }
282
283
284 // Change justification
onCmdJustification(FXObject *,FXSelector sel,void *)285 long ButtonWindow::onCmdJustification(FXObject*,FXSelector sel,void*){
286 FXuint style=button->getJustify();
287 switch(FXSELID(sel)){
288 case ID_JUST_CENTER_X:
289 style&=~JUSTIFY_HZ_APART;
290 break;
291 case ID_JUST_LEFT:
292 style&=~JUSTIFY_HZ_APART;
293 style|=JUSTIFY_LEFT;
294 break;
295 case ID_JUST_RIGHT:
296 style&=~JUSTIFY_HZ_APART;
297 style|=JUSTIFY_RIGHT;
298 break;
299 case ID_JUST_HOR_APART:
300 style|=JUSTIFY_HZ_APART;
301 break;
302 case ID_JUST_CENTER_Y:
303 style&=~JUSTIFY_VT_APART;
304 break;
305 case ID_JUST_TOP:
306 style&=~JUSTIFY_VT_APART;
307 style|=JUSTIFY_TOP;
308 break;
309 case ID_JUST_BOTTOM:
310 style&=~JUSTIFY_VT_APART;
311 style|=JUSTIFY_BOTTOM;
312 break;
313 case ID_JUST_VER_APART:
314 style|=JUSTIFY_VT_APART;
315 break;
316 }
317 button->setJustify(style);
318 return 1;
319 }
320
321 // Update justification radio buttons
onUpdJustification(FXObject * sender,FXSelector sel,void *)322 long ButtonWindow::onUpdJustification(FXObject* sender,FXSelector sel,void*){
323 FXSelector updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
324 FXuint style=button->getJustify();
325 switch(FXSELID(sel)){
326 case ID_JUST_CENTER_X:
327 if(!(style&JUSTIFY_LEFT) && !(style&JUSTIFY_RIGHT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
328 break;
329 case ID_JUST_LEFT:
330 if((style&JUSTIFY_LEFT) && !(style&JUSTIFY_RIGHT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
331 break;
332 case ID_JUST_RIGHT:
333 if(!(style&JUSTIFY_LEFT) && (style&JUSTIFY_RIGHT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
334 break;
335 case ID_JUST_HOR_APART:
336 if((style&JUSTIFY_LEFT) && (style&JUSTIFY_RIGHT)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
337 break;
338 case ID_JUST_CENTER_Y:
339 if(!(style&JUSTIFY_TOP) && !(style&JUSTIFY_BOTTOM)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
340 break;
341 case ID_JUST_TOP:
342 if((style&JUSTIFY_TOP) && !(style&JUSTIFY_BOTTOM)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
343 break;
344 case ID_JUST_BOTTOM:
345 if(!(style&JUSTIFY_TOP) && (style&JUSTIFY_BOTTOM)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
346 break;
347 case ID_JUST_VER_APART:
348 if((style&JUSTIFY_TOP) && (style&JUSTIFY_BOTTOM)) updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
349 break;
350 }
351 sender->handle(this,updatemessage,NULL);
352 return 1;
353 }
354
355
356 // Set to toolbar style
onCmdToolbarStyle(FXObject *,FXSelector,void * ptr)357 long ButtonWindow::onCmdToolbarStyle(FXObject*,FXSelector,void* ptr){
358 FXuint style=button->getButtonStyle();
359 if(ptr){
360 style|=BUTTON_TOOLBAR;
361 button->setFrameStyle(FRAME_RAISED);
362 }
363 else{
364 style&=~BUTTON_TOOLBAR;
365 button->setFrameStyle(FRAME_RAISED|FRAME_THICK);
366 }
367 button->setButtonStyle(style);
368 return 1;
369 }
370
371
372 // Quit the application
onCmdQuit(FXObject *,FXSelector,void *)373 long ButtonWindow::onCmdQuit(FXObject*,FXSelector,void*){
374 // FXFileStream stream;
375 // stream.open("button.gui",FXStreamSave);
376 // getApp()->writeWindow(stream,this);
377 // stream.close();
378 getApp()->exit(0);
379 // getApp()->dumpWidgets();
380 return 1;
381 }
382
383
384 // Save
save(FXStream & store) const385 void ButtonWindow::save(FXStream& store) const {
386 FXMainWindow::save(store);
387 store << button;
388 store << controls;
389 store << statusbar;
390 store << contents;
391 store << group0;
392 store << group1;
393 store << group2;
394 store << group3;
395 store << group4;
396 store << icon;
397 }
398
399
400 // Load
load(FXStream & store)401 void ButtonWindow::load(FXStream& store){
402 FXMainWindow::load(store);
403 store >> button;
404 store >> controls;
405 store >> statusbar;
406 store >> contents;
407 store >> group0;
408 store >> group1;
409 store >> group2;
410 store >> group3;
411 store >> group4;
412 store >> icon;
413 }
414
415
416 /*******************************************************************************/
417
418
419 // Start the whole thing
main(int argc,char * argv[])420 int main(int argc,char *argv[]){
421
422 // Make application
423 FXApp application("Button","FoxTest");
424
425 // Open display
426 application.init(argc,argv);
427
428 //FXWindow *buttons=NULL;
429
430 // if(argc>1){
431 // FXFileStream stream;
432 // stream.open(argv[1],FXStreamLoad);
433 // application.readWindow(stream,buttons,application.getRootWindow(),application.getRootWindow());
434 // stream.close();
435 // application.dumpWidgets();
436 // }
437
438 // else{
439 // Main window
440 new ButtonWindow(&application);
441 // }
442
443
444 // Create app
445 application.create();
446 //if(buttons) buttons->show();
447
448 // Run
449 return application.run();
450 }
451
452
453