r370: Heroine Virutal's official release 1.2.1
[cinelerra_cv/mob.git] / hvirtual / guicast / bcpot.h
blob18c82fcaaf90db7153163117e232a7a6910c9053
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; };
36 void set_use_caption(int value);
38 int reposition_window(int x, int y);
39 int repeat_event(int64_t repeat_id);
40 int cursor_enter_event();
41 int cursor_leave_event();
42 int button_press_event();
43 virtual int button_release_event();
44 int cursor_motion_event();
45 int keypress_event();
47 private:
48 int set_data(VFrame **data);
49 int draw();
50 float percentage_to_angle(float percentage);
51 float angle_to_percentage(float angle);
52 int angle_to_coords(int &x1, int &y1, int &x2, int &y2, float angle);
53 float coords_to_angle(int x2, int y2);
54 void show_value_tooltip();
56 VFrame **data;
57 BC_Pixmap *images[POT_STATES];
58 char caption[BCTEXTLEN], temp_tooltip_text[BCTEXTLEN];
59 int status;
60 int64_t keypress_tooltip_timer;
61 float angle_offset;
62 float start_cursor_angle;
63 float start_needle_angle;
64 float prev_angle, angle_correction;
65 int use_caption;
68 class BC_FPot : public BC_Pot
70 public:
71 BC_FPot(int x,
72 int y,
73 float value,
74 float minvalue,
75 float maxvalue,
76 VFrame **data = 0);
77 ~BC_FPot();
79 char* get_caption();
80 int increase_value();
81 int decrease_value();
82 float get_percentage();
83 float get_value();
84 int percentage_to_value(float percentage);
85 void update(float value);
86 void set_precision(float value);
88 private:
89 float value, minvalue, maxvalue;
90 float precision;
93 class BC_IPot : public BC_Pot
95 public:
96 BC_IPot(int x,
97 int y,
98 int64_t value,
99 int64_t minvalue,
100 int64_t maxvalue,
101 VFrame **data = 0);
102 ~BC_IPot();
104 char* get_caption();
105 int increase_value();
106 int decrease_value();
107 float get_percentage();
108 int percentage_to_value(float percentage);
109 int64_t get_value();
110 void update(int64_t value);
112 private:
113 int64_t value, minvalue, maxvalue;
116 class BC_QPot : public BC_Pot
118 public:
119 BC_QPot(int x,
120 int y,
121 int64_t value, // Units of frequencies
122 VFrame **data = 0);
123 ~BC_QPot();
125 char* get_caption();
126 int increase_value();
127 int decrease_value();
128 float get_percentage();
129 int percentage_to_value(float percentage);
130 // Units of frequencies
131 int64_t get_value();
132 // Units of frequencies
133 void update(int64_t value);
135 private:
136 // Units of frequency index
137 int64_t value, minvalue, maxvalue;
140 class BC_PercentagePot : public BC_Pot
142 public:
143 BC_PercentagePot(int x,
144 int y,
145 float value,
146 float minvalue,
147 float maxvalue,
148 VFrame **data = 0);
149 ~BC_PercentagePot();
151 char* get_caption();
152 int increase_value();
153 int decrease_value();
154 float get_percentage();
155 float get_value();
156 int percentage_to_value(float percentage);
157 void update(float value);
159 private:
160 float value, minvalue, maxvalue;
163 #endif