neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
tab_bar.hpp
Go to the documentation of this file.
1// tab_bar.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>
23#include "scrollable_widget.hpp"
24#include "tab_button.hpp"
25
26namespace neogfx
27{
29 {
31 public:
32 define_declared_event(StyleChanged, style_changed)
33 private:
34 typedef std::unique_ptr<tab_button> tab_pointer;
35 typedef std::vector<tab_pointer> tab_list;
36 public:
37 typedef i_tab_container::tab_index tab_index;
38 public:
42 public:
43 bool closable_tabs() const noexcept override;
44 void set_closable_tabs(bool aClosableTabs) override;
47 void set_tab_icon_size(const size& aIconSize) override;
48 public:
49 neogfx::size_policy size_policy() const override;
50 size minimum_size(optional_size const& aAvailableSpace = optional_size{}) const override;
51 public:
52 bool has_tabs() const noexcept override;
53 uint32_t tab_count() const noexcept override;
54 tab_index index_of(const i_tab& aTab) const override;
55 const i_tab& tab(tab_index aTabIndex) const override;
56 i_tab& tab(tab_index aTabIndex) override;
57 bool is_tab_selected() const noexcept override;
58 const i_tab& selected_tab() const override;
59 i_tab& selected_tab() override;
60 i_tab& add_tab(i_string const& aTabText) override;
61 i_tab& insert_tab(tab_index aTabIndex, i_string const& aTabText) override;
62 void remove_tab(tab_index aTabIndex) override;
63 void show_tab(tab_index aTabIndex) override;
64 void hide_tab(tab_index aTabIndex) override;
65 optional_tab_index next_visible_tab(tab_index aStartFrom) const override;
67 void select_next_tab() override;
68 void select_previous_tab() override;
69 public:
70 void adding_tab(i_tab& aTab) override;
71 void selecting_tab(i_tab& aTab) override;
72 void removing_tab(i_tab& aTab) override;
73 public:
74 bool has_tab_page(tab_index aTabIndex) const override;
75 const i_tab_page& tab_page(tab_index aTabIndex) const override;
76 i_tab_page& tab_page(tab_index aTabIndex) override;
77 public:
78 bool has_parent_container() const override;
79 const i_tab_container& parent_container() const override;
81 public:
82 const i_widget& as_widget() const override;
83 i_widget& as_widget() override;
84 public:
85 bool visible() const override;
86 protected:
87 bool is_managing_layout() const override;
88 private:
89 void update_placement();
90 private:
91 i_tab_container& iContainer;
92 bool iClosableTabs;
94 size iIconSize = size{ 16.0, 16.0 };
95 tab_list iTabs;
96 std::optional<horizontal_layout> iHorizontalLayout;
97 std::optional<vertical_layout> iVerticalLayout;
98 };
99}
declare_event(style_changed) public typedef std::optional< tab_index > optional_tab_index
bool visible() const override
void select_previous_tab() override
bool closable_tabs() const noexcept override
const i_widget & as_widget() const override
tab_bar(i_widget &aParent, i_tab_container &aContainer, bool aClosableTabs=false, neogfx::tab_container_style aStyle=neogfx::tab_container_style::TabAlignmentTop)
bool is_tab_selected() const noexcept override
optional_tab_index next_visible_tab(tab_index aStartFrom) const override
uint32_t tab_count() const noexcept override
i_tab & insert_tab(tab_index aTabIndex, i_string const &aTabText) override
tab_index index_of(const i_tab &aTab) const override
tab_bar(i_layout &aLayout, i_tab_container &aContainer, bool aClosableTabs=false, neogfx::tab_container_style aStyle=neogfx::tab_container_style::TabAlignmentTop)
void hide_tab(tab_index aTabIndex) override
bool is_managing_layout() const override
void selecting_tab(i_tab &aTab) override
void show_tab(tab_index aTabIndex) override
bool has_parent_container() const override
tab_bar(i_tab_container &aContainer, bool aClosableTabs=false, neogfx::tab_container_style aStyle=neogfx::tab_container_style::TabAlignmentTop)
void remove_tab(tab_index aTabIndex) override
bool has_tabs() const noexcept override
const i_tab & selected_tab() const override
void set_tab_container_style(neogfx::tab_container_style aStyle) override
bool has_tab_page(tab_index aTabIndex) const override
optional_tab_index previous_visible_tab(tab_index aStartFrom) const override
void adding_tab(i_tab &aTab) override
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const override
const i_tab_container & parent_container() const override
i_tab & add_tab(i_string const &aTabText) override
const i_tab & tab(tab_index aTabIndex) const override
void select_next_tab() override
i_tab_container::tab_index tab_index
Definition tab_bar.hpp:37
void set_tab_icon_size(const size &aIconSize) override
neogfx::size_policy size_policy() const override
void removing_tab(i_tab &aTab) override
void set_closable_tabs(bool aClosableTabs) override
#define meta_object(...)
Definition i_object.hpp:28
#define define_declared_event(name, declName,...)
Definition event.hpp:195