FLTK 1.3.2
Fl_Window.H
1 //
2 // "$Id: Fl_Window.H 9706 2012-11-06 20:46:14Z matt $"
3 //
4 // Window header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2012 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 /* \file
20  Fl_Window widget . */
21 
22 #ifndef Fl_Window_H
23 #define Fl_Window_H
24 
25 #include "Fl_Group.H"
26 
27 #define FL_WINDOW 0xF0
28 #define FL_DOUBLE_WINDOW 0xF1
29 
30 class Fl_X;
31 
49 class FL_EXPORT Fl_Window : public Fl_Group {
50 
51  static char *default_xclass_;
52  // Note: we must use separate statements for each of the following 4 variables,
53  // with the static attribute, otherwise MS VC++ 2008/2010 complains :-(
54  // AlbrechtS 04/2012
55 #if FLTK_ABI_VERSION < 10301
56  static // when these members are static, ABI compatibility with 1.3.0 is respected
57 #endif
58  int no_fullscreen_x;
59 #if FLTK_ABI_VERSION < 10301
60  static // when these members are static, ABI compatibility with 1.3.0 is respected
61 #endif
62  int no_fullscreen_y;
63 #if FLTK_ABI_VERSION < 10301
64  static // when these members are static, ABI compatibility with 1.3.0 is respected
65 #endif
66  int no_fullscreen_w;
67 #if FLTK_ABI_VERSION < 10301
68  static // when these members are static, ABI compatibility with 1.3.0 is respected
69 #endif
70  int no_fullscreen_h;
71 
72  friend class Fl_X;
73  Fl_X *i; // points at the system-specific stuff
74 
75  const char* iconlabel_;
76  char* xclass_;
77  const void* icon_;
78  // size_range stuff:
79  int minw, minh, maxw, maxh;
80  int dw, dh, aspect;
81  uchar size_range_set;
82  // cursor stuff
83  Fl_Cursor cursor_default;
84  Fl_Color cursor_fg, cursor_bg;
85  void size_range_();
86  void _Fl_Window(); // constructor innards
87  void fullscreen_x(); // platform-specific part of sending a window to full screen
88  void fullscreen_off_x(int X, int Y, int W, int H);// platform-specific part of leaving full screen
89 
90  // unimplemented copy ctor and assignment operator
91  Fl_Window(const Fl_Window&);
92  Fl_Window& operator=(const Fl_Window&);
93 
94 protected:
95 
98  virtual void draw();
100  virtual void flush();
101 
110  void force_position(int force) {
111  if (force) set_flag(FORCE_POSITION);
112  else clear_flag(FORCE_POSITION);
113  }
122  int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
123 
124 public:
125 
154  Fl_Window(int w, int h, const char* title= 0);
159  Fl_Window(int x, int y, int w, int h, const char* title = 0);
168  virtual ~Fl_Window();
169 
170  virtual int handle(int);
171 
188  virtual void resize(int X,int Y,int W,int H);
196  void border(int b);
201  void clear_border() {set_flag(NOBORDER);}
203  unsigned int border() const {return !(flags() & NOBORDER);}
205  void set_override() {set_flag(NOBORDER|OVERRIDE);}
207  unsigned int override() const { return flags()&OVERRIDE; }
216  void set_modal() {set_flag(MODAL);}
218  unsigned int modal() const {return flags() & MODAL;}
225  void set_non_modal() {set_flag(NON_MODAL);}
227  unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
228 
242  void set_menu_window() {set_flag(MENU_WINDOW);}
243 
245  unsigned int menu_window() const {return flags() & MENU_WINDOW;}
246 
263  void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
264  clear_flag(MENU_WINDOW); }
266  unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
267 
275  void hotspot(int x, int y, int offscreen = 0);
277  void hotspot(const Fl_Widget*, int offscreen = 0);
279  void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
280 
289  void free_position() {clear_flag(FORCE_POSITION);}
326  void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0) {
327  this->minw = minw;
328  this->minh = minh;
329  this->maxw = maxw;
330  this->maxh = maxh;
331  this->dw = dw;
332  this->dh = dh;
333  this->aspect = aspect;
334  size_range_();
335  }
336 
338  const char* label() const {return Fl_Widget::label();}
340  const char* iconlabel() const {return iconlabel_;}
342  void label(const char*);
344  void iconlabel(const char*);
346  void label(const char* label, const char* iconlabel); // platform dependent
347  void copy_label(const char* a);
348 
349  static void default_xclass(const char*);
350  static const char *default_xclass();
351  const char* xclass() const;
352  void xclass(const char* c);
353  const void* icon() const;
354  void icon(const void * ic);
355 
361  int shown() {return i != 0;}
377  virtual void show();
382  virtual void hide();
403  void show(int argc, char **argv);
413  void fullscreen();
417  void fullscreen_off();
422  void fullscreen_off(int X,int Y,int W,int H);
426  unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
442  void iconize();
443 
444  int x_root() const ;
445  int y_root() const ;
446 
447  static Fl_Window *current();
457  void make_current();
458 
459  // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
460  virtual Fl_Window* as_window() { return this; }
461 
475  void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
476  void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
477  static void default_callback(Fl_Window*, void* v);
478 
483  int decorated_w();
489  int decorated_h();
490 
491 };
492 
493 #endif
494 
495 //
496 // End of "$Id: Fl_Window.H 9706 2012-11-06 20:46:14Z matt $".
497 //