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
40 struct data;
41
42 public:
45 public:
47
52
54
59 explicit tab_page_collection(const allocator_type& allocator = allocator_type());
61
63 explicit tab_page_collection(const base& collection);
65 tab_page_collection& operator =(const tab_page_collection& collection);
68
70
81 iterator insert(const_iterator pos, const xtd::string& text, const xtd::string& name);
82
87 void insert_at(size_t index, const xtd::string& text);
92 void insert_at(size_t index, const xtd::string& text, const xtd::string& name);
93
97 void push_back(const xtd::string& text);
101 void push_back(const xtd::string& text, const string& name);
102
104
106 void push_back(const char* text);
107#if defined(__xtd__cpp_lib_char8_t)
108 void push_back(const char8* text);
109#endif
110 void push_back(const char16* text);
111 void push_back(const char32* text);
112 void push_back(const wchar* text);
114
116
118 using base::operator [];
123 std::optional<value_type> operator [](const xtd::string& name) const;
128 std::optional<value_type> operator [](const xtd::string& name);
130 private:
131 friend tab_control;
132 event<tab_page_collection, delegate<void(size_t index, const string& text, const string& name)>> text_added;
133 event<tab_page_collection, delegate<iterator(const_iterator pos, const string& text, const string& name)>> text_inserted;
134 };
135
137
140 static constexpr xtd::size npos = size_object::max_value;
142
144
149
152 tab_control(const tab_control&) = default;
153 tab_control& operator =(const tab_control&) = default;
155
157
161 virtual tab_alignment alignment() const noexcept;
165 virtual tab_control& alignment(tab_alignment alignment);
166
170 virtual const forms::image_list& image_list() const noexcept;
171 /*
175 virtual forms::image_list& image_list() {return image_list_;}
176 */
181 virtual tab_control& image_list(const forms::image_list& value);
182
185 virtual size_t selected_index() const noexcept;
189 virtual tab_control& selected_index(size_t selected_index);
190
194 virtual tab_page_collection& tab_pages() noexcept;
198 virtual const tab_page_collection& tab_pages() const noexcept;
200
202
206 static tab_control create();
210 static tab_control create(const drawing::point& location);
215 static tab_control create(const drawing::point& location, const drawing::size& size);
221 static tab_control create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
225 static tab_control create(const control& parent);
230 static tab_control create(const control& parent, const drawing::point& location);
236 static tab_control create(const control& parent, const drawing::point& location, const drawing::size& size);
243 static tab_control create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
245
247
251 event<tab_control, event_handler> selected_index_changed;
253
254 protected:
256
258 forms::create_params create_params() const noexcept override;
260
262
268 xtd::uptr<xtd::object> clone() const override;
269
270 drawing::size measure_control() const noexcept override;
271
272 void on_control_added(const control_event_args& e) override;
273 void on_control_removed(const control_event_args& e) override;
274
275 void on_handle_created(const event_args& e) override;
276
279 virtual void on_selected_index_changed(const event_args& e);
280
281 void wnd_proc(message& message) override;
283
285 friend class tab_page;
286 size_t get_child_index(intptr page);
288
289 private:
290 friend class xtd::forms::form;
291 using control::controls;
292
293 void on_tab_pages_item_added(size_t, tab_page_ref& item);
294 void on_tab_pages_item_removed(size_t, tab_page_ref& item);
295 void on_tab_pages_text_added(size_t index, const string& text, const string& name);
296 tab_page_collection::iterator on_tab_pages_text_inserted(tab_page_collection::const_iterator pos, const string& text, const string& name);
297
298 void wm_command_control(message& message);
299
300 xtd::sptr<data> data_;
301 };
302 }
303}
Represents text as a sequence of character units.
Definition basic_string.h:79
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:27
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 a window or dialog box that makes up an application's user interface.
Definition form.h:54
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition image_list.h:30
Represents a collection of objects.
Definition arranged_element_collection.h:34
typename std::vector< value_type >::iterator iterator
Represents the iterator type of the collection.
Definition arranged_element_collection.h:85
std::allocator< value_type > allocator_type
Represents the allocator type of the collection.
Definition arranged_element_collection.h:71
typename std::vector< value_type >::const_iterator const_iterator
Represents the const iterator type of the collection.
Definition arranged_element_collection.h:87
Implements a Windows message.
Definition message.h:28
Represents a collection of controls.
Definition tab_control.h:44
void push_back(const xtd::string &text, const string &name)
Adds an element to the end.
void push_back(const xtd::string &text)
Adds an element to the end.
void insert_at(size_t index, const xtd::string &text)
Inserts specified element at specified index.
iterator insert(const_iterator pos, const xtd::string &text, const xtd::string &name)
Inserts specified element at specified position.
tab_page_collection(const allocator_type &allocator=allocator_type())
Creates a new object xtd::forms::control::tab_page_collection with specified allocator (optional).
void insert_at(size_t index, const xtd::string &text, const xtd::string &name)
Inserts specified element at specified index.
iterator insert(const_iterator pos, const xtd::string &text)
Inserts specified element at specified position.
Manages a related set of tab pages.
Definition tab_control.h:39
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:33
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:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.h:27
wchar_t wchar
Represents a wide character.
Definition wchar.h:24
char16_t char16
Represents a 16-bit unicode character.
Definition char16.h:26
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
size_t size
Represents a size of any object in bytes.
Definition size.h:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.h:26
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
tab_alignment
Specifies the locations of the tabs in a tab control.
Definition tab_alignment.h:22
std::reference_wrapper< tab_page > tab_page_ref
Represents a tab_page reference.
Definition tab_page_ref.h:25
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.