xtd 1.0.0
Loading...
Searching...
No Matches
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 [[nodiscard]] virtual auto accepts_return() const noexcept -> bool;
53 virtual auto accepts_return(bool value) -> text_box&;
54
58 [[nodiscard]] virtual auto character_casing() const noexcept -> xtd::forms::character_casing;
64
69 [[nodiscard]] virtual auto password_char() const noexcept -> xtd::char32;
75 virtual auto password_char(xtd::char32 value) -> text_box&;
76
79 [[nodiscard]] auto placeholder_text() const noexcept -> const xtd::string&;
83 auto placeholder_text(const xtd::string& value) -> text_box&;
84
89 [[nodiscard]] auto selection_length() const noexcept -> xtd::usize override;
90
95 [[nodiscard]] auto selection_start() const noexcept -> xtd::usize override;
96
97 [[nodiscard]] auto text() const noexcept -> const xtd::string& override;
98 auto text(const xtd::string& text) -> xtd::forms::control& override;
99
103 [[nodiscard]] virtual auto use_system_password_char() const noexcept -> bool;
108 virtual auto use_system_password_char(bool value) -> text_box&;
110
112
114 auto append_text(const xtd::string& value) -> void override;
115
116 auto select(xtd::usize start, xtd::usize length) -> void override;
118
120
124 [[nodiscard]] static auto create() -> text_box;
128 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> text_box;
133 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> text_box;
139 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> text_box;
143 [[nodiscard]] static auto create(const xtd::string& text) -> text_box;
148 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location) -> text_box;
154 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> text_box;
161 [[nodiscard]] static auto create(const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> text_box;
165 [[nodiscard]] static auto create(const xtd::forms::control& parent) -> text_box;
170 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location) -> text_box;
176 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> text_box;
183 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> text_box;
188 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text) -> text_box;
194 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location) -> text_box;
201 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size) -> text_box;
209 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::string& text, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> text_box;
211
213
219
220 protected:
222
224 [[nodiscard]] auto create_params() const noexcept -> xtd::forms::create_params override;
225 [[nodiscard]] auto default_back_color() const noexcept -> xtd::drawing::color override;
226 [[nodiscard]] auto default_fore_color() const noexcept -> xtd::drawing::color override;
228
230
232 [[nodiscard]] auto measure_control() const noexcept -> xtd::drawing::size override;
233
236 virtual auto on_accepts_return_changed(const xtd::event_args& e) -> void;
237
238 auto on_handle_created(const xtd::event_args& e) -> void override;
239 auto on_text_changed(const xtd::event_args& e) -> void override;
240
244 auto wnd_proc(xtd::forms::message& message) -> void override;
246
248 auto wm_key_char(xtd::forms::message& message) -> void;
249 auto wm_set_text(xtd::forms::message& message) -> void;
251
252 private:
253 xtd::sptr<data> data_;
254 };
255 }
256}
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:23
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Implements the basic functionality required by text controls.
Definition text_box_base.hpp:26
text_box_base()
initializes a new instance of the text_box_base class.
auto default_back_color() const noexcept -> xtd::drawing::color override
Gets the default background color of the control.
auto create_params() const noexcept -> xtd::forms::create_params override
Gets the required creation parameters when the control handle is created.
virtual auto character_casing() const noexcept -> xtd::forms::character_casing
Gets whether the text_box control modifies the case of characters as they are typed.
auto default_fore_color() const noexcept -> xtd::drawing::color override
Gets the default foreground color of the control.
auto placeholder_text() const noexcept -> const xtd::string &
Gets the text that is displayed when the control has no text and does not have the focus.
text_box()
initializes a new instance of the text_box class.
xtd::event< text_box, xtd::event_handler > accepts_return_changed
Occurs when the value of the accepts_return property has changed.
Definition text_box.hpp:217
virtual auto password_char() const noexcept -> xtd::char32
Gets the character used to mask characters of a password in a single-line TextBox control.
auto append_text(const xtd::string &value) -> void override
Appends text to the current text of a text box.
auto on_handle_created(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::handle_created event.
virtual auto on_accepts_return_changed(const xtd::event_args &e) -> void
Raises the text_box::accepts_return_changed event.
auto selection_start() const noexcept -> xtd::usize override
Gets o the starting point of text selected in the text box.
virtual auto use_system_password_char() const noexcept -> bool
Gets a value indicating whether the text in the TextBox control should appear as the default password...
auto measure_control() const noexcept -> xtd::drawing::size override
Measure this control.
static auto create() -> text_box
A factory to create an xtd::forms::text_box.
auto wnd_proc(xtd::forms::message &message) -> void override
Processes Windows messages.
auto select(xtd::usize start, xtd::usize length) -> void override
Selects a range of text in the text box.
auto on_text_changed(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::text_changed event.
auto text() const noexcept -> const xtd::string &override
Gets the text associated with this control.
virtual auto accepts_return() const noexcept -> bool
Gets a value indicating whether pressing ENTER in a multiline text_box control creates a new line of ...
auto selection_length() const noexcept -> xtd::usize override
Gets the number of characters selected in the text box.
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
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
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 auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
constexpr auto length() const noexcept -> size_type
Returns the length of the current read_only_span.
Definition read_only_span.hpp:213
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::text_box_base control.