00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef _FL_SLIDER_H_
00023 #define _FL_SLIDER_H_
00024 
00025 #include "Fl_Valuator.h"
00026 
00028 class FL_API Fl_Slider : public Fl_Valuator {
00029 public:
00030     static Fl_Named_Style* default_style;
00031 
00033     Fl_Slider(int x,int y,int w,int h, const char *l = 0);
00034 
00036     Fl_Slider(const char* l = 0,int layout_size=30,Fl_Align layout_al=FL_ALIGN_TOP,int label_w=100);
00037 
00038     enum { 
00039         VERTICAL        = 0,
00040         HORIZONTAL      = 1,
00041         TICK_ABOVE      = 2,
00042         TICK_LEFT       = TICK_ABOVE,
00043         TICK_BELOW      = 4,
00044         TICK_RIGHT      = TICK_BELOW,
00045         TICK_BOTH       = TICK_ABOVE|TICK_BELOW,
00046         LOG         = 8,
00047         FILL        = 16 
00048     };
00049 
00050     bool horizontal() const {return (type()&HORIZONTAL)!=0;}
00051     bool log() const {return (type()&LOG)!=0;}
00052 
00053     unsigned short slider_size() const {return slider_size_;}
00054     void slider_size(int n) {slider_size_ = (unsigned short)n;}
00055 
00056     unsigned short tick_size() const {return tick_size_;}
00057     void tick_size(int n) {tick_size_ = (unsigned short)n;}
00058 
00059     virtual void draw();
00060     virtual int handle(int);
00061 
00062 protected:
00063     int slider_position(double value, int w);
00064     double position_value(int x, int w);
00065     int handle(int event, int, int, int, int);
00066     void draw_ticks(int,int,int,int, int min_spacing);
00067     bool draw(int, int, int, int, Fl_Flags flags, bool slot);
00068 
00069 private:
00070     unsigned short slider_size_;
00071     unsigned short tick_size_;
00072     unsigned short old_position;
00073 };
00074 
00075 #endif