fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Window.H
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Window header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2012 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
22 #ifndef Fl_Window_H
23 #define Fl_Window_H
24 
25 #ifdef WIN32
26 #include <windows.h>
27 #endif
28 
29 #include "Fl_Group.H"
30 #include "Fl_Bitmap.H"
31 #include <stdlib.h>
32 
33 #define FL_WINDOW 0xF0
34 #define FL_DOUBLE_WINDOW 0xF1
35 
36 class Fl_X;
37 class Fl_RGB_Image;
38 
39 
57 class FL_EXPORT Fl_Window : public Fl_Group {
58 
59  static char *default_xclass_;
60  // Note: we must use separate statements for each of the following 8 variables,
61  // with the static attribute, otherwise MS VC++ 2008/2010 complains :-(
62  // AlbrechtS 04/2012
63 #if FLTK_ABI_VERSION < 10301
64  static // when these members are static, ABI compatibility with 1.3.0 is respected
65 #endif
67 #if FLTK_ABI_VERSION < 10301
68  static // when these members are static, ABI compatibility with 1.3.0 is respected
69 #endif
71 #if FLTK_ABI_VERSION < 10301
72  static // when these members are static, ABI compatibility with 1.3.0 is respected
73 #endif
75 #if FLTK_ABI_VERSION < 10301
76  static // when these members are static, ABI compatibility with 1.3.0 is respected
77 #endif
79 #if FLTK_ABI_VERSION < 10303
80  static // when these members are static, ABI compatibility with 1.3.0 is respected
81 #endif
83 #if FLTK_ABI_VERSION < 10303
84  static // when these members are static, ABI compatibility with 1.3.0 is respected
85 #endif
87 #if FLTK_ABI_VERSION < 10303
88  static // when these members are static, ABI compatibility with 1.3.0 is respected
89 #endif
91 #if FLTK_ABI_VERSION < 10303
92  static // when these members are static, ABI compatibility with 1.3.0 is respected
93 #endif
95 
96  friend class Fl_X;
97  Fl_X *i; // points at the system-specific stuff
98 
99  struct icon_data {
100  const void *legacy_icon;
102  int count;
103 #ifdef WIN32
104  HICON big_icon;
105  HICON small_icon;
106 #endif
107  };
108 
109  const char* iconlabel_;
110  char* xclass_;
111  struct icon_data *icon_;
112  // size_range stuff:
113  int minw, minh, maxw, maxh;
114  int dw, dh, aspect;
116  // cursor stuff
118 #if FLTK_ABI_VERSION < 10303
119  // legacy, not used
120  Fl_Color cursor_fg, cursor_bg;
121 #endif
122 
123 protected:
126  int lw_;
127  int lh_;
129 #if defined(__APPLE__)
130  typedef struct CGImage* CGImageRef;
131  CGImageRef mask;
132 #endif
134  };
135 
136 #if FLTK_ABI_VERSION < 10303 && !defined(FL_DOXYGEN)
137  static
138 #endif
140 private:
141  void shape_bitmap_(Fl_Image* b);
142  void shape_alpha_(Fl_Image* img, int offset);
143  void shape_pixmap_(Fl_Image* pixmap);
144 public:
145  void shape(const Fl_Image* img);
149  inline void shape(const Fl_Image& b) { shape(&b); }
150 #if ! (defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN))
151  void combine_mask(void);
152 #endif
153 private:
154 
155 
156  void size_range_();
157  void _Fl_Window(); // constructor innards
158  void fullscreen_x(); // platform-specific part of sending a window to full screen
159  void fullscreen_off_x(int X, int Y, int W, int H);// platform-specific part of leaving full screen
160 
161  // unimplemented copy ctor and assignment operator
162  Fl_Window(const Fl_Window&);
163  Fl_Window& operator=(const Fl_Window&);
164 
165 protected:
166 
169  virtual void draw();
171  virtual void flush();
172 
181  void force_position(int force) {
182  if (force) set_flag(FORCE_POSITION);
183  else clear_flag(FORCE_POSITION);
184  }
193  int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
194 
195  void free_icons();
196 
197 public:
198 
227  Fl_Window(int w, int h, const char* title= 0);
232  Fl_Window(int x, int y, int w, int h, const char* title = 0);
241  virtual ~Fl_Window();
242 
243  virtual int handle(int);
244 
261  virtual void resize(int X,int Y,int W,int H);
269  void border(int b);
274  void clear_border() {set_flag(NOBORDER);}
276  unsigned int border() const {return !(flags() & NOBORDER);}
278  void set_override() {set_flag(NOBORDER|OVERRIDE);}
280  unsigned int override() const { return flags()&OVERRIDE; }
289  void set_modal() {set_flag(MODAL);}
291  unsigned int modal() const {return flags() & MODAL;}
298  void set_non_modal() {set_flag(NON_MODAL);}
300  unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
301 
339  void clear_modal_states() {clear_flag(NON_MODAL | MODAL);}
340 
354  void set_menu_window() {set_flag(MENU_WINDOW);}
355 
357  unsigned int menu_window() const {return flags() & MENU_WINDOW;}
358 
375  void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
376  clear_flag(MENU_WINDOW); }
378  unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
379 
387  void hotspot(int x, int y, int offscreen = 0);
389  void hotspot(const Fl_Widget*, int offscreen = 0);
391  void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
392 
401  void free_position() {clear_flag(FORCE_POSITION);}
438  void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0) {
439  this->minw = minw;
440  this->minh = minh;
441  this->maxw = maxw;
442  this->maxh = maxh;
443  this->dw = dw;
444  this->dh = dh;
445  this->aspect = aspect;
446  size_range_();
447  }
448 
450  const char* label() const {return Fl_Widget::label();}
452  const char* iconlabel() const {return iconlabel_;}
454  void label(const char*);
456  void iconlabel(const char*);
458  void label(const char* label, const char* iconlabel); // platform dependent
459  void copy_label(const char* a);
460 
461  static void default_xclass(const char*);
462  static const char *default_xclass();
463  const char* xclass() const;
464  void xclass(const char* c);
465 
466  static void default_icon(const Fl_RGB_Image*);
467  static void default_icons(const Fl_RGB_Image*[], int);
468  void icon(const Fl_RGB_Image*);
469  void icons(const Fl_RGB_Image*[], int);
470 
471 #ifdef WIN32
472  static void default_icons(HICON big_icon, HICON small_icon);
473  void icons(HICON big_icon, HICON small_icon);
474 #endif
475 
476  /* for legacy compatibility */
477  const void* icon() const;
478  void icon(const void * ic);
479 
485  int shown() {return i != 0;}
512  virtual void show();
517  virtual void hide();
538  void show(int argc, char **argv);
539 
540  // Enables synchronous show(), docs in Fl_Window.cxx
541  void wait_for_expose();
542 
554  void fullscreen();
558  void fullscreen_off();
563  void fullscreen_off(int X,int Y,int W,int H);
567  unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
578  void fullscreen_screens(int top, int bottom, int left, int right);
594  void iconize();
595 
596  int x_root() const ;
597  int y_root() const ;
598 
599  static Fl_Window *current();
609  void make_current();
610 
611  // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
612  virtual Fl_Window* as_window() { return this; }
613 
624  void cursor(Fl_Cursor);
625  void cursor(const Fl_RGB_Image*, int, int);
626  void default_cursor(Fl_Cursor);
627 
628  /* for legacy compatibility */
629  void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
630  void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE);
631 
632  static void default_callback(Fl_Window*, void* v);
633 
638  int decorated_w();
644  int decorated_h();
645 
646 };
647 
648 #endif
649 
650 //
651 // End of "$Id$".
652 //
Fl_Window::minw
int minw
Definition: Fl_Window.H:113
Fl_Widget::OVERRIDE
position window on top (Fl_Window)
Definition: Fl_Widget.H:164
Fl_Bitmap.H
iconlabel
static const char * iconlabel
Definition: fl_ask.cxx:52
Fl_Window::icon_data::icons
Fl_RGB_Image ** icons
Definition: Fl_Window.H:101
Fl_Window::modal
unsigned int modal() const
Definition: Fl_Window.H:291
Fl_Window::set_menu_window
void set_menu_window()
Definition: Fl_Window.H:354
Fl_Widget::MENU_WINDOW
a temporary popup window, dismissed by clicking outside (Fl_Window)
Definition: Fl_Widget.H:168
Fl_Color
unsigned int Fl_Color
Definition: Enumerations.H:934
Fl_Window::shape
void shape(const Fl_Image &b)
Definition: Fl_Window.H:149
Fl_Window::hotspot
void hotspot(const Fl_Widget &p, int offscreen=0)
Definition: Fl_Window.H:391
Fl_Widget::show
virtual void show()
Definition: Fl_Widget.cxx:271
Fl_Window::shape_data_type
Definition: Fl_Window.H:125
Fl_Image
Base class for image caching and drawing.
Definition: Fl_Image.H:55
Fl_Widget::MODAL
a window blocking input to all other winows (Fl_Window)
Definition: Fl_Widget.H:170
FL_WHITE
const Fl_Color FL_WHITE
Definition: Enumerations.H:971
Fl_Window::icon_data::count
int count
Definition: Fl_Window.H:102
Fl_Window::fullscreen_active
unsigned int fullscreen_active() const
Definition: Fl_Window.H:567
Fl_Window::cursor_default
Fl_Cursor cursor_default
Definition: Fl_Window.H:117
Fl_Window::menu_window
unsigned int menu_window() const
Definition: Fl_Window.H:357
Fl_Group::draw
void draw()
Definition: Fl_Group.cxx:738
H
static int H
Definition: Fl_Tooltip.cxx:76
offset
static double offset[5]
Definition: fl_rounded_box.cxx:32
Fl_Widget::set_flag
void set_flag(unsigned int c)
Definition: Fl_Widget.H:149
Fl_Window::border
unsigned int border() const
Definition: Fl_Window.H:276
Fl_Window::no_fullscreen_y
static int no_fullscreen_y
Definition: Fl_Window.H:70
Fl_Widget::TOOLTIP_WINDOW
a temporary popup, transparent to events, and dismissed easily (Fl_Window)
Definition: Fl_Widget.H:169
Fl_Window::set_tooltip_window
void set_tooltip_window()
Definition: Fl_Window.H:375
Fl_Window::icon_data::legacy_icon
const void * legacy_icon
Definition: Fl_Window.H:100
b
long b
Definition: jpegint.h:397
FL_EXPORT
#define FL_EXPORT
Definition: Fl_Export.H:35
Fl_Window::icon_
struct icon_data * icon_
Definition: Fl_Window.H:111
Fl_Window::size_range_set
uchar size_range_set
Definition: Fl_Window.H:115
Fl_Window::force_position
void force_position(int force)
Definition: Fl_Window.H:181
icon
static Fl_Box * icon
Definition: fl_ask.cxx:48
Fl_Window::force_position
int force_position() const
Definition: Fl_Window.H:193
Fl_Bitmap
Definition: Fl_Bitmap.H:33
Fl_Widget::copy_label
void copy_label(const char *new_label)
Definition: Fl_Widget.cxx:324
dw
uchar dw
Definition: fl_boxtype.cxx:286
p
static menustate * p
Definition: Fl_Menu.cxx:606
Fl_Widget::flags
unsigned int flags() const
Definition: Fl_Widget.H:147
Fl_Window::non_modal
unsigned int non_modal() const
Definition: Fl_Window.H:300
Fl_Window::set_modal
void set_modal()
Definition: Fl_Window.H:289
Fl_Window::shape_data_type::shape_
Fl_Image * shape_
shape image
Definition: Fl_Window.H:128
Fl_Window::clear_modal_states
void clear_modal_states()
Definition: Fl_Window.H:339
Fl_Window::size_range
void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0)
Definition: Fl_Window.H:438
Fl_Window
Definition: Fl_Window.H:57
Fl_Widget::hide
virtual void hide()
Definition: Fl_Widget.cxx:283
Fl_Window::fullscreen_screen_bottom
static int fullscreen_screen_bottom
Definition: Fl_Window.H:86
pixmap
Fl_Pixmap * pixmap[]
Definition: Fl_Type.cxx:154
Fl_Window::cursor_fg
Fl_Color cursor_fg
Definition: Fl_Window.H:120
CGImageRef
struct CGImage * CGImageRef
Definition: mac.H:43
Fl_Widget
Definition: Fl_Widget.H:101
Fl_Group
Definition: Fl_Group.H:41
Fl_Group::current
static Fl_Group * current()
Definition: Fl_Group.cxx:84
Fl_Window::free_position
void free_position()
Definition: Fl_Window.H:401
Fl_Window::xclass_
char * xclass_
Definition: Fl_Window.H:110
Fl_Window::shape_data_type::lw_
int lw_
width of shape image
Definition: Fl_Window.H:126
Fl_Window::shown
int shown()
Definition: Fl_Window.H:485
Fl_Group::resize
void resize(int, int, int, int)
Definition: Fl_Group.cxx:634
Fl_Widget::label
const char * label() const
Definition: Fl_Widget.H:421
Fl_Group::operator=
Fl_Group & operator=(const Fl_Group &)
Fl_Window::iconlabel_
const char * iconlabel_
Definition: Fl_Window.H:109
Fl_Window::label
const char * label() const
Definition: Fl_Window.H:450
Fl_Window::dw
int dw
Definition: Fl_Window.H:114
Fl_Window::iconlabel
const char * iconlabel() const
Definition: Fl_Window.H:452
Fl_Group::handle
int handle(int)
Definition: Fl_Group.cxx:147
x
int x
Definition: test.c:73
Fl_Widget::default_callback
static void default_callback(Fl_Widget *cb, void *d)
Definition: Fl_Widget.cxx:39
Fl_Window::shape_data_type::todelete_
Fl_Bitmap * todelete_
auxiliary bitmap image
Definition: Fl_Window.H:133
Fl_Window::icon_data
Definition: Fl_Window.H:99
Fl_Group.H
Fl_Window::shape_data_
static shape_data_type * shape_data_
non-null means the window has a non-rectangular shape
Definition: Fl_Window.H:139
Fl_Window::default_xclass_
static char * default_xclass_
Definition: Fl_Window.H:59
Fl_Window::fullscreen_screen_right
static int fullscreen_screen_right
Definition: Fl_Window.H:94
Fl_Window::set_non_modal
void set_non_modal()
Definition: Fl_Window.H:298
y
int y
Definition: test.c:74
Fl_Widget::FULLSCREEN
a fullscreen window (Fl_Window)
Definition: Fl_Widget.H:174
Fl_Window::shape_data_type::lh_
int lh_
height of shape image
Definition: Fl_Window.H:127
Fl_Widget::NOBORDER
don't draw a decoration (Fl_Window)
Definition: Fl_Widget.H:159
Fl_Cursor
Fl_Cursor
Definition: Enumerations.H:1048
Y
static int Y
Definition: Fl_Tooltip.cxx:76
Fl_Window::i
Fl_X * i
Definition: Fl_Window.H:97
Fl_Window::set_override
void set_override()
Definition: Fl_Window.H:278
title
static const char * title
Definition: Fl_arg.cxx:55
Fl_Window::no_fullscreen_w
static int no_fullscreen_w
Definition: Fl_Window.H:74
Fl_Window::fullscreen_screen_left
static int fullscreen_screen_left
Definition: Fl_Window.H:90
Fl_Window::current_
static Fl_Window * current_
Definition: Fl_Window.H:168
uchar
unsigned char uchar
Definition: fl_types.h:30
Fl_Window::as_window
virtual Fl_Window * as_window()
Definition: Fl_Window.H:612
Fl_RGB_Image
Definition: Fl_Image.H:202
dh
uchar dh
Definition: fl_boxtype.cxx:286
Fl_Widget::clear_flag
void clear_flag(unsigned int c)
Definition: Fl_Widget.H:151
Fl_Window::no_fullscreen_x
static int no_fullscreen_x
Definition: Fl_Window.H:66
Fl_Window::no_fullscreen_h
static int no_fullscreen_h
Definition: Fl_Window.H:78
Fl_Window::tooltip_window
unsigned int tooltip_window() const
Definition: Fl_Window.H:378
Fl_Window::clear_border
void clear_border()
Definition: Fl_Window.H:274
Fl_Window::fullscreen_screen_top
static int fullscreen_screen_top
Definition: Fl_Window.H:82