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
35 BC_Slider(int x, int y, int pixels, int pointer_motion_range,
36 VFrame **images, int show_number, int vertical,
40 friend class BC_ISlider;
41 friend class BC_FSlider;
42 friend class BC_PercentageSlider;
44 virtual int handle_event() { return 0; };
49 void enable_show_value(int v);
50 static int get_span(int vertical);
51 int get_button_pixels();
52 virtual int value_to_pixel() { return 0; };
54 int cursor_enter_event();
55 int cursor_leave_event();
56 int button_press_event();
57 virtual int button_release_event();
58 int get_pointer_motion_range();
59 void set_pointer_motion_range(int value);
60 int cursor_motion_event();
61 int repeat_event(int64_t repeat_id);
62 int reposition_window(int x, int y, int w = -1, int h = -1);
65 virtual int increase_value() { return 0; };
66 virtual int decrease_value() { return 0; };
67 virtual int increase_value_big() { return 0; };
68 virtual int decrease_value_big() { return 0; };
69 virtual char* get_caption() { return caption; };
76 #define SLIDER_BG_UP 0
77 #define SLIDER_BG_HI 1
78 #define SLIDER_BG_DN 2
79 #define SLIDER_IMAGES 6
81 virtual int init_selection(int cursor_x, int cursor_y) { return 0; };
82 virtual int update_selection(int cursor_x, int cursor_y) { return 0; };
83 int set_images(VFrame **images);
84 int draw_face(int flush);
85 void show_value_tooltip();
89 int show_number, vertical, pointer_motion_range, pixels;
90 int keypress_tooltip_timer;
94 int min_pixel, max_pixel;
95 int text_line, text_height;
97 char caption[BCTEXTLEN];
103 class BC_ISlider : public BC_Slider
106 BC_ISlider(int x, int y, int vertical, int pixels, int pointer_motion_range,
107 int64_t minvalue, int64_t maxvalue, int64_t value,
108 int use_caption = 0, VFrame **data = 0, int *output = 0);
109 int update(int64_t value);
110 int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
112 int64_t get_length();
113 int increase_value();
114 int decrease_value();
115 int increase_value_big();
116 int decrease_value_big();
117 virtual int handle_event();
118 virtual char* get_caption();
121 int value_to_pixel();
122 int init_selection(int cursor_x, int cursor_y);
123 int update_selection(int cursor_x, int cursor_y);
124 int64_t minvalue, maxvalue, value;
128 class BC_FSlider : public BC_Slider
131 BC_FSlider(int x, int y, int vertical, int pixels, int pointer_motion_range,
132 float minvalue, float maxvalue, float value,
133 int use_caption = 0, VFrame **data = 0);
135 friend class BC_PercentageSlider;
137 int update(float value);
138 int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
141 virtual int increase_value();
142 virtual int decrease_value();
143 virtual int increase_value_big();
144 virtual int decrease_value_big();
145 virtual char* get_caption();
146 void set_precision(float value);
147 void set_pagination(float small_change, float big_change);
150 int value_to_pixel();
151 int init_selection(int cursor_x, int cursor_y);
152 int update_selection(int cursor_x, int cursor_y);
153 float minvalue, maxvalue, value;
155 float small_change, big_change;
158 class BC_PercentageSlider : public BC_FSlider
161 BC_PercentageSlider(int x, int y, int vertical, int pixels, int pointer_motion_range,
162 float minvalue, float maxvalue, float value,
163 int use_caption = 0, VFrame **data = 0);