Flu_Toggle_Group.H 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // $Id: Flu_Toggle_Group.h,v 1.8 2003/08/20 16:29:43 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_TOGGLE_GROUP_H
  13. #define _FLU_TOGGLE_GROUP_H
  14. #include <stdio.h>
  15. #include <string.h>
  16. /* fltk includes */
  17. #include <FL/Fl.H>
  18. #include <FL/Fl_Check_Button.H>
  19. #include <FL/fl_draw.H>
  20. #include <FL/Fl_Group.H>
  21. #include "FLU/Flu_Enumerations.H"
  22. //! This class provides a group that can be toggled active or inactive
  23. class FLU_EXPORT Flu_Toggle_Group : public Fl_Group
  24. {
  25. DECLARE_CLASS_CHEAP_RTTI_2(Flu_Toggle_Group, Fl_Group)
  26. public:
  27. //! Default FLTK constructor
  28. Flu_Toggle_Group( int x, int y, int w, int h, const char *l = 0 );
  29. //! Activate the group
  30. inline void activate()
  31. { value(1); }
  32. //! Deactivate the group
  33. inline void deactivate()
  34. { value(0); }
  35. //! Get the activation state of this group.
  36. inline int active() const
  37. { return value(); }
  38. //! Set the activation state of this group. 0 deactivates the group, anything else activates it.
  39. inline void value( int v )
  40. { chkBtn->value(v); redraw(); }
  41. //! Get the activation state of this group.
  42. inline int value() const
  43. { return chkBtn->value(); }
  44. //! Override of Fl_Group::draw()
  45. void draw();
  46. protected:
  47. static void _toggleCB( Fl_Widget *w, void *arg )
  48. { ((Flu_Toggle_Group*)arg)->toggleCB(); }
  49. void toggleCB();
  50. Fl_Check_Button *chkBtn;
  51. };
  52. #endif