diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile | 8 | ||||
| -rw-r--r-- | test/demo.menu | 1 | ||||
| -rw-r--r-- | test/input_choice.cxx | 57 |
3 files changed, 64 insertions, 2 deletions
diff --git a/test/Makefile b/test/Makefile index 3c7d74bb4..ead8a4753 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.19.2.7.2.42 2004/08/26 22:24:24 matthiaswm Exp $" +# "$Id$" # # Test/example program makefile for the Fast Light Tool Kit (FLTK). # @@ -61,6 +61,7 @@ CPPFILES =\ image.cxx \ inactive.cxx \ input.cxx \ + input_choice.cxx \ keyboard.cxx \ label.cxx \ line_style.cxx \ @@ -118,6 +119,7 @@ ALL = \ image$(EXEEXT) \ inactive$(EXEEXT) \ input$(EXEEXT) \ + input_choice$(EXEEXT) \ keyboard$(EXEEXT) \ label$(EXEEXT) \ line_style$(EXEEXT) \ @@ -259,6 +261,8 @@ inactive.cxx: inactive.fl input$(EXEEXT): input.o +input_choice$(EXEEXT): input_choice.o + keyboard$(EXEEXT): keyboard_ui.o keyboard.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) -o $@ keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS) @@ -376,5 +380,5 @@ shape$(EXEEXT): shape.o # -# End of "$Id: Makefile,v 1.19.2.7.2.42 2004/08/26 22:24:24 matthiaswm Exp $". +# End of "$Id$". # diff --git a/test/demo.menu b/test/demo.menu index 75417d01f..a8678a08b 100644 --- a/test/demo.menu +++ b/test/demo.menu @@ -65,6 +65,7 @@ @o:File Chooser:file_chooser @o:Fonts:fonts @o:HelpDialog:help + @o:Input Choice:input_choice @o:Preferences:preferences @o:Threading:threads @o:XForms Emulation:forms diff --git a/test/input_choice.cxx b/test/input_choice.cxx new file mode 100644 index 000000000..45a50916b --- /dev/null +++ b/test/input_choice.cxx @@ -0,0 +1,57 @@ +// Test program for Fl_Input_Choice +// +// Copyright 1998-2004 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. +// + +#include <stdio.h> +#include <FL/Fl_Button.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Input_Choice.H> + +void buttcb(Fl_Widget*,void*data) { + Fl_Input_Choice *in=(Fl_Input_Choice *)data; + static int flag = 1; + flag ^= 1; + if ( flag ) in->activate(); + else in->deactivate(); +} + +void input_choice_cb(Fl_Widget*,void*data) { + Fl_Input_Choice *in=(Fl_Input_Choice *)data; + fprintf(stderr, "Value='%s'\n", (const char*)in->value()); +} + +int main(int argc, char **argv) { + Fl::scheme("plastic"); // optional + Fl_Window win(300, 200); + + Fl_Input_Choice in(40,40,100,28,"Test"); + in.callback(input_choice_cb, (void*)&in); + in.add("one"); + in.add("two"); + in.add("three"); + in.value(1); + + Fl_Button onoff(40,150,200,28,"Activate/Deactivate"); + onoff.callback(buttcb, (void*)&in); + + win.end(); + win.resizable(win); + win.show(argc, argv); + return Fl::run(); +} |
