xtd 0.2.0
Loading...
Searching...
No Matches
tab_control.h
Go to the documentation of this file.
1
4#pragma once
5
7#include "control.h"
8#include "image_list.h"
9#include "tab_alignment.h"
10#include "tab_page_ref.h"
11#include <xtd/size_object>
12
14namespace xtd {
16 namespace forms {
18 class form;
20
38 struct data;
39
40 public:
43 public:
45
50
52
57 explicit tab_page_collection(const allocator_type& allocator = allocator_type());
59
61 explicit tab_page_collection(const base& collection);
63 tab_page_collection& operator =(const tab_page_collection& collection);
66
68
79 iterator insert(const_iterator pos, const xtd::ustring& text, const xtd::ustring& name);
80
85 void insert_at(size_t index, const xtd::ustring& text);
90 void insert_at(size_t index, const xtd::ustring& text, const xtd::ustring& name);
91
95 void push_back(const xtd::ustring& text);
99 void push_back(const xtd::ustring& text, const ustring& name);
100
102
104 void push_back(const char* text);
105#if defined(__cpp_lib_char8_t)
106 void push_back(const char8* text);
107#endif
108 void push_back(const char16* text);
109 void push_back(const char32* text);
110 void push_back(const wchar* text);
112
114
116 using base::operator [];
121 std::optional<value_type> operator [](const xtd::ustring& name) const;
126 std::optional<value_type> operator [](const xtd::ustring& name);
128 private:
129 friend tab_control;
130 event<tab_page_collection, delegate<void(size_t index, const ustring& text, const ustring& name)>> text_added;
131 event<tab_page_collection, delegate<iterator(const_iterator pos, const ustring& text, const ustring& name)>> text_inserted;
132 };
133
135
138 static const size_t npos = size_object::max_value;
140
142
147
150 tab_control(const tab_control&) = default;
151 tab_control& operator =(const tab_control&) = default;
153
155
159 virtual tab_alignment alignment() const noexcept;
163 virtual tab_control& alignment(tab_alignment alignment);
164
168 virtual const forms::image_list& image_list() const noexcept;
169 /*
173 virtual forms::image_list& image_list() {return image_list_;}
174 */
179 virtual tab_control& image_list(const forms::image_list& value);
180
183 virtual size_t selected_index() const noexcept;
187 virtual tab_control& selected_index(size_t selected_index);
188
192 virtual tab_page_collection& tab_pages() noexcept;
196 virtual const tab_page_collection& tab_pages() const noexcept;
198
200
204 static tab_control create();
208 static tab_control create(const drawing::point& location);
213 static tab_control create(const drawing::point& location, const drawing::size& size);
219 static tab_control create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
223 static tab_control create(const control& parent);
228 static tab_control create(const control& parent, const drawing::point& location);
234 static tab_control create(const control& parent, const drawing::point& location, const drawing::size& size);
241 static tab_control create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
243
245
249 event<tab_control, event_handler> selected_index_changed;
251
252 protected:
254
256 forms::create_params create_params() const noexcept override;
258
260
266 std::unique_ptr<xtd::object> clone() const override;
267
268 drawing::size measure_control() const noexcept override;
269
270 void on_control_added(const control_event_args& e) override;
271 void on_control_removed(const control_event_args& e) override;
272
273 void on_handle_created(const event_args& e) override;
274
277 virtual void on_selected_index_changed(const event_args& e);
278
279 void wnd_proc(message& message) override;
281
283 friend class tab_page;
284 size_t get_child_index(intptr page);
286
287 private:
288 friend class xtd::forms::form;
289 using control::controls;
290
291 void on_tab_pages_item_added(size_t, tab_page_ref& item);
292 void on_tab_pages_item_removed(size_t, tab_page_ref& item);
293 void on_tab_pages_text_added(size_t index, const ustring& text, const ustring& name);
294 tab_page_collection::iterator on_tab_pages_text_inserted(tab_page_collection::const_iterator pos, const ustring& text, const ustring& name);
295
296 void wm_command_control(message& message);
297
298 std::shared_ptr<data> data_;
299 };
300 }
301}
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
Provides data for the xtd::forms::control::control_added and xtd::forms::control::control_removed eve...
Definition control_event_args.h:25
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
Encapsulates the information needed when creating a control.
Definition create_params.h:27
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:52
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition image_list.h:28
Represents a collection of objects.
Definition arranged_element_collection.h:32
typename std::vector< value_type >::iterator iterator
Represents the iterator type of the collection.
Definition arranged_element_collection.h:83
std::allocator< value_type > allocator_type
Represents the allocator type of the collection.
Definition arranged_element_collection.h:69
typename std::vector< value_type >::const_iterator const_iterator
Represents the const iterator type of the collection.
Definition arranged_element_collection.h:85
Implements a Windows message.
Definition message.h:26
Represents a collection of controls.
Definition tab_control.h:42
void push_back(const xtd::ustring &text)
Adds an element to the end.
void push_back(const xtd::ustring &text, const ustring &name)
Adds an element to the end.
void insert_at(size_t index, const xtd::ustring &text, const xtd::ustring &name)
Inserts specified element at specified index.
tab_page_collection(const allocator_type &allocator=allocator_type())
Creates a new object xtd::forms::control::tab_page_collection with specified allocator (optional).
iterator insert(const_iterator pos, const xtd::ustring &text, const xtd::ustring &name)
Inserts specified element at specified position.
iterator insert(const_iterator pos, const xtd::ustring &text)
Inserts specified element at specified position.
void insert_at(size_t index, const xtd::ustring &text)
Inserts specified element at specified index.
Manages a related set of tab pages.
Definition tab_control.h:37
tab_control()
Initializes a new instance of the tab_control class.
virtual tab_alignment alignment() const noexcept
Gets the area of the control (for example, along the top) where the tabs are aligned.
Represents a single tab page in a tab_control.
Definition tab_page.h:31
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::forms::const_tab_page_ref typedef.
generic_event_handler<> event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.h:32
#define forms_export_
Define shared library export.
Definition forms_export.h:13
xtd::forms::style_sheets::control form
The form data allows you to specify the box of a form control.
Definition form.h:21
char8_t char8
Represents a 8-bit unicode character.
Definition types.h:64
wchar_t wchar
Represents a wide character.
Definition types.h:286
char16_t char16
Represents a 16-bit unicode character.
Definition types.h:76
size_t size
Represents a size of any object in bytes.
Definition types.h:197
char32_t char32
Represents a 32-bit unicode character.
Definition types.h:87
intmax_t intptr
Represent a pointer or a handle.
Definition types.h:153
tab_alignment
Specifies the locations of the tabs in a tab control.
Definition tab_alignment.h:20
std::reference_wrapper< tab_page > tab_page_ref
Represents a tab_page reference.
Definition tab_page_ref.h:23
Contains xtd::forms::image_list component.
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::control class.
Contains xtd::forms::tab_alignment enum class.
Contains xtd::forms::tab_page_ref typedef.