xtd 0.2.0
text_box_base.h
Go to the documentation of this file.
1 #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 
12 namespace xtd {
14  namespace forms {
24  class text_box_base : public control {
25  struct data;
26 
27  public:
29 
33  virtual bool accepts_tab() const noexcept;
37  virtual text_box_base& accepts_tab(bool value);
38 
41  virtual forms::border_sides border_sides() const noexcept;
45 
48  virtual forms::border_style border_style() const noexcept;
53 
57  std::vector<xtd::ustring> lines() const noexcept;
62  text_box_base& lines(const std::vector<xtd::ustring>& lines);
63 
67  virtual bool multiline() const noexcept;
72  virtual text_box_base& multiline(bool value);
73 
77  virtual bool read_only() const noexcept;
82  virtual text_box_base& read_only(bool value);
83 
87  virtual size_t selection_length() const noexcept;
92  virtual text_box_base& selection_length(size_t value);
93 
97  virtual size_t selection_start() const noexcept;
102  virtual text_box_base& selection_start(size_t value);
103 
106  virtual bool word_wrap() const noexcept;
110  virtual text_box_base& word_wrap(bool value);
111 
114  virtual void append_text(const xtd::ustring& value);
116 
118 
122  void clear();
123 
128  virtual void select(size_t start, size_t length);
129 
132  void select_all();
134 
136 
141 
145 
149 
154 
155  protected:
157 
160  text_box_base();
162 
164 
166  forms::cursor default_cursor() const noexcept override;
168 
170 
174  virtual void on_accepts_tab_changed(const event_args& e);
175 
178  virtual void on_border_style_changed(const event_args& e);
179 
182  virtual void on_multiline_changed(const event_args& e);
183 
186  virtual void on_read_only_changed(const event_args& e);
188 
189  private:
190  std::shared_ptr<data> data_;
191  };
192  }
193 }
virtual forms::border_style border_style() const noexcept
Gets the border type of the text box control.
virtual void on_accepts_tab_changed(const event_args &e)
Raises the text_box_base::accepts_tab_changed event.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
virtual forms::border_sides border_sides() const noexcept
Gets the border sides for the control.
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
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:152
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:140
Implements the basic functionality required by text controls.
Definition: text_box_base.h:24
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...
virtual bool word_wrap() const noexcept
Indicates whether a multiline text box control automatically wraps words to the beginning of the next...
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Represents the image used to paint the mouse pointer.
Definition: cursor.h:38
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:148
virtual bool multiline() const noexcept
Gets a value indicating whether this is a multiline text box control.
virtual void select(size_t start, size_t length)
Selects a range of text in the text box.
void select_all()
Selects all text in the text box.
std::vector< xtd::ustring > lines() const noexcept
Gets the lines of text in a text box control.
forms::cursor default_cursor() const noexcept override
Gets the default cursor for the control.
Represents an event.
Definition: event.h:21
virtual size_t selection_length() const noexcept
Gets the number of characters selected in the text box.
border_sides
Specifies how a control anchors to the edges of its container.
Definition: border_sides.h:21
virtual void append_text(const xtd::ustring &value)
Appends text to the current text of a text box.
border_style
Specifies the border style for a control.
Definition: border_style.h:20
virtual void on_read_only_changed(const event_args &e)
Raises the text_box_base::read_only_changed event.
Contains xtd::forms::border_sides enum class.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
virtual void on_multiline_changed(const event_args &e)
Raises the text_box_base::text_box_base::multiline_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:144
virtual bool read_only() const noexcept
Gets a value indicating whether text in the text box is read-only.
Contains xtd::forms::control control.
virtual void on_border_style_changed(const event_args &e)
Raises the text_box_base::border_style_changed event.
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.
text_box_base()
initializes a new instance of the text_box_base class.