2 // "$Id: tiled_image.cxx 7903 2010-11-28 21:06:39Z matt $"
4 // Fl_Tiled_Image test program for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2010 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
29 #include <FL/Fl_Double_Window.H>
30 #include <FL/Fl_Button.H>
31 #include <FL/Fl_Pixmap.H>
32 #include <FL/Fl_Tiled_Image.H>
37 #include "pixmaps/tile.xpm"
42 void button_cb(Fl_Widget
*,void *) {
47 #if !defined(WIN32) && !defined(__APPLE__)
48 #include "list_visuals.cxx"
52 int arg(int argc
, char **argv
, int &i
) {
53 if (argv
[i
][1] == 'v') {
54 if (i
+1 >= argc
) return 0;
55 visid
= atoi(argv
[i
+1]);
62 int main(int argc
, char **argv
) {
63 #if !defined(WIN32) && !defined(__APPLE__)
66 Fl::args(argc
,argv
,i
,arg
);
70 XVisualInfo templt
; int num
;
71 templt
.visualid
= visid
;
72 fl_visual
= XGetVisualInfo(fl_display
, VisualIDMask
, &templt
, &num
);
74 fprintf(stderr
, "No visual with id %d, use one of:\n",visid
);
78 fl_colormap
= XCreateColormap(fl_display
, RootWindow(fl_display
,fl_screen
),
79 fl_visual
->visual
, AllocNone
);
80 fl_xpixel(FL_BLACK
); // make sure black is allocated in overlay visuals
86 Fl_Double_Window
window(400,400); ::w
= &window
;
87 Fl_Group
group(0,0,400,400);
88 group
.image(new Fl_Tiled_Image(new Fl_Pixmap((const char * const *)tile_xpm
)));
89 group
.align(FL_ALIGN_INSIDE
);
91 Fl_Button
b(340,365,50,25,"Close"); ::b
= &b
;
92 b
.callback(button_cb
);
96 window
.resizable(group
);
98 window
.show(argc
, argv
);
104 // End of "$Id: tiled_image.cxx 7903 2010-11-28 21:06:39Z matt $".