00001 #ifndef BCSLIDER_H
00002 #define BCSLIDER_H
00003
00004 #include "bcbitmap.inc"
00005 #include "bcsubwindow.h"
00006
00007 class BC_ISlider;
00008 class BC_FSlider;
00009 class BC_PercentageSlider;
00010
00011 class BC_Slider : public BC_SubWindow
00012 {
00013 public:
00014 BC_Slider(int x,
00015 int y,
00016 int pixels,
00017 int pointer_motion_range,
00018 VFrame **images,
00019 int show_number,
00020 int vertical,
00021 int use_caption);
00022 virtual ~BC_Slider();
00023
00024 friend class BC_ISlider;
00025 friend class BC_FSlider;
00026 friend class BC_PercentageSlider;
00027
00028 virtual int handle_event() { return 0; };
00029
00030 int initialize();
00031 static int get_span(int vertical);
00032 int get_button_pixels();
00033 virtual int value_to_pixel() { return 0; };
00034 int keypress_event();
00035 int cursor_enter_event();
00036 int cursor_leave_event();
00037 int button_press_event();
00038 int button_release_event();
00039 int get_pointer_motion_range();
00040 int cursor_motion_event();
00041 int repeat_event(int64_t repeat_id);
00042 int reposition_window(int x, int y, int w = -1, int h = -1);
00043 int activate();
00044 int deactivate();
00045 virtual int increase_value() { return 0; };
00046 virtual int decrease_value() { return 0; };
00047 virtual char* get_caption() { return caption; };
00048
00049 private:
00050
00051 #define SLIDER_UP 0
00052 #define SLIDER_HI 1
00053 #define SLIDER_DN 2
00054 #define SLIDER_BG_UP 0
00055 #define SLIDER_BG_HI 1
00056 #define SLIDER_BG_DN 2
00057 #define SLIDER_IMAGES 6
00058
00059 virtual int init_selection(int cursor_x, int cursor_y) { return 0; };
00060 virtual int update_selection(int cursor_x, int cursor_y) { return 0; };
00061 int set_images(VFrame **images);
00062 int draw_face();
00063 void show_value_tooltip();
00064
00065 VFrame **images;
00066 BC_Pixmap **pixmaps;
00067 int show_number, vertical, pointer_motion_range, pixels;
00068 int keypress_tooltip_timer;
00069 int button_pixel;
00070 int status;
00071 int button_down;
00072 int min_pixel, max_pixel;
00073 int text_line, text_height;
00074 int use_caption;
00075 char caption[BCTEXTLEN];
00076 char temp_tooltip_text[BCTEXTLEN];
00077 int active;
00078 int enabled;
00079 };
00080
00081
00082 class BC_ISlider : public BC_Slider
00083 {
00084 public:
00085 BC_ISlider(int x,
00086 int y,
00087 int vertical,
00088 int pixels,
00089 int pointer_motion_range,
00090 int64_t minvalue,
00091 int64_t maxvalue,
00092 int64_t value,
00093 int use_caption = 0,
00094 VFrame **data = 0,
00095 int *output = 0);
00096
00097 int update(int64_t value);
00098 int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
00099 int64_t get_value();
00100 int64_t get_length();
00101 int increase_value();
00102 int decrease_value();
00103 virtual int handle_event();
00104 char* get_caption();
00105
00106 private:
00107 int value_to_pixel();
00108 int init_selection(int cursor_x, int cursor_y);
00109 int update_selection(int cursor_x, int cursor_y);
00110 int64_t minvalue, maxvalue, value;
00111 int *output;
00112 };
00113
00114 class BC_FSlider : public BC_Slider
00115 {
00116 public:
00117 BC_FSlider(int x,
00118 int y,
00119 int vertical,
00120 int pixels,
00121 int pointer_motion_range,
00122 float minvalue,
00123 float maxvalue,
00124 float value,
00125 int use_caption = 0,
00126 VFrame **data = 0);
00127
00128 friend class BC_PercentageSlider;
00129
00130 int update(float value);
00131 int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
00132 float get_value();
00133 float get_length();
00134 virtual int increase_value();
00135 virtual int decrease_value();
00136 virtual char* get_caption();
00137 void set_precision(float value);
00138
00139 private:
00140 int value_to_pixel();
00141 int init_selection(int cursor_x, int cursor_y);
00142 int update_selection(int cursor_x, int cursor_y);
00143 float minvalue, maxvalue, value;
00144 float precision;
00145 };
00146
00147 class BC_PercentageSlider : public BC_FSlider
00148 {
00149 public:
00150 BC_PercentageSlider(int x,
00151 int y,
00152 int vertical,
00153 int pixels,
00154 int pointer_motion_range,
00155 float minvalue,
00156 float maxvalue,
00157 float value,
00158 int use_caption = 0,
00159 VFrame **data = 0);
00160
00161 virtual int increase_value();
00162 virtual int decrease_value();
00163 char* get_caption();
00164 private:
00165 };
00166
00167
00168 #endif