r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / guicast / bcpot.h
blob4eb08727850156652985e421bb4f3d056e598aed
1 #ifndef BCPOT_H
2 #define BCPOT_H
4 #include "bcpixmap.h"
5 #include "vframe.inc"
6 #include "bcsubwindow.h"
8 #define POT_UP 0
9 #define POT_HIGH 1
10 #define POT_DN 2
11 #define POT_STATES 3
13 class BC_FPot;
14 class BC_IPot;
15 class BC_QPot;
16 class BC_PercentagePot;
18 class BC_Pot : public BC_SubWindow
20 public:
21 BC_Pot(int x, int y, VFrame **data);
22 virtual ~BC_Pot();
24 friend class BC_FPot;
25 friend class BC_IPot;
26 friend class BC_QPot;
27 friend class BC_PercentagePot;
29 int initialize();
30 virtual float get_percentage() { return 0; };
31 virtual int percentage_to_value(float percentage) { return 0; };
32 virtual int handle_event() { return 0; };
33 virtual char* get_caption() { return ""; };
34 virtual int increase_value() { return 0; };
35 virtual int decrease_value() { return 0; };
37 int reposition_window(int x, int y);
38 int repeat_event(int64_t repeat_id);
39 int cursor_enter_event();
40 int cursor_leave_event();
41 int button_press_event();
42 int button_release_event();
43 int cursor_motion_event();
44 int keypress_event();
46 private:
47 int set_data(VFrame **data);
48 int draw();
49 float percentage_to_angle(float percentage);
50 float angle_to_percentage(float angle);
51 int angle_to_coords(int &x1, int &y1, int &x2, int &y2, float angle);
52 float coords_to_angle(int x2, int y2);
53 void show_value_tooltip();
55 VFrame **data;
56 BC_Pixmap *images[POT_STATES];
57 char caption[BCTEXTLEN], temp_tooltip_text[BCTEXTLEN];
58 int status;
59 int64_t keypress_tooltip_timer;
60 float angle_offset;
61 float start_cursor_angle;
62 float start_needle_angle;
63 float prev_angle, angle_correction;
66 class BC_FPot : public BC_Pot
68 public:
69 BC_FPot(int x,
70 int y,
71 float value,
72 float minvalue,
73 float maxvalue,
74 VFrame **data = 0);
75 ~BC_FPot();
77 char* get_caption();
78 int increase_value();
79 int decrease_value();
80 float get_percentage();
81 float get_value();
82 int percentage_to_value(float percentage);
83 void update(float value);
84 void set_precision(float value);
86 private:
87 float value, minvalue, maxvalue;
88 float precision;
91 class BC_IPot : public BC_Pot
93 public:
94 BC_IPot(int x,
95 int y,
96 int64_t value,
97 int64_t minvalue,
98 int64_t maxvalue,
99 VFrame **data = 0);
100 ~BC_IPot();
102 char* get_caption();
103 int increase_value();
104 int decrease_value();
105 float get_percentage();
106 int percentage_to_value(float percentage);
107 int64_t get_value();
108 void update(int64_t value);
110 private:
111 int64_t value, minvalue, maxvalue;
114 class BC_QPot : public BC_Pot
116 public:
117 BC_QPot(int x,
118 int y,
119 int64_t value, // Units of frequencies
120 VFrame **data = 0);
121 ~BC_QPot();
123 char* get_caption();
124 int increase_value();
125 int decrease_value();
126 float get_percentage();
127 int percentage_to_value(float percentage);
128 // Units of frequencies
129 int64_t get_value();
130 // Units of frequencies
131 void update(int64_t value);
133 private:
134 // Units of frequency index
135 int64_t value, minvalue, maxvalue;
138 class BC_PercentagePot : public BC_Pot
140 public:
141 BC_PercentagePot(int x,
142 int y,
143 float value,
144 float minvalue,
145 float maxvalue,
146 VFrame **data = 0);
147 ~BC_PercentagePot();
149 char* get_caption();
150 int increase_value();
151 int decrease_value();
152 float get_percentage();
153 float get_value();
154 int percentage_to_value(float percentage);
155 void update(float value);
157 private:
158 float value, minvalue, maxvalue;
161 #endif