Flu_Choice_Group.H 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // $Id: Flu_Choice_Group.h,v 1.9 2003/08/20 16:29:40 jbryan Exp $
  2. /***************************************************************
  3. * FLU - FLTK Utility Widgets
  4. * Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University
  5. *
  6. * This file and its content is protected by a software license.
  7. * You should have received a copy of this license with this file.
  8. * If not, please contact the Ohio Supercomputer Center immediately:
  9. * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212
  10. *
  11. ***************************************************************/
  12. #ifndef _FLU_CHOICE_GROUP_H
  13. #define _FLU_CHOICE_GROUP_H
  14. #include <stdio.h>
  15. #include <string.h>
  16. /* fltk includes */
  17. #include <FL/Fl.H>
  18. #include <FL/Fl_Choice.H>
  19. #include <FL/fl_draw.H>
  20. #include <FL/Fl_Group.H>
  21. #include "FLU/Flu_Enumerations.H"
  22. //! This class provides an alternative group to Fl_Tabs. It provides an Fl_Choice menu that is used to determine which child Fl_Group is visible
  23. class FLU_EXPORT Flu_Choice_Group : public Fl_Group
  24. {
  25. public:
  26. //! Default FLTK constructor
  27. Flu_Choice_Group( int x, int y, int w, int h, const char *l = 0 );
  28. //! Get the currently visible child Fl_Group widget
  29. /*! \return \c NULL if there are no child Fl_Groups, else the currently selected group */
  30. inline Fl_Widget* wvalue()
  31. { return selected; }
  32. //! Get the index of the currently visible child Fl_Group widget
  33. /*! \return \c -1 if there are no child Fl_Groups, else the index of the group */
  34. int value();
  35. //! Set the currently visible child Fl_Group widget
  36. /*! \return the index of the child Fl_Group widget that is currently selected, or \c -1 if \b newvalue cannot be found. */
  37. int value( Fl_Widget *newvalue );
  38. //! Set the currently visible child Fl_Group widget
  39. void value( int v );
  40. //! Override of Fl_Group::draw()
  41. void draw();
  42. //! \return the number of entries able to be selected with value(int)
  43. inline int size()
  44. { return children()-1; }
  45. DECLARE_CLASS_CHEAP_RTTI_2(Flu_Choice_Group, Fl_Group)
  46. protected:
  47. static void _choiceCB( Fl_Widget *w, void *arg )
  48. { ((Flu_Choice_Group*)arg)->choiceCB(); }
  49. void choiceCB();
  50. Fl_Choice *choice;
  51. Fl_Widget *selected;
  52. };
  53. #endif