xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
tab_control.h
Go to the documentation of this file.
1
4#pragma once
5#include "control.h"
6#include "image_list.h"
7#include "tab_alignment.h"
8
10namespace xtd {
12 namespace forms {
14 class tab_page;
16
27 public:
30
33 virtual tab_alignment alignment() const {return alignment_;}
37 virtual tab_control& alignment(tab_alignment alignment);
38
39 drawing::size default_size() const override {return {200, 100};}
40
44 virtual const forms::image_list& image_list() const {return image_list_;}
45 /*
49 virtual forms::image_list& image_list() {return image_list_;}
50 */
56
59 virtual size_t selected_index() const {return selected_index_;}
63 virtual tab_control& selected_index(size_t selected_index);
64
68 virtual control_collection& tab_pages() {return controls();}
72 virtual const control_collection& tab_pages() const {return controls();}
73
77
79 static const size_t npos = std::numeric_limits<size_t>::max();
80
81 protected:
82 forms::create_params create_params() const override;
83
85
86 void on_control_added(const control_event_args& e) override;
87
88 void on_control_removed(const control_event_args& e) override;
89
90 void on_handle_created(const event_args& e) override;
91
94 virtual void on_selected_index_changed(const event_args& e) {selected_index_changed(*this, e);}
95
96 void recreate_handle() override;
97
98 void wnd_proc(message& message) override;
99
101 virtual void wm_reflect_command(message& message);
102
103 friend class tab_page;
104 size_t get_child_index(intptr_t page) {
105 for (size_t index = 0;index < controls().size(); ++index)
106 if (controls()[index].get().handle() == page) return index;
107 return npos;
108 }
109 tab_alignment alignment_ = tab_alignment::top;
110 forms::image_list image_list_;
111 size_t selected_index_ = npos;
113 };
114 }
115}
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
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
Represents a collection of controls.
Definition: control.h:133
Provides data for the control_added and control_removed events.
Definition: control_event_args.h:23
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Provides methods to manage a collection of xtd::drawing::image objects. This class cannot be inherite...
Definition: image_list.h:25
Implements a Windows message.
Definition: message.h:25
Manages a related set of tab pages.
Definition: tab_control.h:26
virtual void on_selected_index_changed(const event_args &e)
Raises the tab_control::selected_index_changed event.
Definition: tab_control.h:94
forms::create_params create_params() const override
Gets the required creation parameters when the control handle is created.
drawing::size measure_control() const override
Measure this control.
void recreate_handle() override
Forces the re-creation of the handle for the control.
virtual control_collection & tab_pages()
Gets the collection of tab pages in this tab control.
Definition: tab_control.h:68
virtual const forms::image_list & image_list() const
Gets the images to display on the control's tabs.
Definition: tab_control.h:44
tab_control()
Initializes a new instance of the tab_control class.
void on_handle_created(const event_args &e) override
Raises the control::handle_created event.
virtual const control_collection & tab_pages() const
Gets the collection of tab pages in this tab control.
Definition: tab_control.h:72
void on_control_added(const control_event_args &e) override
Raises the control::control_added event.
virtual tab_control & image_list(const forms::image_list &value)
Sets the images to display on the control's tabs.
void on_control_removed(const control_event_args &e) override
Raises the control::control_removed event.
virtual tab_control & selected_index(size_t selected_index)
Sets the index of the currently selected tab page.
void wnd_proc(message &message) override
Processes Windows messages.
virtual size_t selected_index() const
Gets the index of the currently selected tab page.
Definition: tab_control.h:59
drawing::size default_size() const override
Gets the default size of the control.
Definition: tab_control.h:39
virtual tab_alignment alignment() const
Gets the area of the control (for example, along the top) where the tabs are aligned.
Definition: tab_control.h:33
virtual tab_control & alignment(tab_alignment alignment)
Sets 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:23
Contains xtd::forms::control control.
event< tab_control, event_handler > selected_index_changed
Occurs when the selected_index property has changed.
Definition: tab_control.h:76
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
@ e
The E key.
tab_alignment
Specifies the locations of the tabs in a tab control.
Definition: tab_alignment.h:18
Contains xtd::forms::image_list component.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::forms::tab_alignment enum class.