00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00022 #ifndef Fl_Window_H
00023 #define Fl_Window_H
00024
00025 #ifdef WIN32
00026 #include <windows.h>
00027 #endif
00028
00029 #include "Fl_Group.H"
00030 #include "Fl_Bitmap.H"
00031 #include <stdlib.h>
00032
00033 #define FL_WINDOW 0xF0
00034 #define FL_DOUBLE_WINDOW 0xF1
00035
00036 class Fl_X;
00037 class Fl_RGB_Image;
00038
00039
00057 class FL_EXPORT Fl_Window : public Fl_Group {
00058
00059 static char *default_xclass_;
00060
00061
00062
00063 #if FLTK_ABI_VERSION < 10301
00064 static
00065 #endif
00066 int no_fullscreen_x;
00067 #if FLTK_ABI_VERSION < 10301
00068 static
00069 #endif
00070 int no_fullscreen_y;
00071 #if FLTK_ABI_VERSION < 10301
00072 static
00073 #endif
00074 int no_fullscreen_w;
00075 #if FLTK_ABI_VERSION < 10301
00076 static
00077 #endif
00078 int no_fullscreen_h;
00079 #if FLTK_ABI_VERSION < 10303
00080 static
00081 #endif
00082 int fullscreen_screen_top;
00083 #if FLTK_ABI_VERSION < 10303
00084 static
00085 #endif
00086 int fullscreen_screen_bottom;
00087 #if FLTK_ABI_VERSION < 10303
00088 static
00089 #endif
00090 int fullscreen_screen_left;
00091 #if FLTK_ABI_VERSION < 10303
00092 static
00093 #endif
00094 int fullscreen_screen_right;
00095
00096 friend class Fl_X;
00097 Fl_X *i;
00098
00099 struct icon_data {
00100 const void *legacy_icon;
00101 Fl_RGB_Image **icons;
00102 int count;
00103 #ifdef WIN32
00104 HICON big_icon;
00105 HICON small_icon;
00106 #endif
00107 };
00108
00109 const char* iconlabel_;
00110 char* xclass_;
00111 struct icon_data *icon_;
00112
00113 int minw, minh, maxw, maxh;
00114 int dw, dh, aspect;
00115 uchar size_range_set;
00116
00117 Fl_Cursor cursor_default;
00118 #if FLTK_ABI_VERSION < 10303
00119
00120 Fl_Color cursor_fg, cursor_bg;
00121 #endif
00122
00123 protected:
00125 struct shape_data_type {
00126 int lw_;
00127 int lh_;
00128 Fl_Image* shape_;
00129 #if defined(__APPLE__)
00130 typedef struct CGImage* CGImageRef;
00131 CGImageRef mask;
00132 #endif
00133 Fl_Bitmap *todelete_;
00134 };
00135
00136 #if FLTK_ABI_VERSION < 10303 && !defined(FL_DOXYGEN)
00137 static
00138 #endif
00139 shape_data_type *shape_data_;
00140 private:
00141 void shape_bitmap_(Fl_Image* b);
00142 void shape_alpha_(Fl_Image* img, int offset);
00143 void shape_pixmap_(Fl_Image* pixmap);
00144 public:
00145 void shape(const Fl_Image* img);
00149 inline void shape(const Fl_Image& b) { shape(&b); }
00150 #if ! (defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN))
00151 void combine_mask(void);
00152 #endif
00153 private:
00154
00155
00156 void size_range_();
00157 void _Fl_Window();
00158 void fullscreen_x();
00159 void fullscreen_off_x(int X, int Y, int W, int H);
00160
00161
00162 Fl_Window(const Fl_Window&);
00163 Fl_Window& operator=(const Fl_Window&);
00164
00165 protected:
00166
00168 static Fl_Window *current_;
00169 virtual void draw();
00171 virtual void flush();
00172
00181 void force_position(int force) {
00182 if (force) set_flag(FORCE_POSITION);
00183 else clear_flag(FORCE_POSITION);
00184 }
00193 int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
00194
00195 void free_icons();
00196
00197 public:
00198
00227 Fl_Window(int w, int h, const char* title= 0);
00232 Fl_Window(int x, int y, int w, int h, const char* title = 0);
00241 virtual ~Fl_Window();
00242
00243 virtual int handle(int);
00244
00261 virtual void resize(int X,int Y,int W,int H);
00269 void border(int b);
00274 void clear_border() {set_flag(NOBORDER);}
00276 unsigned int border() const {return !(flags() & NOBORDER);}
00278 void set_override() {set_flag(NOBORDER|OVERRIDE);}
00280 unsigned int override() const { return flags()&OVERRIDE; }
00289 void set_modal() {set_flag(MODAL);}
00291 unsigned int modal() const {return flags() & MODAL;}
00298 void set_non_modal() {set_flag(NON_MODAL);}
00300 unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
00301
00339 void clear_modal_states() {clear_flag(NON_MODAL | MODAL);}
00340
00354 void set_menu_window() {set_flag(MENU_WINDOW);}
00355
00357 unsigned int menu_window() const {return flags() & MENU_WINDOW;}
00358
00375 void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
00376 clear_flag(MENU_WINDOW); }
00378 unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
00379
00387 void hotspot(int x, int y, int offscreen = 0);
00389 void hotspot(const Fl_Widget*, int offscreen = 0);
00391 void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
00392
00401 void free_position() {clear_flag(FORCE_POSITION);}
00438 void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0) {
00439 this->minw = minw;
00440 this->minh = minh;
00441 this->maxw = maxw;
00442 this->maxh = maxh;
00443 this->dw = dw;
00444 this->dh = dh;
00445 this->aspect = aspect;
00446 size_range_();
00447 }
00448
00450 const char* label() const {return Fl_Widget::label();}
00452 const char* iconlabel() const {return iconlabel_;}
00454 void label(const char*);
00456 void iconlabel(const char*);
00458 void label(const char* label, const char* iconlabel);
00459 void copy_label(const char* a);
00460
00461 static void default_xclass(const char*);
00462 static const char *default_xclass();
00463 const char* xclass() const;
00464 void xclass(const char* c);
00465
00466 static void default_icon(const Fl_RGB_Image*);
00467 static void default_icons(const Fl_RGB_Image*[], int);
00468 void icon(const Fl_RGB_Image*);
00469 void icons(const Fl_RGB_Image*[], int);
00470
00471 #ifdef WIN32
00472 static void default_icons(HICON big_icon, HICON small_icon);
00473 void icons(HICON big_icon, HICON small_icon);
00474 #endif
00475
00476
00477 const void* icon() const;
00478 void icon(const void * ic);
00479
00485 int shown() {return i != 0;}
00512 virtual void show();
00517 virtual void hide();
00538 void show(int argc, char **argv);
00539
00540
00541 void wait_for_expose();
00542
00554 void fullscreen();
00558 void fullscreen_off();
00563 void fullscreen_off(int X,int Y,int W,int H);
00567 unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
00578 void fullscreen_screens(int top, int bottom, int left, int right);
00594 void iconize();
00595
00596 int x_root() const ;
00597 int y_root() const ;
00598
00599 static Fl_Window *current();
00609 void make_current();
00610
00611
00612 virtual Fl_Window* as_window() { return this; }
00613
00624 void cursor(Fl_Cursor);
00625 void cursor(const Fl_RGB_Image*, int, int);
00626 void default_cursor(Fl_Cursor);
00627
00628
00629 void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
00630 void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
00631
00632 static void default_callback(Fl_Window*, void* v);
00633
00638 int decorated_w();
00644 int decorated_h();
00645
00646 };
00647
00648 #endif
00649
00650
00651
00652