Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
progress_spinner.hpp
Go to the documentation of this file.
1/*
2 Copyright 2019-2021 natinusala
3 Copyright 2021 XITRIX
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16*/
17
18#pragma once
19
20#include <aurore/core/view.hpp>
21
22namespace aurore
23{
24
30
31// A progress spinner
32class ProgressSpinner : public View
33{
34 public:
36
37 void draw(NVGcontext* vg, float x, float y, float width, float height, Style style, FrameContext* ctx) override;
38 void willAppear(bool resetState = false) override;
39 void willDisappear(bool resetState = false) override;
40
45 void setColor(NVGcolor color);
46
47 // barColor, the bars' colour (the theme's until setColor)
48 bool getStyleProperty(const std::string& name, StyleValue* value) override;
49 bool setStyleProperty(const std::string& name, const StyleValue& value) override;
50
51 void animate(bool animate);
52
54
55 private:
56 NVGcolor barColor;
57 bool customBarColor = false;
58 Animatable animationValue = 0.0f;
60 void setSize(ProgressSpinnerSize size)
61 {
62 this->size = size;
63 }
64
65 void restartAnimation();
66};
67
68} // namespace aurore
Definition animation.hpp:42
Definition frame_context.hpp:30
Definition progress_spinner.hpp:33
void animate(bool animate)
void draw(NVGcontext *vg, float x, float y, float width, float height, Style style, FrameContext *ctx) override
void willDisappear(bool resetState=false) override
void setColor(NVGcolor color)
bool setStyleProperty(const std::string &name, const StyleValue &value) override
bool getStyleProperty(const std::string &name, StyleValue *value) override
ProgressSpinner(ProgressSpinnerSize size=ProgressSpinnerSize::NORMAL)
static aurore::View * create()
void willAppear(bool resetState=false) override
Simple wrapper around StyleValues for the array operator.
Definition style.hpp:115
Definition view.hpp:232
Definition actions.hpp:25
ProgressSpinnerSize
Definition progress_spinner.hpp:26
@ LARGE
Definition progress_spinner.hpp:28
@ NORMAL
Definition progress_spinner.hpp:27
Definition view_style.hpp:41