xtd 0.2.0
tab_control.hpp
Go to the documentation of this file.
1
4#pragma once
5
7#include "control.hpp"
8#include "image_list.hpp"
9#include "tab_alignment.hpp"
10#include "tab_page_ref.hpp"
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
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
101 void push_back(const xtd::string& text, const string& name);
102
104
106 void push_back(const char* text);
107 void push_back(const char8* text);
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::string& name) const;
126 std::optional<value_type> operator [](const xtd::string& name);
128 private:
129 friend tab_control;
130 event<tab_page_collection, delegate<void(size_t index, const string& text, const string& name)>> text_added;
131 event<tab_page_collection, delegate<iterator(const_iterator pos, const string& text, const string& name)>> text_inserted;
132 };
133
135
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;
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;
188
192 virtual tab_page_collection& tab_pages() noexcept;
196 virtual const tab_page_collection& tab_pages() const noexcept;
198
200
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::string& name);
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::string& name);
243
245
251
252 protected:
254
256 forms::create_params create_params() const noexcept override;
258
260
266 xtd::uptr<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;
272
273 void on_handle_created(const event_args& e) override;
274
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 string& text, const string& name);
294 tab_page_collection::iterator on_tab_pages_text_inserted(tab_page_collection::const_iterator pos, const string& text, const string& name);
295
296 void wm_command_control(message& message);
297
298 xtd::sptr<data> data_;
299 };
300 }
301}
static constexpr size_t max_value
Definition box_integer.hpp:67
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Provides data for the xtd::forms::control::control_added and xtd::forms::control::control_removed eve...
Definition control_event_args.hpp:27
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual const xtd::string & name() const noexcept
Gets the name of the control.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
size_t get_child_index(intptr child) const
Retrieves the index of a control within the control collection.
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a collection of objects.
Definition arranged_element_collection.hpp:35
typename std::vector< value_type >::iterator iterator
Definition arranged_element_collection.hpp:86
std::allocator< value_type > allocator_type
Definition arranged_element_collection.hpp:72
typename std::vector< value_type >::const_iterator const_iterator
Definition arranged_element_collection.hpp:88
Represents a collection of controls.
Definition tab_control.hpp: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).
xtd::forms::layout::arranged_element_collection< tab_page_ref > base
Represents the base type of the collection.
Definition tab_control.hpp:50
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.
virtual void on_selected_index_changed(const event_args &e)
Raises the tab_control::selected_index_changed event.
virtual const forms::image_list & image_list() const noexcept
Gets the images to display on the control's tabs.
tab_control()
Initializes a new instance of the tab_control class.
static constexpr xtd::size npos
This is a special value equal to the maximum value representable by the type size_t.
Definition tab_control.hpp:138
void on_handle_created(const event_args &e) override
Raises the xtd::forms::control::handle_created event.
void on_control_added(const control_event_args &e) override
Raises the xtd::forms::control::control_added event.
virtual tab_page_collection & tab_pages() noexcept
Gets the collection of tab pages in this tab control.
virtual size_t selected_index() const noexcept
Gets the index of the currently selected tab page.
drawing::size measure_control() const noexcept override
Measure this control.
void on_control_removed(const control_event_args &e) override
Raises the xtd::forms::control::control_removed event.
void wnd_proc(message &message) override
Processes Windows messages.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
static tab_control create()
A factory to create an xtd::forms::tab_control.
virtual tab_alignment alignment() const noexcept
Gets the area of the control (for example, along the top) where the tabs are aligned.
event< tab_control, event_handler > selected_index_changed
Occurs when the selected_index property has changed.
Definition tab_control.hpp:249
Represents a single tab page in a tab_control.
Definition tab_page.hpp:33
Contains xtd::forms::const_tab_page_ref typedef.
Contains xtd::forms::control control.
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
tab_alignment
Specifies the locations of the tabs in a tab control.
Definition tab_alignment.hpp:22
std::reference_wrapper< tab_page > tab_page_ref
Represents a tab_page reference.
Definition tab_page_ref.hpp:25
@ e
The E key.
Definition keys.hpp:207
Contains xtd::forms::image_list component.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::tab_alignment enum class.
Contains xtd::forms::tab_page_ref typedef.