Hello,
is possible to define disabled colors for the widget in the theme file?
I was unable to find something.
Thank you.
is possible to define disabled colors for the widget in the theme file?
I was unable to find something.
Thank you.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
#include <TGUI/TGUI.hpp>
tgui::Gui g_gui;
void CreateTab1()
{
tgui::Panel::Ptr panel = g_gui.get<tgui::Panel>("MAIN_PANEL");
panel->removeAllWidgets();
tgui::CheckBox::Ptr checkbox = std::make_shared<tgui::CheckBox>();
checkbox->setPosition(10, 20);
checkbox->setText("check 1");
checkbox->setSize(25, 25);
panel->add(checkbox);
}
void CreateTab2()
{
tgui::Panel::Ptr panel = g_gui.get<tgui::Panel>("MAIN_PANEL");
panel->removeAllWidgets();
tgui::CheckBox::Ptr checkbox = std::make_shared<tgui::CheckBox>();
checkbox->setPosition(10, 20);
checkbox->setText("check 2");
checkbox->setSize(25, 25);
panel->add(checkbox);
tgui::ListBox::Ptr listBox = std::make_shared<tgui::ListBox>();
listBox->setSize(250, 120);
listBox->setItemHeight(25);
listBox->setPosition(10, 50);
listBox->addItem("Item 1");
listBox->addItem("Item 2");
listBox->addItem("Item 3");
panel->add(listBox);
}
void CreateTab3()
{
tgui::Panel::Ptr panel = g_gui.get<tgui::Panel>("MAIN_PANEL");
panel->removeAllWidgets();
tgui::CheckBox::Ptr checkbox = std::make_shared<tgui::CheckBox>();
checkbox->setPosition(10, 20);
checkbox->setText("check 3");
checkbox->setSize(25, 25);
panel->add(checkbox);
}
void CreateTab4()
{
tgui::Panel::Ptr panel = g_gui.get<tgui::Panel>("MAIN_PANEL");
panel->removeAllWidgets();
tgui::CheckBox::Ptr checkbox = std::make_shared<tgui::CheckBox>();
checkbox->setPosition(10, 20);
checkbox->setText("check 4");
checkbox->setSize(25, 25);
panel->add(checkbox);
}
void OnTabChange(std::string selectedTab)
{
if (selectedTab == "TAB1")
CreateTab1();
else if (selectedTab == "TAB2")
CreateTab2();
else if (selectedTab == "TAB3")
CreateTab3();
else if (selectedTab == "TAB4")
CreateTab4();
}
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768), VERSION);
g_gui.setWindow(window);
tgui::Tab::Ptr tabs = std::make_shared<tgui::Tab>();
tabs->add("TAB1");
tabs->add("TAB2");
tabs->add("TAB3");
tabs->add("TAB4");
tabs->setPosition(0, 0);
g_gui.add(tabs, "MAIN_TABS");
tgui::Panel::Ptr panel = std::make_shared<tgui::Panel>();
panel->setSize(1024, 743);
panel->setPosition(tabs->getPosition().x, tabs->getPosition().y + tabs->getTabHeight());
g_gui.add(panel, "MAIN_PANEL");
tabs->connect("TabSelected", OnTabChange);
tabs->select("TAB1");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
g_gui.handleEvent(event);
}
window.clear(sf::Color::White);
g_gui.draw();
window.display();
}
}