FLTK 1.3.0
|
00001 // 00002 // "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $" 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; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 /* \file 00029 Fl_Group, Fl_End classes . */ 00030 00031 #ifndef Fl_Group_H 00032 #define Fl_Group_H 00033 00034 #ifndef Fl_Widget_H 00035 #include "Fl_Widget.H" 00036 #endif 00037 00045 class FL_EXPORT Fl_Group : public Fl_Widget { 00046 00047 Fl_Widget** array_; 00048 Fl_Widget* savedfocus_; 00049 Fl_Widget* resizable_; 00050 int children_; 00051 int *sizes_; // remembered initial sizes of children 00052 00053 int navigation(int); 00054 static Fl_Group *current_; 00055 00056 // unimplemented copy ctor and assignment operator 00057 Fl_Group(const Fl_Group&); 00058 Fl_Group& operator=(const Fl_Group&); 00059 00060 protected: 00061 void draw(); 00062 void draw_child(Fl_Widget& widget) const; 00063 void draw_children(); 00064 void draw_outside_label(const Fl_Widget& widget) const ; 00065 void update_child(Fl_Widget& widget) const; 00066 int *sizes(); 00067 00068 public: 00069 00070 int handle(int); 00071 void begin(); 00072 void end(); 00073 static Fl_Group *current(); 00074 static void current(Fl_Group *g); 00075 00079 int children() const {return children_;} 00083 Fl_Widget* child(int n) const {return array()[n];} 00084 int find(const Fl_Widget*) const; 00088 int find(const Fl_Widget& o) const {return find(&o);} 00089 Fl_Widget* const* array() const; 00090 00091 void resize(int,int,int,int); 00096 Fl_Group(int,int,int,int, const char * = 0); 00097 virtual ~Fl_Group(); 00098 void add(Fl_Widget&); 00102 void add(Fl_Widget* o) {add(*o);} 00103 void insert(Fl_Widget&, int i); 00108 void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));} 00109 void remove(int index); 00110 void remove(Fl_Widget&); 00115 void remove(Fl_Widget* o) {remove(*o);} 00116 void clear(); 00117 00121 void resizable(Fl_Widget& o) {resizable_ = &o;} 00150 void resizable(Fl_Widget* o) {resizable_ = o;} 00154 Fl_Widget* resizable() const {return resizable_;} 00158 void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);} 00159 void init_sizes(); 00160 00170 void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); } 00178 unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; } 00179 00180 // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. 00181 virtual Fl_Group* as_group() { return this; } 00182 00183 // back compatibility functions: 00184 00190 void focus(Fl_Widget* W) {W->take_focus();} 00191 00193 Fl_Widget* & _ddfdesign_kludge() {return resizable_;} 00194 00196 void forms_end(); 00197 }; 00198 00199 // dummy class used to end child groups in constructors for complex 00200 // subclasses of Fl_Group: 00220 class FL_EXPORT Fl_End { 00221 public: 00223 Fl_End() {Fl_Group::current()->end();} 00224 }; 00225 00226 #endif 00227 00228 // 00229 // End of "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $". 00230 //