add binfolder path relative filters, fix gbrp color model, vwdw timebar tweaks, title...
[goodguy/history.git] / cinelerra-5.1 / guicast / bcslider.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef BCSLIDER_H
23 #define BCSLIDER_H
24
25 #include "bcbitmap.inc"
26 #include "bcsubwindow.h"
27
28 class BC_ISlider;
29 class BC_FSlider;
30 class BC_PercentageSlider;
31
32 class BC_Slider : public BC_SubWindow
33 {
34 public:
35         BC_Slider(int x,
36                 int y,
37                 int pixels,
38                 int pointer_motion_range,
39                 VFrame **images,
40                 int show_number,
41                 int vertical,
42                 int use_caption);
43         virtual ~BC_Slider();
44
45         friend class BC_ISlider;
46         friend class BC_FSlider;
47         friend class BC_PercentageSlider;
48
49         virtual int handle_event() { return 0; };
50
51         int initialize();
52         void enable();
53         void disable();
54         static int get_span(int vertical);
55         int get_button_pixels();
56         virtual int value_to_pixel() { return 0; };
57         int keypress_event();
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);
67         int activate();
68         int deactivate();
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; };
74
75 private:
76
77 #define SLIDER_UP 0
78 #define SLIDER_HI 1
79 #define SLIDER_DN 2
80 #define SLIDER_BG_UP 0
81 #define SLIDER_BG_HI 1
82 #define SLIDER_BG_DN 2
83 #define SLIDER_IMAGES 6
84
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();
90
91         VFrame **images;
92         BC_Pixmap **pixmaps;
93         int show_number, vertical, pointer_motion_range, pixels;
94         int keypress_tooltip_timer;
95         int button_pixel;
96         int status;
97         int button_down;
98         int min_pixel, max_pixel;
99         int text_line, text_height;
100         int use_caption;
101         char caption[BCTEXTLEN];
102         int active;
103         int enabled;
104 };
105
106
107 class BC_ISlider : public BC_Slider
108 {
109 public:
110         BC_ISlider(int x,
111                         int y,
112                         int vertical,
113                         int pixels,
114                         int pointer_motion_range,
115                         int64_t minvalue,
116                         int64_t maxvalue,
117                         int64_t value,
118                         int use_caption = 0,
119                         VFrame **data = 0,
120                         int *output = 0);
121
122         int update(int64_t value);
123         int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
124         int64_t get_value();
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();
132
133 private:
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;
138         int *output;
139 };
140
141 class BC_FSlider : public BC_Slider
142 {
143 public:
144         BC_FSlider(int x,
145                         int y,
146                         int vertical,
147                         int pixels,
148                         int pointer_motion_range,
149                         float minvalue,
150                         float maxvalue,
151                         float value,
152                         int use_caption = 0,
153                         VFrame **data = 0);
154
155         friend class BC_PercentageSlider;
156
157         int update(float value);
158         int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
159         float get_value();
160         float get_length();
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);
168
169 private:
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;
174         float precision;
175         float small_change, big_change;
176 };
177
178 class BC_PercentageSlider : public BC_FSlider
179 {
180 public:
181         BC_PercentageSlider(int x,
182                         int y,
183                         int vertical,
184                         int pixels,
185                         int pointer_motion_range,
186                         float minvalue,
187                         float maxvalue,
188                         float value,
189                         int use_caption = 0,
190                         VFrame **data = 0);
191
192         char* get_caption();
193 private:
194 };
195
196
197 #endif