xtd 0.2.0
text_box.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "border_style.hpp"
7#include "text_box_base.hpp"
8
10namespace xtd {
12 namespace forms {
32 struct data;
33
34 public:
36
41
43
48 virtual bool accepts_return() const noexcept;
53 virtual text_box& accepts_return(bool value);
54
58 virtual xtd::forms::character_casing character_casing() const noexcept;
64
69 virtual char32 password_char() const noexcept;
75 virtual text_box& password_char(char32 value);
76
79 const xtd::string& placeholder_text() const noexcept;
83 text_box& placeholder_text(const xtd::string& value);
84
89 size_t selection_length() const noexcept override;
90
95 size_t selection_start() const noexcept override;
96
97 const xtd::string& text() const noexcept override;
98 control& text(const xtd::string& text) override;
99
103 virtual bool use_system_password_char() const noexcept;
108 virtual text_box& use_system_password_char(bool value);
110
112
114 void append_text(const xtd::string& value) override;
115
116 void select(size_t start, size_t length) override;
118
120
124 static text_box create();
128 static text_box create(const drawing::point& location);
133 static text_box create(const drawing::point& location, const drawing::size& size);
139 static text_box create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
143 static text_box create(const xtd::string& text);
148 static text_box create(const xtd::string& text, const drawing::point& location);
154 static text_box create(const xtd::string& text, const drawing::point& location, const drawing::size& size);
161 static text_box create(const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
170 static text_box create(const control& parent, const drawing::point& location);
176 static text_box create(const control& parent, const drawing::point& location, const drawing::size& size);
183 static text_box create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
188 static text_box create(const control& parent, const xtd::string& text);
194 static text_box create(const control& parent, const xtd::string& text, const drawing::point& location);
201 static text_box create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size);
209 static text_box create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
211
213
219
220 protected:
222
224 forms::create_params create_params() const noexcept override;
225 drawing::color default_back_color() const noexcept override;
226 drawing::color default_fore_color() const noexcept override;
228
230
236 xtd::uptr<xtd::object> clone() const override;
237
238 drawing::size measure_control() const noexcept override;
239
243
244 void on_handle_created(const event_args& e) override;
245 void on_text_changed(const event_args& e) override;
246
250 void wnd_proc(message& message) override;
252
254 void wm_key_char(message& message);
255 void wm_set_text(message& message);
257
258 private:
259 xtd::sptr<data> data_;
260 };
261 }
262}
Contains xtd::forms::border_style enum class.
Contains xtd::forms::character_casing enum class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
text_box_base()
initializes a new instance of the text_box_base class.
drawing::color default_back_color() const noexcept override
Gets the default background color of the control.
virtual xtd::forms::character_casing character_casing() const noexcept
Gets whether the text_box control modifies the case of characters as they are typed.
drawing::color default_fore_color() const noexcept override
Gets the default foreground color of the control.
virtual char32 password_char() const noexcept
Gets the character used to mask characters of a password in a single-line TextBox control.
size_t selection_start() const noexcept override
Gets o the starting point of text selected in the text box.
void wnd_proc(message &message) override
Processes Windows messages.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
text_box()
initializes a new instance of the text_box class.
drawing::size measure_control() const noexcept override
Measure this control.
void append_text(const xtd::string &value) override
Appends text to the current text of a text box.
event< text_box, event_handler > accepts_return_changed
Occurs when the value of the accepts_return property has changed.
Definition text_box.hpp:217
virtual bool accepts_return() const noexcept
Gets a value indicating whether pressing ENTER in a multiline text_box control creates a new line of ...
const xtd::string & placeholder_text() const noexcept
Gets the text that is displayed when the control has no text and does not have the focus.
static text_box create()
A factory to create an xtd::forms::text_box.
size_t selection_length() const noexcept override
Gets the number of characters selected in the text box.
virtual bool use_system_password_char() const noexcept
Gets a value indicating whether the text in the TextBox control should appear as the default password...
virtual void on_accepts_return_changed(const event_args &e)
Raises the text_box::accepts_return_changed event.
const xtd::string & text() const noexcept override
Gets the text associated with this control.
void on_text_changed(const event_args &e) override
Raises the xtd::forms::control::text_changed event.
void select(size_t start, size_t length) override
Selects a range of text in the text box.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
@ e
The E key.
Definition keys.hpp:207
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::text_box_base control.