5 #include "bcsubwindow.h"
13 class BC_TextBox
: public BC_SubWindow
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
);
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
);
44 // Set top left of text view
45 void set_text_row(int row
);
47 int reposition_window(int x
, int y
, int w
= -1, int rows
= -1);
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
);
54 int reset_parameters(int rows
, int has_border
, int font
);
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
72 // Top left of cursor relative to window
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
;
85 int high_color
, back_color
;
87 char text
[BCTEXTLEN
], text_row
[BCTEXTLEN
], temp_string
[2];
95 class BC_ScrollTextBoxText
;
96 class BC_ScrollTextBoxYScroll
;
99 class BC_ScrollTextBox
102 BC_ScrollTextBox(BC_WindowBase
*parent_window
,
108 virtual ~BC_ScrollTextBox();
109 void create_objects();
110 virtual int handle_event();
113 void update(char *text
);
114 void reposition_window(int x
, int y
, int w
, int rows
);
118 // Visible rows for resizing
121 friend class BC_ScrollTextBoxText
;
122 friend class BC_ScrollTextBoxYScroll
;
125 BC_ScrollTextBoxText
*text
;
126 BC_ScrollTextBoxYScroll
*yscroll
;
127 BC_WindowBase
*parent_window
;
132 class BC_ScrollTextBoxText
: public BC_TextBox
135 BC_ScrollTextBoxText(BC_ScrollTextBox
*gui
);
136 virtual ~BC_ScrollTextBoxText();
139 BC_ScrollTextBox
*gui
;
142 class BC_ScrollTextBoxYScroll
: public BC_ScrollBar
145 BC_ScrollTextBoxYScroll(BC_ScrollTextBox
*gui
);
146 virtual ~BC_ScrollTextBoxYScroll();
148 BC_ScrollTextBox
*gui
;
154 class BC_PopupTextBoxText
;
155 class BC_PopupTextBoxList
;
157 class BC_PopupTextBox
160 BC_PopupTextBox(BC_WindowBase
*parent_window
,
161 ArrayList
<BC_ListBoxItem
*> *list_items
,
167 virtual ~BC_PopupTextBox();
168 int create_objects();
169 virtual int handle_event();
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
;
184 int x
, y
, text_w
, list_h
;
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
195 BC_PopupTextBoxText(BC_PopupTextBox
*popup
, int x
, int y
);
196 virtual ~BC_PopupTextBoxText();
198 BC_PopupTextBox
*popup
;
201 class BC_PopupTextBoxList
: public BC_ListBox
204 BC_PopupTextBoxList(BC_PopupTextBox
*popup
, int x
, int y
);
206 BC_PopupTextBox
*popup
;
210 class BC_TumbleTextBoxText
;
211 class BC_TumbleTextBoxTumble
;
213 class BC_TumbleTextBox
216 BC_TumbleTextBox(BC_WindowBase
*parent_window
,
217 int64_t default_value
,
223 BC_TumbleTextBox(BC_WindowBase
*parent_window
,
230 BC_TumbleTextBox(BC_WindowBase
*parent_window
,
237 virtual ~BC_TumbleTextBox();
239 int create_objects();
241 virtual int handle_event();
243 int update(char *value
);
244 int update(int64_t value
);
245 int update(float value
);
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
;
261 int64_t default_value
, min
, max
;
262 float default_value_f
, min_f
, max_f
;
266 BC_TumbleTextBoxText
*textbox
;
268 BC_WindowBase
*parent_window
;
271 class BC_TumbleTextBoxText
: public BC_TextBox
274 BC_TumbleTextBoxText(BC_TumbleTextBox
*popup
,
275 int64_t default_value
,
280 BC_TumbleTextBoxText(BC_TumbleTextBox
*popup
,
286 BC_TumbleTextBoxText(BC_TumbleTextBox
*popup
, int x
, int y
);
287 virtual ~BC_TumbleTextBoxText();
289 BC_TumbleTextBox
*popup
;