diff options
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Shaped_Window.H | 78 | ||||
| -rw-r--r-- | FL/Fl_Window.H | 40 |
2 files changed, 38 insertions, 80 deletions
diff --git a/FL/Fl_Shaped_Window.H b/FL/Fl_Shaped_Window.H deleted file mode 100644 index fb3296fae..000000000 --- a/FL/Fl_Shaped_Window.H +++ /dev/null @@ -1,78 +0,0 @@ -// -// "$Id$" -// -// Fl_Shaped_Window header file for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2014 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// http://www.fltk.org/COPYING.php -// -// Please report all bugs and problems to: -// -// http://www.fltk.org/str.php -// - -#ifndef Fl_Shaped_Window_H -#define Fl_Shaped_Window_H - -#include <FL/Fl_Window.H> -#if defined(__APPLE__) -#include <FL/x.H> -#endif - - -class Fl_Bitmap; -class Fl_Pixmap; - -/** - The Fl_Shaped_Window is an Fl_Window that can take an arbitrary shape (not just a rectangular region). - The window shape is determined by the argument of the Fl_Shaped_Window::shape(const Fl_Image*) - member function. - An Fl_Image of any dimension can be used as mask; it is rescaled to the window's dimension as needed. - - The layout and widgets inside are unaware of the mask shape, and most will act as though the window's - rectangular bounding box is available - to them. It is up to you to make sure they adhere to the bounds of their masking shape. - - On the Mac platform, OS version 10.4 or above is required. - On the unix/linux platform, the SHAPE extension of the X server is required. - - The window borders and caption created by the window system are turned off by default. They - can be re-enabled by calling void Fl_Window::border(1). - - A usage example is found at example/shapedwindow.cxx. - */ -class FL_EXPORT Fl_Shaped_Window : public Fl_Window { -private: - int lw_, lh_; - Fl_Image* shape_; -#if defined(__APPLE__) - CGImageRef mask; -#endif - Fl_Bitmap *todelete_; - void shape_bitmap_(Fl_Bitmap*); - void shape_pixmap_(Fl_Pixmap*); - void shape_alpha_(Fl_RGB_Image* img, int offset); -protected: - virtual void draw(); -public: - Fl_Shaped_Window(int w, int h, const char* l = 0); - Fl_Shaped_Window(int x, int y, int w, int h, const char* l = 0); - ~Fl_Shaped_Window(); - void shape(const Fl_Image*); - /** Set the window's shape with an Fl_Image */ - inline void shape(const Fl_Image& b) { shape(&b); } -#if ! (defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN)) - void combine_mask(void); -#endif -}; - -#endif // Fl_Shaped_Window_H - -// -// End of "$Id$". -// diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index 03c82789e..4020b8a86 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -27,14 +27,16 @@ #endif #include "Fl_Group.H" +#include "Fl_Bitmap.H" +#include <stdlib.h> #define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this #define FL_DOUBLE_WINDOW 0xF1 ///< double window type id -#define FL_SHAPED_WINDOW 0xF2 ///< shaped window type id class Fl_X; class Fl_RGB_Image; + /** This widget produces an actual window. This can either be a main window, with a border and title and all the window management controls, @@ -117,6 +119,40 @@ class FL_EXPORT Fl_Window : public Fl_Group { // legacy, not used Fl_Color cursor_fg, cursor_bg; #endif + +protected: + /** Data supporting a non-rectangular window shape */ + struct shape_data_type { + int lw_; ///< width of shape image + int lh_; ///< height of shape image + Fl_Image* shape_; ///< shape image +#if defined(__APPLE__) + typedef struct CGImage* CGImageRef; + CGImageRef mask; +#endif + Fl_Bitmap *todelete_; ///< auxiliary bitmap image + }; + +#if FLTK_ABI_VERSION < 10303 && !defined(FL_DOXYGEN) + static +#endif + shape_data_type *shape_data_; ///< non-null means the window has a non-rectangular shape +private: + void shape_bitmap_(Fl_Bitmap* b); + void shape_alpha_(Fl_RGB_Image* img, int offset); + void shape_pixmap_(Fl_Pixmap* pixmap); +public: + void shape(const Fl_Image* img); + /** Set the window's shape with an Fl_Image. + \see void shape(const Fl_Image* img) + */ + inline void shape(const Fl_Image& b) { shape(&b); } +#if ! (defined(WIN32) || defined(__APPLE__) || defined(FL_DOXYGEN)) + void combine_mask(void); +#endif +private: + + void size_range_(); void _Fl_Window(); // constructor innards void fullscreen_x(); // platform-specific part of sending a window to full screen @@ -280,7 +316,7 @@ public: /** Returns true if this window is a menu window. */ unsigned int menu_window() const {return flags() & MENU_WINDOW;} - + /** Marks the window as a tooltip window. |
