xtd - Reference Guide 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 {
22  class forms_export_ text_box : public text_box_base {
23  public:
25 
28  text_box();
30 
32 
37  virtual bool accepts_return() const {return accepts_return_;}
42  virtual text_box& accepts_return(bool value) {
43  if (accepts_return_ != value) {
44  accepts_return_ = value;
45  post_recreate_handle();
46  on_accepts_return_changed(event_args::empty);
47  }
48  return *this;
49  }
50 
54  virtual xtd::forms::character_casing character_casing() const {return character_casing_;}
60 
61  drawing::color default_back_color() const override {return xtd::forms::theme_colors::current_theme().text_box();}
62 
63  drawing::color default_fore_color() const override {return xtd::forms::theme_colors::current_theme().text_box_text();}
64 
69  virtual char32_t password_char() const {return password_char_;}
75  virtual text_box& password_char(char32_t value);
76 
81  size_t selection_length() const override;
82 
87  size_t selection_start() const override;
88 
89  const xtd::ustring& text() const override;
90  control& text(const xtd::ustring& text) override;
91 
95  virtual bool use_system_password_char() const {return use_system_password_char_;}
100  virtual text_box& use_system_password_char(bool value);
102 
104 
106  void append_text(const xtd::ustring& value) override;
107  void select(size_t start, size_t length) override;
109 
111 
118 
119  protected:
121 
123  forms::create_params create_params() const override;
124  drawing::size measure_control() const override;
125 
128  virtual void on_accepts_return_changed(const event_args& e) {if (can_raise_events()) accepts_return_changed(*this, e);}
129 
130  void on_handle_created(const event_args& e) override;
131  void on_text_changed(const event_args& e) override;
132 
136  void wnd_proc(message& message) override;
138 
140  void wm_key_char(message& message);
141  void wm_set_text(message& message);
143 
144  private:
145  bool accepts_return_ = false;
147  char32_t password_char_ = 0;
148  bool use_system_password_char_ = false;
149  };
150  }
151 }
virtual void on_accepts_return_changed(const event_args &e)
Raises the text_box::accepts_return_changed event.
Definition: text_box.h:128
virtual bool use_system_password_char() const
Gets a value indicating whether the text in the TextBox control should appear as the default password...
Definition: text_box.h:95
The default appearance defined by the control class.
drawing::color default_fore_color() const override
Gets the default foreground color of the control.
Definition: text_box.h:63
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
static const event_args empty
Provides a value to use with events that do not have event data.
Definition: event_args.h:25
virtual char32_t password_char() const
Gets the character used to mask characters of a password in a single-line TextBox control...
Definition: text_box.h:69
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:30
drawing::color default_back_color() const override
Gets the default background color of the control.
Definition: text_box.h:61
virtual size_t selection_start() const
Gets o the starting point of text selected in the text box.
Definition: text_box_base.h:137
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
virtual xtd::forms::character_casing character_casing() const
Gets whether the text_box control modifies the case of characters as they are typed.
Definition: text_box.h:54
virtual text_box & accepts_return(bool value)
Sets a value indicating whether pressing ENTER in a multiline text_box control creates a new line of ...
Definition: text_box.h:42
Implements the basic functionality required by text controls.
Definition: text_box_base.h:22
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
virtual size_t selection_length() const
Gets the number of characters selected in the text box.
Definition: text_box_base.h:124
Represents a standard Windows text box.
Definition: text_box.h:22
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:44
Represents an event.
Definition: event.h:21
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:18
Implements a Windows message.
Definition: message.h:25
Defines the base class for controls, which are components with visual representation.
Definition: control.h:73
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
virtual bool accepts_return() const
Gets a value indicating whether pressing ENTER in a multiline text_box control creates a new line of ...
Definition: text_box.h:37
Contains xtd::forms::border_style enum class.
The xtd::forms::status_bar_panel displays text in the standard font.
event< text_box, event_handler > accepts_return_changed
Occurs when the value of the accepts_return property has changed.
Definition: text_box.h:116