FLTK 1.3.0
Fl_Window.H
00001 //
00002 // "$Id$"
00003 //
00004 // Window header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2012 by Bill Spitzak and others.
00007 //
00008 // This library is free software. Distribution and use rights are outlined in
00009 // the file "COPYING" which should have been included with this file.  If this
00010 // file is missing or damaged, see the license at:
00011 //
00012 //     http://www.fltk.org/COPYING.php
00013 //
00014 // Please report all bugs and problems on the following page:
00015 //
00016 //     http://www.fltk.org/str.php
00017 //
00018 
00019 /* \file
00020    Fl_Window widget . */
00021 
00022 #ifndef Fl_Window_H
00023 #define Fl_Window_H
00024 
00025 #include "Fl_Group.H"
00026 
00027 #define FL_WINDOW 0xF0          ///< window type id all subclasses have type() >= this
00028 #define FL_DOUBLE_WINDOW 0xF1   ///< double window type id
00029 
00030 class Fl_X;
00031 
00049 class FL_EXPORT Fl_Window : public Fl_Group {
00050 
00051   static char *default_xclass_;
00052   // Note: we must use separate statements for each of the following 4 variables,
00053   // with the static attribute, otherwise MS VC++ 2008/2010 complains :-(
00054   // AlbrechtS 04/2012
00055 #if FLTK_ABI_VERSION < 10302
00056   static // when these members are static, ABI compatibility with 1.3.0 is respected
00057 #endif
00058   int no_fullscreen_x;
00059 #if FLTK_ABI_VERSION < 10302
00060   static // when these members are static, ABI compatibility with 1.3.0 is respected
00061 #endif
00062   int no_fullscreen_y;
00063 #if FLTK_ABI_VERSION < 10302
00064   static // when these members are static, ABI compatibility with 1.3.0 is respected
00065 #endif
00066   int no_fullscreen_w;
00067 #if FLTK_ABI_VERSION < 10302
00068   static // when these members are static, ABI compatibility with 1.3.0 is respected
00069 #endif
00070   int no_fullscreen_h;
00071 
00072   friend class Fl_X;
00073   Fl_X *i; // points at the system-specific stuff
00074 
00075   const char* iconlabel_;
00076   char* xclass_;
00077   const void* icon_;
00078   // size_range stuff:
00079   int minw, minh, maxw, maxh;
00080   int dw, dh, aspect;
00081   uchar size_range_set;
00082   // cursor stuff
00083   Fl_Cursor cursor_default;
00084   Fl_Color cursor_fg, cursor_bg;
00085   void size_range_();
00086   void _Fl_Window(); // constructor innards
00087   void fullscreen_x(); // platform-specific part of sending a window to full screen
00088   void fullscreen_off_x(int X, int Y, int W, int H);// platform-specific part of leaving full screen
00089 
00090   // unimplemented copy ctor and assignment operator
00091   Fl_Window(const Fl_Window&);
00092   Fl_Window& operator=(const Fl_Window&);
00093 
00094 protected:
00095 
00097   static Fl_Window *current_;
00098   virtual void draw();
00100   virtual void flush();
00101 
00110   void force_position(int force) {
00111     if (force) set_flag(FORCE_POSITION);
00112     else clear_flag(FORCE_POSITION);
00113   }
00122   int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
00123 
00124 public:
00125 
00154     Fl_Window(int w, int h, const char* title= 0);
00159     Fl_Window(int x, int y, int w, int h, const char* title = 0);
00168     virtual ~Fl_Window();
00169 
00170   virtual int handle(int);
00171 
00188   virtual void resize(int X,int Y,int W,int H);
00196   void border(int b);
00201   void clear_border()   {set_flag(NOBORDER);}
00203   unsigned int border() const   {return !(flags() & NOBORDER);}
00205   void set_override()   {set_flag(NOBORDER|OVERRIDE);}
00207   unsigned int override() const  { return flags()&OVERRIDE; }
00216   void set_modal()      {set_flag(MODAL);}
00218   unsigned int modal() const    {return flags() & MODAL;}
00225   void set_non_modal()  {set_flag(NON_MODAL);}
00227   unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
00228 
00242   void set_menu_window()        {set_flag(MENU_WINDOW);}
00243 
00245   unsigned int menu_window() const {return flags() & MENU_WINDOW;}
00246 
00263   void set_tooltip_window()     { set_flag(TOOLTIP_WINDOW);
00264                                   clear_flag(MENU_WINDOW); }
00266   unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
00267 
00275   void hotspot(int x, int y, int offscreen = 0);
00277   void hotspot(const Fl_Widget*, int offscreen = 0);
00279   void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
00280 
00289   void free_position()  {clear_flag(FORCE_POSITION);}
00326   void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0) {
00327     this->minw   = minw;
00328     this->minh   = minh;
00329     this->maxw   = maxw;
00330     this->maxh   = maxh;
00331     this->dw     = dw;
00332     this->dh     = dh;
00333     this->aspect = aspect;
00334     size_range_();
00335   }
00336 
00338   const char* label() const     {return Fl_Widget::label();}
00340   const char* iconlabel() const {return iconlabel_;}
00342   void label(const char*);
00344   void iconlabel(const char*);
00346   void label(const char* label, const char* iconlabel); // platform dependent
00347   void copy_label(const char* a);
00348 
00349   static void default_xclass(const char*);
00350   static const char *default_xclass();
00351   const char* xclass() const;
00352   void xclass(const char* c);
00353   const void* icon() const;
00354   void icon(const void * ic);
00355 
00361   int shown() {return i != 0;}
00377   virtual void show();
00382   virtual void hide();
00403   void show(int argc, char **argv);
00413   void fullscreen();
00417   void fullscreen_off();
00422   void fullscreen_off(int X,int Y,int W,int H);
00426   unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
00442   void iconize();
00443 
00444   int x_root() const ;
00445   int y_root() const ;
00446 
00447  static Fl_Window *current();
00457   void make_current();
00458 
00459   // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
00460   virtual Fl_Window* as_window() { return this; }
00461 
00475   void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
00476   void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
00477   static void default_callback(Fl_Window*, void* v);
00478   
00483   int decorated_w();
00489   int decorated_h();
00490 
00491 };
00492 
00493 #endif
00494 
00495 //
00496 // End of "$Id$".
00497 //