FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 // Group header file for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software. Distribution and use rights are outlined in 00009 // the file "COPYING" which should have been included with this file. If this 00010 // file is missing or damaged, see the license at: 00011 // 00012 // http://www.fltk.org/COPYING.php 00013 // 00014 // Please report all bugs and problems on the following page: 00015 // 00016 // http://www.fltk.org/str.php 00017 // 00018 00019 /* \file 00020 Fl_Group, Fl_End classes . */ 00021 00022 #ifndef Fl_Group_H 00023 #define Fl_Group_H 00024 00025 #ifndef Fl_Widget_H 00026 #include "Fl_Widget.H" 00027 #endif 00028 00036 class FL_EXPORT Fl_Group : public Fl_Widget { 00037 00038 Fl_Widget** array_; 00039 Fl_Widget* savedfocus_; 00040 Fl_Widget* resizable_; 00041 int children_; 00042 int *sizes_; // remembered initial sizes of children 00043 00044 int navigation(int); 00045 static Fl_Group *current_; 00046 00047 // unimplemented copy ctor and assignment operator 00048 Fl_Group(const Fl_Group&); 00049 Fl_Group& operator=(const Fl_Group&); 00050 00051 protected: 00052 void draw(); 00053 void draw_child(Fl_Widget& widget) const; 00054 void draw_children(); 00055 void draw_outside_label(const Fl_Widget& widget) const ; 00056 void update_child(Fl_Widget& widget) const; 00057 int *sizes(); 00058 00059 public: 00060 00061 int handle(int); 00062 void begin(); 00063 void end(); 00064 static Fl_Group *current(); 00065 static void current(Fl_Group *g); 00066 00070 int children() const {return children_;} 00074 Fl_Widget* child(int n) const {return array()[n];} 00075 int find(const Fl_Widget*) const; 00079 int find(const Fl_Widget& o) const {return find(&o);} 00080 Fl_Widget* const* array() const; 00081 00082 void resize(int,int,int,int); 00087 Fl_Group(int,int,int,int, const char * = 0); 00088 virtual ~Fl_Group(); 00089 void add(Fl_Widget&); 00093 void add(Fl_Widget* o) {add(*o);} 00094 void insert(Fl_Widget&, int i); 00099 void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));} 00100 void remove(int index); 00101 void remove(Fl_Widget&); 00106 void remove(Fl_Widget* o) {remove(*o);} 00107 void clear(); 00108 00112 void resizable(Fl_Widget& o) {resizable_ = &o;} 00141 void resizable(Fl_Widget* o) {resizable_ = o;} 00145 Fl_Widget* resizable() const {return resizable_;} 00149 void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);} 00150 void init_sizes(); 00151 00161 void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); } 00169 unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; } 00170 00171 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. 00172 virtual Fl_Group* as_group() { return this; } 00173 00174 // back compatibility functions: 00175 00181 void focus(Fl_Widget* W) {W->take_focus();} 00182 00184 Fl_Widget* & _ddfdesign_kludge() {return resizable_;} 00185 00187 void forms_end(); 00188 }; 00189 00190 // dummy class used to end child groups in constructors for complex 00191 // subclasses of Fl_Group: 00211 class FL_EXPORT Fl_End { 00212 public: 00214 Fl_End() {Fl_Group::current()->end();} 00215 }; 00216 00217 #endif 00218 00219 // 00220 // End of "$Id$". 00221 //