Simple SFML GUI  0.2a
PanelTabbed.hpp
1 #ifndef PANELTABBED_HPP
2 #define PANELTABBED_HPP
3 
4 #include "PanelSplitted.hpp"
5 #include "PanelModelList.hpp"
6 
7 class PanelTabbed : public PanelSplitted {
8 private:
9  using PanelSplitted::getFirst;
10  using PanelSplitted::getSecond;
11  using PanelSplitted::addToFirst;
12  using PanelSplitted::addToSecond;
13  using PanelSplitted::setModelFirst;
14  using PanelSplitted::setModelSecond;
15  using PanelSplitted::setSplitButtonSize;
16  using PanelSplitted::setSplitPositionLimitFirst;
17  using PanelSplitted::setSplitPositionLimitSecond;
18  using PanelSplitted::setResizeable;
19  using PanelSplitted::setVisibleSplitButton;
20 
21 public:
22  PanelTabbed(bool autoResize = false);
23  void setTabWidth(float value);
24  void setTabHeight(float value);
25  virtual bool update(sf::Vector2f mp, bool pressLeft, bool pressRight, bool aboveHover);
26  virtual void draw(sf::RenderTarget& target, sf::RenderStates states);
27  void addTab(const sf::String& name, long long index = -1);
28  void addToTab(const sf::String& name, const ElementPtr& element, bool createNewTab = false);
29  void addToTab(long long index, const ElementPtr& element);
30  Button& getTabButton(const sf::String& name);
31  const Button& getTabButton(const sf::String& name) const;
32  Button& getTabButton(long long index);
33  const Button& getTabButton(long long index) const;
34 
35  PanelScrolled& getTabPanel(const sf::String& name);
36  const PanelScrolled& getTabPanel(const sf::String& name)const;
37  PanelScrolled& getTabPanel(long long index);
38  const PanelScrolled& getTabPanel(long long index)const;
39 
40  PanelScrolled& getTabHolder();
41  const PanelScrolled& getTabHolder()const;
42 
43  bool removeTab(const sf::String& name);
44  bool removeTab(long long index);
45  bool activateTab(const sf::String& name);
46  bool activateTab(long long index);
47  sf::String getActiveName();
48  void setTabGap(float value);
49  void setTabMaxAutoSize(float value);
50  virtual void setOrientation(Orientation orientation);
51  void setTabPosition(TabPosition value);
52  void refreshTabs();
53  void setTabMode(TabMode value);
54  size_t getTabCount()const;
55  void setAutoResize(bool value);
56 
57 private:
58  float tabWidth = 200.f;
59  float tabHeight = 50.f;
60  float tabGap = 10.f;
61  float tabMaxAutoSize = 200.f;
62 
63  bool autoResize = false;
64 
65  TabMode tabMode = TabMode::Fixed;
66  TabPosition tabPosition = TabPosition::Top;
67  PanelScrolledPtr selectedTab;
68  PanelScrolledPtr tabPanel;
69  PanelModelListPtr tabPanelModel;
70  ColorVector tabColorVector;
71 
72  std::vector<ButtonPtr> tabVec;
73  std::map<sf::String, PanelScrolledPtr> panelMap;
74 };
75 
76 typedef std::shared_ptr<PanelTabbed> PanelTabbedPtr;
77 
78 
79 #endif // PANELTABBED_HPP
Definition: PanelTabbed.hpp:7
Pressable button with some configuration options.
Definition: Button.hpp:41
Definition: PanelSplitted.hpp:11
Definition: PanelScrolled.hpp:7