00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00032
00033 #pragma once
00034
00035 #include "../api_gui.h"
00036 #include "../gui_component.h"
00037 #include "../../Display/Window/input_event.h"
00038 #include "../../Core/Signals/callback_v0.h"
00039 #include "../../Core/Signals/callback_v1.h"
00040 #include "../../Core/Signals/callback_1.h"
00041
00042 class CL_LineEdit_Impl;
00043
00047 class CL_API_GUI CL_LineEdit : public CL_GUIComponent
00048 {
00051
00052 public:
00053
00057 CL_LineEdit(CL_GUIComponent *parent);
00058
00059 virtual ~CL_LineEdit();
00060
00064
00065 public:
00066 enum Alignment
00067 {
00068 align_left,
00069 align_center,
00070 align_right
00071 };
00072
00076 Alignment get_alignment() const;
00077
00081 bool is_read_only() const;
00082
00086 bool is_lowercase() const;
00087
00091 bool is_uppercase() const;
00092
00096 bool is_password_mode() const;
00097
00101 int get_max_length() const;
00102
00106 CL_StringRef get_text() const;
00107
00109 int get_text_int() const;
00110
00112 float get_text_float() const;
00113
00117 CL_String get_selection() const;
00118
00122 int get_selection_start() const;
00123
00127 int get_selection_length() const;
00128
00132 int get_cursor_pos() const;
00133
00137 virtual CL_Size get_preferred_size() const;
00138
00140 CL_Size get_text_size();
00141
00147 CL_Size get_text_size(const CL_String &str);
00148
00152
00153 public:
00154 void set_select_all_on_focus_gain(bool enable);
00155
00157 void select_all();
00158
00162 void set_alignment(Alignment alignment);
00163
00167 void set_read_only(bool enable = true);
00168
00172 void set_lowercase(bool enable = true);
00173
00177 void set_uppercase(bool enable = true);
00178
00182 void set_password_mode(bool enable = true);
00183
00188 void set_numeric_mode(bool enable = true, bool decimals = false);
00189
00193 void set_max_length(int length);
00194
00198 void set_text(const CL_StringRef &text);
00199
00203 void set_text(int number);
00204
00208 void set_text(float number);
00209
00214 void set_selection(int pos, int length);
00215
00217 void clear_selection();
00218
00222 void set_cursor_pos(int pos);
00223
00225 void delete_selected_text();
00226
00228 void resize_to_fit(int max_width);
00229
00231 void set_input_mask(const CL_StringRef &mask);
00232
00236 void set_decimal_character(const CL_StringRef &decimal_char);
00237
00239 void set_cursor_drawing_enabled(bool enable);
00240
00244
00245 public:
00246 CL_Callback_v1<CL_InputEvent> &func_before_edit_changed();
00247
00248 CL_Callback_v1<CL_InputEvent> &func_after_edit_changed();
00249
00253 CL_Callback_v0 &func_selection_changed();
00254
00256 CL_Callback_v0 &func_focus_gained();
00257
00259 CL_Callback_v0 &func_focus_lost();
00260
00264 CL_Callback_v0 &func_enter_pressed();
00265
00269
00270 private:
00271 CL_SharedPtr<CL_LineEdit_Impl> impl;
00273 };
00274