Add clip_children() method (STR #1844)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5993 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
fe1e8a37ee
commit
681e6ae946
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user