Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
battery.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2021 XITRIX
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <
aurore/core/application.hpp
>
20
#include <
aurore/core/box.hpp
>
21
#include <
aurore/views/image.hpp
>
22
#include <
aurore/views/rectangle.hpp
>
23
24
namespace
aurore
25
{
26
27
class
BatteryWidget
:
public
Box
28
{
29
public
:
30
BatteryWidget
();
31
32
void
draw
(NVGcontext* vg,
float
x,
float
y,
float
width,
float
height,
Style
style,
FrameContext
* ctx)
override
;
33
void
onThemeChanged
()
override
;
34
static
View
*
create
();
35
36
private
:
37
// None where the platform shows no battery level
38
Image
* back =
nullptr
;
39
Rectangle
* level =
nullptr
;
40
Platform
* platform;
41
42
void
applyBackTheme(
ThemeVariant
theme);
43
44
void
updateState();
45
inline
static
bool
isBatteryCharging =
false
;
46
inline
static
float
batteryLevel = 1;
47
inline
static
bool
updating =
false
;
// a read is under way
48
};
49
50
}
// namespace aurore
application.hpp
box.hpp
aurore::BatteryWidget
Definition
battery.hpp:28
aurore::BatteryWidget::onThemeChanged
void onThemeChanged() override
aurore::BatteryWidget::create
static View * create()
aurore::BatteryWidget::BatteryWidget
BatteryWidget()
aurore::BatteryWidget::draw
void draw(NVGcontext *vg, float x, float y, float width, float height, Style style, FrameContext *ctx) override
aurore::Box
Generic FlexBox layout.
Definition
box.hpp:74
aurore::FrameContext
Definition
frame_context.hpp:30
aurore::Image
Definition
image.hpp:67
aurore::Platform
Definition
platform.hpp:37
aurore::Rectangle
Definition
rectangle.hpp:28
aurore::Style
Simple wrapper around StyleValues for the array operator.
Definition
style.hpp:115
aurore::View
Definition
view.hpp:232
image.hpp
aurore
Definition
actions.hpp:25
aurore::ThemeVariant
ThemeVariant
The two sets of colours every theme has: light and dark.
Definition
theme.hpp:37
rectangle.hpp
aurore
views
widgets
battery.hpp
Generated by
1.9.8