1 //
2 // "$Id: Fl_Window.H 4421 2005-07-15 09:34:53Z matt $"
3 //
4 // Window header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2005 by Bill Spitzak and others.
7 //
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.
12 //
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.
17 //
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21 // USA.
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 //     http://www.fltk.org/str.php
26 //
27 
28 #ifndef Fl_Window_H
29 #define Fl_Window_H
30 
31 #include "Fl_Group.H"
32 
33 #define FL_WINDOW 0xF0	// all subclasses have type() >= this
34 #define FL_DOUBLE_WINDOW 0xF1
35 
36 class Fl_X;
37 
38 class FL_EXPORT Fl_Window : public Fl_Group {
39 
40   friend class Fl_X;
41   Fl_X *i; // points at the system-specific stuff
42 
43   const char* iconlabel_;
44   const char* xclass_;
45   const void* icon_;
46   // size_range stuff:
47   short minw, minh, maxw, maxh;
48   uchar dw, dh, aspect, size_range_set;
49   // cursor stuff
50   Fl_Cursor cursor_default;
51   Fl_Color cursor_fg, cursor_bg;
52   void size_range_();
53   // values for flags():
54   enum {
55     FL_MODAL = 64,
56     FL_NOBORDER = 8,
57     FL_FORCE_POSITION = 16,
58     FL_NON_MODAL = 32,
59     FL_OVERRIDE = 256
60   };
61   void _Fl_Window(); // constructor innards
62 
63   // unimplemented copy ctor and assignment operator
64   Fl_Window(const Fl_Window&);
65   Fl_Window& operator=(const Fl_Window&);
66 
67 protected:
68 
69   static Fl_Window *current_;
70   virtual void draw();
71   virtual void flush();
72 
73 public:
74 
75   Fl_Window(int,int,int,int, const char* = 0);
76   Fl_Window(int,int, const char* = 0);
77   virtual ~Fl_Window();
78 
79   virtual int handle(int);
80 
81   virtual void resize(int,int,int,int);
82   void border(int b);
clear_border()83   void clear_border()	{set_flag(FL_NOBORDER);}
border()84   int border() const	{return !(flags() & FL_NOBORDER);}
set_override()85   void set_override()	{set_flag(FL_NOBORDER|FL_OVERRIDE);}
override()86   int override() const  { return flags()&FL_OVERRIDE; }
set_modal()87   void set_modal()	{set_flag(FL_MODAL);}
modal()88   int modal() const	{return flags() & FL_MODAL;}
set_non_modal()89   void set_non_modal()	{set_flag(FL_NON_MODAL);}
non_modal()90   int non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);}
91 
92   void hotspot(int x, int y, int offscreen = 0);
93   void hotspot(const Fl_Widget*, int offscreen = 0);
94   void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
free_position()95   void free_position()	{clear_flag(FL_FORCE_POSITION);}
96   void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
97     minw=(short)a; minh=(short)b; maxw=(short)c; maxh=(short)d; dw=(uchar)e; dh=(uchar)f; aspect=(uchar)g; size_range_();}
98 
label()99   const char* label() const	{return Fl_Widget::label();}
iconlabel()100   const char* iconlabel() const	{return iconlabel_;}
101   void label(const char*);
102   void iconlabel(const char*);
103   void label(const char* label, const char* iconlabel);
104   void copy_label(const char* a);
xclass()105   const char* xclass() const	{return xclass_;}
xclass(const char * c)106   void xclass(const char* c)	{xclass_ = c;}
icon()107   const void* icon() const	{return icon_;}
icon(const void * ic)108   void icon(const void * ic)	{icon_ = ic;}
109 
shown()110   int shown() {return i != 0;}
111   virtual void show();
112   virtual void hide();
113   void show(int, char**);
114   void fullscreen();
115   void fullscreen_off(int,int,int,int);
116   void iconize();
117 
118   int x_root() const ;
119   int y_root() const ;
120 
121   static Fl_Window *current();
122   void make_current();
123 
124   // for back-compatability only:
125   void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
126   void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
127   static void default_callback(Fl_Window*, void* v);
128 
129 };
130 
131 #endif
132 
133 //
134 // End of "$Id: Fl_Window.H 4421 2005-07-15 09:34:53Z matt $".
135 //
136