Go to the documentation of this file.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
00073 using CL_GUIComponent::get_named_item;
00074
00078 static CL_LineEdit *get_named_item(CL_GUIComponent *reference_component, const CL_StringRef &id);
00079
00083 Alignment get_alignment() const;
00084
00088 bool is_read_only() const;
00089
00093 bool is_lowercase() const;
00094
00098 bool is_uppercase() const;
00099
00103 bool is_password_mode() const;
00104
00108 int get_max_length() const;
00109
00113 CL_StringRef get_text() const;
00114
00116 int get_text_int() const;
00117
00119 float get_text_float() const;
00120
00124 CL_String get_selection() const;
00125
00129 int get_selection_start() const;
00130
00134 int get_selection_length() const;
00135
00139 int get_cursor_pos() const;
00140
00144 virtual CL_Size get_preferred_size() const;
00145
00147 CL_Size get_text_size();
00148
00154 CL_Size get_text_size(const CL_String &str);
00155
00159
00160 public:
00161 void set_select_all_on_focus_gain(bool enable);
00162
00164 void select_all();
00165
00169 void set_alignment(Alignment alignment);
00170
00174 void set_read_only(bool enable = true);
00175
00179 void set_lowercase(bool enable = true);
00180
00184 void set_uppercase(bool enable = true);
00185
00189 void set_password_mode(bool enable = true);
00190
00195 void set_numeric_mode(bool enable = true, bool decimals = false);
00196
00200 void set_max_length(int length);
00201
00205 void set_text(const CL_StringRef &text);
00206
00210 void set_text(int number);
00211
00216 void set_text(float number, int num_decimal_places = 6);
00217
00222 void set_selection(int pos, int length);
00223
00225 void clear_selection();
00226
00230 void set_cursor_pos(int pos);
00231
00233 void delete_selected_text();
00234
00236 void resize_to_fit(int max_width);
00237
00239 void set_input_mask(const CL_StringRef &mask);
00240
00244 void set_decimal_character(const CL_StringRef &decimal_char);
00245
00247 void set_cursor_drawing_enabled(bool enable);
00248
00252
00253 public:
00254 CL_Callback_v1<CL_InputEvent &> &func_before_edit_changed();
00255
00256 CL_Callback_v1<CL_InputEvent &> &func_after_edit_changed();
00257
00261 CL_Callback_v0 &func_selection_changed();
00262
00264 CL_Callback_v0 &func_focus_gained();
00265
00267 CL_Callback_v0 &func_focus_lost();
00268
00272 CL_Callback_v0 &func_enter_pressed();
00273
00277
00278 private:
00279 CL_SharedPtr<CL_LineEdit_Impl> impl;
00281 };
00282