1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
|
/********************************************************************************
* *
* Test Group Box *
* *
*********************************************************************************
* Copyright (C) 1997 by Jeroen van der Zijp. All Rights Reserved. *
*********************************************************************************
* $Id: groupbox.cpp,v 1.47.4.1 2003/09/16 02:48:05 fox Exp $ *
********************************************************************************/
#include "fx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*******************************************************************************/
// Mini application object
class GroupWindow : public FXMainWindow {
FXDECLARE(GroupWindow)
protected:
// Member data
FXTooltip* tooltip;
FXMenubar* menubar;
FXMenuPane* filemenu;
FXMenuPane* popupmenu;
FXMenuPane* helpmenu;
FXMenuPane* editmenu;
FXMenuPane* submenu1;
FXPopup* pop;
FXPopup* coolpop;
FXHorizontalFrame* contents;
FXPacker* group1;
FXGroupBox* group2;
FXGroupBox* group3;
FXuint choice;
protected:
GroupWindow(){}
public:
// Message handlers
long onCmdFileDlgAny(FXObject*,FXSelector,void*);
long onCmdFileDlgExisting(FXObject*,FXSelector,void*);
long onCmdFileDlgMultiple(FXObject*,FXSelector,void*);
long onCmdFileDlgDirectory(FXObject*,FXSelector,void*);
long onCmdFileDlgMultipleAll(FXObject*,FXSelector,void*);
long onCmdDirDlg(FXObject*,FXSelector,void*);
long onCmdDownSize(FXObject*,FXSelector,void*);
long onCmdDelete(FXObject*,FXSelector,void*);
long onCmdAbout(FXObject*,FXSelector,void*);
long onCmdRadio(FXObject*,FXSelector,void*);
long onCmdPopup(FXObject*,FXSelector,void*);
long onUpdRadio(FXObject*,FXSelector,void*);
long onCmdOption(FXObject*,FXSelector,void*);
public:
// Messages
enum {
ID_DOWNSIZE=FXMainWindow::ID_LAST,
ID_POPUP,
ID_ABOUT,
ID_DELETE,
ID_FILEDLG_ANY,
ID_FILEDLG_EXISTING,
ID_FILEDLG_MULTIPLE,
ID_FILEDLG_DIRECTORY,
ID_FILEDLG_MULTIPLE_ALL,
ID_DIRDLG,
ID_OPTION1,
ID_OPTION2,
ID_OPTION3,
ID_OPTION4,
ID_RADIO1,
ID_RADIO2,
ID_RADIO3
};
public:
GroupWindow(FXApp* a);
virtual void create();
virtual ~GroupWindow();
};
/*******************************************************************************/
// Map
FXDEFMAP(GroupWindow) GroupWindowMap[]={
//__Message_Type__________ID___________________________________________________Message_Handler_____
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_DOWNSIZE, GroupWindow::onCmdDownSize),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_DELETE, GroupWindow::onCmdDelete),
FXMAPFUNCS(SEL_COMMAND, GroupWindow::ID_RADIO1,GroupWindow::ID_RADIO3, GroupWindow::onCmdRadio),
FXMAPFUNCS(SEL_UPDATE, GroupWindow::ID_RADIO1,GroupWindow::ID_RADIO3, GroupWindow::onUpdRadio),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_POPUP, GroupWindow::onCmdPopup),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_ABOUT, GroupWindow::onCmdAbout),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_FILEDLG_ANY, GroupWindow::onCmdFileDlgAny),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_FILEDLG_EXISTING, GroupWindow::onCmdFileDlgExisting),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_FILEDLG_MULTIPLE, GroupWindow::onCmdFileDlgMultiple),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_FILEDLG_MULTIPLE_ALL, GroupWindow::onCmdFileDlgMultipleAll),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_FILEDLG_DIRECTORY, GroupWindow::onCmdFileDlgDirectory),
FXMAPFUNC(SEL_COMMAND, GroupWindow::ID_DIRDLG, GroupWindow::onCmdDirDlg),
FXMAPFUNCS(SEL_COMMAND, GroupWindow::ID_OPTION1,GroupWindow::ID_OPTION4, GroupWindow::onCmdOption),
};
// Object implementation
FXIMPLEMENT(GroupWindow,FXMainWindow,GroupWindowMap,ARRAYNUMBER(GroupWindowMap))
/*******************************************************************************/
const unsigned char minidoc1[]={
0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0xbf,0xbf,0xbf,
0x00,0x00,0x00,0xff,0xff,0xff,0x7f,0x7f,0x7f,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
0x10,0x00,0x00,0x02,0x39,0x84,0x8f,0x89,0xc1,0x1d,0x7a,0x82,0x98,0x93,0x41,0x20,
0x87,0x16,0xf2,0x29,0x49,0x71,0xcd,0x27,0x68,0x9b,0x16,0x0c,0x09,0x18,0x56,0xea,
0x52,0x9a,0x5b,0xba,0xb6,0x14,0x0d,0xcb,0xf3,0x1b,0xd9,0x6e,0xad,0x1b,0x70,0x78,
0x06,0x56,0x0b,0x17,0x71,0x28,0x89,0x86,0xa0,0xec,0x02,0x05,0x14,0x00,0x00,0x3b
};
const unsigned char minifolderopen[]={
0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
0x00,0x00,0x00,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xd9,0xd9,0xd9,0xff,0xff,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
0x42,0x08,0xba,0xdc,0x2c,0x10,0xba,0x37,0x6a,0x15,0x13,0x88,0x41,0x4a,0x27,0x43,
0x14,0x29,0x9b,0x67,0x82,0x56,0x18,0x68,0xdc,0xe9,0x12,0x42,0x20,0xce,0x62,0x11,
0x6f,0x69,0x1e,0xc3,0x72,0xfb,0xb9,0xb2,0x18,0xeb,0x47,0xbc,0xad,0x4a,0xc4,0x93,
0x6c,0xc5,0x7a,0x99,0x62,0x4c,0x1a,0x2d,0xc0,0x04,0x50,0xaf,0x58,0x6c,0x66,0xcb,
0x6d,0x24,0x00,0x00,0x3b
};
/* Generated by reswrap from file minifolderclosed.gif */
const unsigned char minifolderclosed[]={
0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
0x80,0x80,0x80,0xc0,0xc0,0xc0,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x00,
0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
0x3b,0x08,0xba,0xdc,0x1b,0x10,0x3a,0x16,0xc4,0xb0,0x22,0x4c,0x50,0xaf,0xcf,0x91,
0xc4,0x15,0x64,0x69,0x92,0x01,0x31,0x7e,0xac,0x95,0x8e,0x58,0x7b,0xbd,0x41,0x21,
0xc7,0x74,0x11,0xef,0xb3,0x5a,0xdf,0x9e,0x1c,0x6f,0x97,0x03,0xba,0x7c,0xa1,0x64,
0x48,0x05,0x20,0x38,0x9f,0x50,0xe8,0x66,0x4a,0x75,0x24,0x00,0x00,0x3b
};
// Make some windows
GroupWindow::GroupWindow(FXApp* a):FXMainWindow(a,"Group Box Test",NULL,NULL,DECOR_ALL,0,0,0,0){
tooltip=new FXTooltip(getApp(),0,100,100);
FXIcon *doc=new FXGIFIcon(getApp(),minidoc1);
FXIcon *folder_open=new FXGIFIcon(getApp(),minifolderopen);
FXIcon *folder_closed=new FXGIFIcon(getApp(),minifolderclosed);
// Menubar
menubar=new FXMenubar(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
filemenu=new FXMenuPane(this);
new FXMenuCommand(filemenu,"Open any",folder_open,this,ID_FILEDLG_ANY);
new FXMenuCommand(filemenu,"Open existing",folder_open,this,ID_FILEDLG_EXISTING);
new FXMenuCommand(filemenu,"Open multiple",folder_open,this,ID_FILEDLG_MULTIPLE);
new FXMenuCommand(filemenu,"Open multiple all",folder_open,this,ID_FILEDLG_MULTIPLE_ALL);
new FXMenuCommand(filemenu,"Open directory",folder_open,this,ID_FILEDLG_DIRECTORY);
new FXMenuCommand(filemenu,"Open directory dialog",folder_open,this,ID_DIRDLG);
new FXMenuCommand(filemenu,"Radio&1",NULL,this,ID_RADIO1,0);
new FXMenuCommand(filemenu,"Radio&2",NULL,this,ID_RADIO2,0);
new FXMenuCommand(filemenu,"Radio&3",NULL,this,ID_RADIO3,0);
new FXMenuCommand(filemenu,"Delete\tCtl-X",NULL,this,ID_DELETE,0);
new FXMenuCommand(filemenu,"Downsize\tF5\tResize to minimum",NULL,this,ID_DOWNSIZE,0);
new FXMenuCommand(filemenu,"&Size",NULL,this,ID_DOWNSIZE,0);
new FXMenuCommand(filemenu,"Dump Widgets",NULL,getApp(),FXApp::ID_DUMP);
// Make edit popup menu
editmenu=new FXMenuPane(this);
new FXMenuCommand(editmenu,"Undo");
new FXMenuCommand(editmenu,"Cut");
submenu1=new FXMenuPane(this);
new FXMenuCommand(submenu1,"&One");
new FXMenuCommand(submenu1,"&Two");
new FXMenuCommand(submenu1,"Th&ree");
new FXMenuCommand(submenu1,"&Four");
new FXMenuCascade(editmenu,"&Submenu1",NULL,submenu1);
new FXMenuCascade(filemenu,"&Edit",NULL,editmenu);
new FXMenuCommand(filemenu,"&Quit\tCtl-Q",NULL,getApp(),FXApp::ID_QUIT,0);
new FXMenuTitle(menubar,"&File",NULL,filemenu);
helpmenu=new FXMenuPane(this);
new FXMenuCommand(helpmenu,"&About FOX...",NULL,this,ID_ABOUT,0);
new FXMenuTitle(menubar,"&Help",NULL,helpmenu,LAYOUT_RIGHT);
popupmenu=new FXMenuPane(this);
FXTextField* poptext=new FXTextField(popupmenu,10,NULL,0,FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP,0,0,0,0);
poptext->setText("Popup with text");
// Status bar
FXStatusbar *status=new FXStatusbar(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER);
new FXLabel(status,"10:15 PM",NULL,LAYOUT_FILL_Y|LAYOUT_RIGHT|FRAME_SUNKEN);
// Content
contents=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
group1=new FXGroupBox(contents,"Title Left",GROUPBOX_TITLE_LEFT|FRAME_RIDGE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
group2=new FXGroupBox(contents,"Slider Tests",GROUPBOX_TITLE_CENTER|FRAME_RIDGE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
group3=new FXGroupBox(contents,"Title Right",GROUPBOX_TITLE_RIGHT|FRAME_RIDGE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXLabel *testlabel=new FXLabel(group1,"&This is a multi-line\nlabel widget\nwith a big font",NULL,LAYOUT_CENTER_X|JUSTIFY_CENTER_X);
testlabel->setFont(new FXFont(getApp(),"helvetica",24,FONTWEIGHT_BOLD,FONTSLANT_ITALIC,FONTENCODING_DEFAULT));
new FXButton(group1,"Small &Button",NULL,NULL,0,FRAME_RAISED|FRAME_THICK);
new FXButton(group1,"Big Fat Wide Button\nComprising\nthree lines",NULL,NULL,0,FRAME_RAISED|FRAME_THICK);
new FXToggleButton(group1,"C&losed\tTooltip for closed\tHelp for closed","O&pen\nState\tTooltip for open\tHelp for open",folder_closed,folder_open,NULL,0,ICON_BEFORE_TEXT|JUSTIFY_LEFT|FRAME_RAISED|FRAME_THICK);
pop=new FXPopup(this);
new FXOption(pop,"&First\tTip #1\tHelp first",NULL,this,ID_OPTION1,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
new FXOption(pop,"&Second\tTip #2\tHelp second",NULL,this,ID_OPTION2,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
new FXOption(pop,"Th&ird\tTip #3\tHelp third",NULL,this,ID_OPTION3,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
new FXOption(pop,"F&ourth\tTip #4\tHelp fourth",NULL,this,ID_OPTION4,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
new FXOptionMenu(group1,pop,LAYOUT_TOP|FRAME_RAISED|FRAME_THICK|JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
new FXLabel(group1,"Te&kstje",NULL,LAYOUT_TOP|JUSTIFY_LEFT);
new FXButton(group1,"Add an `&&' by doubling\tTooltip\tHelp text for status",NULL,NULL,0,LAYOUT_TOP|FRAME_RAISED|FRAME_THICK);
new FXButton(group1,"Te&kstje",NULL,this,ID_POPUP,LAYOUT_TOP|FRAME_RAISED|FRAME_THICK);
new FXMenuButton(group1,"&Menu",NULL,filemenu,MENUBUTTON_ATTACH_BOTH|MENUBUTTON_DOWN|JUSTIFY_HZ_APART|LAYOUT_TOP|FRAME_RAISED|FRAME_THICK|ICON_AFTER_TEXT);
new FXMenuButton(group1,"&Menu",NULL,filemenu,MENUBUTTON_UP|LAYOUT_TOP|FRAME_RAISED|FRAME_THICK|ICON_AFTER_TEXT);
coolpop=new FXPopup(this,POPUP_HORIZONTAL);
new FXButton(coolpop,"A\tTipA",NULL,NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,30,30);
new FXButton(coolpop,"B\tTipB",NULL,NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,30,30);
new FXButton(coolpop,"C\tTipC",NULL,NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,30,30);
new FXButton(coolpop,"D\tTipD",NULL,NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,30,30);
new FXMenuButton(group1,"&S\tSideways",NULL,coolpop,MENUBUTTON_ATTACH_BOTH|MENUBUTTON_LEFT|MENUBUTTON_NOARROWS|LAYOUT_TOP|FRAME_RAISED|FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,30,30);
FXMatrix* matrix=new FXMatrix(group1,3,FRAME_RAISED|LAYOUT_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXButton(matrix,"A",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_ROW);
new FXButton(matrix,"&Wide button",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X);
new FXButton(matrix,"A",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X);
new FXButton(matrix,"BBBB",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_ROW|LAYOUT_FILL_COLUMN);
new FXButton(matrix,"B",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN);
new FXButton(matrix,"BB",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN);
new FXButton(matrix,"C",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_Y|LAYOUT_CENTER_X|LAYOUT_FILL_ROW);
new FXButton(matrix,"&wide",NULL,NULL,0,FRAME_RAISED|FRAME_THICK);
new FXButton(matrix,"CC",NULL,NULL,0,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT);
FXSlider *slider;
new FXLabel(group2,"No Arrow");
slider=new FXSlider(group2,NULL,0,LAYOUT_TOP|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|SLIDER_HORIZONTAL,0,0,200,30);
new FXLabel(group2,"Up Arrow");
slider=new FXSlider(group2,NULL,0,LAYOUT_TOP|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|SLIDER_HORIZONTAL|SLIDER_ARROW_UP|SLIDER_TICKS_TOP,0,0,200,30);
slider->setRange(0,10);
new FXLabel(group2,"Down Arrow");
slider=new FXSlider(group2,NULL,0,LAYOUT_TOP|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|SLIDER_HORIZONTAL|SLIDER_ARROW_DOWN|SLIDER_TICKS_BOTTOM,0,0,200,30);
slider->setRange(0,10);
new FXLabel(group2,"Inside Bar");
slider=new FXSlider(group2,NULL,0,LAYOUT_TOP|LAYOUT_FILL_X|LAYOUT_FIX_HEIGHT|SLIDER_HORIZONTAL|SLIDER_INSIDE_BAR|SLIDER_TICKS_BOTTOM,0,0,200,20);
slider->setRange(0,3);
FXHorizontalFrame *frame=new FXHorizontalFrame(group2,LAYOUT_FILL_X|LAYOUT_FILL_Y);
slider=new FXSlider(frame,NULL,0,LAYOUT_FIX_HEIGHT|SLIDER_VERTICAL|SLIDER_TICKS_LEFT|SLIDER_TICKS_RIGHT,0,0,30,200);
slider->setRange(0,10);
slider=new FXSlider(frame,NULL,0,LAYOUT_FIX_HEIGHT|SLIDER_VERTICAL|SLIDER_ARROW_RIGHT|SLIDER_TICKS_RIGHT,0,0,30,200);
slider->setRange(0,10);
slider=new FXSlider(frame,NULL,0,LAYOUT_FIX_HEIGHT|SLIDER_VERTICAL|SLIDER_ARROW_LEFT|SLIDER_TICKS_LEFT,0,0,30,200);
slider->setRange(0,10);
slider=new FXSlider(frame,NULL,0,LAYOUT_FIX_HEIGHT|SLIDER_VERTICAL|SLIDER_INSIDE_BAR|SLIDER_TICKS_LEFT,0,0,20,200);
slider->setRange(0,10);
new FXScrollbar(frame,NULL,0,SCROLLBAR_VERTICAL|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_WIDTH,0,0,20,300);
FXVerticalFrame *vframe1=new FXVerticalFrame(frame,LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXArrowButton(vframe1,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_UP);
new FXArrowButton(vframe1,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN);
new FXArrowButton(vframe1,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_LEFT);
new FXArrowButton(vframe1,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_RIGHT);
FXVerticalFrame *vframe2=new FXVerticalFrame(frame,LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXArrowButton(vframe2,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_UP|ARROW_TOOLBAR);
new FXArrowButton(vframe2,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR);
new FXArrowButton(vframe2,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_LEFT|ARROW_TOOLBAR);
new FXArrowButton(vframe2,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_RIGHT|ARROW_TOOLBAR);
FXGroupBox *gp=new FXGroupBox(group3,"Group Box",LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0,0,0,0);
new FXRadioButton(gp,"Hilversum &1",NULL,0,ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
new FXRadioButton(gp,"Hilversum &2",NULL,0,ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
new FXRadioButton(gp,"One multi-line\nRadiobox Widget",NULL,0,JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
new FXRadioButton(gp,"Radio Stad Amsterdam",NULL,0,ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
FXPacker *vv=new FXGroupBox(group3,"Group Box",LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0,0,0,0);
new FXCheckButton(vv,"Hilversum 1",NULL,0,ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
new FXCheckButton(vv,"Hilversum 2",NULL,0,ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
new FXCheckButton(vv,"One multi-line\nCheckbox Widget",NULL,0,JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
new FXCheckButton(vv,"Radio Stad Amsterdam",NULL,0,ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP);
FXSpinner *spinner=new FXSpinner(group3,20,NULL,0,SPIN_NORMAL|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP);
spinner->setRange(1,20);
spinner->setTipText("tip");
spinner->setHelpText("help");
FXComboBox* combobox=new FXComboBox(group3,5,5,NULL,0,COMBOBOX_INSERT_LAST|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP);
combobox->appendItem("Very Wide Item");
for(int i=0; i<3; i++){
char name[50];
sprintf(name,"%04d",i);
combobox->appendItem(name);
}
//FXDebugTarget *debugtarget=new FXDebugTarget;
FXTreeListBox *treebox=new FXTreeListBox(group3,10,NULL,0,FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP,0,0,200,0);
FXTreeItem *branch,*twig,*leaf,*topmost,*topmost2;
topmost=treebox->addItemLast(0,"Top",folder_open,folder_closed);
topmost2=treebox->addItemLast(0,"Top2",folder_open,folder_closed);
treebox->addItemLast(topmost2,"First",doc,doc);
treebox->addItemLast(topmost,"First",doc,doc);
treebox->addItemLast(topmost,"Second",doc,doc);
treebox->addItemLast(topmost,"Third",doc,doc);
branch=treebox->addItemLast(topmost,"Fourth",folder_open,folder_closed);
treebox->addItemLast(branch,"Fourth-First",doc,doc);
treebox->addItemLast(branch,"Fourth-Second",doc,doc);
twig=treebox->addItemLast(branch,"Fourth-Third",folder_open,folder_closed);
treebox->addItemLast(twig,"Fourth-Third-First",doc,doc);
treebox->addItemLast(twig,"Fourth-Third-Second",doc,doc);
treebox->addItemLast(twig,"Fourth-Third-Third",doc,doc);
leaf=treebox->addItemLast(twig,"Fourth-Third-Fourth",folder_open,folder_closed);
treebox->addItemLast(leaf,"Fourth-Third-Fourth-First",doc,doc);
treebox->addItemLast(leaf,"Fourth-Third-Fourth-Second",doc,doc);
treebox->addItemLast(leaf,"Fourth-Third-Fourth-Third",doc,doc);
twig=treebox->addItemLast(branch,"Fourth-Fourth",folder_open,folder_closed);
treebox->addItemLast(twig,"Fourth-Fourth-First",doc,doc);
treebox->addItemLast(twig,"Fourth-Fourth-Second",doc,doc);
treebox->addItemLast(twig,"Fourth-Fourth-Third",doc,doc);
new FXLabel(group3,"H&it the hotkey",NULL,LAYOUT_CENTER_X|JUSTIFY_CENTER_X|FRAME_RAISED);
FXTextField* textfield1=new FXTextField(group3,20,NULL,0,JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP);
textfield1->setText("Normal Text Field");
FXTextField* textfield2=new FXTextField(group3,20,NULL,0,JUSTIFY_RIGHT|TEXTFIELD_PASSWD|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP);
textfield2->setText("Password");
FXTextField* textfield3=new FXTextField(group3,20,NULL,0,TEXTFIELD_READONLY|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP);
textfield3->setText("Read Only");
FXTextField* textfield4=new FXTextField(group3,20,NULL,0,TEXTFIELD_READONLY|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP);
textfield4->setText("Grayed out");
textfield4->disable();
FXTextField* realnumber=new FXTextField(group3,20,NULL,0,TEXTFIELD_REAL|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FIX_HEIGHT,0,0,0,30);
realnumber->setText("1.0E+3");
FXTextField* intnumber=new FXTextField(group3,20,NULL,0,TEXTFIELD_INTEGER|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FIX_HEIGHT,0,0,0,30);
intnumber->setText("1000");
FXDial *dial2=new FXDial(group3,NULL,0,DIAL_CYCLIC|DIAL_HAS_NOTCH|DIAL_HORIZONTAL|LAYOUT_FILL_X|FRAME_RAISED|FRAME_THICK,0,0,120,0);
new FXScrollbar(group3,NULL,0,SCROLLBAR_HORIZONTAL|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_WIDTH,0,0,300,20);
FXProgressBar *pbar=new FXProgressBar(group3,NULL,0,LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_PERCENTAGE);
pbar->setProgress(48);
pbar->setTotal(360);
FXProgressBar *pbar2=new FXProgressBar(group3,NULL,0,LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_VERTICAL|PROGRESSBAR_PERCENTAGE|LAYOUT_SIDE_LEFT);
pbar2->setTotal(360);
FXDial *dial1=new FXDial(group3,NULL,0,DIAL_CYCLIC|DIAL_HAS_NOTCH|DIAL_VERTICAL|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_SIDE_LEFT);
pbar2->setProgress(48);
dial1->setTarget(pbar2);
dial1->setSelector(FXWindow::ID_SETVALUE);
dial2->setTarget(pbar);
dial2->setSelector(FXWindow::ID_SETVALUE);
choice=0;
}
GroupWindow::~GroupWindow(){
delete filemenu;
delete helpmenu;
delete editmenu;
delete submenu1;
delete pop;
delete coolpop;
delete popupmenu;
}
static const FXchar sourcefiles[]="All Files (*)\nC++ Source Files (*.cpp,*.cxx,*.cc)\nC Source Files (*.c)\nC++ Header Files (*.hpp,*.hxx,*.hh,*.h)\n*.o\nAny Extension (*.*)\nThree Letter (*.???)\nREADME*";
// Open any file
long GroupWindow::onCmdFileDlgAny(FXObject*,FXSelector,void*){
FXString file=FXFileDialog::getSaveFilename(this,"Save file","../tests/groupbox.cpp",sourcefiles,1);
fxmessage("File=\"%s\"\n",file.text());
return 1;
}
// Open existing file
long GroupWindow::onCmdFileDlgExisting(FXObject*,FXSelector,void*){
FXString file=FXFileDialog::getOpenFilename(this,"Open file","../tests/dippy.h",sourcefiles,3);
fxmessage("File=\"%s\"\n",file.text());
return 1;
}
// Open multiple
long GroupWindow::onCmdFileDlgMultiple(FXObject*,FXSelector,void*){
FXString* files=FXFileDialog::getOpenFilenames(this,"Open files","../tests/groupbox.cpp",sourcefiles);
if(files){
for(int i=0; !files[i].empty(); i++){
fxmessage("Files=\"%s\"\n",files[i].text());
}
delete [] files;
}
return 1;
}
// Open multiple all
long GroupWindow::onCmdFileDlgMultipleAll(FXObject*,FXSelector,void*){
FXFileDialog open(this,"Open files or directories");
open.setSelectMode(SELECTFILE_MULTIPLE_ALL);
if(open.execute(PLACEMENT_CURSOR)){
FXString* files=open.getFilenames();
if(files){
for(int i=0; !files[i].empty(); i++){
fxmessage("Files=\"%s\"\n",files[i].text());
}
delete [] files;
}
}
return 1;
}
// Open existing directory
long GroupWindow::onCmdFileDlgDirectory(FXObject*,FXSelector,void*){
FXString dir=FXFileDialog::getOpenDirectory(this,"Open directory","../tests");
fxmessage("Dir=\"%s\"\n",dir.text());
return 1;
}
// Open
long GroupWindow::onCmdDirDlg(FXObject*,FXSelector,void*){
FXDirDialog open(this,"Open some file");
open.setDirectory("d:\\");
if(open.execute()){
fxmessage("Dir=%s\n",open.getDirectory().text());
}
return 1;
}
// Option
long GroupWindow::onCmdOption(FXObject*,FXSelector sel,void*){
fprintf(stderr,"Chose option %d\n",SELID(sel)-ID_OPTION1+1);
return 1;
}
// Test something
long GroupWindow::onCmdDownSize(FXObject*,FXSelector,void*){
resize(getDefaultWidth(),getDefaultHeight());
return 1;
}
// Test delete
long GroupWindow::onCmdDelete(FXObject*,FXSelector,void*){
delete group2;
group2=NULL;
return 1;
}
// Pop up menu
long GroupWindow::onCmdPopup(FXObject*,FXSelector,void*){
FXint x,y; FXuint buttons;
getRoot()->getCursorPosition(x,y,buttons);
popupmenu->popup(NULL,x,y);
return 1;
}
// Set choice
long GroupWindow::onCmdRadio(FXObject*,FXSelector sel,void*){
choice=SELID(sel);
return 1;
}
// Update menu
long GroupWindow::onUpdRadio(FXObject* sender,FXSelector sel,void*){
FXMenuCommand *cmd=(FXMenuCommand*)sender;
(SELID(sel)==choice) ? cmd->checkRadio() : cmd->uncheckRadio();
return 1;
}
// About
long GroupWindow::onCmdAbout(FXObject*,FXSelector,void*){
FXMessageBox::information(this,MBOX_OK,"About FOX:- An intentionally long title","FOX is a really, really cool C++ library!\nExample written by Jeroen");
return 1;
}
// Start
void GroupWindow::create(){
FXMainWindow::create();
show(PLACEMENT_SCREEN);
}
/*******************************************************************************/
// Start the whole thing
int main(int argc,char *argv[]){
// Make application
FXApp application("Groupbox","FoxTest");
// Open display
application.init(argc,argv);
// Make window
new GroupWindow(&application);
// Create app
application.create();
// Run
return application.run();
}
|