xtd 0.2.0
Loading...
Searching...
No Matches
text_box_base.h
Go to the documentation of this file.
1
4#pragma once
5#include "border_sides.h"
6#include "border_style.h"
7#include "control.h"
8#include <xtd/argument_out_of_range_exception>
9#include <xtd/bit_converter>
10
12namespace xtd {
14 namespace forms {
26 class text_box_base : public control {
27 struct data;
28
29 public:
31
35 virtual bool accepts_tab() const noexcept;
39 virtual text_box_base& accepts_tab(bool value);
40
43 virtual forms::border_sides border_sides() const noexcept;
47
50 virtual forms::border_style border_style() const noexcept;
59 virtual text_box_base& border_style(std::nullptr_t);
60
64 std::vector<xtd::string> lines() const noexcept;
69 text_box_base& lines(const std::vector<xtd::string>& lines);
70
74 virtual bool multiline() const noexcept;
79 virtual text_box_base& multiline(bool value);
80
84 virtual bool read_only() const noexcept;
89 virtual text_box_base& read_only(bool value);
90
94 virtual size_t selection_length() const noexcept;
99 virtual text_box_base& selection_length(size_t value);
100
104 virtual size_t selection_start() const noexcept;
109 virtual text_box_base& selection_start(size_t value);
110
113 virtual bool word_wrap() const noexcept;
117 virtual text_box_base& word_wrap(bool value);
118
121 virtual void append_text(const xtd::string& value);
123
125
129 void clear();
130
135 virtual void select(size_t start, size_t length);
136
141
143
148
152
156
161
162 protected:
164
169
171
173 forms::create_params create_params() const noexcept override;
174 forms::cursor default_cursor() const noexcept override;
176
178
182 virtual void on_accepts_tab_changed(const event_args& e);
183
187
190 virtual void on_multiline_changed(const event_args& e);
191
194 virtual void on_read_only_changed(const event_args& e);
196
197 private:
198 xtd::sptr<data> data_;
199 };
200 }
201}
Contains xtd::forms::border_sides enum class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Represents an event.
Definition event.h:21
Defines the base class for controls, which are components with visual representation.
Definition control.h:81
Encapsulates the information needed when creating a control.
Definition create_params.h:29
Represents the image used to paint the mouse pointer.
Definition cursor.h:40
Implements the basic functionality required by text controls.
Definition text_box_base.h:26
virtual bool word_wrap() const noexcept
Indicates whether a multiline text box control automatically wraps words to the beginning of the next...
void select_all()
Selects all text in the text box.
forms::cursor default_cursor() const noexcept override
Gets the default cursor for the control.
virtual void on_read_only_changed(const event_args &e)
Raises the text_box_base::read_only_changed event.
virtual void on_border_style_changed(const event_args &e)
Raises the text_box_base::border_style_changed event.
event< text_box_base, event_handler > border_style_changed
Occurs when the value of the accepts_tab border_style has changed.
Definition text_box_base.h:151
virtual void on_accepts_tab_changed(const event_args &e)
Raises the text_box_base::accepts_tab_changed event.
virtual void on_multiline_changed(const event_args &e)
Raises the text_box_base::text_box_base::multiline_changed event.
std::vector< xtd::string > lines() const noexcept
Gets the lines of text in a text box control.
virtual bool read_only() const noexcept
Gets a value indicating whether text in the text box is read-only.
event< text_box_base, event_handler > multiline_changed
Occurs when the value of the accepts_tab border_style has changed.
Definition text_box_base.h:155
event< text_box_base, event_handler > read_only_changed
Occurs when the value of the read_only property has changed.
Definition text_box_base.h:159
virtual size_t selection_start() const noexcept
Gets o the starting point of text selected in the text box.
virtual bool multiline() const noexcept
Gets a value indicating whether this is a multiline text box control.
void clear()
Clears all text from the text box control.
event< text_box_base, event_handler > accepts_tab_changed
Occurs when the value of the accepts_tab property has changed.
Definition text_box_base.h:147
virtual void append_text(const xtd::string &value)
Appends text to the current text of a text box.
virtual size_t selection_length() const noexcept
Gets the number of characters selected in the text box.
virtual bool accepts_tab() const noexcept
Gets a value indicating whether pressing the TAB key in a multiline text box control types a TAB char...
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:32
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
border_sides
Specifies how a control anchors to the edges of its container.
Definition border_sides.h:23
border_style
Specifies the border style for a control.
Definition border_style.h:22
@ select
The SELECT key.
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::style_sheets::border_style class.
Contains xtd::forms::style_sheets::control class.