r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / guicast / bctextbox.h
blobea79ea45bfa87e6a98c97f673f315c079e52a688
1 #ifndef BCTEXTBOX_H
2 #define BCTEXTBOX_H
4 #include "bclistbox.h"
5 #include "bcsubwindow.h"
6 #include "bctumble.h"
7 #include "fonts.h"
9 #define BCCURSORW 2
13 class BC_TextBox : public BC_SubWindow
15 public:
16 BC_TextBox(int x, int y, int w, int rows, char *text, int has_border = 1, int font = MEDIUMFONT);
17 BC_TextBox(int x, int y, int w, int rows, int64_t text, int has_border = 1, int font = MEDIUMFONT);
18 BC_TextBox(int x, int y, int w, int rows, int text, int has_border = 1, int font = MEDIUMFONT);
19 BC_TextBox(int x, int y, int w, int rows, float text, int has_border = 1, int font = MEDIUMFONT);
20 virtual ~BC_TextBox();
22 // Whenever the contents of the text change
23 virtual int handle_event() { return 0; };
24 // Whenever the position of the text changes
25 virtual int motion_event() { return 0; };
26 int update(char *text);
27 int update(int64_t value);
28 int update(float value);
29 void disable();
30 void enable();
32 int initialize();
33 int cursor_enter_event();
34 int cursor_leave_event();
35 int cursor_motion_event();
36 int button_press_event();
37 int button_release_event();
38 int repeat_event(int64_t repeat_id);
39 int keypress_event();
40 int activate();
41 int deactivate();
42 char* get_text();
43 int get_text_rows();
44 // Set top left of text view
45 void set_text_row(int row);
46 int get_text_row();
47 int reposition_window(int x, int y, int w = -1, int rows = -1);
48 int uses_text();
49 static int calculate_row_h(int rows, BC_WindowBase *parent_window, int has_border = 1, int font = MEDIUMFONT);
50 static int pixels_to_rows(BC_WindowBase *window, int font, int pixels);
51 void set_precision(int precision);
53 private:
54 int reset_parameters(int rows, int has_border, int font);
55 void draw();
56 void draw_border();
57 void draw_cursor();
58 void copy_selection(int clipboard_num);
59 void paste_selection(int clipboard_num);
60 void delete_selection(int letter1, int letter2, int text_len);
61 void insert_text(char *string);
62 void get_ibeam_position(int &x, int &y);
63 void find_ibeam(int dispatch_event);
64 void select_word(int &letter1, int &letter2, int ibeam_letter);
65 int get_cursor_letter(int cursor_x, int cursor_y);
66 int get_row_h(int rows);
67 void default_keypress(int &dispatch_event, int &result);
70 // Top left of text relative to window
71 int text_x, text_y;
72 // Top left of cursor relative to window
73 int ibeam_x, ibeam_y;
75 int ibeam_letter;
76 int highlight_letter1, highlight_letter2;
77 int highlight_letter3, highlight_letter4;
78 int text_x1, text_start, text_end, text_selected, word_selected;
79 int text_ascent, text_descent, text_height;
80 int left_margin, right_margin, top_margin, bottom_margin;
81 int has_border;
82 int font;
83 int rows;
84 int highlighted;
85 int high_color, back_color;
86 int background_color;
87 char text[BCTEXTLEN], text_row[BCTEXTLEN], temp_string[2];
88 int active;
89 int enabled;
90 int precision;
95 class BC_ScrollTextBoxText;
96 class BC_ScrollTextBoxYScroll;
99 class BC_ScrollTextBox
101 public:
102 BC_ScrollTextBox(BC_WindowBase *parent_window,
103 int x,
104 int y,
105 int w,
106 int rows,
107 char *default_text);
108 virtual ~BC_ScrollTextBox();
109 void create_objects();
110 virtual int handle_event();
112 char* get_text();
113 void update(char *text);
114 void reposition_window(int x, int y, int w, int rows);
115 int get_x();
116 int get_y();
117 int get_w();
118 // Visible rows for resizing
119 int get_rows();
121 friend class BC_ScrollTextBoxText;
122 friend class BC_ScrollTextBoxYScroll;
124 private:
125 BC_ScrollTextBoxText *text;
126 BC_ScrollTextBoxYScroll *yscroll;
127 BC_WindowBase *parent_window;
128 char *default_text;
129 int x, y, w, rows;
132 class BC_ScrollTextBoxText : public BC_TextBox
134 public:
135 BC_ScrollTextBoxText(BC_ScrollTextBox *gui);
136 virtual ~BC_ScrollTextBoxText();
137 int handle_event();
138 int motion_event();
139 BC_ScrollTextBox *gui;
142 class BC_ScrollTextBoxYScroll : public BC_ScrollBar
144 public:
145 BC_ScrollTextBoxYScroll(BC_ScrollTextBox *gui);
146 virtual ~BC_ScrollTextBoxYScroll();
147 int handle_event();
148 BC_ScrollTextBox *gui;
154 class BC_PopupTextBoxText;
155 class BC_PopupTextBoxList;
157 class BC_PopupTextBox
159 public:
160 BC_PopupTextBox(BC_WindowBase *parent_window,
161 ArrayList<BC_ListBoxItem*> *list_items,
162 char *default_text,
163 int x,
164 int y,
165 int text_w,
166 int list_h);
167 virtual ~BC_PopupTextBox();
168 int create_objects();
169 virtual int handle_event();
170 char* get_text();
171 int get_number();
172 int get_x();
173 int get_y();
174 int get_w();
175 int get_h();
176 void update(char *text);
177 void update_list(ArrayList<BC_ListBoxItem*> *data);
178 void reposition_window(int x, int y);
180 friend class BC_PopupTextBoxText;
181 friend class BC_PopupTextBoxList;
183 private:
184 int x, y, text_w, list_h;
185 char *default_text;
186 ArrayList<BC_ListBoxItem*> *list_items;
187 BC_PopupTextBoxText *textbox;
188 BC_PopupTextBoxList *listbox;
189 BC_WindowBase *parent_window;
192 class BC_PopupTextBoxText : public BC_TextBox
194 public:
195 BC_PopupTextBoxText(BC_PopupTextBox *popup, int x, int y);
196 virtual ~BC_PopupTextBoxText();
197 int handle_event();
198 BC_PopupTextBox *popup;
201 class BC_PopupTextBoxList : public BC_ListBox
203 public:
204 BC_PopupTextBoxList(BC_PopupTextBox *popup, int x, int y);
205 int handle_event();
206 BC_PopupTextBox *popup;
210 class BC_TumbleTextBoxText;
211 class BC_TumbleTextBoxTumble;
213 class BC_TumbleTextBox
215 public:
216 BC_TumbleTextBox(BC_WindowBase *parent_window,
217 int64_t default_value,
218 int64_t min,
219 int64_t max,
220 int x,
221 int y,
222 int text_w);
223 BC_TumbleTextBox(BC_WindowBase *parent_window,
224 int default_value,
225 int min,
226 int max,
227 int x,
228 int y,
229 int text_w);
230 BC_TumbleTextBox(BC_WindowBase *parent_window,
231 float default_value,
232 float min,
233 float max,
234 int x,
235 int y,
236 int text_w);
237 virtual ~BC_TumbleTextBox();
239 int create_objects();
240 void reset();
241 virtual int handle_event();
242 char* get_text();
243 int update(char *value);
244 int update(int64_t value);
245 int update(float value);
246 int get_x();
247 int get_y();
248 int get_w();
249 int get_h();
250 void reposition_window(int x, int y);
251 void set_boundaries(int64_t min, int64_t max);
252 void set_boundaries(float min, float max);
253 void set_precision(int precision);
254 void set_increment(float value);
256 friend class BC_TumbleTextBoxText;
257 friend class BC_TumbleTextBoxTumble;
259 private:
260 int x, y, text_w;
261 int64_t default_value, min, max;
262 float default_value_f, min_f, max_f;
263 int use_float;
264 int precision;
265 float increment;
266 BC_TumbleTextBoxText *textbox;
267 BC_Tumbler *tumbler;
268 BC_WindowBase *parent_window;
271 class BC_TumbleTextBoxText : public BC_TextBox
273 public:
274 BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
275 int64_t default_value,
276 int64_t min,
277 int64_t max,
278 int x,
279 int y);
280 BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
281 float default_value,
282 float min,
283 float max,
284 int x,
285 int y);
286 BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int x, int y);
287 virtual ~BC_TumbleTextBoxText();
288 int handle_event();
289 BC_TumbleTextBox *popup;
293 #endif