summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/Makefile4
-rw-r--r--test/icon.cxx51
3 files changed, 56 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a2cba8840..1ec27d35e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -82,6 +82,7 @@ CREATE_EXAMPLE(fonts fonts.cxx fltk)
CREATE_EXAMPLE(forms forms.cxx "fltk;fltk_forms")
CREATE_EXAMPLE(hello hello.cxx fltk)
CREATE_EXAMPLE(help help.cxx "fltk;fltk_images")
+CREATE_EXAMPLE(icon icon.cxx fltk)
CREATE_EXAMPLE(iconize iconize.cxx fltk)
CREATE_EXAMPLE(image image.cxx fltk)
CREATE_EXAMPLE(inactive inactive.fl fltk)
diff --git a/test/Makefile b/test/Makefile
index 5f4597bd8..4570df628 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -53,6 +53,7 @@ CPPFILES =\
glpuzzle.cxx \
hello.cxx \
help.cxx \
+ icon.cxx \
iconize.cxx \
image.cxx \
inactive.cxx \
@@ -121,6 +122,7 @@ ALL = \
forms$(EXEEXT) \
hello$(EXEEXT) \
help$(EXEEXT) \
+ icon$(EXEEXT) \
iconize$(EXEEXT) \
image$(EXEEXT) \
inactive$(EXEEXT) \
@@ -355,6 +357,8 @@ help$(EXEEXT): help.o $(IMGLIBNAME)
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) $(LDFLAGS) help.o -o $@ $(LINKFLTKIMG) $(LDLIBS)
$(OSX_ONLY) ../fltk-config --post $@
+icon$(EXEEXT): icon.o
+
iconize$(EXEEXT): iconize.o
image$(EXEEXT): image.o
diff --git a/test/icon.cxx b/test/icon.cxx
new file mode 100644
index 000000000..75c43ab39
--- /dev/null
+++ b/test/icon.cxx
@@ -0,0 +1,51 @@
+//
+// Icon test program for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file. If this
+// file is missing or damaged, see the license at:
+//
+// http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+#include <FL/Fl.H>
+#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_Choice.H>
+#include <FL/Fl_RGB_Image.H>
+
+static Fl_Double_Window *win;
+
+void choice_cb(Fl_Widget *, void *v) {
+ Fl_Color c = (Fl_Color)(fl_intptr_t)v;
+ uchar buffer[32*32*3];
+ Fl_RGB_Image icon(buffer, 32, 32, 3);
+ icon.color_average(c, 0.0);
+ win->icon(&icon);
+}
+
+Fl_Menu_Item choices[] = {
+ {"Red",0,choice_cb,(void*)FL_RED},
+ {"Green",0,choice_cb,(void*)FL_GREEN},
+ {"Blue",0,choice_cb,(void*)FL_BLUE},
+ {0}
+};
+
+int main(int argc, char **argv) {
+ Fl_Double_Window window(400,300);
+ win = &window;
+
+ Fl_Choice choice(80,100,200,25,"Colour:");
+ choice.menu(choices);
+ choice.callback(choice_cb);
+ choice.when(FL_WHEN_RELEASE|FL_WHEN_NOT_CHANGED);
+
+ window.end();
+ window.show(argc,argv);
+ return Fl::run();
+}