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 class Fl_RGB_Image;
32 
50 class FL_EXPORT Fl_Window : public Fl_Group {
51 
52  static char *default_xclass_;
53  // Note: we must use separate statements for each of the following 4 variables,
54  // with the static attribute, otherwise MS VC++ 2008/2010 complains :-(
55  // AlbrechtS 04/2012
56 #if FLTK_ABI_VERSION < 10301
57  static // when these members are static, ABI compatibility with 1.3.0 is respected
58 #endif
59  int no_fullscreen_x;
60 #if FLTK_ABI_VERSION < 10301
61  static // when these members are static, ABI compatibility with 1.3.0 is respected
62 #endif
63  int no_fullscreen_y;
64 #if FLTK_ABI_VERSION < 10301
65  static // when these members are static, ABI compatibility with 1.3.0 is respected
66 #endif
67  int no_fullscreen_w;
68 #if FLTK_ABI_VERSION < 10301
69  static // when these members are static, ABI compatibility with 1.3.0 is respected
70 #endif
71  int no_fullscreen_h;
72 
73  friend class Fl_X;
74  Fl_X *i; // points at the system-specific stuff
75 
76  const char* iconlabel_;
77  char* xclass_;
78  const void* icon_;
79  // size_range stuff:
80  int minw, minh, maxw, maxh;
81  int dw, dh, aspect;
82  uchar size_range_set;
83  // cursor stuff
84  Fl_Cursor cursor_default;
85 #if FLTK_ABI_VERSION < 10303
86  // legacy, not used
87  Fl_Color cursor_fg, cursor_bg;
88 #endif
89  void size_range_();
90  void _Fl_Window(); // constructor innards
91  void fullscreen_x(); // platform-specific part of sending a window to full screen
92  void fullscreen_off_x(int X, int Y, int W, int H);// platform-specific part of leaving full screen
93 
94  // unimplemented copy ctor and assignment operator
95  Fl_Window(const Fl_Window&);
96  Fl_Window& operator=(const Fl_Window&);
97 
98 protected:
99 
102  virtual void draw();
104  virtual void flush();
105 
114  void force_position(int force) {
115  if (force) set_flag(FORCE_POSITION);
116  else clear_flag(FORCE_POSITION);
117  }
126  int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
127 
128 public:
129 
158  Fl_Window(int w, int h, const char* title= 0);
163  Fl_Window(int x, int y, int w, int h, const char* title = 0);
172  virtual ~Fl_Window();
173 
174  virtual int handle(int);
175 
192  virtual void resize(int X,int Y,int W,int H);
200  void border(int b);
205  void clear_border() {set_flag(NOBORDER);}
207  unsigned int border() const {return !(flags() & NOBORDER);}
209  void set_override() {set_flag(NOBORDER|OVERRIDE);}
211  unsigned int override() const { return flags()&OVERRIDE; }
220  void set_modal() {set_flag(MODAL);}
222  unsigned int modal() const {return flags() & MODAL;}
229  void set_non_modal() {set_flag(NON_MODAL);}
231  unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
232 
246  void set_menu_window() {set_flag(MENU_WINDOW);}
247 
249  unsigned int menu_window() const {return flags() & MENU_WINDOW;}
250 
267  void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
268  clear_flag(MENU_WINDOW); }
270  unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
271 
279  void hotspot(int x, int y, int offscreen = 0);
281  void hotspot(const Fl_Widget*, int offscreen = 0);
283  void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
284 
293  void free_position() {clear_flag(FORCE_POSITION);}
330  void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0) {
331  this->minw = minw;
332  this->minh = minh;
333  this->maxw = maxw;
334  this->maxh = maxh;
335  this->dw = dw;
336  this->dh = dh;
337  this->aspect = aspect;
338  size_range_();
339  }
340 
342  const char* label() const {return Fl_Widget::label();}
344  const char* iconlabel() const {return iconlabel_;}
346  void label(const char*);
348  void iconlabel(const char*);
350  void label(const char* label, const char* iconlabel); // platform dependent
351  void copy_label(const char* a);
352 
353  static void default_xclass(const char*);
354  static const char *default_xclass();
355  const char* xclass() const;
356  void xclass(const char* c);
357  const void* icon() const;
358  void icon(const void * ic);
359 
365  int shown() {return i != 0;}
381  virtual void show();
386  virtual void hide();
407  void show(int argc, char **argv);
417  void fullscreen();
421  void fullscreen_off();
426  void fullscreen_off(int X,int Y,int W,int H);
430  unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
446  void iconize();
447 
448  int x_root() const ;
449  int y_root() const ;
450 
451  static Fl_Window *current();
461  void make_current();
462 
463  // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
464  virtual Fl_Window* as_window() { return this; }
465 
476  void cursor(Fl_Cursor);
477  void cursor(const Fl_RGB_Image*, int, int);
478  void default_cursor(Fl_Cursor);
479 
480  /* for legacy compatibility */
481  void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
482  void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
483 
484  static void default_callback(Fl_Window*, void* v);
485 
490  int decorated_w();
496  int decorated_h();
497 
498 };
499 
500 #endif
501 
502 //
503 // End of "$Id: Fl_Window.H 9706 2012-11-06 20:46:14Z matt $".
504 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
void set_non_modal()
A "non-modal" window (terminology borrowed from Microsoft Windows) acts like a modal() one in that it...
Definition: Fl_Window.H:229
This widget produces an actual window.
Definition: Fl_Window.H:50
void force_position(int force)
Sets an internal flag that tells FLTK and the window manager to honor position requests.
Definition: Fl_Window.H:114
position window on top (Fl_Window)
Definition: Fl_Widget.H:163
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition: Enumerations.H:888
virtual void hide()
Makes a widget invisible.
Definition: Fl_Widget.cxx:264
const char * label() const
See void Fl_Window::label(const char*)
Definition: Fl_Window.H:342
int force_position() const
Returns the internal state of the window's FORCE_POSITION flag.
Definition: Fl_Window.H:126
unsigned int border() const
See void Fl_Window::border(int)
Definition: Fl_Window.H:207
void set_override()
Activates the flags NOBORDER|FL_OVERRIDE.
Definition: Fl_Window.H:209
static void default_callback(Fl_Widget *cb, void *d)
Sets the default callback for all widgets.
Definition: Fl_Widget.cxx:39
virtual Fl_Window * as_window()
Returns an Fl_Window pointer if this widget is an Fl_Window.
Definition: Fl_Window.H:464
void free_position()
Undoes the effect of a previous resize() or show() so that the next time show() is called the window ...
Definition: Fl_Window.H:293
unsigned int non_modal() const
Returns true if this window is modal or non-modal.
Definition: Fl_Window.H:231
a window blocking input to all other winows (Fl_Window)
Definition: Fl_Widget.H:169
unsigned int modal() const
Returns true if this window is modal.
Definition: Fl_Window.H:222
The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of colo...
Definition: Fl_Image.H:168
void draw()
Draws the widget.
Definition: Fl_Group.cxx:736
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:36
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition: Fl_Widget.H:150
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:145
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition: Fl_Widget.H:168
void set_tooltip_window()
Marks the window as a tooltip window.
Definition: Fl_Window.H:267
virtual void show()
Makes a widget visible.
Definition: Fl_Widget.cxx:252
a fullscreen window (Fl_Window)
Definition: Fl_Widget.H:173
void clear_border()
Fast inline function to turn the window manager border off.
Definition: Fl_Window.H:205
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:632
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:774
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition: Fl_Widget.H:167
static Fl_Window * current_
Stores the last window that was made current.
Definition: Fl_Window.H:101
void hotspot(const Fl_Widget &p, int offscreen=0)
See void Fl_Window::hotspot(int x, int y, int offscreen = 0)
Definition: Fl_Window.H:283
void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0)
Sets the allowable range the user can resize this window to.
Definition: Fl_Window.H:330
unsigned int menu_window() const
Returns true if this window is a menu window.
Definition: Fl_Window.H:249
don't draw a decoration (Fl_Window)
Definition: Fl_Widget.H:158
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition: Fl_Widget.H:148
void set_menu_window()
Marks the window as a menu window.
Definition: Fl_Window.H:246
void set_modal()
A "modal" window, when shown(), will prevent any events from being delivered to other windows in the ...
Definition: Fl_Window.H:220
int shown()
Returns non-zero if show() has been called (but not hide() ).
Definition: Fl_Window.H:365
const char * label() const
Gets the current label text.
Definition: Fl_Widget.H:409
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:146
unsigned int fullscreen_active() const
Returns non zero if FULLSCREEN flag is set, 0 otherwise.
Definition: Fl_Window.H:430
const char * iconlabel() const
See void Fl_Window::iconlabel(const char*)
Definition: Fl_Window.H:344
unsigned int tooltip_window() const
Returns true if this window is a tooltip window.
Definition: Fl_Window.H:270
static Fl_Group * current()
Returns the currently active group.
Definition: Fl_Group.cxx:84
void copy_label(const char *new_label)
Sets the current label.
Definition: Fl_Widget.cxx:305
unsigned char uchar
unsigned char
Definition: fl_types.h:30