NTK 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
39class Fl_X;
40
58class FL_EXPORT Fl_Window : public Fl_Group {
59
60 static char *default_xclass_;
61
62 friend class Fl;
63 friend class Fl_X;
64 Fl_X *i; // points at the system-specific stuff
65
66 const char* iconlabel_;
67 char* xclass_;
68 const void* icon_;
69 // size_range stuff:
70 int minw, minh, maxw, maxh;
71 int dw, dh, aspect;
72 uchar size_range_set;
73 // cursor stuff
74 Fl_Cursor cursor_default;
75 Fl_Color cursor_fg, cursor_bg;
76 void size_range_();
77 void _Fl_Window(); // constructor innards
78
79 // unimplemented copy ctor and assignment operator
80 Fl_Window(const Fl_Window&);
81 Fl_Window& operator=(const Fl_Window&);
82
83protected:
84
87 virtual void draw();
89 virtual void flush();
90
99 void force_position(int force) {
100 if (force) set_flag(FORCE_POSITION);
101 else clear_flag(FORCE_POSITION);
102 }
111 int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
112
113public:
114
143 Fl_Window(int w, int h, const char* title= 0);
148 Fl_Window(int x, int y, int w, int h, const char* title = 0);
157 virtual ~Fl_Window();
158
159 virtual int handle(int);
160
177 virtual void resize(int,int,int,int);
185 void border(int b);
190 void clear_border() {set_flag(NOBORDER);}
192 unsigned int border() const {return !(flags() & NOBORDER);}
194 void set_override() {set_flag(NOBORDER|OVERRIDE);}
196 unsigned int override() const { return flags()&OVERRIDE; }
205 void set_modal() {set_flag(MODAL);}
207 unsigned int modal() const {return flags() & MODAL;}
214 void set_non_modal() {set_flag(NON_MODAL);}
216 unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
217
231 void set_menu_window() {set_flag(MENU_WINDOW);}
232
234 unsigned int menu_window() const {return flags() & MENU_WINDOW;}
235
252 void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
253 clear_flag(MENU_WINDOW); }
255 unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
256
264 void hotspot(int x, int y, int offscreen = 0);
266 void hotspot(const Fl_Widget*, int offscreen = 0);
268 void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
269
278 void free_position() {clear_flag(FORCE_POSITION);}
315 void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
316 minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
317
319 const char* label() const {return Fl_Widget::label();}
321 const char* iconlabel() const {return iconlabel_;}
323 void label(const char*);
325 void iconlabel(const char*);
327 void label(const char* label, const char* iconlabel); // platform dependent
328 void copy_label(const char* a);
329
330 static void default_xclass(const char*);
331 static const char *default_xclass();
332 const char* xclass() const;
333 void xclass(const char* c);
334 const void* icon() const;
335 void icon(const void * ic);
336
342 int shown() const {return i != 0;}
358 virtual void show();
363 virtual void hide();
384 void show(int argc, char **argv);
390 void fullscreen();
395 void fullscreen_off(int,int,int,int);
411 void iconize();
412
413 int x_root() const ;
414 int y_root() const ;
415
416 static Fl_Window *current();
427
428 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
429 virtual Fl_Window* as_window() { return this; }
430
444 void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
445 void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
446 static void default_callback(Fl_Window*, void* v);
447
459
460};
461
462#endif
463
464//
465// End of "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $".
466//
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition: Enumerations.H:879
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:764
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:45
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:150
void draw()
Draws the widget.
Definition: Fl_Group.cxx:742
static Fl_Group * current()
Returns the currently active group.
Definition: Fl_Group.cxx:89
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:111
@ OVERRIDE
position window on top (Fl_Window)
Definition: Fl_Widget.H:174
@ NOBORDER
don't draw a decoration (Fl_Window)
Definition: Fl_Widget.H:169
@ TOOLTIP_WINDOW
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition: Fl_Widget.H:179
@ MODAL
a window blocking input to all other winows (Fl_Window)
Definition: Fl_Widget.H:180
@ MENU_WINDOW
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition: Fl_Widget.H:178
virtual void hide()
Makes a widget invisible.
Definition: Fl_Widget.cxx:242
static void default_callback(Fl_Widget *cb, void *d)
Sets the default callback for all widgets.
Definition: Fl_Widget.cxx:48
const char * label() const
Gets the current label text.
Definition: Fl_Widget.H:419
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:157
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition: Fl_Widget.H:159
void copy_label(const char *new_label)
Sets the current label.
Definition: Fl_Widget.cxx:284
virtual void show()
Makes a widget visible.
Definition: Fl_Widget.cxx:230
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition: Fl_Widget.H:161
This widget produces an actual window.
Definition: Fl_Window.H:58
int force_position() const
Returns the internal state of the window's FORCE_POSITION flag.
Definition: Fl_Window.H:111
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:278
void force_position(int force)
Sets an internal flag that tells FLTK and the window manager to honor position requests.
Definition: Fl_Window.H:99
int decorated_h()
Returns the window height including any window title bar and any frame added by the window manager.
void set_menu_window()
Marks the window as a menu window.
Definition: Fl_Window.H:231
const char * iconlabel() const
See void Fl_Window::iconlabel(const char*)
Definition: Fl_Window.H:321
unsigned int non_modal() const
Returns true if this window is modal or non-modal.
Definition: Fl_Window.H:216
void make_current()
Sets things up so that the drawing functions in <FL/fl_draw.H> will go into this window.
unsigned int menu_window() const
Returns true if this window is a menu window.
Definition: Fl_Window.H:234
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:268
void label(const char *label, const char *iconlabel)
Sets the icon label.
int decorated_w()
Returns the window width including any frame added by the window manager.
virtual Fl_Window * as_window()
Returns an Fl_Window pointer if this widget is an Fl_Window.
Definition: Fl_Window.H:429
static Fl_Window * current_
Stores the last window that was made current.
Definition: Fl_Window.H:86
void set_override()
Activates the flags NOBORDER|FL_OVERRIDE.
Definition: Fl_Window.H:194
virtual void show()
Puts the window on the screen.
unsigned int modal() const
Returns true if this window is modal.
Definition: Fl_Window.H:207
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:315
unsigned int border() const
See void Fl_Window::border(int)
Definition: Fl_Window.H:192
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:214
void clear_border()
Fast inline function to turn the window manager border off.
Definition: Fl_Window.H:190
void set_modal()
A "modal" window, when shown(), will prevent any events from being delivered to other windows in the ...
Definition: Fl_Window.H:205
void set_tooltip_window()
Marks the window as a tooltip window.
Definition: Fl_Window.H:252
const char * label() const
See void Fl_Window::label(const char*)
Definition: Fl_Window.H:319
int shown() const
Returns non-zero if show() has been called (but not hide() ).
Definition: Fl_Window.H:342
unsigned int tooltip_window() const
Returns true if this window is a tooltip window.
Definition: Fl_Window.H:255
virtual void resize(int, int, int, int)
Changes the size and position of the window.
The Fl is the FLTK global (static) class containing state information and global methods for the curr...
Definition: Fl.H:116
unsigned char uchar
unsigned char
Definition: fl_types.h:39