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-2010 by Bill Spitzak and others.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00027 
00028 /* \file
00029    Fl_Window widget . */
00030 
00031 #ifndef Fl_Window_H
00032 #define Fl_Window_H
00033 
00034 #include "Fl_Group.H"
00035 
00036 #define FL_WINDOW 0xF0          ///< window type id all subclasses have type() >= this
00037 #define FL_DOUBLE_WINDOW 0xF1   ///< double window type id
00038 
00039 class Fl_X;
00040 
00058 class FL_EXPORT Fl_Window : public Fl_Group {
00059 
00060   static char *default_xclass_;
00061 
00062   friend class Fl_X;
00063   Fl_X *i; // points at the system-specific stuff
00064 
00065   const char* iconlabel_;
00066   char* xclass_;
00067   const void* icon_;
00068   // size_range stuff:
00069   int minw, minh, maxw, maxh;
00070   int dw, dh, aspect;
00071   uchar size_range_set;
00072   // cursor stuff
00073   Fl_Cursor cursor_default;
00074   Fl_Color cursor_fg, cursor_bg;
00075   void size_range_();
00076   void _Fl_Window(); // constructor innards
00077 
00078   // unimplemented copy ctor and assignment operator
00079   Fl_Window(const Fl_Window&);
00080   Fl_Window& operator=(const Fl_Window&);
00081 
00082 protected:
00083 
00085   static Fl_Window *current_;
00086   virtual void draw();
00088   virtual void flush();
00089 
00098   void force_position(int force) {
00099     if (force) set_flag(FORCE_POSITION);
00100     else clear_flag(FORCE_POSITION);
00101   }
00110   int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
00111 
00112 public:
00113 
00142     Fl_Window(int w, int h, const char* title= 0);
00147     Fl_Window(int x, int y, int w, int h, const char* title = 0);
00156     virtual ~Fl_Window();
00157 
00158   virtual int handle(int);
00159 
00176   virtual void resize(int,int,int,int);
00184   void border(int b);
00189   void clear_border()   {set_flag(NOBORDER);}
00191   unsigned int border() const   {return !(flags() & NOBORDER);}
00193   void set_override()   {set_flag(NOBORDER|OVERRIDE);}
00195   unsigned int override() const  { return flags()&OVERRIDE; }
00204   void set_modal()      {set_flag(MODAL);}
00206   unsigned int modal() const    {return flags() & MODAL;}
00213   void set_non_modal()  {set_flag(NON_MODAL);}
00215   unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
00216 
00230   void set_menu_window()        {set_flag(MENU_WINDOW);}
00231 
00233   unsigned int menu_window() const {return flags() & MENU_WINDOW;}
00234 
00251   void set_tooltip_window()     { set_flag(TOOLTIP_WINDOW);
00252                                   clear_flag(MENU_WINDOW); }
00254   unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
00255 
00263   void hotspot(int x, int y, int offscreen = 0);
00265   void hotspot(const Fl_Widget*, int offscreen = 0);
00267   void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
00268 
00277   void free_position()  {clear_flag(FORCE_POSITION);}
00314   void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
00315     minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
00316 
00318   const char* label() const     {return Fl_Widget::label();}
00320   const char* iconlabel() const {return iconlabel_;}
00322   void label(const char*);
00324   void iconlabel(const char*);
00326   void label(const char* label, const char* iconlabel); // platform dependent
00327   void copy_label(const char* a);
00328 
00329   static void default_xclass(const char*);
00330   static const char *default_xclass();
00331   const char* xclass() const;
00332   void xclass(const char* c);
00333   const void* icon() const;
00334   void icon(const void * ic);
00335 
00341   int shown() {return i != 0;}
00357   virtual void show();
00362   virtual void hide();
00383   void show(int argc, char **argv);
00389   void fullscreen();
00394   void fullscreen_off(int,int,int,int);
00410   void iconize();
00411 
00412   int x_root() const ;
00413   int y_root() const ;
00414 
00415  static Fl_Window *current();
00425   void make_current();
00426 
00427   // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
00428   virtual Fl_Window* as_window() { return this; }
00429 
00443   void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
00444   void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
00445   static void default_callback(Fl_Window*, void* v);
00446 
00447 };
00448 
00449 #endif
00450 
00451 //
00452 // End of "$Id$".
00453 //