xtd 0.2.0
tab_control.h
Go to the documentation of this file.
1 #pragma once
5 #include "const_tab_page_ref.h"
6 #include "control.h"
7 #include "image_list.h"
8 #include "tab_alignment.h"
9 #include "tab_page_ref.h"
10 
12 namespace xtd {
14  namespace forms {
16  class form;
18 
35  class forms_export_ tab_control : public control {
36  struct data;
37 
38  public:
41  public:
43 
48 
50 
55  explicit tab_page_collection(const allocator_type& allocator = allocator_type());
57 
59  explicit tab_page_collection(const base& collection);
60  tab_page_collection(const tab_page_collection& collection);
61  tab_page_collection& operator =(const tab_page_collection& collection);
64 
66 
72  iterator insert(const_iterator pos, const xtd::ustring& text);
77  iterator insert(const_iterator pos, const xtd::ustring& text, const xtd::ustring& name);
78 
83  void insert_at(size_t index, const xtd::ustring& text);
88  void insert_at(size_t index, const xtd::ustring& text, const xtd::ustring& name);
89 
93  void push_back(const xtd::ustring& text);
97  void push_back(const xtd::ustring& text, const ustring& name);
98 
100 
102  void push_back(const char* text);
103 #if defined(__cpp_lib_char8_t)
104  void push_back(const char8* text);
105 #endif
106  void push_back(const char16* text);
107  void push_back(const char32* text);
108  void push_back(const wchar* text);
110 
112 
114  using base::operator [];
119  std::optional<value_type> operator [](const xtd::ustring& name) const;
124  std::optional<value_type> operator [](const xtd::ustring& name);
126  private:
127  friend tab_control;
130  };
131 
133 
136  static const size_t npos = std::numeric_limits<size_t>::max();
138 
140 
143  tab_control();
145 
147 
151  virtual tab_alignment alignment() const noexcept;
155  virtual tab_control& alignment(tab_alignment alignment);
156 
160  virtual const forms::image_list& image_list() const noexcept;
161  /*
165  virtual forms::image_list& image_list() {return image_list_;}
166  */
171  virtual tab_control& image_list(const forms::image_list& value);
172 
175  virtual size_t selected_index() const noexcept;
179  virtual tab_control& selected_index(size_t selected_index);
180 
184  virtual tab_page_collection& tab_pages() noexcept;
188  virtual const tab_page_collection& tab_pages() const noexcept;
190 
192 
194  //using control::create;
201  static tab_control create(const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
209  static tab_control create(const control& parent, const drawing::point& location = {-1, -1}, const drawing::size& size = {-1, -1}, const xtd::ustring& name = xtd::ustring::empty_string);
211 
213 
219 
220  protected:
222 
224  forms::create_params create_params() const noexcept override;
226 
228 
230  drawing::size measure_control() const noexcept override;
231 
232  void on_control_added(const control_event_args& e) override;
233  void on_control_removed(const control_event_args& e) override;
234 
235  void on_handle_created(const event_args& e) override;
236 
239  virtual void on_selected_index_changed(const event_args& e);
240 
241  void wnd_proc(message& message) override;
243 
245  friend class tab_page;
246  size_t get_child_index(intptr page);
248 
249  private:
250  friend class xtd::forms::form;
251  using control::controls;
252 
253  void on_tab_pages_item_added(size_t, control_ref item);
254  void on_tab_pages_item_removed(size_t, control_ref item);
255  void on_tab_pages_text_added(size_t index, const ustring& text, const ustring& name);
256  tab_page_collection::iterator on_tab_pages_text_inserted(tab_page_collection::const_iterator pos, const ustring& text, const ustring& name);
257 
258  void wm_command_control(message& message);
259 
260  std::shared_ptr<data> data_;
261  };
262  }
263 }
Contains xtd::forms::tab_page_ref typedef.
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition: image_list.h:28
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
The INSERT key.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
tab_alignment
Specifies the locations of the tabs in a tab control.
Definition: tab_alignment.h:20
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:31
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::forms::const_tab_page_ref typedef.
Encapsulates the information needed when creating a control.
Definition: create_params.h:27
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Represents a collection of objects.
Definition: arranged_element_collection.h:31
event< tab_control, event_handler > selected_index_changed
Occurs when the selected_index property has changed.
Definition: tab_control.h:217
Represents a window or dialog box that makes up an application&#39;s user interface.
Definition: form.h:52
Represents an event.
Definition: event.h:21
Contains xtd::forms::image_list component.
Represents a collection of controls.
Definition: tab_control.h:40
Manages a related set of tab pages.
Definition: tab_control.h:35
Implements a Windows message.
Definition: message.h:26
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
xtd::forms::style_sheets::control form
The form data allows you to specify the box of a form control.
Definition: form.h:21
Represents a single tab page in a tab_control.
Definition: tab_page.h:31
Contains xtd::forms::tab_alignment enum class.
char32_t char32
Represents a 32-bit unicode character.
Definition: types.h:85
std::allocator< value_type > allocator_type
Represents the allocator type of the collection.
Definition: arranged_element_collection.h:68
Contains xtd::forms::control control.
Provides data for the xtd::forms::control::control_added and xtd::forms::control::control_removed eve...
Definition: control_event_args.h:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static const ustring empty_string
Represents the empty string.
Definition: ustring.h:53
typename std::vector< value_type >::iterator iterator
Represents the iterator type of the collection.
Definition: arranged_element_collection.h:82
std::reference_wrapper< control > control_ref
Represents a control reference.
Definition: control_ref.h:23
Specifies that both the x and y coordinates of the control are defined.
char8_t char8
Represents a 8-bit unicode character.
Definition: types.h:62
char16_t char16
Represents a 16-bit unicode character.
Definition: types.h:74
The xtd::forms::status_bar_panel displays text in the standard font.
size_t size
Represents a size of any object in bytes.
Definition: types.h:195
wchar_t wchar
Represents a wide character.
Definition: types.h:284