diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-12-15 16:42:00 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-12-15 16:42:00 +0000 |
| commit | 681e6ae9460864e9dca10aa19495f2f94a326f8d (patch) | |
| tree | 797ed2bbeca7411ea35fde92154be2359b1c00b1 | |
| parent | fe1e8a37eeca9a9c6816fe7c71a782bfe9137ff1 (diff) | |
Add clip_children() method (STR #1844)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5993 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Group.H | 4 | ||||
| -rw-r--r-- | documentation/Fl_Group.html | 17 | ||||
| -rw-r--r-- | src/Fl_Group.cxx | 5 |
3 files changed, 23 insertions, 3 deletions
diff --git a/FL/Fl_Group.H b/FL/Fl_Group.H index 3ede57cfa..ac1ad0876 100644 --- a/FL/Fl_Group.H +++ b/FL/Fl_Group.H @@ -48,6 +48,10 @@ class FL_EXPORT Fl_Group : public Fl_Widget { Fl_Group& operator=(const Fl_Group&); protected: + enum { CLIP_CHILDREN = 2048 }; + + void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); } + int clip_children() { return (flags() & CLIP_CHILDREN) != 0; } void draw(); void draw_child(Fl_Widget&) const; diff --git a/documentation/Fl_Group.html b/documentation/Fl_Group.html index 1dab3a2f0..45dd288ce 100644 --- a/documentation/Fl_Group.html +++ b/documentation/Fl_Group.html @@ -39,18 +39,19 @@ behavior. <LI><A href=#Fl_Group.Fl_Group>Fl_Group</A></LI> <LI><A href=#Fl_Group.~Fl_Group>~Fl_Group</A></LI> <LI><A href=#Fl_Group.add>add</A></LI> +<LI><A href=#Fl_Group.add_resizable>add_resizable</A></LI> </UL> </TD><TD align=left valign=top> <UL> -<LI><A href=#Fl_Group.add_resizable>add_resizable</A></LI> <LI><A href=#Fl_Group.array>array</A></LI> <LI><A href=#Fl_Group.begin>begin</A></LI> +<LI><A href=#Fl_Group.child>child</A></LI> +<LI><A href=#Fl_Group.children>children</A></LI> </UL> </TD><TD align=left valign=top> <UL> -<LI><A href=#Fl_Group.child>child</A></LI> -<LI><A href=#Fl_Group.children>children</A></LI> <LI><A href="#Fl_Group.clear">clear</A></LI> +<LI><A href="#Fl_Group.clip_children">clip_children</A></LI> <LI><A href=#Fl_Group.current>current</A></LI> </UL> </TD><TD align=left valign=top> @@ -94,6 +95,16 @@ memory recursively.</p> href='#Fl_Group.remove'><tt>remove()</tt></a> method in that it affects all child widgets and deletes them from memory.</p> +<H4><A name="Fl_Group.clip_children">void Fl_Group::clip_children(int c);<br> +int Fl_Group::clip_children();</A></H4> + +The first method controls whether the group widget clips the drawing of +child widgets to its bounding box. + +<p>The second method returns the current clipping mode. + +<p>The default is to not clip (0) the drawing of child widgets. + <H4><A name="Fl_Group.init_sizes">void Fl_Group::init_sizes()</A></H4> The <TT>Fl_Group</TT> widget keeps track of the original widget sizes and diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index a9aecf097..f2c2e1e21 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -536,6 +536,9 @@ void Fl_Group::resize(int X, int Y, int W, int H) { void Fl_Group::draw_children() { Fl_Widget*const* a = array(); + + if (clip_children()) fl_push_clip(x(), y(), w(), h()); + if (damage() & ~FL_DAMAGE_CHILD) { // redraw the entire thing: for (int i=children_; i--;) { Fl_Widget& o = **a++; @@ -545,6 +548,8 @@ void Fl_Group::draw_children() { } else { // only redraw the children that need it: for (int i=children_; i--;) update_child(**a++); } + + if (clip_children()) fl_pop_clip(); } void Fl_Group::draw() { |
