xtd 0.2.0
Loading...
Searching...
No Matches
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
58 explicit tab_page_collection() = default;
60
62 explicit tab_page_collection(const base& collection);
64 tab_page_collection& operator =(const tab_page_collection& collection);
67
69
74 void add(const xtd::string& text);
78 void add(const xtd::string& text, const string& name);
79
84 iterator insert(const_iterator pos, const xtd::string& text);
89 iterator insert(const_iterator pos, const xtd::string& text, const xtd::string& name);
90
95 void insert_at(size_t index, const xtd::string& text);
100 void insert_at(size_t index, const xtd::string& text, const xtd::string& name);
102
104 void add(const char* text);
105 void add(const char8* text);
106 void add(const char16* text);
107 void add(const char32* text);
108 void add(const wchar* text);
110
112
114 using base::operator [];
119 std::optional<value_type> operator [](const xtd::string& name) const;
124 std::optional<value_type> operator [](const xtd::string& name);
126
128
134 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
140 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
141 void push_back(const xtd::string& text, const string& name);
142
143 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
144 void push_back(const char* text);
145 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
146 void push_back(const char8* text);
147 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
148 void push_back(const char16* text);
149 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
150 void push_back(const char32* text);
151 [[deprecated("Replaced by xtd::forms::tab_control::tab_page_collection::add - Will be removed in version 0.4.0.")]]
152 void push_back(const wchar* text);
154
155 private:
156 friend tab_control;
157 event<tab_page_collection, delegate<void(size_t index, const string& text, const string& name)>> text_added;
158 event<tab_page_collection, delegate<iterator(const_iterator pos, const string& text, const string& name)>> text_inserted;
159 };
160
162
167
170 tab_control(const tab_control&) = default;
171 tab_control& operator =(const tab_control&) = default;
173
175
179 virtual tab_alignment alignment() const noexcept;
184
188 virtual const forms::image_list& image_list() const noexcept;
189 /*
193 virtual forms::image_list& image_list() {return image_list_;}
194 */
199 virtual tab_control& image_list(const forms::image_list& value);
200
203 virtual size_t selected_index() const noexcept;
208
212 virtual tab_page_collection& tab_pages() noexcept;
216 virtual const tab_page_collection& tab_pages() const noexcept;
218
220
228 static tab_control create(const drawing::point& location);
233 static tab_control create(const drawing::point& location, const drawing::size& size);
239 static tab_control create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
248 static tab_control create(const control& parent, const drawing::point& location);
254 static tab_control create(const control& parent, const drawing::point& location, const drawing::size& size);
261 static tab_control create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
263
265
271
272 protected:
274
276 forms::create_params create_params() const noexcept override;
278
280
286 xtd::uptr<xtd::object> clone() const override;
287
288 drawing::size measure_control() const noexcept override;
289
290 void on_control_added(const control_event_args& e) override;
292
293 void on_handle_created(const event_args& e) override;
294
298
299 void wnd_proc(message& message) override;
301
303 friend class tab_page;
304 size_t get_child_index(intptr page);
306
307 private:
308 friend class xtd::forms::form;
309 using control::controls;
310
311 void on_tab_pages_item_added(xtd::size, tab_page_ref& item);
312 void on_tab_pages_item_removed(xtd::size, tab_page_ref& item);
313 void on_tab_pages_text_added(xtd::size index, const string& text, const string& name);
314 void on_tab_pages_text_inserted(xtd::size pos, const string& text, const string& name);
315
316 void wm_command_control(message& message);
317
318 xtd::sptr<data> data_;
319 };
320 }
321}
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:42
Represents a collection of controls.
Definition tab_control.hpp:44
void add(const xtd::string &text)
Adds an element to the end.
void push_back(const xtd::string &text, const string &name)
Adds an element to the end.
void add(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.
tab_page_collection()=default
Creates a new object xtd::forms::control::tab_page_collection with specified allocator (optional).
iterator insert(const_iterator pos, const xtd::string &text, const xtd::string &name)
Inserts specified element at specified position.
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.
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:269
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
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
xtd::ref< 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.