• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

Fl_Group.H

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 
00041 class FL_EXPORT Fl_Group : public Fl_Widget {
00042 
00043   Fl_Widget** array_;
00044   Fl_Widget* savedfocus_;
00045   Fl_Widget* resizable_;
00046   int children_;
00047   int *sizes_; // remembered initial sizes of children
00048 
00049   int navigation(int);
00050   static Fl_Group *current_;
00051  
00052   // unimplemented copy ctor and assignment operator
00053   Fl_Group(const Fl_Group&);
00054   Fl_Group& operator=(const Fl_Group&);
00055 
00056 protected:
00057   void draw();
00058   void draw_child(Fl_Widget& widget) const;
00059   void draw_children();
00060   void draw_outside_label(const Fl_Widget& widget) const ;
00061   void update_child(Fl_Widget& widget) const;
00062   int  *sizes();
00063 
00064 public:
00065 
00066   int handle(int);
00067   void begin();
00068   void end();
00069   static Fl_Group *current();
00070   static void current(Fl_Group *g);
00071 
00075   int children() const {return children_;}
00079   Fl_Widget* child(int n) const {return array()[n];}
00080   int find(const Fl_Widget*) const;
00084   int find(const Fl_Widget& o) const {return find(&o);}
00085   Fl_Widget* const* array() const;
00086 
00087   void resize(int,int,int,int);
00092   Fl_Group(int,int,int,int, const char * = 0);
00093   virtual ~Fl_Group();
00094   void add(Fl_Widget&);
00098   void add(Fl_Widget* o) {add(*o);}
00099   void insert(Fl_Widget&, int i);
00104   void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
00105   void remove(int index);
00106   void remove(Fl_Widget&);
00111   void remove(Fl_Widget* o) {remove(*o);}
00112   void clear();
00113 
00117   void resizable(Fl_Widget& o) {resizable_ = &o;}
00148   void resizable(Fl_Widget* o) {resizable_ = o;}
00152   Fl_Widget* resizable() const {return resizable_;}
00156   void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
00157   void init_sizes();
00158 
00168   void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
00176   unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
00177 
00178   // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
00179   virtual Fl_Group* as_group() { return this; }
00180 
00181   // back compatibility functions:
00182 
00188   void focus(Fl_Widget* W) {W->take_focus();}
00189 
00191   Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
00192 
00194   void forms_end();
00195 };
00196 
00197 // dummy class used to end child groups in constructors for complex
00198 // subclasses of Fl_Group:
00218 class FL_EXPORT Fl_End {
00219 public:
00221   Fl_End() {Fl_Group::current()->end();}
00222 };
00223 
00224 #endif
00225 
00226 //
00227 // End of "$Id$".
00228 //
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.