5#ifndef INCLUDE_FIFECHAN_WIDGETS_TABBEDAREA_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_TABBEDAREA_HPP_
14#include "fifechan/actionlistener.hpp"
15#include "fifechan/keylistener.hpp"
16#include "fifechan/mouselistener.hpp"
17#include "fifechan/platform.hpp"
18#include "fifechan/widget.hpp"
19#include "fifechan/widgets/container.hpp"
32 class FIFEGUI_API TabbedArea :
public ActionListener,
public KeyListener,
public MouseListener,
public Widget
39 ~TabbedArea()
override;
41 TabbedArea(TabbedArea
const &) =
delete;
42 TabbedArea& operator=(TabbedArea
const &) =
delete;
43 TabbedArea(TabbedArea&&) =
delete;
44 TabbedArea& operator=(TabbedArea&&) =
delete;
178 void setSize(
int width,
int height);
310 std::vector<std::pair<Tab*, Widget*>>
mTabs;
Represents an action trigger (e.g., button click).
A composite widget capable of holding and managing child widgets.
LayoutPolicy
The layout policy of the container.
Base class for all GUI event objects.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Represents a mouse event.
Represents a rectangular area (X, Y, Width, Height).
A single tab label used within a TabbedArea.
Container * mTabContainer
Holds the container for the tabs.
bool mOpaque
True if the tabbed area is opaque, false otherwise.
virtual bool isUniformSize() const
True if the tab container tries to expand the childs to a uniform size.
void resizeToContent(bool recursion) override
Resize this widget to fit its content.
virtual unsigned int getHorizontalSpacing() const
Get the horizontal spacing between rows.
virtual unsigned int getVerticalSpacing() const
Get the vertical spacing between rows.
virtual int getSelectedTabIndex() const
Gets the index of the selected tab.
Rectangle getChildrenArea() override
Gets the area of the widget occupied by the widget's children.
void setHeight(int height)
Set the height of the tabbed area in pixels.
void mousePressed(MouseEvent &mouseEvent) override
Called when a mouse button has been pressed on the widget area.
virtual void setUniformSize(bool uniform)
If enabled, the free space is distributed in a way that the size of the childrens will be equal (if p...
void setDimension(Rectangle const &dimension)
Set the area dimension for the tabbed area.
virtual void death(Event const &event)
DeathListener callback invoked when a child widget dies.
virtual bool isTabSelected(unsigned int index) const
Checks if a tab given an index is selected or not.
virtual void setHorizontalSpacing(unsigned int spacing)
Set the horizontal spacing between columns.
virtual void setSelectedTab(unsigned int index)
Sets a tab given an index to be selected.
void setLayout(Container::LayoutPolicy policy)
Sets the layout of the tabbedarea.
void setBaseColor(Color const &color) override
Set the base/background color used for the tabbed area.
virtual void addTab(Tab *tab, Widget *widget)
Adds a tab to the tabbed area.
void action(ActionEvent const &actionEvent) override
Called when an action is received from a widget.
void adjustTabPositions()
Adjusts the positions of the tabs.
void setSize(int width, int height)
Set the size (width and height) of the tabbed area in pixels.
void keyPressed(KeyEvent &keyEvent) override
Called if a key is pressed when the widget has keyboard focus.
void setWidth(int width)
Set the width of the tabbed area in pixels.
Container * mWidgetContainer
Holds the container for the widgets.
Widget * getBackgroundWidget()
Get the background widget, or nullptr if none is set.
void adjustSize() override
Adjusts the size of the tab container and the widget container.
std::vector< std::unique_ptr< Tab > > mTabsToDelete
Holds a vector of tabs to delete in the destructor.
Container::LayoutPolicy getLayout() const
Gets the layout of the tabbedarea.
std::vector< std::pair< Tab *, Widget * > > mTabs
A map between a tab and a widget to display when the tab is selected.
void setBackgroundWidget(Widget *widget)
Set the background widget which is drawn behind tabs.
int getNumberOfTabs() const
Returns the number of tabs in this tabbed area.
virtual void removeTabWithIndex(unsigned int index)
Removes a tab from the tabbed area.
virtual void setVerticalSpacing(unsigned int spacing)
Set the vertical spacing between rows.
void setOpaque(bool opaque)
Sets the tabbed area to be opaque or not.
Tab * getSelectedTab() const
Gets the selected tab.
virtual void removeTab(Tab *tab)
Removes a tab from the tabbed area.
bool isOpaque() const
Checks if the tabbed area is opaque or not.
Tab * mSelectedTab
Holds the selected tab.
void draw(Graphics *graphics) override
Draws the widget.
void expandContent(bool recursion) override
Expands child widgets to fit this widget's size.