add mask color radio btn sel, fix del all mask btn, fix mask dflt kfrm draw name...
[goodguy/cinelerra.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, int y, int pixels, int pointer_motion_range,
36                 VFrame **images, int show_number, int vertical,
37                 int use_caption);
38         virtual ~BC_Slider();
39
40         friend class BC_ISlider;
41         friend class BC_FSlider;
42         friend class BC_PercentageSlider;
43
44         virtual int handle_event() { return 0; };
45
46         int initialize();
47         void enable();
48         void disable();
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; };
53         int keypress_event();
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);
63         int activate();
64         int deactivate();
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; };
70
71 private:
72
73 #define SLIDER_UP 0
74 #define SLIDER_HI 1
75 #define SLIDER_DN 2
76 #define SLIDER_BG_UP 0
77 #define SLIDER_BG_HI 1
78 #define SLIDER_BG_DN 2
79 #define SLIDER_IMAGES 6
80
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();
86
87         VFrame **images;
88         BC_Pixmap **pixmaps;
89         int show_number, vertical, pointer_motion_range, pixels;
90         int keypress_tooltip_timer;
91         int button_pixel;
92         int status;
93         int button_down;
94         int min_pixel, max_pixel;
95         int text_line, text_height;
96         int use_caption;
97         char caption[BCTEXTLEN];
98         int active;
99         int enabled;
100 };
101
102
103 class BC_ISlider : public BC_Slider
104 {
105 public:
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);
111         int64_t get_value();
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();
119
120 private:
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;
125         int *output;
126 };
127
128 class BC_FSlider : public BC_Slider
129 {
130 public:
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);
134
135         friend class BC_PercentageSlider;
136
137         int update(float value);
138         int update(int pointer_motion_range, float value, float minvalue, float maxvalue);
139         float get_value();
140         float get_length();
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);
148
149 private:
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;
154         float precision;
155         float small_change, big_change;
156 };
157
158 class BC_PercentageSlider : public BC_FSlider
159 {
160 public:
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);
164         char* get_caption();
165 private:
166 };
167
168 #endif