summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Group.H8
-rw-r--r--FL/Fl_Widget.H16
-rw-r--r--FL/Fl_Window.H8
3 files changed, 32 insertions, 0 deletions
diff --git a/FL/Fl_Group.H b/FL/Fl_Group.H
index 941951cbf..7e1630d0b 100644
--- a/FL/Fl_Group.H
+++ b/FL/Fl_Group.H
@@ -176,6 +176,14 @@ public:
*/
unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
+ /** Returns an Fl_Group pointer if this widget is an Fl_Group.
+
+ \retval NULL if this widget is not derived from Fl_Group.
+ \note This method is provided to avoid dynamic_cast.
+ \todo More documentation ...
+ */
+ virtual Fl_Group* as_group() const { return (Fl_Group*)this; }
+
// back compatibility functions:
/**
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index 94591107e..95351f9f2 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -924,6 +924,22 @@ public:
*/
Fl_Window* window() const ;
+ /** Returns an Fl_Group pointer if this widget is an Fl_Group.
+
+ \retval NULL if this widget is not derived from Fl_Group.
+ \note This method is provided to avoid dynamic_cast.
+ \todo More documentation ...
+ */
+ virtual Fl_Group* as_group() const {return 0;}
+
+ /** Returns an Fl_Window pointer if this widget is an Fl_Window.
+
+ \retval NULL if this widget is not derived from Fl_Window.
+ \note This method is provided to avoid dynamic_cast.
+ \todo More documentation ...
+ */
+ virtual Fl_Window* as_window() const {return 0;}
+
/** For back compatibility only.
\deprecated Use selection_color() instead.
*/
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index 2b7fdf84a..b2430e958 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -415,6 +415,14 @@ public:
*/
void make_current();
+ /** Returns an Fl_Window pointer if this widget is an Fl_Window.
+
+ \retval NULL if this widget is not derived from Fl_Window.
+ \note This method is provided to avoid dynamic_cast.
+ \todo More documentation ...
+ */
+ virtual Fl_Window* as_window() const { return (Fl_Window*)this; }
+
// for back-compatibility only:
/**
Changes the cursor for this window. This always calls the system, if