FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Group.H
1 //
2 // "$Id: Fl_Group.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
3 //
4 // Group header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 /* \file
20 Fl_Group, Fl_End classes . */
21
22 #ifndef Fl_Group_H
23 #define Fl_Group_H
24
25 #ifndef Fl_Widget_H
26 #include "Fl_Widget.H"
27 #endif
28
36 class FL_EXPORT Fl_Group : public Fl_Widget {
37
38 Fl_Widget** array_;
39 Fl_Widget* savedfocus_;
40 Fl_Widget* resizable_;
41 int children_;
42 int *sizes_; // remembered initial sizes of children
43
44 int navigation(int);
45 static Fl_Group *current_;
46
47 // unimplemented copy ctor and assignment operator
48 Fl_Group(const Fl_Group&);
49 Fl_Group& operator=(const Fl_Group&);
50
51 protected:
52 void draw();
53 void draw_child(Fl_Widget& widget) const;
54 void draw_children();
55 void draw_outside_label(const Fl_Widget& widget) const ;
56 void update_child(Fl_Widget& widget) const;
57 int *sizes();
58
59 public:
60
61 int handle(int);
62 void begin();
63 void end();
64 static Fl_Group *current();
65 static void current(Fl_Group *g);
66
70 int children() const {return children_;}
74 Fl_Widget* child(int n) const {return array()[n];}
75 int find(const Fl_Widget*) const;
79 int find(const Fl_Widget& o) const {return find(&o);}
80 Fl_Widget* const* array() const;
81
82 void resize(int,int,int,int);
87 Fl_Group(int,int,int,int, const char * = 0);
88 virtual ~Fl_Group();
89 void add(Fl_Widget&);
93 void add(Fl_Widget* o) {add(*o);}
94 void insert(Fl_Widget&, int i);
99 void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
100 void remove(int index);
101 void remove(Fl_Widget&);
106 void remove(Fl_Widget* o) {remove(*o);}
107 void clear();
108
112 void resizable(Fl_Widget& o) {resizable_ = &o;}
141 void resizable(Fl_Widget* o) {resizable_ = o;}
145 Fl_Widget* resizable() const {return resizable_;}
149 void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
150 void init_sizes();
151
161 void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
169 unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
170
171 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
172 virtual Fl_Group* as_group() { return this; }
173
174 // back compatibility functions:
175
181 void focus(Fl_Widget* W) {W->take_focus();}
182
184 Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
185
187 void forms_end();
188 };
189
190 // dummy class used to end child groups in constructors for complex
191 // subclasses of Fl_Group:
211 class FL_EXPORT Fl_End {
212 public:
214 Fl_End() {Fl_Group::current()->end();}
215 };
216
217 #endif
218
219 //
220 // End of "$Id: Fl_Group.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
221 //
Fl_Group::resizable
Fl_Widget * resizable() const
See void Fl_Group::resizable(Fl_Widget *box)
Definition: Fl_Group.H:145
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
Fl_Group::add_resizable
void add_resizable(Fl_Widget &o)
Adds a widget to the group and makes it the resizable widget.
Definition: Fl_Group.H:149
Fl_Widget::handle
virtual int handle(int event)
Handles the specified event.
Definition: Fl_Widget.cxx:97
Fl_Group::find
int find(const Fl_Widget &o) const
See int Fl_Group::find(const Fl_Widget *w) const.
Definition: Fl_Group.H:79
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
Fl_End
This is a dummy class that allows you to end a Fl_Group in a constructor list of a class: ...
Definition: Fl_Group.H:211
Fl_Group::child
Fl_Widget * child(int n) const
Returns array()[n].
Definition: Fl_Group.H:74
Fl_Group::end
void end()
Exactly the same as current(this-&gt;parent()).
Definition: Fl_Group.cxx:75
Fl_Widget::take_focus
int take_focus()
Gives the widget the keyboard focus.
Definition: Fl_Widget.cxx:143
Fl_Group::as_group
virtual Fl_Group * as_group()
Returns an Fl_Group pointer if this widget is an Fl_Group.
Definition: Fl_Group.H:172
Fl_Group::insert
void insert(Fl_Widget &o, Fl_Widget *before)
This does insert(w, find(before)).
Definition: Fl_Group.H:99
Fl_Widget::resize
virtual void resize(int x, int y, int w, int h)
Changes the size or position of the widget.
Definition: Fl_Widget.cxx:131
Fl_Group
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:36
Fl_Widget::clear_flag
void clear_flag(unsigned int c)
Clears a flag in the flags mask.
Definition: Fl_Widget.H:150
Fl_Widget.H
Fl_Widget, Fl_Label classes .
Fl_Group::resizable
void resizable(Fl_Widget &o)
See void Fl_Group::resizable(Fl_Widget *box)
Definition: Fl_Group.H:112
Fl_Group::children
int children() const
Returns how many child widgets the group has.
Definition: Fl_Group.H:70
Fl_Group::clip_children
unsigned int clip_children()
Returns the current clipping mode.
Definition: Fl_Group.H:169
Fl_Group::focus
void focus(Fl_Widget *W)
Definition: Fl_Group.H:181
Fl_Group::add
void add(Fl_Widget *o)
See void Fl_Group::add(Fl_Widget &amp;w)
Definition: Fl_Group.H:93
Fl_Widget::set_flag
void set_flag(unsigned int c)
Sets a flag in the flags mask.
Definition: Fl_Widget.H:148
Fl_End::Fl_End
Fl_End()
All it does is calling Fl_Group::current()-&gt;end()
Definition: Fl_Group.H:214
Fl_Group::clip_children
void clip_children(int c)
Controls whether the group widget clips the drawing of child widgets to its bounding box...
Definition: Fl_Group.H:161
Fl_Widget::flags
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:146
Fl_Group::_ddfdesign_kludge
Fl_Widget *& _ddfdesign_kludge()
This is for forms compatibility only.
Definition: Fl_Group.H:184
Fl_Group::current
static Fl_Group * current()
Returns the currently active group.
Definition: Fl_Group.cxx:84
Fl_Group::resizable
void resizable(Fl_Widget *o)
The resizable widget defines the resizing box for the group.
Definition: Fl_Group.H:141
- © 1998-2012 by Bill Spitzak and others.