4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "bcbitmap.inc"
26 #include "bcsubwindow.h"
30 class BC_PercentageSlider;
32 class BC_Slider : public BC_SubWindow
38 int pointer_motion_range,
45 friend class BC_ISlider;
46 friend class BC_FSlider;
47 friend class BC_PercentageSlider;
49 virtual int handle_event() { return 0; };
54 void enable_show_value(int v);
55 static int get_span(int vertical);
56 int get_button_pixels();
57 virtual int value_to_pixel() { return 0; };
59 int cursor_enter_event();
60 int cursor_leave_event();
61 int button_press_event();
62 virtual int button_release_event();
63 int get_pointer_motion_range();
64 void set_pointer_motion_range(int value);
65 int cursor_motion_event();
66 int repeat_event(int64_t repeat_id);
67 int reposition_window(int x, int y, int w = -1, int h = -1);
70 virtual int increase_value() { return 0; };
71 virtual int decrease_value() { return 0; };
72 virtual int increase_value_big() { return 0; };
73 virtual int decrease_value_big() { return 0; };
74 virtual char* get_caption() { return caption; };
81 #define SLIDER_BG_UP 0
82 #define SLIDER_BG_HI 1
83 #define SLIDER_BG_DN 2
84 #define SLIDER_IMAGES 6
86 virtual int init_selection(int cursor_x, int cursor_y) { return 0; };
87 virtual int update_selection(int cursor_x, int cursor_y) { return 0; };
88 int set_images(VFrame **images);
89 int draw_face(int flush);
90 void show_value_tooltip();
94 int show_number, vertical, pointer_motion_range, pixels;
95 int keypress_tooltip_timer;
99 int min_pixel, max_pixel;
100 int text_line, text_height;
102 char caption[BCTEXTLEN];
108 class BC_ISlider : public BC_Slider
115 int pointer_motion_range,
123 int update(int64_t value);
124 int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
126 int64_t get_length();
127 int increase_value();
128 int decrease_value();
129 int increase_value_big();
130 int decrease_value_big();
131 virtual int handle_event();
132 virtual char* get_caption();
135 int value_to_pixel();
136 int init_selection(int cursor_x, int cursor_y);
137 int update_selection(int cursor_x, int cursor_y);
138 int64_t minvalue, maxvalue, value;
142 class BC_FSlider : public BC_Slider
149 int pointer_motion_range,
156 friend class BC_PercentageSlider;
158 int update(float value);
159 int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
162 virtual int increase_value();
163 virtual int decrease_value();
164 virtual int increase_value_big();
165 virtual int decrease_value_big();
166 virtual char* get_caption();
167 void set_precision(float value);
168 void set_pagination(float small_change, float big_change);
171 int value_to_pixel();
172 int init_selection(int cursor_x, int cursor_y);
173 int update_selection(int cursor_x, int cursor_y);
174 float minvalue, maxvalue, value;
176 float small_change, big_change;
179 class BC_PercentageSlider : public BC_FSlider
182 BC_PercentageSlider(int x,
186 int pointer_motion_range,