| @@ -41,32 +41,37 @@ class ExampleColorWidget : public BaseWidget, | |||||
| public: | public: | ||||
| static constexpr const char* kExampleWidgetName = "Color"; | static constexpr const char* kExampleWidgetName = "Color"; | ||||
| // SubWidget | |||||
| explicit ExampleColorWidget(Widget* const parent) | explicit ExampleColorWidget(Widget* const parent) | ||||
| : BaseWidget(parent), | : BaseWidget(parent), | ||||
| cur('r'), | cur('r'), | ||||
| reverse(false), | 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) | 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) | 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); | BaseWidget::setSize(300, 300); | ||||
| // topWidget->getApp().addIdleCallback(this); | |||||
| app.addIdleCallback(this); | |||||
| } | } | ||||
| protected: | protected: | ||||