neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
tab_page_container.hpp
Go to the documentation of this file.
1// tab_page_container.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6This program is free software: you can redistribute it and / or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
27#include <neogfx/core/event.hpp>
30
31namespace neogfx
32{
33 template <typename Base = widget<>>
35 {
37 public:
38 define_declared_event(StyleChanged, style_changed)
39 define_declared_event(TabPageAdded, tab_page_added, i_tab_page&)
40 define_declared_event(TabPageRemoved, tab_page_removed, i_tab_page&)
41 define_declared_event(SelectedTabPageChanged, selected_tab_page_changed, i_tab_page&)
42 private:
43 typedef ref_ptr<i_tab_page> tab_page_pointer;
44 typedef std::map<const i_tab*, tab_page_pointer> tab_list;
45 public:
48 tab_page_container(i_widget& aParent, i_layout& aTabBarLayout, bool aClosableTabs = false, neogfx::tab_container_style aStyle = neogfx::tab_container_style::TabAlignmentTop);
50 tab_page_container(i_layout& aLayout, i_layout& aTabBarLayout, bool aClosableTabs = false, neogfx::tab_container_style aStyle = neogfx::tab_container_style::TabAlignmentTop);
52 public:
53 bool closable_tabs() const noexcept override;
54 void set_closable_tabs(bool aClosableTabs) override;
55 neogfx::tab_container_style tab_container_style() const noexcept override;
57 void set_tab_icon_size(const size& aIconSize) override;
58 public:
59 i_tab_container& tab_bar() override;
60 public:
61 i_layout& page_layout() override;
62 public:
63 bool has_tabs() const noexcept override;
64 uint32_t tab_count() const noexcept override;
65 tab_index index_of(const i_tab& aTab) const override;
66 const i_tab& tab(tab_index aTabIndex) const override;
67 i_tab& tab(tab_index aTabIndex) override;
68 bool has_tab_page(tab_index aTabIndex) const override;
69 const i_tab_page& tab_page(tab_index aTabIndex) const override;
70 i_tab_page& tab_page(tab_index aTabIndex) override;
71 bool is_tab_selected() const noexcept override;
72 const i_tab& selected_tab() const override;
73 i_tab& selected_tab() override;
74 const i_tab_page& selected_tab_page() const override;
75 i_tab_page& selected_tab_page() override;
76 i_tab& add_tab(i_string const& aTabText) override;
77 i_tab& insert_tab(tab_index aTabIndex, i_string const& aTabText) override;
78 void remove_tab(tab_index aTabIndex) override;
79 void show_tab(tab_index aTabIndex) override;
80 void hide_tab(tab_index aTabIndex) override;
81 optional_tab_index next_visible_tab(tab_index aStartFrom) const override;
82 optional_tab_index previous_visible_tab(tab_index aStartFrom) const override;
83 void select_next_tab() override;
84 void select_previous_tab() override;
85 public:
86 i_tab_page& add_tab_page(i_string const& aTabText) override;
87 i_tab_page& insert_tab_page(tab_index aTabIndex, i_string const& aTabText) override;
88 i_tab_page& add_tab_page(i_tab& aTab) override;
89 i_tab_page& add_tab_page(i_tab& aTab, i_tab_page& aWidget) override;
90 i_tab_page& add_tab_page(i_tab& aTab, i_ref_ptr<i_tab_page> const& aWidget) override;
91 void remove_tab_page(i_tab_page& aPage) override;
92 public:
93 void adding_tab(i_tab& aTab) override;
94 void selecting_tab(i_tab& aTab) override;
95 void removing_tab(i_tab& aTab) override;
96 public:
97 bool has_parent_container() const override;
98 const i_tab_container& parent_container() const override;
100 const i_widget& as_widget() const override;
101 i_widget& as_widget() override;
102 protected:
103 bool is_managing_layout() const override;
104 private:
105 void init();
106 void update_tab_bar_placement();
107 private:
108 tab_list iTabs;
109 border_layout iContainerLayout;
110 neogfx::tab_bar iTabBar;
111 };
112}
declare_event(style_changed) public typedef std::optional< tab_index > optional_tab_index
const i_widget & as_widget() const override
void adding_tab(i_tab &aTab) override
void selecting_tab(i_tab &aTab) override
bool closable_tabs() const noexcept override
void set_tab_icon_size(const size &aIconSize) override
i_tab_container & tab_bar() override
const i_tab_page & selected_tab_page() const override
i_tab & insert_tab(tab_index aTabIndex, i_string const &aTabText) override
i_tab_page & insert_tab_page(tab_index aTabIndex, i_string const &aTabText) override
const i_tab & tab(tab_index aTabIndex) const override
void hide_tab(tab_index aTabIndex) override
bool is_managing_layout() const override
void show_tab(tab_index aTabIndex) override
i_tab & add_tab(i_string const &aTabText) override
void removing_tab(i_tab &aTab) override
void remove_tab_page(i_tab_page &aPage) override
optional_tab_index previous_visible_tab(tab_index aStartFrom) const override
optional_tab_index next_visible_tab(tab_index aStartFrom) const override
bool has_tab_page(tab_index aTabIndex) const override
bool is_tab_selected() const noexcept override
uint32_t tab_count() const noexcept override
void remove_tab(tab_index aTabIndex) override
tab_index index_of(const i_tab &aTab) const override
void set_tab_container_style(neogfx::tab_container_style aStyle) override
bool has_parent_container() const override
bool has_tabs() const noexcept override
void set_closable_tabs(bool aClosableTabs) override
const i_tab_container & parent_container() const override
neogfx::tab_container_style tab_container_style() const noexcept override
const i_tab & selected_tab() const override
i_layout & page_layout() override
i_tab_page & add_tab_page(i_string const &aTabText) override
#define meta_object(...)
Definition i_object.hpp:28
#define define_declared_event(name, declName,...)
Definition event.hpp:195