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 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:109
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:213
This widget produces an actual window.
Definition: Fl_Window.H:58
void force_position(int force)
Sets an internal flag that tells FLTK and the window manager to honor position requests.
Definition: Fl_Window.H:98
position window on top (Fl_Window)
Definition: Fl_Widget.H:172
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition: Enumerations.H:882
virtual void hide()
Makes a widget invisible.
Definition: Fl_Widget.cxx:273
const char * label() const
See void Fl_Window::label(const char*)
Definition: Fl_Window.H:318
int force_position() const
Returns the internal state of the window's FORCE_POSITION flag.
Definition: Fl_Window.H:110
unsigned int border() const
See void Fl_Window::border(int)
Definition: Fl_Window.H:191
void set_override()
Activates the flags NOBORDER|FL_OVERRIDE.
Definition: Fl_Window.H:193
static void default_callback(Fl_Widget *cb, void *d)
Sets the default callback for all widgets.
Definition: Fl_Widget.cxx:48
virtual Fl_Window * as_window()
Returns an Fl_Window pointer if this widget is an Fl_Window.
Definition: Fl_Window.H:428
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:277
unsigned int non_modal() const
Returns true if this window is modal or non-modal.
Definition: Fl_Window.H:215
a window blocking input to all other winows (Fl_Window)
Definition: Fl_Widget.H:178
unsigned int modal() const
Returns true if this window is modal.
Definition: Fl_Window.H:206
void draw()
Draws the widget.
Definition: Fl_Group.cxx:741
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:45
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition: Fl_Widget.H:159
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:150
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition: Fl_Widget.H:177
void set_tooltip_window()
Marks the window as a tooltip window.
Definition: Fl_Window.H:251
virtual void show()
Makes a widget visible.
Definition: Fl_Widget.cxx:261
void clear_border()
Fast inline function to turn the window manager border off.
Definition: Fl_Window.H:189
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:637
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:769
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition: Fl_Widget.H:176
static Fl_Window * current_
Stores the last window that was made current.
Definition: Fl_Window.H:85
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:267
unsigned int menu_window() const
Returns true if this window is a menu window.
Definition: Fl_Window.H:233
don't draw a decoration (Fl_Window)
Definition: Fl_Widget.H:167
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition: Fl_Widget.H:157
void set_menu_window()
Marks the window as a menu window.
Definition: Fl_Window.H:230
void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0)
Sets the allowable range the user can resize this window to.
Definition: Fl_Window.H:314
void set_modal()
A "modal" window, when shown(), will prevent any events from being delivered to other windows in the ...
Definition: Fl_Window.H:204
int shown()
Returns non-zero if show() has been called (but not hide() ).
Definition: Fl_Window.H:341
const char * label() const
Gets the current label text.
Definition: Fl_Widget.H:417
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:155
const char * iconlabel() const
See void Fl_Window::iconlabel(const char*)
Definition: Fl_Window.H:320
unsigned int tooltip_window() const
Returns true if this window is a tooltip window.
Definition: Fl_Window.H:254
static Fl_Group * current()
Returns the currently active group.
Definition: Fl_Group.cxx:89
void copy_label(const char *new_label)
Sets the current label.
Definition: Fl_Widget.cxx:314
unsigned char uchar
unsigned char
Definition: fl_types.h:39