diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
| commit | f9039b2ae21988783feae9b362818e7923e82d14 (patch) | |
| tree | 6d6fe3679d73448758f9794e7d4d4f6b22a4adad /FL/Fl_Group.H | |
| parent | 67e89232f9ba067825a158734a09e0fa21aacbe3 (diff) | |
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Group.H')
| -rw-r--r-- | FL/Fl_Group.H | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/FL/Fl_Group.H b/FL/Fl_Group.H new file mode 100644 index 000000000..c64af5312 --- /dev/null +++ b/FL/Fl_Group.H @@ -0,0 +1,73 @@ +// Fl_Group.H + +#ifndef Fl_Group_H +#define Fl_Group_H + +#ifndef Fl_Widget_H +#include "Fl_Widget.H" +#endif + +class Fl_Group : public Fl_Widget { + + Fl_Widget** array_; + Fl_Widget* savedfocus_; + Fl_Widget* resizable_; + int children_; + short *sizes_; // remembered initial sizes of children + + int navigation(int = 0); + static Fl_Group *current_; + +protected: + + void draw(); + int handle(int); + void draw_child(Fl_Widget&) const; + void update_child(Fl_Widget&) const; + void draw_outside_label(const Fl_Widget&) const ; + short* sizes(); + +public: + + void begin() {current_ = this;} + void end() {current_ = (Fl_Group*)parent();} + static Fl_Group *current() {return current_;} + static void current(Fl_Group *g) {current_ = g;} + + int children() const {return children_;} + Fl_Widget* child(int n) const {return array()[n];} + int find(const Fl_Widget*) const; + int find(const Fl_Widget& o) const {return find(&o);} + Fl_Widget* const* array() const; + + void resize(int,int,int,int); + Fl_Group(int,int,int,int, const char * = 0); + virtual ~Fl_Group(); + void add(Fl_Widget&); + void add(Fl_Widget* o) {add(*o);} + void insert(Fl_Widget&, int i); + void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));} + void remove(Fl_Widget&); + void remove(Fl_Widget* o) {remove(*o);} + void clear(); + + void resizable(Fl_Widget& o) {resizable_ = &o;} + void resizable(Fl_Widget* o) {resizable_ = o;} + Fl_Widget* resizable() const {return resizable_;} + void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);} + void init_sizes(); + + // back compatability function: + void focus(Fl_Widget* o) {o->take_focus();} + Fl_Widget* & _ddfdesign_kludge() {return resizable_;} + void forms_end(); +}; + +// dummy class used to end child groups in constructors for complex +// subclasses of Fl_Group: +class Fl_End { +public: + Fl_End() {Fl_Group::current()->end();} +}; + +#endif |
