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 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
void set_non_modal()
A &quot;non-modal&quot; window (terminology borrowed from Microsoft Windows) acts like a modal() one in that it...
Definition: Fl_Window.H:225
This widget produces an actual window.
Definition: Fl_Window.H:49
void force_position(int force)
Sets an internal flag that tells FLTK and the window manager to honor position requests.
Definition: Fl_Window.H:110
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:887
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:338
int force_position() const
Returns the internal state of the window&#39;s FORCE_POSITION flag.
Definition: Fl_Window.H:122
unsigned int border() const
See void Fl_Window::border(int)
Definition: Fl_Window.H:203
void set_override()
Activates the flags NOBORDER|FL_OVERRIDE.
Definition: Fl_Window.H:205
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:460
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:289
unsigned int non_modal() const
Returns true if this window is modal or non-modal.
Definition: Fl_Window.H:227
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:218
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:263
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:201
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:97
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:279
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:326
unsigned int menu_window() const
Returns true if this window is a menu window.
Definition: Fl_Window.H:245
don&#39;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:242
void set_modal()
A &quot;modal&quot; window, when shown(), will prevent any events from being delivered to other windows in the ...
Definition: Fl_Window.H:216
int shown()
Returns non-zero if show() has been called (but not hide() ).
Definition: Fl_Window.H:361
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:426
const char * iconlabel() const
See void Fl_Window::iconlabel(const char*)
Definition: Fl_Window.H:340
unsigned int tooltip_window() const
Returns true if this window is a tooltip window.
Definition: Fl_Window.H:266
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