summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Shaped_Window.H78
-rw-r--r--FL/Fl_Window.H3
2 files changed, 80 insertions, 1 deletions
diff --git a/FL/Fl_Shaped_Window.H b/FL/Fl_Shaped_Window.H
new file mode 100644
index 000000000..af2cefc5a
--- /dev/null
+++ b/FL/Fl_Shaped_Window.H
@@ -0,0 +1,78 @@
+//
+// "$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 92e76676f..03c82789e 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -16,7 +16,7 @@
// http://www.fltk.org/str.php
//
-/* \file
+/** \file
Fl_Window widget . */
#ifndef Fl_Window_H
@@ -30,6 +30,7 @@
#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;