class ffw::GuiCheckbox
Class List > ffw :: GuiCheckbox
Create a checkbox widget with on/off status and a label. More...
Inherits the following classes: ffw::GuiWidget
Classes
Type | Name |
---|---|
class | Button |
struct | Style |
Public Functions
Type | Name |
---|---|
GuiCheckbox (GuiWindow * context, const std::string & label) | |
virtual | ~GuiCheckbox () = default |
void | setLabel (const std::string & label) |
const std::string & | getLabel () const |
void | setValue (bool value) |
bool | getValue () const |
const GuiCheckbox::Button * | getButton () const |
GuiCheckbox::Button * | getButton () |
virtual ffw::Pointf | getMinimumWrapSize () override |
void | setStyle (const GuiCheckbox::Style * style, bool defaults = false) |
Detailed Description
// Example creating a checkbox
auto gui = ffw::GuiWindowNanoVG(nvg);
auto root = gui.getLayout();
auto checkbox = new ffw::GuiCheckbox(&gui, "I am a checkbox");
checkbox->setLabel("I am a new label");
checkbox->setSize(ffw::guiPercent(100.0f), ffw::guiPixels(25.0f));
checkbox->addEventCallback([](ffw::GuiEvent e) {
std::cout << "Clicked! Status: " << e.data.action.value << std::endl;
}, ffw::GuiEventType::ACTION);
auto isPressed = checkbox->getValue(); // Programatically get on/off state
checkbox->setValue(true); // Programatically set on/off state
root->addWidget(checkbox);
// Do not free the created widgets! They will be deleted by window itself!
while(true){
// Render the gui
}
Public Functions Documentation
function GuiCheckbox
ffw::GuiCheckbox::GuiCheckbox (
GuiWindow * context,
const std::string & label
)
function ~GuiCheckbox
virtual ffw::GuiCheckbox::~GuiCheckbox () = default
function setLabel
void ffw::GuiCheckbox::setLabel (
const std::string & label
)
function getLabel
const std::string & ffw::GuiCheckbox::getLabel () const
function setValue
void ffw::GuiCheckbox::setValue (
bool value
)
function getValue
bool ffw::GuiCheckbox::getValue () const
function getButton (1/2)
const GuiCheckbox::Button * ffw::GuiCheckbox::getButton () const
function getButton (2/2)
GuiCheckbox::Button * ffw::GuiCheckbox::getButton ()
function getMinimumWrapSize
virtual ffw::Pointf ffw::GuiCheckbox::getMinimumWrapSize ()
Implements GuiWidget::getMinimumWrapSize
function setStyle
void ffw::GuiCheckbox::setStyle (
const GuiCheckbox::Style * style,
bool defaults = false
)
The documentation for this class was generated from the following file: include/ffw/gui/guicheckbox.h