FLTK Utility Library and Widget Collection (FLU): Flu_Wrap_Group.h Source File

Main Page | Class Hierarchy | Class List | File List | Class Members

# Flu_Wrap_Group.h

    00001 // $Id: Flu_Wrap_Group.h,v 1.10 2004/01/27 21:44:21 jbryan Exp $
    00002
    00003 /***************************************************************
    00004  *                FLU - FLTK Utility Widgets
    00005  *  Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University
    00006  *
    00007  * This file and its content is protected by a software license.
    00008  * You should have received a copy of this license with this file.
    00009  * If not, please contact the Ohio Supercomputer Center immediately:
    00010  * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212
    00011  *
    00012  ***************************************************************/
    00013
    00014
    00015
    00016 #ifndef _FLU_WRAP_GROUP_H
    00017 #define _FLU_WRAP_GROUP_H
    00018
    00019 /* fltk includes */
    00020 #include <FL/Fl.H>
    00021 #include <FL/fl_draw.H>
    00022 #include <FL/Fl_Group.H>
    00023 #include <FL/Fl_Scrollbar.H>
    00024
    00025 #include "FLU/Flu_Enumerations.h"
    00026
    00028
    00038 class FLU_EXPORT Flu_Wrap_Group : public Fl_Group
    00039 {
    00040
    00041  public:
    00042
    00043   class Scrollbar : public Fl_Scrollbar
    00044     {
    00045     public:
    00046       Scrollbar( int x, int y, int w, int h, const char *l = 0 );
    00047       int handle( int event );
    00048     };
    00049
    00051   Flu_Wrap_Group( int x, int y, int w, int h, const char *l = 0 );
    00052
    00054   Fl_Widget *above( Fl_Widget* w );
    00055
    00057   Fl_Widget *below( Fl_Widget* w );
    00058
    00060   void draw();
    00061
    00063   Fl_Widget *left( Fl_Widget* w );
    00064
    00066   Fl_Widget *next( Fl_Widget* w );
    00067
    00069   inline void offset( int x, int y )
    00070     { _offset[0] = x, _offset[1] = y; redraw(); }
    00071
    00073   inline int offset_x() const
    00074     { return _offset[0]; }
    00075
    00077   inline int offset_y() const
    00078     { return _offset[1]; }
    00079
    00081   Fl_Widget *previous( Fl_Widget* w );
    00082
    00084   void resize( int x, int y, int w, int h );
    00085
    00087   Fl_Widget *right( Fl_Widget* w );
    00088
    00090   void scroll_to( const Fl_Widget *w );
    00091
    00093   inline void scroll_to( const Fl_Widget& w )
    00094     { scroll_to( &w ); }
    00095
    00097   void scroll_to_beginning();
    00098
    00100   void scroll_to_end();
    00101
    00103   inline void spacing( int x, int y )
    00104     { _spacing[0] = x, _spacing[1] = y; redraw(); }
    00105
    00107   inline int spacing_x() const
    00108     { return _spacing[0]; }
    00109
    00111   inline int spacing_y() const
    00112     { return _spacing[1]; }
    00113
    00115   void type( int t );
    00116
    00118   inline int type() const
    00119     { return _type; }
    00120
    00126
    00127   inline Fl_Widget* const* array() const
    00128     { return group.array(); }
    00129
    00130   inline int find( const Fl_Widget* w ) const
    00131     { return group.find( w ); }
    00132
    00133   inline int find( const Fl_Widget& w ) const
    00134     { return group.find( w ); }
    00135
    00136   inline void clear()
    00137     { group.clear(); }
    00138
    00139   inline Fl_Widget *child(int n) const
    00140     { return group.child(n); }
    00141
    00142   inline int children() const
    00143     { return group.children(); }
    00144
    00145   inline void begin()
    00146     { group.begin(); }
    00147
    00148   inline void end()
    00149     { group.end(); Fl_Group::end(); }
    00150
    00151   inline void resizable(Fl_Widget *box)
    00152     { group.resizable(box); }
    00153
    00154   inline void resizable(Fl_Widget &box)
    00155     { group.resizable(box); }
    00156
    00157   inline Fl_Widget *resizable() const
    00158     { return group.resizable(); }
    00159
    00160   inline void add( Fl_Widget &w )
    00161     { group.add( w ); }
    00162
    00163   inline void add( Fl_Widget *w )
    00164     { group.add( w ); }
    00165
    00166   inline void insert( Fl_Widget &w, int n )
    00167     { group.insert( w, n ); }
    00168
    00169   inline void insert( Fl_Widget &w, Fl_Widget* beforethis )
    00170     { group.insert( w, beforethis ); }
    00171
    00172   inline void remove( Fl_Widget &w )
    00173     { group.remove( w ); }
    00174
    00175   inline void add_resizable( Fl_Widget &box )
    00176     { group.add_resizable( box ); }
    00177
    00179
    00180   Scrollbar scrollbar;
    00181   Fl_Group group;
    00182
    00183  protected:
    00184
    00185   inline static void _scrollCB( Fl_Widget*, void *arg )
    00186     { ((Flu_Wrap_Group*)arg)->redraw(); }
    00187
    00188   int layout( bool sbVisible, bool doScrollTo, int *measure = 0 );
    00189
    00190   const Fl_Widget *scrollTo;
    00191   int _offset[2], _spacing[2], _type;
    00192
    00193 };
    00194
    00195 #endif