Max OS 0.3
Loading...
Searching...
No Matches
window.h
Go to the documentation of this file.
1
9#ifndef MaxOS_GUI_WINDOW_H
10#define MaxOS_GUI_WINDOW_H
11
12#include <stdint.h>
13#include <gui/widget.h>
14#include <gui/widgets/text.h>
15
16namespace MaxOS{
17
18 namespace gui{
19
24 class Window : public CompositeWidget{
25
26 private:
27 widgets::Text m_title;
28
29 // Resizes
30 WidgetMover m_mover;
31 WidgetMoverResizerTop m_resizer_top;
32 WidgetMoverResizerBottom m_resizer_bottom;
33 WidgetMoverResizerLeft m_resizer_left;
34 WidgetMoverResizerRight m_resizer_right;
35 WidgetMoverResizerTopLeft m_resizer_top_left;
36 WidgetMoverResizerTopRight m_resizer_top_right;
37 WidgetMoverResizerBottomLeft m_resizer_bottom_left;
38 WidgetMoverResizerBottomRight m_resizer_bottom_right;
39
40
41 public:
42
43 uint8_t frame_thickness { 5 };
44 uint8_t title_bar_height { 10 };
45
49
50 Window(int32_t left, int32_t top, uint32_t width, uint32_t height, const string& title_text);
51 Window(Widget* contained_widget, const string& title_text);
52 ~Window();
53
55 void add_child(Widget* child) override;
56
57 drivers::peripherals::MouseEventHandler* on_mouse_button_pressed(uint32_t x, uint32_t y, uint8_t button) override;
58 };
59 }
60}
61#endif //MaxOS_GUI_WINDOW_H
Stores the red, green, blue and alpha values of a colour. Can be parsed from a hex string,...
Definition colour.h:91
Draws pixels to the screen, and handles drawing lines, rectangles and circles.
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
Handles events that are triggered by the mouse driver.
Definition mouse.h:72
A widget that can contain other widgets.
Definition widget.h:88
A graphical object that can be drawn on the screen.
Definition widget.h:29
A window that can be moved and resized and contains a widget.
Definition window.h:24
uint8_t title_bar_height
How large the bar at the top of the window is.
Definition window.h:44
uint8_t frame_thickness
How thick the bar around the window is.
Definition window.h:43
drivers::peripherals::MouseEventHandler * on_mouse_button_pressed(uint32_t x, uint32_t y, uint8_t button) override
Handles the mouse button being pressed.
Definition window.cpp:103
common::Colour area_colour
The background colour of the window inner area.
Definition window.h:46
common::Colour frame_colour
The colour of the bar around the window.
Definition window.h:47
void draw_self(common::GraphicsContext *gc, common::Rectangle< int32_t > &area) override
Draws the window and its children.
Definition window.cpp:154
void add_child(Widget *child) override
Adds a child to the window.
Definition window.cpp:220
common::Colour frame_border_colour
The colour of the border around the bar around the window.
Definition window.h:48
A box that can be used to display text.
Definition text.h:24
Defines a Text widget for displaying text in the GUI.
Defines a base Widget class and CompositeWidget class for creating graphical user interface elements.