SubWidget
| 42 | |
| 43 | // SubWidget |
| 44 | explicit ExampleShapesWidget(Widget* const parent); |
| 45 | |
| 46 | // TopLevelWidget |
| 47 | explicit ExampleShapesWidget(Window& windowToMapTo); |
| 48 | |
| 49 | // StandaloneWindow |
| 50 | explicit ExampleShapesWidget(Application& app); |
| 51 | |
| 52 | protected: |
| 53 | void onDisplay() override |
| 54 | { |
| 55 | const GraphicsContext& context(BaseWidget::getGraphicsContext()); |
| 56 | |
| 57 | Color(0.302f, 0.337f, 0.361f).setFor(context);; |
| 58 | bg.draw(context); |
| 59 | |
| 60 | Color(0.235f, 0.271f, 0.294f).setFor(context); |
| 61 | rect.draw(context); |
| 62 | |
| 63 | Color(0.176f, 0.212f, 0.235f).setFor(context); |
| 64 | rect.drawOutline(context, 1); |
| 65 | |
| 66 | Color(0.302f*2, 0.337f*2, 0.361f*2).setFor(context); |
| 67 | tri.draw(context); |
| 68 | |
| 69 | Color(0.302f/2.0f, 0.337f/2.0f, 0.361f/2.0f).setFor(context); |
| 70 | tri.drawOutline(context, 3); |
| 71 | |
| 72 | Color(0.235f, 0.271f, 0.294f).setFor(context); |
| 73 | cir.draw(context); |
| 74 | |
| 75 | Color(0.176f/4, 0.212f/4, 0.235f/4).setFor(context); |
| 76 | cir.drawOutline(context, 2); |
| 77 | } |
| 78 | |
| 79 | void onResize(const Widget::ResizeEvent& ev) override |
| 80 | { |
| 81 | const int width = ev.size.getWidth(); |
| 82 | const int height = ev.size.getHeight(); |
| 83 | |
| 84 | // background |
| 85 | bg = Rectangle<int>(0, 0, width, height); |
| 86 | |
| 87 | // rectangle |
| 88 | rect = Rectangle<int>(20, 10, width-40, height-20); |
| 89 | |
| 90 | // center triangle |
| 91 | tri = Triangle<int>(width*0.5, height*0.1, width*0.1, height*0.9, width*0.9, height*0.9); |
| 92 | |
| 93 | // circle |
| 94 | cir = Circle<int>(width/2, height*2/3, height/6, 300); |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | // SubWidget |
nothing calls this directly
no test coverage detected