new widgets
This commit is contained in:
parent
5cc982fa00
commit
285ca80b4b
18 changed files with 373 additions and 43 deletions
45
Widgets/examples/SimpleGUI.hpp
Normal file
45
Widgets/examples/SimpleGUI.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "Widgets.hpp"
|
||||
|
||||
namespace tp {
|
||||
|
||||
template <typename Events, typename Canvas>
|
||||
class SimpleWidget : public ScrollableWindow<Events, Canvas> {
|
||||
public:
|
||||
SimpleWidget() {
|
||||
this->addWidget(&mLabel);
|
||||
this->addWidget(&mButton);
|
||||
this->addWidget(&mSlider);
|
||||
this->addWidget(&mCollapsableMenu);
|
||||
|
||||
mCollapsableMenu.addWidgetToMenu(&mInMenuButton1);
|
||||
mCollapsableMenu.addWidgetToMenu(&mInMenuButton2);
|
||||
|
||||
mInMenuButton1.mLabel.mLabel = "Button1";
|
||||
mInMenuButton2.mLabel.mLabel = "Button2";
|
||||
|
||||
this->mArea.size = { 500, 500 };
|
||||
}
|
||||
|
||||
private:
|
||||
CollapsableMenu<Events, Canvas> mCollapsableMenu;
|
||||
ButtonWidget<EventHandler, Canvas> mInMenuButton1;
|
||||
ButtonWidget<EventHandler, Canvas> mInMenuButton2;
|
||||
|
||||
ButtonWidget<EventHandler, Canvas> mButton;
|
||||
LabelWidget<EventHandler, Canvas> mLabel;
|
||||
NamedSliderWidget<EventHandler, Canvas> mSlider;
|
||||
};
|
||||
|
||||
template <typename Events, typename Canvas>
|
||||
class SimpleWidget2 : public Widget<Events, Canvas> {
|
||||
public:
|
||||
SimpleWidget2() {
|
||||
this->mChildWidgets.pushBack(&mFloating);
|
||||
mFloating.addWidgetToMenu(&mWidget);
|
||||
}
|
||||
|
||||
private:
|
||||
FloatingWidget<EventHandler, Canvas> mFloating;
|
||||
SimpleWidget<EventHandler, Canvas> mWidget;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue