Update Widgets

2025-11-03 08:33:33 +11:00
parent 85d90b9f67
commit a19ce256d9

@@ -1,47 +1,65 @@
# Widgets
Quip uses a widget-based system to show things on a screen. Each widget has it's own purpose and properties.
## Creating and Modifying Widgets
See the "Window" page for information on this.
## List of Avaliable Widgets
### `Quip::Widget::TextLabel(std::string text, int xpos, int ypos)`
#### Summary
The `TextLabel` widget allows you to render text on the screen. For now, text is rendered as Noto Sans 16pt. This will be customisable in the future.
#### Members
`std::string text`: The text to be displayed.
`int xpos, ypos`: The xpos and ypos of the text label.
#### Example
```c++
Quip::Widget::TextLabel("Hello!", 10, 10);
```
### `Quip::Widget::Button(std::string text, std::function<void()> callback, int xpos, int ypos)`
#### Summary
The `Button` widget creates a clickable button which runs a provided function upon click. For now, button text is rendered as Noto Sans 16pt, the button background is slightly blue, and the clickable size is constant. This will be customisable in the future.
#### Members
`std::string text`: The text to be displayed.
`int xpos, ypos`: The xpos and ypos of the button.
#### Example
```c++
Quip::Widget::Button("Click me!", []() {
std::cout << "Button has been clicked!" << std::endl;
}, 10, 10)
```
# Widgets
Quip uses a widget-based system to show things on a screen. Each widget has it's own purpose and properties.
## Creating and Modifying Widgets
See the "Window" page for information on this.
## List of Avaliable Widgets
### `Quip::Widget::TextLabel(std::string text, int xpos, int ypos)`
#### Summary
The `TextLabel` widget allows you to render text on the screen. For now, text is rendered as Noto Sans 16pt. This will be customisable in the future.
#### Members
`std::string text`: The text to be displayed.
`int xpos, ypos`: The xpos and ypos of the text label.
#### Example
```c++
Quip::Widget::TextLabel("Hello!", 10, 10);
```
### `Quip::Widget::Button(std::string text, std::function<void()> callback, int xpos, int ypos)`
#### Summary
The `Button` widget creates a clickable button which runs a provided function upon click. For now, button text is rendered as Noto Sans 16pt, the button background is slightly blue, and the clickable size is constant. This will be customisable in the future.
#### Members
`std::string text`: The text to be displayed.
`int xpos, ypos`: The xpos and ypos of the button.
#### Example
```c++
Quip::Widget::Button("Click me!", []() {
std::cout << "Button has been clicked!" << std::endl;
}, 10, 10)
```
### `Quip::Widget::Image(std::string filepath, int xpos, int ypos, int width = -1, int height = -1)`
#### Summary
The `Image` widget renders an image given at a provided filepath. If width and height are values below 0, the image will be displayed at it's normal resolution.
#### Members
`int width, height`: The width and height of the image.
`int xpos, ypos`: The xpos and ypos of the image.
#### Example
```c++
Quip::Widget::Image("image.png", 10, 10, 100, 100);
```