FLTK Utility Library and Widget Collection (FLU): Flu_Combo_Box.h Source File

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

# Flu_Combo_Box.h

    00001 // $Id: Flu_Combo_Box.h,v 1.12 2004/03/24 02:49:00 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_COMBO_BOX_H
    00017 #define _FLU_COMBO_BOX_H
    00018
    00019 #include <FL/Fl_Double_Window.H>
    00020 #include <FL/Fl_Input.H>
    00021 #include <FL/Fl_Group.H>
    00022
    00023 #include "FLU/Flu_Enumerations.h"
    00024
    00026 class FLU_EXPORT Flu_Combo_Box : public Fl_Group
    00027 {
    00028
    00029 public:
    00030
    00032   Flu_Combo_Box( int x, int y, int w, int h, const char *l = 0 );
    00033
    00035   ~Flu_Combo_Box();
    00036
    00038   inline bool editable() const
    00039     { return (int)(!input.readonly()); }
    00040
    00042   inline void editable( bool b )
    00043     { input.readonly( (int)(!b) ); }
    00044
    00046   inline const char* value() const
    00047     { return input.value(); }
    00048
    00050   void value( const char *v );
    00051
    00053   inline void pop_height( int h )
    00054     { popHeight = h; }
    00055
    00057   inline int pop_height()
    00058     { return popHeight; }
    00059
    00061   int handle( int );
    00062
    00064   void resize( int X, int Y, int W, int H );
    00065
    00067   inline void input_callback( void (*cb)(Fl_Widget*,void*), void* cbd = NULL )
    00068     { _inputCB = cb; _inputCBD = cbd; }
    00069
    00071   Fl_Input input;
    00072
    00073 protected:
    00074
    00075   void (*_inputCB)(Fl_Widget*,void*);
    00076   void* _inputCBD;
    00077
    00078   virtual bool _value( const char *v ) = 0;
    00079   virtual const char* _next() = 0;
    00080   virtual const char* _previous() = 0;
    00081   virtual void _hilight( int x, int y ) = 0;
    00082
    00083   void draw();
    00084
    00085   void selected( const char *v );
    00086
    00087   void set_combo_widget( Fl_Widget *w );
    00088
    00089   uchar _valbox;
    00090   bool _pushed, _popped;
    00091   Fl_Widget *_cbox;
    00092   int popHeight;
    00093
    00094   static void input_cb( Fl_Widget*, void* v );
    00095
    00096   class FLU_EXPORT Popup : public Fl_Double_Window
    00097     {
    00098
    00099     public:
    00100
    00101       Popup( Flu_Combo_Box *b, Fl_Widget *c, int H );
    00102
    00103       ~Popup();
    00104
    00105       int handle( int event );
    00106
    00107     protected:
    00108
    00109       Flu_Combo_Box *combo;
    00110       bool dragging;
    00111       const char* selected;
    00112
    00113     };
    00114   friend class Popup;
    00115
    00116 };
    00117
    00118 #endif