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 static int get_span(int vertical);
55 int get_button_pixels();
56 virtual int value_to_pixel() { return 0; };
58 int cursor_enter_event();
59 int cursor_leave_event();
60 int button_press_event();
61 virtual int button_release_event();
62 int get_pointer_motion_range();
63 void set_pointer_motion_range(int value);
64 int cursor_motion_event();
65 int repeat_event(int64_t repeat_id);
66 int reposition_window(int x, int y, int w = -1, int h = -1);
69 virtual int increase_value() { return 0; };
70 virtual int decrease_value() { return 0; };
71 virtual int increase_value_big() { return 0; };
72 virtual int decrease_value_big() { return 0; };
73 virtual char* get_caption() { return caption; };
80 #define SLIDER_BG_UP 0
81 #define SLIDER_BG_HI 1
82 #define SLIDER_BG_DN 2
83 #define SLIDER_IMAGES 6
85 virtual int init_selection(int cursor_x, int cursor_y) { return 0; };
86 virtual int update_selection(int cursor_x, int cursor_y) { return 0; };
87 int set_images(VFrame **images);
88 int draw_face(int flush);
89 void show_value_tooltip();
93 int show_number, vertical, pointer_motion_range, pixels;
94 int keypress_tooltip_timer;
98 int min_pixel, max_pixel;
99 int text_line, text_height;
101 char caption[BCTEXTLEN];
107 class BC_ISlider : public BC_Slider
114 int pointer_motion_range,
122 int update(int64_t value);
123 int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
125 int64_t get_length();
126 int increase_value();
127 int decrease_value();
128 int increase_value_big();
129 int decrease_value_big();
130 virtual int handle_event();
131 virtual char* get_caption();
134 int value_to_pixel();
135 int init_selection(int cursor_x, int cursor_y);
136 int update_selection(int cursor_x, int cursor_y);
137 int64_t minvalue, maxvalue, value;
141 class BC_FSlider : public BC_Slider
148 int pointer_motion_range,
155 friend class BC_PercentageSlider;
157 int update(float value);
158 int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
161 virtual int increase_value();
162 virtual int decrease_value();
163 virtual int increase_value_big();
164 virtual int decrease_value_big();
165 virtual char* get_caption();
166 void set_precision(float value);
167 void set_pagination(float small_change, float big_change);
170 int value_to_pixel();
171 int init_selection(int cursor_x, int cursor_y);
172 int update_selection(int cursor_x, int cursor_y);
173 float minvalue, maxvalue, value;
175 float small_change, big_change;
178 class BC_PercentageSlider : public BC_FSlider
181 BC_PercentageSlider(int x,
185 int pointer_motion_range,