neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
tab_button.hpp
Go to the documentation of this file.
1// tab_button.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 "push_button.hpp"
24#include "i_tab.hpp"
25#include "i_tab_container.hpp"
26
27namespace neogfx
28{
29 class tab_button : public push_button, public i_tab
30 {
32 public:
34 define_declared_event(Deselected, deselected)
35 private:
36 friend class tab_bar;
37 class close_button;
38 public:
39 tab_button(i_tab_container& aContainer, std::string const& aText = std::string(), bool aClosable = false, bool aStandardImageSize = true);
40 tab_button(i_widget& aParent, i_tab_container& aContainer, std::string const& aText = std::string(), bool aClosable = false, bool aStandardImageSize = true);
41 tab_button(i_layout& aLayout, i_tab_container& aContainer, std::string const& aText = std::string(), bool aClosable = false, bool aStandardImageSize = true);
43 public:
44 const i_tab_container& container() const override;
46 bool closable() const override;
47 void set_closable(bool aClosable) override;
48 bool is_selected() const override;
49 bool is_deselected() const override;
50 void select() override;
51 public:
52 i_string const& text() const override;
53 i_tab& set_text(i_string const& aText) override;
54 i_tab& set_image(const i_texture& aTexture) override;
55 i_tab& set_image(const i_image& aImage) override;
56 public:
57 const i_widget& as_widget() const override;
58 i_widget& as_widget() override;
59 protected:
60 rect path_bounding_rect() const override;
61 bool spot_color() const override;
62 bool perform_hover_animation() const override;
63 protected:
64 neogfx::padding padding() const override;
65 void handle_clicked() override;
66 protected:
67 color palette_color(color_role aColorRole) const override;
68 protected:
70 bool update(const rect& aUpdateRect) override;
71 protected:
72 void mouse_entered(const point& aPosition) override;
73 void mouse_left() override;
74 protected:
75 void set_selected_state(bool aSelectedState);
76 private:
77 void init();
78 void update_appearance();
79 private:
80 i_tab_container& iContainer;
81 std::unique_ptr<close_button> iCloseButton;
82 bool iStandardImageSize;
83 bool iSelectedState;
84 widget_timer iUpdater;
85 sink iSink;
86 };
87}
i_tab_container & container() override
void select() override
neogfx::padding padding() const override
void set_selected_state(bool aSelectedState)
tab_button(i_tab_container &aContainer, std::string const &aText=std::string(), bool aClosable=false, bool aStandardImageSize=true)
void mouse_entered(const point &aPosition) override
rect path_bounding_rect() const override
void set_closable(bool aClosable) override
void mouse_left() override
color palette_color(color_role aColorRole) const override
tab_button(i_layout &aLayout, i_tab_container &aContainer, std::string const &aText=std::string(), bool aClosable=false, bool aStandardImageSize=true)
i_string const & text() const override
tab_button(i_widget &aParent, i_tab_container &aContainer, std::string const &aText=std::string(), bool aClosable=false, bool aStandardImageSize=true)
bool closable() const override
bool is_selected() const override
bool update(const rect &aUpdateRect) override
const i_widget & as_widget() const override
i_widget & as_widget() override
bool is_deselected() const override
const i_tab_container & container() const override
bool spot_color() const override
void handle_clicked() override
i_tab & set_image(const i_image &aImage) override
i_tab & set_image(const i_texture &aTexture) override
bool perform_hover_animation() const override
i_tab & set_text(i_string const &aText) override
bool update(bool aIncludeNonClient=false) override
Definition widget.ipp:1159
#define meta_object(...)
Definition i_object.hpp:28
#define define_declared_event(name, declName,...)
Definition event.hpp:195