summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-02-24 21:14:22 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-02-24 21:14:22 +0000
commit2df3459457eb7c83fea191fa6105fca0c8ca7e8d (patch)
tree85780cd1c60ba72877664b6e202a19de8ae13de3 /test
parent97b9464f59e87bc33009336b3a5b9b37ae06292e (diff)
Added Greg Ercolano's simple Fl_Input_Choice widget which is a
combination of the Fl_Input and Fl_Menu_Button widgets (STR #650) FL/Fl_Input_Choice.H: documentation/Fl_Input_Choice.html: - Added. documentation/fltk.book: - Added Fl_Input_Choice.html + --no-embedfonts option. documentation/index.html: - Update version number and revision. documentation/input_choice.jpg: - Added. documentation/preface.html: - Update version number and revision. documentation/widgets.html: - Add Fl_Input_Choice to lists. fluid/Fl_Menu_Type.cxx: - Add Fl_Input_Choice_Type class and instance. fluid/Fl_Type.h: - Add Fl_Input_Choice_Type class and instance. fluid/factory.cxx: - Add Fl_Input_Choice menu item. test/Makefile: - Add input_choice example. test/input_choice.cxx: - Added. test/demo.menu: - Add input_choice example. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4050 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
-rw-r--r--test/Makefile8
-rw-r--r--test/demo.menu1
-rw-r--r--test/input_choice.cxx57
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();
+}