commit 3f3ac855ada80c62ba4f5aed9a0d7593e063dfd2
parent 467f9199fcb73e54d94998f9d0cfb8230a39bff4
Author: falkTX <falktx@falktx.com>
Date: Sat, 8 May 2021 23:07:40 +0100
Fix ExampleColorWidget
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/tests/widgets/ExampleColorWidget.hpp b/tests/widgets/ExampleColorWidget.hpp
@@ -41,32 +41,37 @@ class ExampleColorWidget : public BaseWidget,
public:
static constexpr const char* kExampleWidgetName = "Color";
+ // SubWidget
explicit ExampleColorWidget(Widget* const parent)
: BaseWidget(parent),
cur('r'),
reverse(false),
- r(0), g(99), b(32)
+ r(0), g(0), b(0)
{
- init();
+ BaseWidget::setSize(300, 300);
+ parent->getApp().addIdleCallback(this);
}
+ // TopLevelWidget
explicit ExampleColorWidget(Window& windowToMapTo)
- : BaseWidget(windowToMapTo)
+ : BaseWidget(windowToMapTo),
+ cur('r'),
+ reverse(false),
+ r(0), g(0), b(0)
{
- init();
+ BaseWidget::setSize(300, 300);
+ windowToMapTo.getApp().addIdleCallback(this);
}
+ // StandaloneWindow
explicit ExampleColorWidget(Application& app)
- : BaseWidget(app)
- {
- init();
- }
-
- void init()
+ : BaseWidget(app),
+ cur('r'),
+ reverse(false),
+ r(0), g(0), b(0)
{
BaseWidget::setSize(300, 300);
-
-// topWidget->getApp().addIdleCallback(this);
+ app.addIdleCallback(this);
}
protected: