File: Fl_Group.html

package info (click to toggle)
fltk1.1 1.1.7-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,204 kB
  • ctags: 13,317
  • sloc: cpp: 67,103; ansic: 39,395; makefile: 1,619; sh: 412
file content (172 lines) | stat: -rw-r--r-- 7,617 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<HTML><BODY>
<!-- NEW PAGE -->
<H2><A name=Fl_Group>class Fl_Group</A></H2>
<HR>
<H3>Class Hierarchy</H3>
<UL>
<PRE>
<A href=Fl_Widget.html#Fl_Widget>Fl_Widget</A>
   |
   +----<B>Fl_Group</B>
           |
           +----<A href=Fl_Pack.html#Fl_Pack>Fl_Pack</A>, <A href=Fl_Scroll.html#Fl_Scroll>Fl_Scroll</A>, <A href=Fl_Tabs.html#Fl_Tabs>Fl_Tabs</A>, <A href=Fl_Tile.html#Fl_Tile>Fl_Tile</A>, <A href=Fl_Window.html#Fl_Window>Fl_Window</A>
</PRE>
</UL>
<H3>Include Files</H3>
<UL>
<PRE>
#include &lt;FL/Fl_Group.H&gt;
</PRE>
</UL>
<H3>Description</H3>
 The <TT>Fl_Group</TT> class is the FLTK container widget. It maintains
an array of child widgets. These children can themselves be any widget
including <TT>Fl_Group</TT>. The most important subclass of <TT>Fl_Group</TT>
 is <A href=Fl_Window.html#Fl_Window><TT>Fl_Window</TT></A>, however
groups can also be used to control radio buttons or to enforce resize
behavior.
<H3>Methods</H3>
<CENTER>
<TABLE width=90% summary="Fl_Group methods.">
<TR><TD align=left valign=top>
<UL>
<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>
</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>
</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.current>current</A></LI>
</UL>
</TD><TD align=left valign=top>
<UL>
<LI><A href=#Fl_Group.end>end</A></LI>
<LI><A href=#Fl_Group.find>find</A></LI>
<LI><A href=#Fl_Group.init_sizes>init_sizes</A></LI>
</UL>
</TD><TD align=left valign=top>
<UL>
<LI><A href=#Fl_Group.insert>insert</A></LI>
<LI><A href=#Fl_Group.remove>remove</A></LI>
<LI><A href=#Fl_Group.resizable>resizable</A></LI>
</UL>
</TD></TR>
</TABLE>
</CENTER>
<H4><A name=Fl_Group.Fl_Group>Fl_Group::Fl_Group(int x, int y, int w,
int h, const char *label = 0)</A></H4>
 Creates a new <TT>Fl_Group</TT> widget using the given position, size,
and label string. The default boxtype is <TT>FL_NO_BOX</TT>.
<H4><A name=Fl_Group.~Fl_Group>virtual Fl_Group::~Fl_Group()</A></H4>
 The destructor <I>also deletes all the children</I>. This allows a
whole tree to be deleted at once, without having to keep a pointer to
all the children in the user code. A kludge has been done so the <TT>
Fl_Group</TT> and all of it's children can be automatic (local)
variables, but you must declare the <TT>Fl_Group</TT> <I>first</I>, so
that it is destroyed last.
<H4><A name=Fl_Group.add>void Fl_Group::add(Fl_Widget &amp;w)
<BR> void Fl_Group::add(Fl_Widget *w)</A></H4>

The widget is removed from it's current group (if any) and then added
to the end of this group.

<H4><A name="Fl_Group.clear">void Fl_Group::clear()</A></H4>

<p>The <tt>clear()</tt> method deletes all child widgets from
memory recursively.</p>

<p>This method differs from the <a
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.init_sizes">void Fl_Group::init_sizes()</A></H4>

The <TT>Fl_Group</TT> widget keeps track of the original widget sizes and
positions when resizing occurs so that if you resize a window back to its
original size the widgets will be in the correct places. If you rearrange
the widgets in your group, call this method to register the new arrangement
with the <TT>Fl_Group</TT> that contains them.

<H4><A name=Fl_Group.insert>void Fl_Group::insert(Fl_Widget &amp;w, int n)</A></H4>

The widget is removed from it's current group (if any) and then
inserted into this group. It is put at index <TT>n</TT> (or at the end
if <tt>n &gt;= children()</tt>.  This can also be used to rearrange
the widgets inside a group.

<H4>void Fl_Group::insert(Fl_Widget &amp;w, Fl_Widget* beforethis)</H4>

This does <tt>insert(w, find(beforethis))</tt>.  This will append the
widget if <tt>beforethis</tt> is not in the group.

<H4><A name=Fl_Group.remove>void Fl_Group::remove(Fl_Widget &amp;w)</A></H4>

<p>Removes a widget from the group but does not delete it. This
method does nothing if the widget is not a child of the
group.</p>

<p>This method differs from the <a
href='#Fl_Group.clear'><tt>clear()</tt></a> method in that it
only affects a single widget and does not delete it from
memory.</p>

<H4><A name=Fl_Group.current>static Fl_Group *Fl_Group::current()
<BR> static void Fl_Group::current(Fl_Group *w)</A></H4>
<TT>current()</TT> returns the currently active group.  The Fl_Widget
 constructor automatically does <tt>current()->add(widget)</tt> if this is not null.
 To prevent new widgets from being added to a group, call <TT>Fl_Group::current(0)</TT>.
<H4><A name=Fl_Group.begin>void Fl_Group::begin()</A></H4>
<TT>begin()</TT> sets the current group so you can build the widget
tree by just constructing the widgets. <TT>begin()</TT> is
automatically called by the constructor for Fl_Group (and thus for
Fl_Window as well). <TT>begin()</TT> <i>is exactly the same as</i> <TT>current(this)</TT>.
<P><I>Don't forget to <TT>end()</TT> the group or window!</I></P>
<H4><A name=Fl_Group.end>void Fl_Group::end()</A></H4>
<TT>end()</TT> <i>is exactly the same as</i> <TT>current(this-&gt;parent())</TT>. Any new widgets
added to the widget tree will be added to the parent of the group.
<H4><A name=Fl_Group.array>const Fl_Widget **Fl_Group::array() const</A></H4>
 Returns a pointer to the array of children. <I>This pointer is only
 valid until the next time a child is added or removed.</I>
<H4><A name=Fl_Group.child>Fl_Widget *Fl_Group::child(int n) const</A></H4>
 Returns <tt>array()[n]</tt>.  <i>No range checking is done!</i>
<H4><A name=Fl_Group.children>int Fl_Group::children() const</A></H4>
 Returns how many child widgets the group has.
<H4><A name=Fl_Group.find>int Fl_Group::find(const Fl_Widget *w) const
<BR> int Fl_Group::find(const Fl_Widget &amp;w) const</A></H4>
 Searches the child array for the widget and returns the index. Returns <A
href=#Fl_Group.children><TT>children()</TT></A> if the widget is <TT>
NULL</TT> or not found.
<H4><A name=Fl_Group.resizable>void Fl_Group::resizable(Fl_Widget *box)
<BR> void Fl_Group::resizable(Fl_Widget &amp;box)
<BR> Fl_Widget *Fl_Group::resizable() const</A></H4>
 The resizable widget defines the resizing box for the group. When the
group is resized it calculates a new size and position for all of its
children. Widgets that are horizontally or vertically inside the
dimensions of the box are scaled to the new size. Widgets outside the
box are moved.
<P>In these examples the gray area is the resizable:
<BR></P>
<P align=center><IMG align=TOP SRC="resizebox1.gif" ALT="Resizeable groups">&nbsp;&nbsp;
<IMG align=TOP SRC="resizebox2.gif" ALT="Resizeable groups"></P>
<P>The resizable may be set to the group itself (this is the default
value for an <TT>Fl_Group</TT>, although <TT>NULL</TT> is the default
for an <TT>Fl_Window</TT>), in which case all the contents are resized.
If the resizable is <TT>NULL</TT> then all widgets remain a fixed size
and distance from the top-left corner. </P>
<P>It is possible to achieve any type of resize behavior by using an
invisible <TT>Fl_Box</TT> as the resizable and/or by using a hierarchy
of child <TT>Fl_Group</TT>'s. </P>

<H4><A name=Fl_Group.add_resizable>Fl_Group
&amp;Fl_Group::add_resizable(Fl_Widget &amp;box)</A></H4>
 Adds a widget to the group and makes it the resizable widget.
</BODY></HTML>