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

Flu_Collapsable_Group.h

00001 // $Id: Flu_Collapsable_Group.h,v 1.8 2003/09/24 21:13:47 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_COLLAPSABLE_GROUP_H
00017 #define _FLU_COLLAPSABLE_GROUP_H
00018 
00019 #include <stdio.h>
00020 #include <string.h>
00021 
00022 /* fltk includes */
00023 #include <FL/Fl.H>
00024 #include <FL/fl_draw.H>
00025 #include <FL/Fl_Group.H>
00026 #include <FL/Fl_Box.H>
00027 
00028 #include "FLU/FluSimpleString.h"
00029 #include "FLU/Flu_Button.h"
00030 
00032 
00044 class FLU_EXPORT Flu_Collapsable_Group : public Fl_Group
00045 {
00046 
00047  public:
00048 
00050   Flu_Collapsable_Group( int x, int y, int w, int h, const char *l = 0 );
00051 
00053   inline float collapse_time() const
00054     { return _collapseTime; }
00055 
00057   inline void collapse_time( float t )
00058     { _collapseTime = t; }
00059 
00061   inline float frame_rate() const
00062     { return _fps; }
00063 
00065   inline void frame_rate( float f )
00066     { _fps = f; }
00067 
00069 
00070   inline void align( unsigned char a )
00071     { _align = a; }
00072 
00074   inline unsigned char align() const
00075     { return _align; }
00076 
00078   inline void fit( bool b )
00079     { _fit = b; }
00080 
00082   inline bool fit() const
00083     { return _fit; }
00084 
00086   inline bool open() const
00087     { return _open; }
00088 
00090   void open( bool o );
00091 
00093   inline bool closed() const
00094     { return !_open; }
00095 
00097   inline bool changing() const
00098     { return _changing; }
00099 
00101   void resize( int x, int y, int w, int h );
00102 
00104   inline void label( const char *l )
00105     { if( l ) _label = l; else _label = ""; }
00106 
00108   inline const char *label()
00109     { return _label.c_str(); }
00110 
00112 
00118 
00119   inline void clear()
00120     { group.clear(); }
00121 
00122   inline Fl_Widget *child(int n) const
00123     { return group.child(n); }
00124 
00125   inline int children() const
00126     { return group.children(); }
00127 
00128   inline void begin()
00129     { group.begin(); }
00130 
00131   inline void end()
00132     { group.end(); Fl_Group::end(); }
00133 
00134   inline void resizable(Fl_Widget *box)
00135     { group.resizable(box); }
00136 
00137   inline void resizable(Fl_Widget &box) 
00138     { group.resizable(box); }
00139 
00140   inline Fl_Widget *resizable() const
00141     { return group.resizable(); }
00142 
00143   inline void add( Fl_Widget &w )
00144     { group.add( w ); }
00145 
00146   inline void add( Fl_Widget *w )
00147     { group.add( w ); }
00148 
00149   inline void insert( Fl_Widget &w, int n )
00150     { group.insert( w, n ); }
00151 
00152   inline void insert( Fl_Widget &w, Fl_Widget* beforethis )
00153     { group.insert( w, beforethis ); }
00154 
00155   inline void remove( Fl_Widget &w )
00156     { group.remove( w ); }
00157 
00158   inline void add_resizable( Fl_Widget &box )
00159     { group.add_resizable( box ); }
00160 
00162 
00163   Flu_Button button;
00164   Fl_Group group;
00165 
00166  protected:
00167 
00169 
00170   void draw();
00171 
00172   inline static void _collapseCB( Fl_Widget* w, void* arg )
00173     { ((Flu_Collapsable_Group*)arg)->open( !((Flu_Collapsable_Group*)arg)->open() ); }
00174 
00175   inline static void _updateCB( void *arg )
00176     { ((Flu_Collapsable_Group*)arg)->updateCB(); }
00177   void updateCB();
00178 
00179   void (*_callback)(Fl_Widget*,void*);
00180   void *_callbackData;
00181 
00182   void (*_collapseCallback)(void*);
00183   void *_collapseCallbackData;
00184 
00185   int _originalHeight, _newHeight;
00186   float _deltaHeight, _currentHeight, _collapseTime, _timeout, _fps;
00187 
00188   Fl_Widget *_oldResizable;
00189 
00190   bool _open, _changing, _fit;
00191   unsigned char _align;
00192   FluSimpleString _label;
00193 
00194 };
00195 
00196 #endif

Generated on Fri Nov 5 12:41:32 2004 for FLTK Utility Library and Widget Collection (FLU) by doxygen 1.3.5