FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::TabbedArea Class Reference

#include <tabbedarea.hpp>

Inheritance diagram for fcn::TabbedArea:
fcn::ActionListener fcn::KeyListener fcn::MouseListener fcn::Widget

Public Member Functions

void action (ActionEvent const &actionEvent) override
virtual void addTab (Tab *tab, Widget *widget)
void adjustSize () override
virtual void death (Event const &event)
void draw (Graphics *graphics) override
void expandContent ()
void expandContent (bool recursion) override
WidgetgetBackgroundWidget ()
Rectangle getChildrenArea () override
virtual unsigned int getHorizontalSpacing () const
Container::LayoutPolicy getLayout () const
int getNumberOfTabs () const
Tab * getSelectedTab () const
virtual int getSelectedTabIndex () const
virtual unsigned int getVerticalSpacing () const
bool isOpaque () const
virtual bool isTabSelected (Tab *tab) const
virtual bool isTabSelected (unsigned int index) const
virtual bool isUniformSize () const
void keyPressed (KeyEvent &keyEvent) override
void mousePressed (MouseEvent &mouseEvent) override
TabbedArea & operator= (TabbedArea &&)=delete
TabbedArea & operator= (TabbedArea const &)=delete
virtual void removeTab (Tab *tab)
virtual void removeTabWithIndex (unsigned int index)
void resizeToContent ()
void resizeToContent (bool recursion) override
void setBackgroundWidget (Widget *widget)
void setBaseColor (Color const &color) override
void setDimension (Rectangle const &dimension)
void setHeight (int height)
virtual void setHorizontalSpacing (unsigned int spacing)
void setLayout (Container::LayoutPolicy policy)
void setOpaque (bool opaque)
virtual void setSelectedTab (Tab *tab)
virtual void setSelectedTab (unsigned int index)
void setSize (int width, int height)
virtual void setUniformSize (bool uniform)
virtual void setVerticalSpacing (unsigned int spacing)
void setWidth (int width)
 TabbedArea (TabbedArea &&)=delete
 TabbedArea (TabbedArea const &)=delete
Public Member Functions inherited from fcn::ActionListener
 ActionListener (ActionListener &&)=delete
 ActionListener (ActionListener const &)=delete
ActionListener & operator= (ActionListener &&)=delete
ActionListener & operator= (ActionListener const &)=delete
Public Member Functions inherited from fcn::KeyListener
 KeyListener (KeyListener &&)=default
 KeyListener (KeyListener const &)=default
virtual void keyReleased (KeyEvent &keyEvent)
KeyListener & operator= (KeyListener &&)=default
KeyListener & operator= (KeyListener const &)=default
Public Member Functions inherited from fcn::MouseListener
virtual void mouseClicked (MouseEvent &mouseEvent)
virtual void mouseDragged (MouseEvent &mouseEvent)
virtual void mouseEntered (MouseEvent &mouseEvent)
virtual void mouseExited (MouseEvent &mouseEvent)
 MouseListener (MouseListener &&)=default
 MouseListener (MouseListener const &)=default
virtual void mouseMoved (MouseEvent &mouseEvent)
virtual void mouseReleased (MouseEvent &mouseEvent)
virtual void mouseWheelMovedDown (MouseEvent &mouseEvent)
virtual void mouseWheelMovedLeft (MouseEvent &mouseEvent)
virtual void mouseWheelMovedRight (MouseEvent &mouseEvent)
virtual void mouseWheelMovedUp (MouseEvent &mouseEvent)
MouseListener & operator= (MouseListener &&)=default
MouseListener & operator= (MouseListener const &)=default
Public Member Functions inherited from fcn::Widget
virtual void _draw (Graphics *graphics)
virtual FocusHandler_getFocusHandler ()
virtual std::list< FocusListener * > const & _getFocusListeners ()
virtual FocusHandler_getInternalFocusHandler ()
virtual std::list< KeyListener * > const & _getKeyListeners ()
virtual std::list< MouseListener * > const & _getMouseListeners ()
virtual void _logic ()
virtual void _setFocusHandler (FocusHandler *focusHandler)
virtual void _setParent (Widget *parent)
void adaptLayout ()
virtual void adaptLayout (bool top)
void addActionListener (ActionListener *actionListener)
void addDeathListener (DeathListener *deathListener)
void addFocusListener (FocusListener *focusListener)
void addKeyListener (KeyListener *keyListener)
void addMouseListener (MouseListener *mouseListener)
void addWidgetListener (WidgetListener *widgetListener)
virtual void drawBorder (Graphics *graphics)
virtual void drawOutline (Graphics *graphics)
virtual void drawSelectionFrame (Graphics *graphics)
void expandContent ()
virtual void focusNext ()
virtual void focusPrevious ()
virtual void fontChanged ()
virtual void getAbsolutePosition (int &x, int &y) const
std::string const & getActionEventId () const
Color const & getBackgroundColor () const
Color const & getBaseColor () const
Color const & getBorderColor () const
unsigned int getBorderSize () const
unsigned int getChildrenCount () const
Rectangle const & getDimension () const
Size const & getFixedSize () const
FontgetFont () const
Color const & getForegroundColor () const
int getHeight () const
std::string const & getId () const
void getLastPosition (int &x, int &y) const
int getMarginBottom () const
int getMarginLeft () const
int getMarginRight () const
int getMarginTop () const
Size const & getMaxSize () const
Size const & getMinSize () const
Color const & getOutlineColor () const
unsigned int getOutlineSize () const
unsigned int getPaddingBottom () const
unsigned int getPaddingLeft () const
unsigned int getPaddingRight () const
unsigned int getPaddingTop () const
virtual WidgetgetParent () const
Color const & getSelectionColor () const
SelectionMode getSelectionMode () const
virtual WidgetgetTop () const
unsigned int getVisibleChildrenCount () const
WidgetgetWidgetAt (int x, int y)
virtual WidgetgetWidgetAt (int x, int y, Widget *exclude)
std::list< Widget * > getWidgetsIn (Rectangle const &area)
virtual std::list< Widget * > getWidgetsIn (Rectangle const &area, Widget *ignore)
int getWidth () const
int getX () const
int getY () const
bool isEnabled () const
bool isFixedSize () const
bool isFocusable () const
virtual bool isFocused () const
bool isHorizontalExpand () const
bool isLastPositionSet () const
virtual bool isLayouted ()
virtual bool isModalFocusable () const
virtual bool isModalFocused () const
virtual bool isModalMouseInputFocusable () const
virtual bool isModalMouseInputFocused () const
bool isSetVisible () const
bool isTabInEnabled () const
bool isTabOutEnabled () const
bool isVerticalExpand () const
bool isVisible () const
virtual void logic ()
virtual void moveToBottom (Widget *widget)
virtual void moveToTop (Widget *widget)
Widgetoperator= (Widget &&)=delete
Widgetoperator= (Widget const &)=delete
virtual void releaseModalFocus ()
virtual void releaseModalMouseInputFocus ()
void removeActionListener (ActionListener *actionListener)
void removeDeathListener (DeathListener *deathListener)
void removeFocusListener (FocusListener *focusListener)
void removeKeyListener (KeyListener *keyListener)
void removeMouseListener (MouseListener *mouseListener)
void removeWidgetListener (WidgetListener *widgetListener)
virtual void requestFocus ()
virtual void requestModalFocus ()
virtual void requestModalMouseInputFocus ()
virtual void requestMoveToBottom ()
virtual void requestMoveToTop ()
void resizeToContent ()
void setActionEventId (std::string const &actionEventId)
virtual void setBackgroundColor (Color const &color)
virtual void setBorderColor (Color const &color)
void setBorderSize (unsigned int size)
void setDimension (Rectangle const &dimension)
void setEnabled (bool enabled)
void setFixedSize (Size const &size)
void setFocusable (bool focusable)
virtual void setFont (Font *font)
virtual void setForegroundColor (Color const &color)
void setHeight (int height)
void setHorizontalExpand (bool expand)
void setId (std::string const &id)
void setInternalFocusHandler (FocusHandler *internalFocusHandler)
void setLastPosition (int x, int y)
void setMargin (int margin)
void setMarginBottom (int margin)
void setMarginLeft (int margin)
void setMarginRight (int margin)
void setMarginTop (int margin)
void setMaxSize (Size const &size)
void setMinSize (Size const &size)
virtual void setOutlineColor (Color const &color)
void setOutlineSize (unsigned int size)
void setPadding (unsigned int padding)
void setPaddingBottom (unsigned int padding)
void setPaddingLeft (unsigned int padding)
void setPaddingRight (unsigned int padding)
void setPaddingTop (unsigned int padding)
void setPosition (int x, int y)
virtual void setSelectionColor (Color const &color)
virtual void setSelectionMode (SelectionMode mode)
void setSize (int width, int height)
void setTabInEnabled (bool enabled)
void setTabOutEnabled (bool enabled)
void setVerticalExpand (bool expand)
void setVisible (bool visible)
void setWidth (int width)
void setX (int x)
void setY (int y)
virtual void showPart (Rectangle rectangle)
virtual void showWidgetPart (Widget *widget, Rectangle area)
 Widget ()
 Widget (Widget &&)=delete
 Widget (Widget const &)=delete

Protected Member Functions

void adjustTabPositions ()
Protected Member Functions inherited from fcn::ActionListener
 ActionListener ()=default
Protected Member Functions inherited from fcn::KeyListener
 KeyListener ()=default
Protected Member Functions inherited from fcn::MouseListener
 MouseListener ()=default
Protected Member Functions inherited from fcn::Widget
void add (Widget *widget)
void calculateSize ()
void distributeActionEvent ()
void distributeAncestorHiddenEvent (Widget *ancestor)
void distributeAncestorMovedEvent (Widget *ancestor)
void distributeAncestorShownEvent (Widget *ancestor)
void distributeHiddenEvent ()
void distributeMovedEvent ()
void distributeResizedEvent ()
void distributeShownEvent ()
virtual WidgetfindWidgetById (std::string const &id)
std::list< Widget * > const & getChildren () const
virtual void remove (Widget *widget)
virtual void removeAllChildren ()
void resizeToChildren ()

Protected Attributes

bool mOpaque {false}
Tab * mSelectedTab {nullptr}
ContainermTabContainer
std::vector< std::pair< Tab *, Widget * > > mTabs
std::vector< std::unique_ptr< Tab > > mTabsToDelete
ContainermWidgetContainer
Protected Attributes inherited from fcn::Widget
std::string mActionEventId
std::list< ActionListener * > mActionListeners
Color mBackgroundColor {0xf9fafb}
Color mBaseColor {0xe5e7eb}
Color mBorderColor {0xd1d5db}
unsigned int mBorderSize {0}
std::list< Widget * > mChildren
FontmCurrentFont {nullptr}
std::list< DeathListener * > mDeathListeners
Rectangle mDimension
bool mEnabled {true}
Size mFixedSize {-1, -1}
bool mFixedSizeUsed {false}
bool mFocusable {false}
FocusHandlermFocusHandler {nullptr}
std::list< FocusListener * > mFocusListeners
Color mForegroundColor {0x1f2933}
bool mHExpand {false}
std::string mId
FocusHandlermInternalFocusHandler {nullptr}
std::list< KeyListener * > mKeyListeners
int mLastX {0}
int mLastY {0}
int mMarginBottom {0}
int mMarginLeft {0}
int mMarginRight {0}
int mMarginTop {0}
Size mMaxSize {std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}
Size mMinSize {0, 0}
std::list< MouseListener * > mMouseListeners
Rectangle mOffsetRect
Color mOutlineColor {0x9ca3af}
unsigned int mOutlineSize {0}
unsigned int mPaddingBottom {0}
unsigned int mPaddingLeft {0}
unsigned int mPaddingRight {0}
unsigned int mPaddingTop {0}
WidgetmParent {nullptr}
Color mSelectionColor {0x3b82f6}
SelectionMode mSelectionMode {SelectionMode::None}
bool mTabIn {true}
bool mTabOut {true}
bool mVExpand {false}
bool mVisible {true}
std::list< WidgetListener * > mWidgetListeners

Friends

class Tab

Additional Inherited Members

Public Types inherited from fcn::Widget
enum class  SelectionMode : uint8_t { None = 0 , Border = 1 , Background = 2 }
Static Public Member Functions inherited from fcn::Widget
static DeathListener_getGuiDeathListener ()
static VisibilityEventHandler_getVisibilityEventHandler ()
static void _setGuiDeathListener (DeathListener *deathListener)
static void _setVisibilityEventHandler (VisibilityEventHandler *visibilityEventHandler)
static void setGlobalFont (Font *font)
static bool widgetExists (Widget const *widget)
Static Protected Attributes inherited from fcn::Widget
static DefaultFont mDefaultFont
static FontmGlobalFont = nullptr
static DeathListenermGuiDeathListener = nullptr
static VisibilityEventHandlermVisibilityEventHandler = nullptr
static std::list< Widget * > mWidgetInstances

Detailed Description

A container organizing content into selectable tabs.

A tabbed area where a user can display a widget by selecting a tab.

Definition at line 32 of file tabbedarea.hpp.

Constructor & Destructor Documentation

◆ TabbedArea()

fcn::TabbedArea::TabbedArea ( )

Definition at line 18 of file tabbedarea.cpp.

◆ ~TabbedArea()

fcn::TabbedArea::~TabbedArea ( )
override

Definition at line 34 of file tabbedarea.cpp.

Member Function Documentation

◆ action()

void fcn::TabbedArea::action ( ActionEvent const & actionEvent)
overridevirtual

Called when an action is received from a widget.

It is used to receive notifications about actions that have occurred. The actionEvent contains information about the action.

Parameters
actionEventThe event of the action.

Implements fcn::ActionListener.

Definition at line 438 of file tabbedarea.cpp.

References action(), fcn::Event::getSource(), setSelectedTab(), and fcn::Widget::Widget().

Referenced by action().

◆ addTab()

void fcn::TabbedArea::addTab ( Tab * tab,
Widget * widget )
virtual

Adds a tab to the tabbed area.

The tab will not be deleted by the tabbed area when it is removed.

Parameters
tabThe tab widget for the tab.
widgetThe widget to view when the tab is selected.
See also
removeTab, removeTabWithIndex

Definition at line 43 of file tabbedarea.cpp.

References fcn::Widget::adaptLayout(), fcn::Widget::addActionListener(), addTab(), fcn::Widget::getBaseColor(), fcn::Container::getLayout(), getLayout(), mSelectedTab, mTabContainer, mTabs, fcn::Widget::setBaseColor(), fcn::Container::setLayout(), setSelectedTab(), fcn::Tab::setTabbedArea(), and fcn::Widget::Widget().

Referenced by addTab().

◆ adjustSize()

void fcn::TabbedArea::adjustSize ( )
overridevirtual

Adjusts the size of the tab container and the widget container.

Reimplemented from fcn::Widget.

Definition at line 268 of file tabbedarea.cpp.

References adjustSize(), fcn::Widget::getHeight(), getLayout(), fcn::Widget::getWidth(), mTabContainer, mTabs, and mWidgetContainer.

Referenced by adjustSize(), expandContent(), resizeToContent(), setDimension(), setHeight(), setSize(), and setWidth().

◆ adjustTabPositions()

void fcn::TabbedArea::adjustTabPositions ( )
protected

◆ death()

void fcn::TabbedArea::death ( Event const & event)
virtual

DeathListener callback invoked when a child widget dies.

Definition at line 427 of file tabbedarea.cpp.

References death(), and removeTab().

Referenced by death().

◆ draw()

void fcn::TabbedArea::draw ( Graphics * graphics)
overridevirtual

Draws the widget.

The call to draw is initiated by the widget's parent. The graphics object is set up so that all drawing is relative to the widget, i.e coordinate (0,0) is the top left corner of the widget. It is not possible to draw outside of a widget's dimension. If a widget has children, the parent's draw function will always be called before the children's draw functions are called.

NOTE: A widget with children won't draw its children unless the children area given by Widget::getChildrenArea returns a none empty rectangle inside the widgets dimension. The children area is considered relative to the widget's position.

Parameters
Graphics & RenderingA graphics object to draw with.
See also
getChildrenArea, drawOutline, drawBorder

Implements fcn::Widget.

Definition at line 198 of file tabbedarea.cpp.

References fcn::Color::a, draw(), fcn::Graphics::drawLine(), fcn::Graphics::fillRectangle(), fcn::Widget::getBaseColor(), fcn::Widget::getHeight(), fcn::Widget::getWidth(), isOpaque(), mSelectedTab, mTabContainer, and fcn::Graphics::setColor().

Referenced by draw().

◆ expandContent() [1/2]

void fcn::Widget::expandContent ( )
inline

Expands the child widgets to the size of this widget, calls recursively all childs.

This is a convenience wrapper that calls expandContent(true).

Definition at line 1440 of file widget.hpp.

◆ expandContent() [2/2]

void fcn::TabbedArea::expandContent ( bool recursion)
overridevirtual

Expands child widgets to fit this widget's size.

Parameters
recursionIf true, call expandContent recursively on children.

Reimplemented from fcn::Widget.

Definition at line 258 of file tabbedarea.cpp.

References adjustSize(), adjustTabPositions(), expandContent(), mTabContainer, and mWidgetContainer.

Referenced by expandContent().

◆ getBackgroundWidget()

Widget * fcn::TabbedArea::getBackgroundWidget ( )

Get the background widget, or nullptr if none is set.

Definition at line 193 of file tabbedarea.cpp.

References getBackgroundWidget(), mTabContainer, and fcn::Widget::Widget().

Referenced by getBackgroundWidget().

◆ getChildrenArea()

Rectangle fcn::TabbedArea::getChildrenArea ( )
overridevirtual

Gets the area of the widget occupied by the widget's children.

By default this method returns an empty rectangle as not all widgets are containers. If you want to make a container this method should return the area where the children resides. This method is used when drawing children of a widget when computing clip rectangles for the children.

NOTE: The returned rectangle should be relative to the widget, i.e a rectangle with x and y coordinate (0,0) and with width and height the same as the widget will let the children draw themselves in the whole widget.

An example of a widget that overloads this method is ScrollArea. A ScrollArea has a view of its constant and that view is the children area. The size of a ScrollArea's children area might vary depending on if the scroll bars of the ScrollArea is shown or not.

Returns
The area of the widget occupied by the widget's children.

Reimplemented from fcn::Widget.

Definition at line 237 of file tabbedarea.cpp.

References fcn::Widget::getBorderSize(), getChildrenArea(), fcn::Widget::getHeight(), fcn::Widget::getPaddingBottom(), fcn::Widget::getPaddingLeft(), fcn::Widget::getPaddingRight(), fcn::Widget::getPaddingTop(), fcn::Widget::getWidth(), fcn::Rectangle::height, fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by getChildrenArea().

◆ getHorizontalSpacing()

unsigned int fcn::TabbedArea::getHorizontalSpacing ( ) const
virtual

Get the horizontal spacing between rows.

Returns
horizontal spacing in pixels.
See also
setHorizontalSpacing

Definition at line 495 of file tabbedarea.cpp.

References getHorizontalSpacing(), and mTabContainer.

Referenced by getHorizontalSpacing().

◆ getLayout()

Container::LayoutPolicy fcn::TabbedArea::getLayout ( ) const

Gets the layout of the tabbedarea.

See also
LayoutPolicy
Returns
The LayoutPolicy of the tabbedarea.
See also
setLayout

Definition at line 465 of file tabbedarea.cpp.

References getLayout(), and mTabContainer.

Referenced by addTab(), adjustSize(), adjustTabPositions(), and getLayout().

◆ getNumberOfTabs()

int fcn::TabbedArea::getNumberOfTabs ( ) const

Returns the number of tabs in this tabbed area.

Definition at line 111 of file tabbedarea.cpp.

References getNumberOfTabs(), and mTabs.

Referenced by getNumberOfTabs().

◆ getSelectedTab()

Tab * fcn::TabbedArea::getSelectedTab ( ) const

Gets the selected tab.

Returns
The selected tab.
See also
isTabSelected, setSelectedTab

Definition at line 172 of file tabbedarea.cpp.

References getSelectedTab(), and mSelectedTab.

Referenced by getSelectedTab().

◆ getSelectedTabIndex()

int fcn::TabbedArea::getSelectedTabIndex ( ) const
virtual

Gets the index of the selected tab.

Returns
The index of the selected tab. If no tab is selected -1 will be returned.
See also
isTabSelected, setSelectedTab

Definition at line 160 of file tabbedarea.cpp.

References getSelectedTabIndex(), mSelectedTab, and mTabs.

Referenced by getSelectedTabIndex(), keyPressed(), and removeTab().

◆ getVerticalSpacing()

unsigned int fcn::TabbedArea::getVerticalSpacing ( ) const
virtual

Get the vertical spacing between rows.

Returns
vertical spacing in pixels.
See also
setVerticalSpacing

Definition at line 485 of file tabbedarea.cpp.

References getVerticalSpacing(), and mTabContainer.

Referenced by getVerticalSpacing().

◆ isOpaque()

bool fcn::TabbedArea::isOpaque ( ) const

Checks if the tabbed area is opaque or not.

Returns
true if the tabbed area is opaque, false otherwise.
See also
setOpaque

Definition at line 182 of file tabbedarea.cpp.

References isOpaque(), and mOpaque.

Referenced by draw(), and isOpaque().

◆ isTabSelected() [1/2]

bool fcn::TabbedArea::isTabSelected ( Tab * tab) const
virtual

Checks if a tab is selected or not.

Parameters
tabThe tab to check.
Returns
True if the tab is selected, false otherwise.
See also
setSelectedTab

Definition at line 125 of file tabbedarea.cpp.

References isTabSelected(), and mSelectedTab.

◆ isTabSelected() [2/2]

bool fcn::TabbedArea::isTabSelected ( unsigned int index) const
virtual

Checks if a tab given an index is selected or not.

Parameters
indexThe index of the tab to check.
Returns
True if the tab is selected, false otherwise.
See also
setSelectedTab

Definition at line 116 of file tabbedarea.cpp.

References isTabSelected(), mSelectedTab, and mTabs.

Referenced by isTabSelected(), and isTabSelected().

◆ isUniformSize()

bool fcn::TabbedArea::isUniformSize ( ) const
virtual

True if the tab container tries to expand the childs to a uniform size.

Returns
True if uniform size is set, otherwise false.
See also
setUniformSize

Definition at line 475 of file tabbedarea.cpp.

References isUniformSize(), and mTabContainer.

Referenced by isUniformSize().

◆ keyPressed()

void fcn::TabbedArea::keyPressed ( KeyEvent & keyEvent)
overridevirtual

Called if a key is pressed when the widget has keyboard focus.

If a key is held down the widget will generate multiple key presses.

Parameters
keyEventDescribes the event.

Reimplemented from fcn::KeyListener.

Definition at line 371 of file tabbedarea.cpp.

References fcn::InputEvent::consume(), fcn::KeyEvent::getKey(), getSelectedTabIndex(), fcn::Key::getValue(), fcn::InputEvent::isConsumed(), fcn::Widget::isFocused(), keyPressed(), mTabs, and setSelectedTab().

Referenced by keyPressed().

◆ mousePressed()

void fcn::TabbedArea::mousePressed ( MouseEvent & mouseEvent)
overridevirtual

Called when a mouse button has been pressed on the widget area.

NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.

Parameters
mouseEventDescribes the event.

Reimplemented from fcn::MouseListener.

Definition at line 402 of file tabbedarea.cpp.

References fcn::MouseEvent::getButton(), fcn::Event::getSource(), fcn::MouseEvent::getX(), fcn::MouseEvent::getY(), fcn::Widget::isFocusable(), mousePressed(), mTabContainer, fcn::Widget::requestFocus(), setSelectedTab(), and fcn::Widget::Widget().

Referenced by mousePressed().

◆ removeTab()

void fcn::TabbedArea::removeTab ( Tab * tab)
virtual

Removes a tab from the tabbed area.

Parameters
tabThe tab to remove.
See also
addTab

Definition at line 70 of file tabbedarea.cpp.

References fcn::Widget::adaptLayout(), getSelectedTabIndex(), mSelectedTab, mTabContainer, mTabs, mTabsToDelete, mWidgetContainer, removeTab(), and setSelectedTab().

Referenced by death(), removeTab(), and removeTabWithIndex().

◆ removeTabWithIndex()

void fcn::TabbedArea::removeTabWithIndex ( unsigned int index)
virtual

Removes a tab from the tabbed area.

Parameters
indexThe index of the tab to remove.
See also
addTab

Definition at line 61 of file tabbedarea.cpp.

References mTabs, removeTab(), and removeTabWithIndex().

Referenced by removeTabWithIndex().

◆ resizeToContent() [1/2]

Resizes the widget's size to fit the content exactly, calls recursively all childs.

This is a convenience wrapper that calls resizeToContent(true).

Definition at line 1417 of file widget.hpp.

◆ resizeToContent() [2/2]

void fcn::TabbedArea::resizeToContent ( bool recursion)
overridevirtual

Resize this widget to fit its content.

Parameters
recursionIf true, perform the resize operation recursively on children.

Reimplemented from fcn::Widget.

Definition at line 247 of file tabbedarea.cpp.

References adjustSize(), adjustTabPositions(), mTabContainer, mWidgetContainer, fcn::Widget::resizeToChildren(), and resizeToContent().

Referenced by resizeToContent().

◆ setBackgroundWidget()

void fcn::TabbedArea::setBackgroundWidget ( Widget * widget)

Set the background widget which is drawn behind tabs.

Definition at line 187 of file tabbedarea.cpp.

References mTabContainer, mWidgetContainer, setBackgroundWidget(), and fcn::Widget::Widget().

Referenced by setBackgroundWidget().

◆ setBaseColor()

void fcn::TabbedArea::setBaseColor ( Color const & color)
overridevirtual

Set the base/background color used for the tabbed area.

Reimplemented from fcn::Widget.

Definition at line 450 of file tabbedarea.cpp.

References mTabContainer, mTabs, mWidgetContainer, setBaseColor(), and fcn::Widget::setBaseColor().

Referenced by setBaseColor().

◆ setDimension()

void fcn::TabbedArea::setDimension ( Rectangle const & dimension)

Set the area dimension for the tabbed area.

Definition at line 359 of file tabbedarea.cpp.

References adjustSize(), fcn::Widget::mDimension, setDimension(), and fcn::Widget::setDimension().

Referenced by setDimension().

◆ setHeight()

void fcn::TabbedArea::setHeight ( int height)

Set the height of the tabbed area in pixels.

Definition at line 334 of file tabbedarea.cpp.

References adjustSize(), fcn::Widget::mDimension, setHeight(), and fcn::Widget::setHeight().

Referenced by setHeight().

◆ setHorizontalSpacing()

void fcn::TabbedArea::setHorizontalSpacing ( unsigned int spacing)
virtual

Set the horizontal spacing between columns.

Parameters
spacingspacing in pixels.
See also
getHorizontalSpacing

Definition at line 490 of file tabbedarea.cpp.

References mTabContainer, and setHorizontalSpacing().

Referenced by setHorizontalSpacing().

◆ setLayout()

void fcn::TabbedArea::setLayout ( Container::LayoutPolicy policy)

Sets the layout of the tabbedarea.

See also
LayoutPolicy
Parameters
policyThe LayoutPolicy of the tabbedarea.
See also
getLayout

Definition at line 460 of file tabbedarea.cpp.

References mTabContainer, and setLayout().

Referenced by setLayout().

◆ setOpaque()

void fcn::TabbedArea::setOpaque ( bool opaque)

Sets the tabbed area to be opaque or not.

If the tabbed area is opaque its background will be drawn, if it's not opaque its background will not be drawn. By default, a tabbed area is not opaque.

The tabbed area's background is normally only visible behind the tabs, since the container holding the tab contents is opaque by default.

Parameters
opaqueTrue if the tabbed area should be opaque, false otherwise.
See also
isOpaque

Definition at line 177 of file tabbedarea.cpp.

References mOpaque, and setOpaque().

Referenced by setOpaque().

◆ setSelectedTab() [1/2]

void fcn::TabbedArea::setSelectedTab ( Tab * tab)
virtual

Sets a tab to be selected or not.

Parameters
tabThe tab to be selected.
See also
isTabSelected, getSelectedTab

Definition at line 139 of file tabbedarea.cpp.

References fcn::Widget::adaptLayout(), mSelectedTab, mTabs, mWidgetContainer, and setSelectedTab().

◆ setSelectedTab() [2/2]

void fcn::TabbedArea::setSelectedTab ( unsigned int index)
virtual

Sets a tab given an index to be selected.

Parameters
indexThe index of the tab to be selected.
See also
isTabSelected, getSelectedTab

Definition at line 130 of file tabbedarea.cpp.

References mTabs, and setSelectedTab().

Referenced by action(), addTab(), keyPressed(), mousePressed(), removeTab(), setSelectedTab(), and setSelectedTab().

◆ setSize()

void fcn::TabbedArea::setSize ( int width,
int height )

Set the size (width and height) of the tabbed area in pixels.

Definition at line 346 of file tabbedarea.cpp.

References adjustSize(), fcn::Widget::mDimension, setSize(), and fcn::Widget::setSize().

Referenced by setSize().

◆ setUniformSize()

void fcn::TabbedArea::setUniformSize ( bool uniform)
virtual

If enabled, the free space is distributed in a way that the size of the childrens will be equal (if possible).

Otherwise the free space will evenly distributed.

Parameters
uniformIndicates if uniform size is enabled or not.
See also
isUniformSize

Definition at line 470 of file tabbedarea.cpp.

References mTabContainer, and setUniformSize().

Referenced by setUniformSize().

◆ setVerticalSpacing()

void fcn::TabbedArea::setVerticalSpacing ( unsigned int spacing)
virtual

Set the vertical spacing between rows.

Parameters
spacingspacing in pixels.
See also
getVerticalSpacing

Definition at line 480 of file tabbedarea.cpp.

References mTabContainer, and setVerticalSpacing().

Referenced by setVerticalSpacing().

◆ setWidth()

void fcn::TabbedArea::setWidth ( int width)

Set the width of the tabbed area in pixels.

Definition at line 322 of file tabbedarea.cpp.

References adjustSize(), fcn::Widget::mDimension, setWidth(), and fcn::Widget::setWidth().

Referenced by setWidth().

◆ Tab

friend class Tab
friend

Definition at line 34 of file tabbedarea.hpp.

Member Data Documentation

◆ mOpaque

bool fcn::TabbedArea::mOpaque {false}
protected

True if the tabbed area is opaque, false otherwise.

Definition at line 315 of file tabbedarea.hpp.

Referenced by isOpaque(), and setOpaque().

◆ mSelectedTab

Tab* fcn::TabbedArea::mSelectedTab {nullptr}
protected

Holds the selected tab.

Definition at line 287 of file tabbedarea.hpp.

Referenced by addTab(), draw(), getSelectedTab(), getSelectedTabIndex(), isTabSelected(), isTabSelected(), removeTab(), and setSelectedTab().

◆ mTabContainer

◆ mTabs

std::vector<std::pair<Tab*, Widget*> > fcn::TabbedArea::mTabs
protected

A map between a tab and a widget to display when the tab is selected.

Definition at line 310 of file tabbedarea.hpp.

Referenced by addTab(), adjustSize(), adjustTabPositions(), getNumberOfTabs(), getSelectedTabIndex(), isTabSelected(), keyPressed(), removeTab(), removeTabWithIndex(), setBaseColor(), setSelectedTab(), and setSelectedTab().

◆ mTabsToDelete

std::vector<std::unique_ptr<Tab> > fcn::TabbedArea::mTabsToDelete
protected

Holds a vector of tabs to delete in the destructor.

A tab that is to be deleted is a tab that has been internally created by the tabbed area.

Definition at line 304 of file tabbedarea.hpp.

Referenced by removeTab().

◆ mWidgetContainer

Container* fcn::TabbedArea::mWidgetContainer
protected

Holds the container for the widgets.

Definition at line 297 of file tabbedarea.hpp.

Referenced by adjustSize(), expandContent(), removeTab(), resizeToContent(), setBackgroundWidget(), setBaseColor(), and setSelectedTab().


The documentation for this class was generated from the following files: