source: rtems-graphics-toolkit/fltk-1.3.0/test/boxtype.cxx @ 855379e

Last change on this file since 855379e was f5c9e9c, checked in by Alexandru-Sever Horin <alex.sever.h@…>, on 07/05/12 at 09:33:03

Aded FLTK 1.3.0

  • Property mode set to 100644
File size: 4.2 KB
Line 
1//
2// "$Id: boxtype.cxx 7903 2010-11-28 21:06:39Z matt $"
3//
4// Boxtype test program for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2010 by Bill Spitzak and others.
7//
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Library General Public
10// License as published by the Free Software Foundation; either
11// version 2 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16// Library General Public License for more details.
17//
18// You should have received a copy of the GNU Library General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21// USA.
22//
23// Please report all bugs and problems on the following page:
24//
25//     http://www.fltk.org/str.php
26//
27
28#include <stdlib.h>
29#include <stdio.h>
30#include <FL/Fl.H>
31#include <FL/Fl_Double_Window.H>
32#include <FL/Fl_Box.H>
33
34int N = 0;
35#define W 200
36#define H 50
37#define ROWS 14
38
39Fl_Double_Window *window;
40
41void bt(const char *name, Fl_Boxtype type, int square=0) {
42  int x = N%4;
43  int y = N/4;
44  N++;
45  x = x*W+10;
46  y = y*H+10;
47  Fl_Box *b = new Fl_Box(type,x,y,square ? H-20 : W-20,H-20,name);
48  b->labelsize(11);
49  if (square) b->align(FL_ALIGN_RIGHT);
50}
51
52int main(int argc, char ** argv) {
53  window = new Fl_Double_Window(4*W,ROWS*H);
54  window->box(FL_FLAT_BOX);
55#if 0 // this code uses the command line arguments to set arbitrary color schemes
56  Fl::args(argc, argv);
57  Fl::get_system_colors();
58#elif 0 // this code uses a single color to define a scheme
59  Fl::args(argc, argv);
60  Fl::get_system_colors();
61  Fl::background(113,113,198);
62#else // this code uses the nice bright blue background to show box vs. frame types
63  Fl::args(argc, argv);
64  Fl::get_system_colors();
65  window->color(12);// light blue
66#endif
67  bt("FL_NO_BOX",FL_NO_BOX);
68  bt("FL_FLAT_BOX",FL_FLAT_BOX);
69  N += 2; // go to start of next row to line up boxes & frames
70  bt("FL_UP_BOX",FL_UP_BOX);
71  bt("FL_DOWN_BOX",FL_DOWN_BOX);
72  bt("FL_UP_FRAME",FL_UP_FRAME);
73  bt("FL_DOWN_FRAME",FL_DOWN_FRAME);
74  bt("FL_THIN_UP_BOX",FL_THIN_UP_BOX);
75  bt("FL_THIN_DOWN_BOX",FL_THIN_DOWN_BOX);
76  bt("FL_THIN_UP_FRAME",FL_THIN_UP_FRAME);
77  bt("FL_THIN_DOWN_FRAME",FL_THIN_DOWN_FRAME);
78  bt("FL_ENGRAVED_BOX",FL_ENGRAVED_BOX);
79  bt("FL_EMBOSSED_BOX",FL_EMBOSSED_BOX);
80  bt("FL_ENGRAVED_FRAME",FL_ENGRAVED_FRAME);
81  bt("FL_EMBOSSED_FRAME",FL_EMBOSSED_FRAME);
82  bt("FL_BORDER_BOX",FL_BORDER_BOX);
83  bt("FL_SHADOW_BOX",FL_SHADOW_BOX);
84  bt("FL_BORDER_FRAME",FL_BORDER_FRAME);
85  bt("FL_SHADOW_FRAME",FL_SHADOW_FRAME);
86  bt("FL_ROUNDED_BOX",FL_ROUNDED_BOX);
87  bt("FL_RSHADOW_BOX",FL_RSHADOW_BOX);
88  bt("FL_ROUNDED_FRAME",FL_ROUNDED_FRAME);
89  bt("FL_RFLAT_BOX",FL_RFLAT_BOX);
90  bt("FL_OVAL_BOX",FL_OVAL_BOX);
91  bt("FL_OSHADOW_BOX",FL_OSHADOW_BOX);
92  bt("FL_OVAL_FRAME",FL_OVAL_FRAME);
93  bt("FL_OFLAT_BOX",FL_OFLAT_BOX);
94  bt("FL_ROUND_UP_BOX",FL_ROUND_UP_BOX);
95  bt("FL_ROUND_DOWN_BOX",FL_ROUND_DOWN_BOX);
96  bt("FL_DIAMOND_UP_BOX",FL_DIAMOND_UP_BOX);
97  bt("FL_DIAMOND_DOWN_BOX",FL_DIAMOND_DOWN_BOX);
98
99  bt("FL_PLASTIC_UP_BOX",FL_PLASTIC_UP_BOX);
100  bt("FL_PLASTIC_DOWN_BOX",FL_PLASTIC_DOWN_BOX);
101  bt("FL_PLASTIC_UP_FRAME",FL_PLASTIC_UP_FRAME);
102  bt("FL_PLASTIC_DOWN_FRAME",FL_PLASTIC_DOWN_FRAME);
103  bt("FL_PLASTIC_THIN_UP_BOX",FL_PLASTIC_THIN_UP_BOX);
104  bt("FL_PLASTIC_THIN_DOWN_BOX",FL_PLASTIC_THIN_DOWN_BOX);
105  N += 2;
106  bt("FL_PLASTIC_ROUND_UP_BOX",FL_PLASTIC_ROUND_UP_BOX);
107  bt("FL_PLASTIC_ROUND_DOWN_BOX",FL_PLASTIC_ROUND_DOWN_BOX);
108  N += 2;
109
110  bt("FL_GTK_UP_BOX",FL_GTK_UP_BOX);
111  bt("FL_GTK_DOWN_BOX",FL_GTK_DOWN_BOX);
112  bt("FL_GTK_UP_FRAME",FL_GTK_UP_FRAME);
113  bt("FL_GTK_DOWN_FRAME",FL_GTK_DOWN_FRAME);
114  bt("FL_GTK_THIN_UP_BOX",FL_GTK_THIN_UP_BOX);
115  bt("FL_GTK_THIN_DOWN_BOX",FL_GTK_THIN_DOWN_BOX);
116  bt("FL_GTK_THIN_UP_FRAME",FL_GTK_THIN_UP_FRAME);
117  bt("FL_GTK_THIN_DOWN_FRAME",FL_GTK_THIN_DOWN_FRAME);
118  bt("FL_GTK_ROUND_UP_BOX",FL_GTK_ROUND_UP_BOX);
119  bt("FL_GTK_ROUND_DOWN_BOX",FL_GTK_ROUND_DOWN_BOX);
120  window->resizable(window);
121  window->end();
122  window->show();
123  return Fl::run();
124}
125
126//
127// End of "$Id: boxtype.cxx 7903 2010-11-28 21:06:39Z matt $".
128//
Note: See TracBrowser for help on using the repository browser.