FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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 #ifdef WIN32
26 #include <windows.h>
27 #endif
28
29 #include "Fl_Group.H"
30
31 #define FL_WINDOW 0xF0
32 #define FL_DOUBLE_WINDOW 0xF1
33
34 class Fl_X;
35 class Fl_RGB_Image;
36
54 class FL_EXPORT Fl_Window : public Fl_Group {
55
56 static char *default_xclass_;
57 // Note: we must use separate statements for each of the following 8 variables,
58 // with the static attribute, otherwise MS VC++ 2008/2010 complains :-(
59 // AlbrechtS 04/2012
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_x;
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_y;
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_w;
72 #if FLTK_ABI_VERSION < 10301
73 static // when these members are static, ABI compatibility with 1.3.0 is respected
74 #endif
75 int no_fullscreen_h;
76 #if FLTK_ABI_VERSION < 10302
77 static // when these members are static, ABI compatibility with 1.3.0 is respected
78 #endif
79 int fullscreen_screen_top;
80 #if FLTK_ABI_VERSION < 10302
81 static // when these members are static, ABI compatibility with 1.3.0 is respected
82 #endif
83 int fullscreen_screen_bottom;
84 #if FLTK_ABI_VERSION < 10302
85 static // when these members are static, ABI compatibility with 1.3.0 is respected
86 #endif
87 int fullscreen_screen_left;
88 #if FLTK_ABI_VERSION < 10302
89 static // when these members are static, ABI compatibility with 1.3.0 is respected
90 #endif
91 int fullscreen_screen_right;
92
93 friend class Fl_X;
94 Fl_X *i; // points at the system-specific stuff
95
96 struct icon_data {
97 const void *legacy_icon;
98 Fl_RGB_Image **icons;
99 int count;
100 #ifdef WIN32
101 HICON big_icon;
102 HICON small_icon;
103 #endif
104 };
105
106 const char* iconlabel_;
107 char* xclass_;
108 struct icon_data *icon_;
109 // size_range stuff:
110 int minw, minh, maxw, maxh;
111 int dw, dh, aspect;
112 uchar size_range_set;
113 // cursor stuff
114 Fl_Cursor cursor_default;
115 void size_range_();
116 void _Fl_Window(); // constructor innards
117 void fullscreen_x(); // platform-specific part of sending a window to full screen
118 void fullscreen_off_x(int X, int Y, int W, int H);// platform-specific part of leaving full screen
119
120 // unimplemented copy ctor and assignment operator
121 Fl_Window(const Fl_Window&);
122 Fl_Window& operator=(const Fl_Window&);
123
124 protected:
125
127 static Fl_Window *current_;
128 virtual void draw();
130 virtual void flush();
131
140 void force_position(int force) {
141 if (force) set_flag(FORCE_POSITION);
142 else clear_flag(FORCE_POSITION);
143 }
152 int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
153
154 void free_icons();
155
156 public:
157
186 Fl_Window(int w, int h, const char* title= 0);
191 Fl_Window(int x, int y, int w, int h, const char* title = 0);
200 virtual ~Fl_Window();
201
202 virtual int handle(int);
203
220 virtual void resize(int X,int Y,int W,int H);
228 void border(int b);
233 void clear_border() {set_flag(NOBORDER);}
235 unsigned int border() const {return !(flags() & NOBORDER);}
237 void set_override() {set_flag(NOBORDER|OVERRIDE);}
239 unsigned int override() const { return flags()&OVERRIDE; }
248 void set_modal() {set_flag(MODAL);}
250 unsigned int modal() const {return flags() & MODAL;}
257 void set_non_modal() {set_flag(NON_MODAL);}
259 unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
260
274 void set_menu_window() {set_flag(MENU_WINDOW);}
275
277 unsigned int menu_window() const {return flags() & MENU_WINDOW;}
278
295 void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
296 clear_flag(MENU_WINDOW); }
298 unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
299
307 void hotspot(int x, int y, int offscreen = 0);
309 void hotspot(const Fl_Widget*, int offscreen = 0);
311 void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
312
321 void free_position() {clear_flag(FORCE_POSITION);}
358 void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0) {
359 this->minw = minw;
360 this->minh = minh;
361 this->maxw = maxw;
362 this->maxh = maxh;
363 this->dw = dw;
364 this->dh = dh;
365 this->aspect = aspect;
366 size_range_();
367 }
368
370 const char* label() const {return Fl_Widget::label();}
372 const char* iconlabel() const {return iconlabel_;}
374 void label(const char*);
376 void iconlabel(const char*);
378 void label(const char* label, const char* iconlabel); // platform dependent
379 void copy_label(const char* a);
380
381 static void default_xclass(const char*);
382 static const char *default_xclass();
383 const char* xclass() const;
384 void xclass(const char* c);
385
386 static void default_icon(const Fl_RGB_Image*);
387 static void default_icons(const Fl_RGB_Image*[], int);
388 void icon(const Fl_RGB_Image*);
389 void icons(const Fl_RGB_Image*[], int);
390
391 #ifdef WIN32
392 static void default_icons(HICON big_icon, HICON small_icon);
393 void icons(HICON big_icon, HICON small_icon);
394 #endif
395
396 /* for legacy compatibility */
397 const void* icon() const;
398 void icon(const void * ic);
399
405 int shown() {return i != 0;}
421 virtual void show();
426 virtual void hide();
447 void show(int argc, char **argv);
459 void fullscreen();
463 void fullscreen_off();
468 void fullscreen_off(int X,int Y,int W,int H);
472 unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
483 void fullscreen_screens(int top, int bottom, int left, int right);
499 void iconize();
500
501 int x_root() const ;
502 int y_root() const ;
503
504 static Fl_Window *current();
514 void make_current();
515
516 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
517 virtual Fl_Window* as_window() { return this; }
518
529 void cursor(Fl_Cursor);
530 void cursor(const Fl_RGB_Image*, int, int);
531 void default_cursor(Fl_Cursor);
532
533 /* for legacy compatibility */
534 void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
535 void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
536
537 static void default_callback(Fl_Window*, void* v);
538
543 int decorated_w();
549 int decorated_h();
550
551 };
552
553 #endif
554
555 //
556 // End of "$Id: Fl_Window.H 9706 2012-11-06 20:46:14Z matt $".
557 //
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
Fl_Window::set_non_modal
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:257
Fl_Window
This widget produces an actual window.
Definition: Fl_Window.H:54
Fl_Window::force_position
void force_position(int force)
Sets an internal flag that tells FLTK and the window manager to honor position requests.
Definition: Fl_Window.H:140
Fl_Widget::OVERRIDE
position window on top (Fl_Window)
Definition: Fl_Widget.H:163
Fl_Cursor
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition: Enumerations.H:887
Fl_Widget::hide
virtual void hide()
Makes a widget invisible.
Definition: Fl_Widget.cxx:264
Fl_Window::label
const char * label() const
See void Fl_Window::label(const char*)
Definition: Fl_Window.H:370
Fl_Window::force_position
int force_position() const
Returns the internal state of the window&#39;s FORCE_POSITION flag.
Definition: Fl_Window.H:152
Fl_Window::border
unsigned int border() const
See void Fl_Window::border(int)
Definition: Fl_Window.H:235
Fl_Window::set_override
void set_override()
Activates the flags NOBORDER|FL_OVERRIDE.
Definition: Fl_Window.H:237
Fl_Widget::default_callback
static void default_callback(Fl_Widget *cb, void *d)
Sets the default callback for all widgets.
Definition: Fl_Widget.cxx:39
Fl_Window::as_window
virtual Fl_Window * as_window()
Returns an Fl_Window pointer if this widget is an Fl_Window.
Definition: Fl_Window.H:517
Fl_Window::free_position
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:321
Fl_Window::non_modal
unsigned int non_modal() const
Returns true if this window is modal or non-modal.
Definition: Fl_Window.H:259
Fl_Widget::MODAL
a window blocking input to all other winows (Fl_Window)
Definition: Fl_Widget.H:169
Fl_Window::modal
unsigned int modal() const
Returns true if this window is modal.
Definition: Fl_Window.H:250
Fl_RGB_Image
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
Fl_Group::draw
void draw()
Draws the widget.
Definition: Fl_Group.cxx:736
Fl_Group
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:36
Fl_Widget::clear_flag
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition: Fl_Widget.H:150
Fl_Group::handle
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:145
Fl_Widget::TOOLTIP_WINDOW
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition: Fl_Widget.H:168
Fl_Window::set_tooltip_window
void set_tooltip_window()
Marks the window as a tooltip window.
Definition: Fl_Window.H:295
Fl_Widget::show
virtual void show()
Makes a widget visible.
Definition: Fl_Widget.cxx:252
Fl_Widget::FULLSCREEN
a fullscreen window (Fl_Window)
Definition: Fl_Widget.H:173
Fl_Window::clear_border
void clear_border()
Fast inline function to turn the window manager border off.
Definition: Fl_Window.H:233
Fl_Group::resize
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:632
Fl_Color
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:774
Fl_Widget::MENU_WINDOW
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition: Fl_Widget.H:167
Fl_Window::current_
static Fl_Window * current_
Stores the last window that was made current.
Definition: Fl_Window.H:127
Fl_Window::hotspot
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:311
Fl_Window::size_range
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:358
Fl_Window::menu_window
unsigned int menu_window() const
Returns true if this window is a menu window.
Definition: Fl_Window.H:277
Fl_Widget::NOBORDER
don&#39;t draw a decoration (Fl_Window)
Definition: Fl_Widget.H:158
Fl_Widget::set_flag
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition: Fl_Widget.H:148
Fl_Window::set_menu_window
void set_menu_window()
Marks the window as a menu window.
Definition: Fl_Window.H:274
Fl_Window::set_modal
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:248
Fl_Window::shown
int shown()
Returns non-zero if show() has been called (but not hide() ).
Definition: Fl_Window.H:405
Fl_Widget::label
const char * label() const
Gets the current label text.
Definition: Fl_Widget.H:410
Fl_Widget::flags
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:146
Fl_Window::fullscreen_active
unsigned int fullscreen_active() const
Returns non zero if FULLSCREEN flag is set, 0 otherwise.
Definition: Fl_Window.H:472
Fl_Window::iconlabel
const char * iconlabel() const
See void Fl_Window::iconlabel(const char*)
Definition: Fl_Window.H:372
Fl_Window::tooltip_window
unsigned int tooltip_window() const
Returns true if this window is a tooltip window.
Definition: Fl_Window.H:298
Fl_Group::current
static Fl_Group * current()
Returns the currently active group.
Definition: Fl_Group.cxx:84
Fl_Widget::copy_label
void copy_label(const char *new_label)
Sets the current label.
Definition: Fl_Widget.cxx:305
uchar
unsigned char uchar
unsigned char
Definition: fl_types.h:30
- © 1998-2012 by Bill Spitzak and others.