Flu_Combo_Tree.H 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // $Id: Flu_Combo_Tree.h,v 1.6 2004/03/24 02:49:00 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_COMBO_TREE_H
  13. #define _FLU_COMBO_TREE_H
  14. #include "FLU/Flu_Combo_Box.H"
  15. #include "FLU/Flu_Tree_Browser.H"
  16. //! Just like the Fl_Choice widget except the input area is editable and it can display a tree instead of a list (using Flu_Tree_Browser)
  17. class FLU_EXPORT Flu_Combo_Tree : public Flu_Combo_Box
  18. {
  19. public:
  20. //! Normal FLTK widget constructor
  21. Flu_Combo_Tree( int x, int y, int w, int h, const char *l = 0 );
  22. //! Publicly exposed tree widget (instance of Flu_Tree_Browser)
  23. Flu_Tree_Browser tree;
  24. void textsize(Fl_Fontsize pix);
  25. void textfont(Fl_Font f);
  26. void add_item (void *adata, char const * avalue){}
  27. void *get_data_at (int pos=-1);
  28. void select_by_data (void *adata);
  29. void clear_items(){
  30. tree.clear();
  31. }
  32. bool hasItems(){
  33. return tree.children()>0;
  34. }
  35. DECLARE_CLASS_CHEAP_RTTI_2(Flu_Combo_Tree, Flu_Combo_Box)
  36. protected:
  37. bool _value( const char *v );
  38. const char* _next();
  39. const char* _previous();
  40. void _hilight( int x, int y );
  41. inline static void _cb( Fl_Widget *w, void *arg )
  42. { ((Flu_Combo_Tree*)arg)->cb(); }
  43. void cb();
  44. };
  45. #endif