[773] | 1 | // |
---|
| 2 | // "$Id: Window.h 4242 2005-04-06 06:59:36Z spitzak $" |
---|
| 3 | // |
---|
| 4 | // Window widget. This must be the outermost group. You can also put |
---|
| 5 | // them inside other widgets to use the system's window hierarchy. |
---|
| 6 | // |
---|
| 7 | // Copyright 1998-2003 by Bill Spitzak and others. |
---|
| 8 | // |
---|
| 9 | // This library is free software; you can redistribute it and/or |
---|
| 10 | // modify it under the terms of the GNU Library General Public |
---|
| 11 | // License as published by the Free Software Foundation; either |
---|
| 12 | // version 2 of the License, or (at your option) any later version. |
---|
| 13 | // |
---|
| 14 | // This library is distributed in the hope that it will be useful, |
---|
| 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | // Library General Public License for more details. |
---|
| 18 | // |
---|
| 19 | // You should have received a copy of the GNU Library General Public |
---|
| 20 | // License along with this library; if not, write to the Free Software |
---|
| 21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 22 | // USA. |
---|
| 23 | // |
---|
| 24 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
| 25 | // |
---|
| 26 | |
---|
| 27 | #ifndef fltk_Window_h |
---|
| 28 | #define fltk_Window_h |
---|
| 29 | |
---|
| 30 | #include "Group.h" |
---|
| 31 | |
---|
| 32 | namespace fltk { |
---|
| 33 | |
---|
| 34 | // value for x,y to indicate window system places window |
---|
| 35 | const int USEDEFAULT = ((int)0x80000000); // same as Win32 value |
---|
| 36 | |
---|
| 37 | class CreatedWindow; |
---|
| 38 | class Monitor; |
---|
| 39 | |
---|
| 40 | class FL_API Window : public Group { |
---|
| 41 | public: |
---|
| 42 | |
---|
| 43 | Window(int,int,int,int, const char* = 0, bool begin = false); |
---|
| 44 | Window(int,int, const char* = 0); |
---|
| 45 | static NamedStyle* default_style; |
---|
| 46 | virtual ~Window(); |
---|
| 47 | |
---|
| 48 | const char* label() const {return Widget::label();} |
---|
| 49 | const char* iconlabel() const {return iconlabel_;} |
---|
| 50 | void label(const char*); |
---|
| 51 | void iconlabel(const char*); |
---|
| 52 | void label(const char* label, const char* iconlabel); |
---|
| 53 | void copy_label(const char* c) {Widget::copy_label(c); label(label());} |
---|
| 54 | const void* icon() const {return icon_;} |
---|
| 55 | void icon(const void * ic) {icon_ = ic;} |
---|
| 56 | static const char* xclass() {return xclass_;} |
---|
| 57 | static void xclass(const char* v) {xclass_ = v;} |
---|
| 58 | |
---|
| 59 | void clear_border() {set_flag(NOBORDER);} |
---|
| 60 | bool border() const {return !(flags() & NOBORDER);} |
---|
| 61 | void set_override() {set_flag(NOBORDER|OVERRIDE);} |
---|
| 62 | bool override() const {return (flags()&OVERRIDE)!=0; } |
---|
| 63 | const Window* child_of() const {return child_of_;} |
---|
| 64 | void child_of(const Window* w); |
---|
| 65 | void set_modal() {set_flag(MODAL);} // back compatability only! |
---|
| 66 | void set_non_modal() {set_flag(NON_MODAL);} // back compatability only! |
---|
| 67 | |
---|
| 68 | bool double_buffer() const {return (flags()&DOUBLE)!=0;} |
---|
| 69 | void set_double_buffer() {set_flag(DOUBLE);} |
---|
| 70 | void clear_double_buffer() {clear_flag(DOUBLE);} |
---|
| 71 | void free_backbuffer(); |
---|
| 72 | |
---|
| 73 | virtual void draw_overlay(); |
---|
| 74 | void redraw_overlay(); |
---|
| 75 | void erase_overlay(); |
---|
| 76 | |
---|
| 77 | void hotspot(int x, int y, bool offscreen = false); |
---|
| 78 | void hotspot(const Widget*, bool offscreen = false); |
---|
| 79 | void hotspot(const Widget& p, bool offscrn = false) {hotspot(&p,offscrn);} |
---|
| 80 | void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0) |
---|
| 81 | { minw=(short)a; minh=(short)b; maxw=(short)c; maxh=(short)d; dw=(uchar)e; dh=(uchar)f; size_range_(); } |
---|
| 82 | |
---|
| 83 | bool shown() const {return i != 0;} |
---|
| 84 | void show(); |
---|
| 85 | void show(int, char**); |
---|
| 86 | void show(const Window* parent); |
---|
| 87 | bool exec(const Window* parent = 0, bool grab = false); |
---|
| 88 | void show_inside(const Window* parent); |
---|
| 89 | void iconize(); |
---|
| 90 | bool iconic() const; |
---|
| 91 | virtual void destroy(); |
---|
| 92 | |
---|
| 93 | void fullscreen(); |
---|
| 94 | void fullscreen(const Monitor&); |
---|
| 95 | void fullscreen_off(int,int,int,int); |
---|
| 96 | |
---|
| 97 | static void default_callback(Window*, void* v); |
---|
| 98 | |
---|
| 99 | virtual int handle(int); |
---|
| 100 | virtual void layout(); |
---|
| 101 | virtual void flush(); |
---|
| 102 | virtual void draw(); |
---|
| 103 | |
---|
| 104 | static Window* first(); |
---|
| 105 | static void first(Window*); |
---|
| 106 | Window* next(); |
---|
| 107 | |
---|
| 108 | void borders( Rectangle *r ) const; |
---|
| 109 | |
---|
| 110 | static const Window* drawing_window() {return drawing_window_;} |
---|
| 111 | static const Window* drawing_window_; |
---|
| 112 | |
---|
| 113 | protected: |
---|
| 114 | virtual void create(); |
---|
| 115 | |
---|
| 116 | private: |
---|
| 117 | |
---|
| 118 | friend class CreatedWindow; |
---|
| 119 | CreatedWindow *i; // points at the system-specific stuff |
---|
| 120 | const Window* child_of_; |
---|
| 121 | const char* iconlabel_; |
---|
| 122 | const void* icon_; |
---|
| 123 | // size_range stuff: |
---|
| 124 | short minw, minh, maxw, maxh; |
---|
| 125 | unsigned char dw, dh, size_range_set; |
---|
| 126 | void size_range_(); |
---|
| 127 | // values for flags(): |
---|
| 128 | enum { |
---|
| 129 | MODAL = 0x80000000, |
---|
| 130 | NOBORDER = 0x40000000, |
---|
| 131 | OVERRIDE = 0x20000000, |
---|
| 132 | NON_MODAL = 0x10000000, |
---|
| 133 | DOUBLE = 0x08000000 |
---|
| 134 | }; |
---|
| 135 | static const char* xclass_; |
---|
| 136 | void _Window(); // constructor innards |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | #endif |
---|
| 142 | |
---|
| 143 | // |
---|
| 144 | // End of "$Id: Window.h 4242 2005-04-06 06:59:36Z spitzak $". |
---|
| 145 | // |
---|