xtd 0.2.0
text_box.h
Go to the documentation of this file.
1 #pragma once
5 #include "border_style.h"
6 #include "character_casing.h"
7 #include "text_box_base.h"
8 
10 namespace xtd {
12  namespace forms {
29  class forms_export_ text_box : public text_box_base {
30  struct data;
31 
32  public:
34 
37  text_box();
39 
41 
46  virtual bool accepts_return() const noexcept;
51  virtual text_box& accepts_return(bool value);
52 
56  virtual xtd::forms::character_casing character_casing() const noexcept;
62 
67  virtual char32 password_char() const noexcept;
73  virtual text_box& password_char(char32 value);
74 
77  const xtd::ustring& placeholder_text() const noexcept;
81  text_box& placeholder_text(const xtd::ustring& value);
82 
87  size_t selection_length() const noexcept override;
88 
93  size_t selection_start() const noexcept override;
94 
95  const xtd::ustring& text() const noexcept override;
96  control& text(const xtd::ustring& text) override;
97 
101  virtual bool use_system_password_char() const noexcept;
106  virtual text_box& use_system_password_char(bool value);
108 
110 
112  void append_text(const xtd::ustring& value) override;
113  void select(size_t start, size_t length) override;
115 
117 
123 
124  protected:
126 
128  forms::create_params create_params() const noexcept override;
129  drawing::color default_back_color() const noexcept override;
130  drawing::color default_fore_color() const noexcept override;
132 
134 
136  drawing::size measure_control() const noexcept override;
137 
140  virtual void on_accepts_return_changed(const event_args& e);
141 
142  void on_handle_created(const event_args& e) override;
143  void on_text_changed(const event_args& e) override;
144 
148  void wnd_proc(message& message) override;
150 
152  void wm_key_char(message& message);
153  void wm_set_text(message& message);
155 
156  private:
157  std::shared_ptr<data> data_;
158  };
159  }
160 }
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
virtual size_t selection_start() const noexcept
Gets o the starting point of text selected in the text box.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Implements the basic functionality required by text controls.
Definition: text_box_base.h:24
Encapsulates the information needed when creating a control.
Definition: create_params.h:27
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Represents a standard Windows text box.
Definition: text_box.h:29
Represents an event.
Definition: event.h:21
virtual size_t selection_length() const noexcept
Gets the number of characters selected in the text box.
The system-defined color of the accent color (macos specific. On other platform is same as window)...
Contains xtd::forms::character_casing enum class.
Contains xtd::forms::text_box_base control.
The SELECT key.
character_casing
Specifies the case of characters in a text_box control.
Definition: character_casing.h:20
Implements a Windows message.
Definition: message.h:26
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
char32_t char32
Represents a 32-bit unicode character.
Definition: types.h:85
event< text_box, event_handler > accepts_return_changed
Occurs when the value of the accepts_return property has changed.
Definition: text_box.h:121
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Contains xtd::forms::border_style enum class.
The xtd::forms::status_bar_panel displays text in the standard font.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195