summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-12-02 15:39:39 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-12-02 15:39:39 +0000
commit849e11623e44a62599d62ba9425f7e96146f555d (patch)
treed36643917eb5f059da6073b8eb07f202d24b0105 /test
parentdb1205b420680cd6ee13372628cb4bbbb06f1e06 (diff)
Changes from Carl to get rid of default_ variables...
git-svn-id: file:///fltk/svn/fltk/trunk@106 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
-rw-r--r--test/Makefile11
-rw-r--r--test/menubar.cxx18
-rw-r--r--test/style.C198
-rw-r--r--test/style_ui.fl343
4 files changed, 16 insertions, 554 deletions
diff --git a/test/Makefile b/test/Makefile
index b8f435851..0057258c6 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,5 +1,5 @@
#
-# "$Id: Makefile,v 1.11 1998/10/21 22:03:53 mike Exp $"
+# "$Id: Makefile,v 1.12 1998/12/02 15:39:38 mike Exp $"
#
# Test/example program makefile for the Fast Light Tool Kit (FLTK).
#
@@ -33,7 +33,7 @@ CPPFILES =\
minimum.C navigation.C output.C overlay.C pixmap.C \
pixmap_browser.C radio.C resizebox.C scroll.C shape.C shiny.C \
subwindow.C symbols.C tabs.C tile.C valuators.C fast_slow.C \
- resize.C pack.C inactive.C style.C
+ resize.C pack.C inactive.C
ALL = adjuster arc ask bitmap boxtype browser button buttons checkers \
clock colbrowser color_chooser cube cursor curve demo doublebuffer \
@@ -41,7 +41,7 @@ ALL = adjuster arc ask bitmap boxtype browser button buttons checkers \
hello iconize image input keyboard label list_visuals mandelbrot \
menubar message minimum navigation output overlay pixmap \
pixmap_browser radio resizebox scroll shape shiny subwindow \
- symbols tabs tile valuators fast_slow resize pack inactive style
+ symbols tabs tile valuators fast_slow resize pack inactive
all: $(ALL)
@@ -94,9 +94,6 @@ keyboard: keyboard.C keyboard_ui.C
mandelbrot: mandelbrot.C mandelbrot_ui.C
@echo $@:
@$(CXX) -I.. $(CXXFLAGS) mandelbrot.C -L../lib -lfltk $(LDLIBS) -o $@
-style: style.C style_ui.C
- @echo $@:
- @$(CXX) -I.. $(CXXFLAGS) style.C -L../lib -lfltk $(LDLIBS) -o $@
# If you have libjpeg installed, you might want to try this test program:
@@ -114,5 +111,5 @@ install:
@echo Nothing to install in test directory.
#
-# End of "$Id: Makefile,v 1.11 1998/10/21 22:03:53 mike Exp $".
+# End of "$Id: Makefile,v 1.12 1998/12/02 15:39:38 mike Exp $".
#
diff --git a/test/menubar.cxx b/test/menubar.cxx
index 9296d29e5..f94d37e5c 100644
--- a/test/menubar.cxx
+++ b/test/menubar.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: menubar.cxx,v 1.3 1998/10/21 14:21:34 mike Exp $"
+// "$Id: menubar.cxx,v 1.4 1998/12/02 15:39:38 mike Exp $"
//
// Menubar test program for the Fast Light Tool Kit (FLTK).
//
@@ -167,11 +167,17 @@ Fl_Menu_* menus[4];
// turn MicroSoft style on/off
void button_cb(Fl_Widget* w, void*) {
if (((Fl_Button*)w)->value()) {
- Fl::set_color(FL_SELECTION_COLOR, 0, 36, 127);
- Fl_Menu_::default_font(FL_HELVETICA);
+ for (int i = 0; i < 4; i++) {
+ menus[i]->down_box(FL_FLAT_BOX);
+ menus[i]->selection_color(137);
+ menus[i]->textfont(FL_HELVETICA);
+ }
} else {
- Fl::set_color(FL_SELECTION_COLOR, 170, 170, 170);
- Fl_Menu_::default_font(FL_HELVETICA_BOLD_ITALIC);
+ for (int i = 0; i < 4; i++) {
+ menus[i]->down_box(FL_NO_BOX);
+ menus[i]->selection_color(FL_WHITE);
+ menus[i]->textfont(FL_BOLD|FL_ITALIC);
+ }
}
menus[0]->parent()->redraw();
}
@@ -207,5 +213,5 @@ int main(int argc, char **argv) {
}
//
-// End of "$Id: menubar.cxx,v 1.3 1998/10/21 14:21:34 mike Exp $".
+// End of "$Id: menubar.cxx,v 1.4 1998/12/02 15:39:38 mike Exp $".
//
diff --git a/test/style.C b/test/style.C
deleted file mode 100644
index 7d9a0efa9..000000000
--- a/test/style.C
+++ /dev/null
@@ -1,198 +0,0 @@
-//
-// "$Id: style.C,v 1.4 1998/11/08 15:05:48 mike Exp $"
-//
-// Style demo for the Fast Light Tool Kit (FLTK).
-//
-// Demo of a control panel for Fltk "style" changes.
-//
-// You can use this as-is, or modify it to your needs.
-//
-// To save & restore a style you should write the data to a file of
-// your own design. Most likely your program has it's own configuration
-// that you want to save as well, and it is user friendly to put all
-// this into the same file.
-//
-// Copyright 1998 by Bill Spitzak and others.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Library General Public
-// License as published by the Free Software Foundation; either
-// version 2 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-//
-// Please report all bugs and problems to "fltk-bugs@easysw.com".
-//
-
-////////////////////////////////////////////////////////////////
-// This is the part you want to copy to another program. The
-// program should call "show_style_panel()" in response to a button
-// that the user presses.
-
-#include "style_ui.C"
-#include <FL/Fl_Color_Chooser.H>
-#include <FL/fl_draw.H>
-#include <config.h>
-#include <string.h>
-
-Fl_Menu_Item* font_menu() {
- static Fl_Menu_Item* menu;
- if (menu) return menu;
- int k = Fl::set_fonts(/*"*"*/);
- menu = new Fl_Menu_Item[k+1];
- memset(menu, 0, (k+1)*sizeof(Fl_Menu_Item));
- for (int i = 0; i < k; i++) {
- int t; const char *name = Fl::get_font_name((Fl_Font)i,&t);
- char buf[256];
- strcpy(buf, name);
- if (t & FL_BOLD) strcat(buf," bold");
- if (t & FL_ITALIC) strcat(buf," italic");
- menu[i].text = strdup(buf);
- }
- return menu;
-}
-
-void font_cb(Fl_Choice* c, long i) {
- Fl_Font n = Fl_Font(c->value());
- switch (i) {
- case 2: Fl_Menu_::default_font(n); break;
- case 1: Fl_Input_::default_font(n); break;
- default: Fl_Widget::default_font(n); break;
- }
- Fl::redraw();
-}
-
-void font_size_cb(Fl_Value_Input* c, long i) {
- int n = int(c->value()); if (n <= 0) n = 1; n -= FL_NORMAL_SIZE;
- switch (i) {
- case 2: Fl_Menu_::default_size(n); break;
- case 1: Fl_Input_::default_size(n); break;
- default: Fl_Widget::default_size(n); break;
- }
- Fl::redraw();
-}
-
-void color_button_cb(Fl_Button* w, void*) {
- Fl_Color c = w->color();
- uchar r,g,b; Fl::get_color(c, r,g,b);
- if (fl_color_chooser(0,r,g,b)) {
- if (c == FL_GRAY) Fl::background(r,g,b);
- else Fl::set_color(c,r,g,b);
- Fl::redraw();
- }
-}
-
-// functions hidden inside fl_boxtype.C:
-void fl_thin_down_frame(int, int, int, int, Fl_Color);
-void fl_thin_up_frame(int, int, int, int, Fl_Color);
-void fl_thin_down_box(int, int, int, int, Fl_Color);
-void fl_thin_up_box(int, int, int, int, Fl_Color);
-void fl_down_frame(int, int, int, int, Fl_Color);
-void fl_up_frame(int, int, int, int, Fl_Color);
-void fl_down_box(int, int, int, int, Fl_Color);
-void fl_up_box(int, int, int, int, Fl_Color);
-
-#if BORDER_WIDTH == 3
-
-#define fl_3_up_frame fl_up_frame
-#define fl_3_up_box fl_up_box
-#define fl_3_down_frame fl_down_frame
-#define fl_3_down_box fl_down_box
-
-// define the 2-pixel boxes:
-void fl_2_up_frame(int x, int y, int w, int h, Fl_Color) {
- fl_frame2("AAUWMMSS",x,y,w,h);
-}
-void fl_2_up_box(int x, int y, int w, int h, Fl_Color c) {
- fl_2_up_frame(x,y,w,h,c);
- fl_color(c); fl_rectf(x+2, y+2, w-4, h-4);
-}
-void fl_2_down_frame(int x, int y, int w, int h, Fl_Color) {
- fl_frame2("UWMMPPAA",x,y,w,h);
-}
-void fl_2_down_box(int x, int y, int w, int h, Fl_Color c) {
- fl_2_down_frame(x,y,w,h,c);
- fl_color(c); fl_rectf(x+2, y+2, w-4, h-4);
-}
-
-#else
-
-#define fl_2_up_frame fl_up_frame
-#define fl_2_up_box fl_up_box
-#define fl_2_down_frame fl_down_frame
-#define fl_2_down_box fl_down_box
-
-// define the 3-pixel boxes:
-void fl_3_up_frame(int x, int y, int w, int h, Fl_Color) {
- fl_frame("AAAAWUJJUSNN",x,y,w,h);
-}
-void fl_3_up_box(int x, int y, int w, int h, Fl_Color c) {
- fl_3_up_frame(x,y,w,h,c);
- fl_color(c); fl_rectf(x+3, y+3, w-6, h-6);
-}
-void fl_3_down_frame(int x, int y, int w, int h, Fl_Color) {
- fl_frame("NNSUJJUWAAAA",x,y,w,h);
-}
-void fl_3_down_box(int x, int y, int w, int h, Fl_Color c) {
- fl_3_down_frame(x,y,w,h,c);
- fl_color(c); fl_rectf(x+3, y+3, w-6, h-6);
-}
-
-#endif
-
-void box_thickness_cb(Fl_Value_Slider*v, void*) {
- switch (int(v->value())) {
- case 1:
- Fl::set_boxtype(FL_UP_BOX, fl_thin_up_box, 1,1,2,2);
- Fl::set_boxtype(FL_DOWN_BOX, fl_thin_down_box, 1,1,2,2);
- Fl::set_boxtype(FL_UP_FRAME, fl_thin_up_frame, 1,1,2,2);
- Fl::set_boxtype(FL_DOWN_FRAME, fl_thin_down_frame, 1,1,2,2);
- break;
- case 2:
- Fl::set_boxtype(FL_UP_BOX, fl_2_up_box, 2,2,4,4);
- Fl::set_boxtype(FL_DOWN_BOX, fl_2_down_box, 2,2,4,4);
- Fl::set_boxtype(FL_UP_FRAME, fl_2_up_frame, 2,2,4,4);
- Fl::set_boxtype(FL_DOWN_FRAME, fl_2_down_frame, 2,2,4,4);
- break;
- default:
- Fl::set_boxtype(FL_UP_BOX, fl_3_up_box, 3,3,6,6);
- Fl::set_boxtype(FL_DOWN_BOX, fl_3_down_box, 3,3,6,6);
- Fl::set_boxtype(FL_UP_FRAME, fl_3_up_frame, 3,3,6,6);
- Fl::set_boxtype(FL_DOWN_FRAME, fl_3_down_frame, 3,3,6,6);
- break;
- }
- Fl::redraw();
-}
-
-void text_box_thickness_cb(Fl_Value_Slider* v, void*) {
- int n = int(v->value());
- switch (n) {
- case 0: Fl_Input_::default_box(FL_FLAT_BOX); break;
- case 1: Fl_Input_::default_box(FL_THIN_DOWN_BOX); break;
- case 2: Fl_Input_::default_box(FL_DOWN_BOX); break;
- }
- Fl::redraw();
-}
-
-void scrollbar_thickness_cb(Fl_Value_Slider* v, void*) {
- Fl_Browser::scrollbar_width(int(v->value()));
- Fl::redraw();
-}
-
-#include <FL/fl_ask.H>
-
-void defaults_cb(Fl_Button*, void*) {
- fl_alert("Sorry, I didn't implement that");
-}
-
-//
-// End of "$Id: style.C,v 1.4 1998/11/08 15:05:48 mike Exp $".
-//
diff --git a/test/style_ui.fl b/test/style_ui.fl
deleted file mode 100644
index 7eb67ef15..000000000
--- a/test/style_ui.fl
+++ /dev/null
@@ -1,343 +0,0 @@
-# data file for the Fltk User Interface Designer (fluid)
-version 0.99
-header_name {.H}
-code_name {.C}
-gridx 5
-gridy 5
-snap 3
-decl {Fl_Menu_Item* font_menu();} {}
-
-Function {show_style_panel()} {open
-} {
- codeblock {if (!style_panel)} {open
- } {
- Fl_Window style_panel {
- label style
- xywh {767 205 335 425} type Double visible
- } {
- Fl_Choice {} {
- label {labels:}
- user_data 0 user_data_type long
- callback font_cb open
- xywh {60 155 220 25}
- code0 {o->menu(font_menu());}
- } {}
- Fl_Value_Input {} {
- user_data 0 user_data_type long
- callback font_size_cb
- xywh {280 155 50 25} when 4 minimum 1 maximum 128 step 1 value 14
- }
- Fl_Choice {} {
- label {text:}
- user_data 1 user_data_type long
- callback font_cb open
- xywh {60 190 220 25}
- code0 {o->menu(font_menu());}
- } {}
- Fl_Value_Input {} {
- user_data 1 user_data_type long
- callback font_size_cb
- xywh {280 190 50 25} when 4 minimum 1 maximum 128 step 1 value 14
- }
- Fl_Choice {} {
- label {menus:}
- user_data 2 user_data_type long
- callback font_cb open
- xywh {60 225 220 25}
- code0 {o->menu(font_menu());}
- } {}
- Fl_Value_Input {} {
- user_data 2 user_data_type long
- callback font_size_cb
- xywh {280 225 50 25} when 4 minimum 1 maximum 128 step 1 value 14
- }
- Fl_Button {} {
- label {background:}
- callback color_button_cb
- xywh {255 30 75 25} box ENGRAVED_BOX align 4
- }
- Fl_Button {} {
- label {foreground:}
- callback color_button_cb
- xywh {255 60 75 25} box ENGRAVED_BOX color 0 align 4
- }
- Fl_Button {} {
- label {text background:}
- callback color_button_cb
- xywh {255 90 75 25} box ENGRAVED_BOX color 7 align 4
- }
- Fl_Button {} {
- label {selection:}
- callback color_button_cb
- xywh {255 120 75 25} box ENGRAVED_BOX color 15 align 4
- }
- Fl_Return_Button {} {
- label OK
- callback {o->window()->hide();}
- xywh {260 395 70 25}
- }
- Fl_Button {} {
- label defaults
- callback defaults_cb
- xywh {175 395 70 25}
- }
- Fl_Value_Slider {} {
- label {box thickness:}
- callback box_thickness_cb
- xywh {235 260 95 25} type Horizontal align 4 minimum 1 maximum 3 step 1 value 3 slider_size 0.3333
- }
- Fl_Value_Slider {} {
- label {text box thickness:}
- callback text_box_thickness_cb
- xywh {235 295 95 25} type Horizontal align 4 maximum 2 step 1 value 2 slider_size 0.3333
- }
- Fl_Value_Slider {} {
- label {scrollbar thickness:}
- callback scrollbar_thickness_cb
- xywh {235 335 95 25} type Horizontal align 4 minimum 3 maximum 30 step 1 value 17
- }
- }
- }
- code {style_panel->show();} {}
-}
-
-Function {} {open
-} {
- Fl_Window {} {open
- xywh {356 409 445 435} type Double resizable visible
- } {
- Fl_Group {} {
- label {Packed buttons:}
- xywh {270 35 140 75} align 4
- } {
- Fl_Button {} {
- label A
- xywh {270 35 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {305 35 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {340 35 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {375 35 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {270 60 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {305 60 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {340 60 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {375 60 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {270 85 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {305 85 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {340 85 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {375 85 35 25} type Radio
- }
- }
- Fl_Adjuster {} {
- xywh {105 90 75 25} labeltype ENGRAVED_LABEL align 4
- }
- Fl_Counter {} {
- label counter
- xywh {20 120 170 25} minimum -1e+06 maximum 1e+06
- }
- Fl_Adjuster {} {
- label {adjuster:}
- xywh {80 40 25 75} labeltype SYMBOL_LABEL align 4
- }
- Fl_Group {} {
- label {Inactive buttons:}
- xywh {270 130 140 75} align 4 deactivate
- } {
- Fl_Button {} {
- label A
- xywh {270 130 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {305 130 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {340 130 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {375 130 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {270 155 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {305 155 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {340 155 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {375 155 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {270 180 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {305 180 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {340 180 35 25} type Radio
- }
- Fl_Button {} {
- label A
- xywh {375 180 35 25} type Radio
- }
- }
- Fl_Input {} {
- label {input:}
- xywh {65 175 200 25}
- code0 {o->static_value("This is a text input field");}
- }
- Fl_Output {} {
- label {output:}
- xywh {65 200 200 25}
- code0 {o->static_value("This is a text output field");}
- }
- Fl_Menu_Bar {} {
- xywh {0 0 445 30}
- } {
- submenu {} {
- label File
- xywh {0 0 100 20}
- } {
- menuitem {} {
- label Open
- xywh {0 0 100 20} shortcut 0x8006f
- }
- menuitem {} {
- label Save
- xywh {10 10 100 20} shortcut 0x80073
- }
- menuitem {} {
- label Merge
- xywh {20 20 100 20}
- }
- menuitem {} {
- label Quit
- callback {exit(0);}
- xywh {30 30 100 20} shortcut 0x80071
- code0 {\#include <stdlib.h>}
- }
- }
- submenu {} {
- label Edit open
- xywh {0 0 100 20}
- } {
- menuitem {} {
- label Undo
- xywh {75 75 100 20} shortcut 0x8007a
- }
- menuitem {} {
- label Cut
- xywh {45 45 100 20} shortcut 0x80078
- }
- menuitem {} {
- label Copy
- xywh {55 55 100 20} shortcut 0x80076
- }
- menuitem {} {
- label Paste
- xywh {65 65 100 20} shortcut 0x80076
- }
- }
- submenu {} {
- label Font
- xywh {10 10 100 20}
- } {
- menuitem {} {
- label Normal
- xywh {0 0 100 20}
- }
- menuitem {} {
- label Bold
- xywh {10 10 100 20} labelfont 1
- }
- menuitem {} {
- label Italic
- xywh {20 20 100 20} labelfont 2
- }
- menuitem {} {
- label {Bold Italic}
- xywh {30 30 100 20}
- }
- menuitem {} {
- label Engrave
- xywh {40 40 100 20} labeltype ENGRAVED_LABEL
- }
- menuitem {} {
- label Emboss
- xywh {50 50 100 20} labeltype EMBOSSED_LABEL
- }
- menuitem {} {
- label {@->}
- xywh {60 60 100 20} labeltype SYMBOL_LABEL
- }
- menuitem {} {
- label Small
- xywh {70 70 100 20} labelsize 10
- }
- }
- submenu {} {
- label Other
- xywh {20 20 100 20}
- } {
- menuitem {} {
- label {help!}
- xywh {0 0 100 20}
- }
- }
- }
- Fl_Browser {} {
- xywh {0 235 440 200} type Multi resizable
- code0 {o->load("browser.C");}
- code1 {o->position(0);}
- }
- Fl_Button {} {
- label {click this to set style}
- callback {show_style_panel();}
- xywh {235 2 170 25} color 12 selection_color 12
- }
- }
- code {Fl::visual(FL_RGB);} {selected
- }
-}