FLTK 1.3.0
Fl_Group.H
1 //
2 // "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $"
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; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 // http://www.fltk.org/str.php
26 //
27 
28 /* \file
29  Fl_Group, Fl_End classes . */
30 
31 #ifndef Fl_Group_H
32 #define Fl_Group_H
33 
34 #ifndef Fl_Widget_H
35 #include "Fl_Widget.H"
36 #endif
37 
45 class FL_EXPORT Fl_Group : public Fl_Widget {
46 
47  Fl_Widget** array_;
48  Fl_Widget* savedfocus_;
49  Fl_Widget* resizable_;
50  int children_;
51  int *sizes_; // remembered initial sizes of children
52 
53  int navigation(int);
54  static Fl_Group *current_;
55 
56  // unimplemented copy ctor and assignment operator
57  Fl_Group(const Fl_Group&);
58  Fl_Group& operator=(const Fl_Group&);
59 
60 protected:
61  void draw();
62  void draw_child(Fl_Widget& widget) const;
63  void draw_children();
64  void draw_outside_label(const Fl_Widget& widget) const ;
65  void update_child(Fl_Widget& widget) const;
66  int *sizes();
67 
68 public:
69 
70  int handle(int);
71  void begin();
72  void end();
73  static Fl_Group *current();
74  static void current(Fl_Group *g);
75 
79  int children() const {return children_;}
83  Fl_Widget* child(int n) const {return array()[n];}
84  int find(const Fl_Widget*) const;
88  int find(const Fl_Widget& o) const {return find(&o);}
89  Fl_Widget* const* array() const;
90 
91  void resize(int,int,int,int);
96  Fl_Group(int,int,int,int, const char * = 0);
97  virtual ~Fl_Group();
98  void add(Fl_Widget&);
102  void add(Fl_Widget* o) {add(*o);}
103  void insert(Fl_Widget&, int i);
108  void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
109  void remove(int index);
110  void remove(Fl_Widget&);
115  void remove(Fl_Widget* o) {remove(*o);}
116  void clear();
117 
121  void resizable(Fl_Widget& o) {resizable_ = &o;}
150  void resizable(Fl_Widget* o) {resizable_ = o;}
154  Fl_Widget* resizable() const {return resizable_;}
158  void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
159  void init_sizes();
160 
170  void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
178  unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
179 
180  // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
181  virtual Fl_Group* as_group() { return this; }
182 
183  // back compatibility functions:
184 
190  void focus(Fl_Widget* W) {W->take_focus();}
191 
193  Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
194 
196  void forms_end();
197 };
198 
199 // dummy class used to end child groups in constructors for complex
200 // subclasses of Fl_Group:
220 class FL_EXPORT Fl_End {
221 public:
224 };
225 
226 #endif
227 
228 //
229 // End of "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $".
230 //