Update widgets module. Raster example initial.

This commit is contained in:
IlyaShurupov 2024-04-12 15:27:40 +03:00
parent 9e339defd6
commit 9cfae3fe3e
48 changed files with 1169 additions and 530 deletions

View file

@ -0,0 +1,44 @@
#include "ChatGUI.hpp"
#include "GraphicApplication.hpp"
using namespace tp;
class SimpleGUI : public Application {
public:
SimpleGUI() {
mGui.mContents.append(&mButton);
mGui.mContents.append(&mSlider);
mGui.mContents.append(&mLabel);
}
void processFrame(EventHandler* eventHandler) override {
mGui.updateConfigCache(mWidgetManager);
mSlider.updateConfigCache(mWidgetManager);
mLabel.updateConfigCache(mWidgetManager);
mButton.updateConfigCache(mWidgetManager);
const auto rec = RectF({ 0, 0 }, mWindow->getSize());
mGui.proc(*eventHandler, rec, rec);
}
void drawFrame(Canvas* canvas) override { mGui.draw(*canvas); }
private:
WidgetManager mWidgetManager;
ScrollableWindow<EventHandler, Canvas> mGui;
ButtonWidget<EventHandler, Canvas> mButton;
LabelWidget<EventHandler, Canvas> mLabel;
SliderWidget<EventHandler, Canvas> mSlider;
};
int main() {
{
SimpleGUI gui;
gui.run();
}
}