Flu_Combo_List.H 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // $Id: Flu_Combo_List.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_LIST_H
  13. #define _FLU_COMBO_LIST_H
  14. #include <FL/Fl_Hold_Browser.H>
  15. #include "FLU/Flu_Combo_Box.H"
  16. //! Just like the Fl_Choice widget except the input area is editable
  17. class FLU_EXPORT Flu_Combo_List : public Flu_Combo_Box
  18. {
  19. public:
  20. //! Normal FLTK widget constructor
  21. Flu_Combo_List( int x, int y, int w, int h, const char *l = 0 );
  22. //! Publicly exposed list widget (instance of Fl_Hold_Browser)
  23. Fl_Hold_Browser list;
  24. void textsize(Fl_Fontsize pix);
  25. void textfont(Fl_Font f);
  26. void add_item (void *adata, char const * avalue){
  27. list.add(avalue, adata);
  28. }
  29. void *get_data_at(int pos=-1);
  30. void select_by_data (void *adata);
  31. void clear_items(){
  32. list.value(0);
  33. }
  34. bool hasItems(){
  35. return list.size();
  36. }
  37. DECLARE_CLASS_CHEAP_RTTI_2(Flu_Combo_List, Flu_Combo_Box)
  38. protected:
  39. bool _value( const char *v );
  40. const char* _next();
  41. const char* _previous();
  42. void _hilight( int x, int y );
  43. inline static void _cb( Fl_Widget *w, void *arg )
  44. { ((Flu_Combo_List*)arg)->cb(); }
  45. void cb();
  46. };
  47. #endif