FLTK 1.3.0
Fl_Window.H
1 //
2 // "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $"
3 //
4 // Window header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
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 /* \file
29  Fl_Window widget . */
30 
31 #ifndef Fl_Window_H
32 #define Fl_Window_H
33 
34 #include "Fl_Group.H"
35 
36 #define FL_WINDOW 0xF0
37 #define FL_DOUBLE_WINDOW 0xF1
38 
39 class Fl_X;
40 
58 class FL_EXPORT Fl_Window : public Fl_Group {
59 
60  static char *default_xclass_;
61 
62  friend class Fl_X;
63  Fl_X *i; // points at the system-specific stuff
64 
65  const char* iconlabel_;
66  char* xclass_;
67  const void* icon_;
68  // size_range stuff:
69  int minw, minh, maxw, maxh;
70  int dw, dh, aspect;
71  uchar size_range_set;
72  // cursor stuff
73  Fl_Cursor cursor_default;
74  Fl_Color cursor_fg, cursor_bg;
75  void size_range_();
76  void _Fl_Window(); // constructor innards
77 
78  // unimplemented copy ctor and assignment operator
79  Fl_Window(const Fl_Window&);
80  Fl_Window& operator=(const Fl_Window&);
81 
82 protected:
83 
86  virtual void draw();
88  virtual void flush();
89 
98  void force_position(int force) {
99  if (force) set_flag(FORCE_POSITION);
100  else clear_flag(FORCE_POSITION);
101  }
110  int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
111 
112 public:
113 
142  Fl_Window(int w, int h, const char* title= 0);
147  Fl_Window(int x, int y, int w, int h, const char* title = 0);
156  virtual ~Fl_Window();
157 
158  virtual int handle(int);
159 
176  virtual void resize(int,int,int,int);
184  void border(int b);
189  void clear_border() {set_flag(NOBORDER);}
191  unsigned int border() const {return !(flags() & NOBORDER);}
193  void set_override() {set_flag(NOBORDER|OVERRIDE);}
195  unsigned int override() const { return flags()&OVERRIDE; }
204  void set_modal() {set_flag(MODAL);}
206  unsigned int modal() const {return flags() & MODAL;}
213  void set_non_modal() {set_flag(NON_MODAL);}
215  unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
216 
230  void set_menu_window() {set_flag(MENU_WINDOW);}
231 
233  unsigned int menu_window() const {return flags() & MENU_WINDOW;}
234 
251  void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
252  clear_flag(MENU_WINDOW); }
254  unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
255 
263  void hotspot(int x, int y, int offscreen = 0);
265  void hotspot(const Fl_Widget*, int offscreen = 0);
267  void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
268 
277  void free_position() {clear_flag(FORCE_POSITION);}
314  void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
315  minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
316 
318  const char* label() const {return Fl_Widget::label();}
320  const char* iconlabel() const {return iconlabel_;}
322  void label(const char*);
324  void iconlabel(const char*);
326  void label(const char* label, const char* iconlabel); // platform dependent
327  void copy_label(const char* a);
328 
329  static void default_xclass(const char*);
330  static const char *default_xclass();
331  const char* xclass() const;
332  void xclass(const char* c);
333  const void* icon() const;
334  void icon(const void * ic);
335 
341  int shown() {return i != 0;}
357  virtual void show();
362  virtual void hide();
383  void show(int argc, char **argv);
389  void fullscreen();
394  void fullscreen_off(int,int,int,int);
410  void iconize();
411 
412  int x_root() const ;
413  int y_root() const ;
414 
415  static Fl_Window *current();
425  void make_current();
426 
427  // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
428  virtual Fl_Window* as_window() { return this; }
429 
443  void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
444  void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
445  static void default_callback(Fl_Window*, void* v);
446 
451  int decorated_w();
457  int decorated_h();
458 
459 };
460 
461 #endif
462 
463 //
464 // End of "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $".
465 //