Author: mike
Date: 2007-12-15 08:42:00 -0800 (Sat, 15 Dec 2007)
New Revision: 5993
Log:
Add clip_children() method (STR #1844)
Modified:
branches/branch-1.1/FL/Fl_Group.H
branches/branch-1.1/documentation/Fl_Group.html
branches/branch-1.1/src/Fl_Group.cxx
Modified: branches/branch-1.1/FL/Fl_Group.H
===================================================================
--- branches/branch-1.1/FL/Fl_Group.H 2007-12-15 16:20:16 UTC (rev 5992)
+++ branches/branch-1.1/FL/Fl_Group.H 2007-12-15 16:42:00 UTC (rev 5993)
@@ -48,7 +48,11 @@
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;
void draw_children();
Modified: branches/branch-1.1/documentation/Fl_Group.html
===================================================================
--- branches/branch-1.1/documentation/Fl_Group.html 2007-12-15 16:20:16 UTC
(rev 5992)
+++ branches/branch-1.1/documentation/Fl_Group.html 2007-12-15 16:42:00 UTC
(rev 5993)
@@ -39,18 +39,19 @@
<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 @@
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
Modified: branches/branch-1.1/src/Fl_Group.cxx
===================================================================
--- branches/branch-1.1/src/Fl_Group.cxx 2007-12-15 16:20:16 UTC (rev
5992)
+++ branches/branch-1.1/src/Fl_Group.cxx 2007-12-15 16:42:00 UTC (rev
5993)
@@ -536,6 +536,9 @@
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 @@
} 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() {
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit