class ffw::GuiTabs

Class List > ffw :: GuiTabs

Create tabs widget. More...

Inherits the following classes: ffw::GuiWidget

Classes

Type Name
class Button
class Content
struct Style
class TopBar

Public Functions

Type Name
GuiTabs (GuiWindow * context)
virtual ~GuiTabs () = default
virtual ffw::Pointf getMinimumWrapSize () override
GuiTabs::Button * addTab (GuiTabs::Button * button, GuiWidget * widget)
GuiTabs::Button * addTab (const std::string & label, GuiWidget * widget)
void showTabByIndex (size_t index)
void showTabByWidget (const GuiWidget * widget)
void setStyle (const GuiTabs::Style * style, bool defaults = false)

Detailed Description

This widget will create one or more tabs. By clicking on the tab at the top will show appropriate widget(s) assigned. For example it is possible to add a layout under each tab, example code below.

auto gui = ffw::GuiWindowNanoVG(nvg);
auto root = gui.getLayout();

auto tabs = new ffw::GuiTabs(&gui);
ffw::GuiVerticalLayout* last = nullptr;
for (auto i = 1; i <= 3; i++) {
    auto layout = new ffw::GuiVerticalLayout(&gui);
    auto button = new ffw::GuiButton(&gui, "Button in Tab #" + std::to_string(i));
    layout->addWidget(button);
    auto tab = tabs->addTab("Tab #" + std::to_string(i), layout);
    tab->setSize(ffw::guiPercent(33.33f), tab->getSize().y);
    if (i == 3) last = layout;
}
tabs->showTabByWidget(last);

root->addWidget(tabs);
// Do not free the created widgets! They will be deleted by the gui window!

while(true){
    // Render the gui
}

Public Functions Documentation

function GuiTabs

ffw::GuiTabs::GuiTabs (
    GuiWindow * context
)

function ~GuiTabs

virtual ffw::GuiTabs::~GuiTabs () = default

function getMinimumWrapSize

virtual ffw::Pointf ffw::GuiTabs::getMinimumWrapSize ()

Implements GuiWidget::getMinimumWrapSize

function addTab (1/2)

GuiTabs::Button * ffw::GuiTabs::addTab (
    GuiTabs::Button * button,
    GuiWidget * widget
)

function addTab (2/2)

GuiTabs::Button * ffw::GuiTabs::addTab (
    const std::string & label,
    GuiWidget * widget
)

function showTabByIndex

void ffw::GuiTabs::showTabByIndex (
    size_t index
)

function showTabByWidget

void ffw::GuiTabs::showTabByWidget (
    const GuiWidget * widget
)

function setStyle

void ffw::GuiTabs::setStyle (
    const GuiTabs::Style * style,
    bool defaults = false
)

The documentation for this class was generated from the following file: include/ffw/gui/guitab.h