diff options
| author | Pierre Ossman <ossman@cendio.se> | 2014-06-16 11:39:32 +0000 |
|---|---|---|
| committer | Pierre Ossman <ossman@cendio.se> | 2014-06-16 11:39:32 +0000 |
| commit | f58b1a91b37e5ad758b3d0a3d9be950e8feb5d0c (patch) | |
| tree | ca7ebd90423d4d9267da62703e282f79a9793131 /test/icon.cxx | |
| parent | 332dc1b7acfedbf80b71cc6f538a14f24d435df3 (diff) | |
Add ability to set custom icons for windows. STR #2816.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10197 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/icon.cxx')
| -rw-r--r-- | test/icon.cxx | 51 |
1 files changed, 51 insertions, 0 deletions
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(); +} |
