NDEVR
API Documentation
SunDial.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: SunDial
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Resource.h>
35#include <NDEVR/Vector.h>
36#include <QWidget>
37namespace NDEVR
38{
43 class NDEVR_WIDGETS_API SunDial : public QWidget
44 {
45 Q_OBJECT
46 public:
51 SunDial(QWidget* parent = nullptr);
56 virtual void mousePressEvent(QMouseEvent* ev) override;
72 {
73 return m_knob_radius * getMin(height(), width());
74 }
75
84 QSize sizeHint() const override
85 {
86 return QSize(300, 300);
87 }
88
91 virtual void mouseReleaseEvent(QMouseEvent*) override
92 {
93 m_dragging = false;
94 }
95
100 void setKnobColor(QColor inner, QColor outer);
106 void setBackgroundColor(QColor inner, QColor outer);
111 virtual void mouseMoveEvent(QMouseEvent* ev) override;
113 protected:
118 void paintEvent(QPaintEvent* paint_event) override;
119 protected:
123
126
129 };
130}
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Definition Resource.h:42
SunDial(QWidget *parent=nullptr)
Constructs a SunDial widget with the given parent.
fltp04 outerRadius() const
Returns the outer radius of the dial in pixels.
QColor m_knob_outer_color
The outer color of the knob gradient.
Definition SunDial.h:125
virtual void mouseMoveEvent(QMouseEvent *ev) override
Handles mouse move events to update the knob position while dragging.
fltp04 m_inner_radius
The inner radius ratio of the dial background.
Definition SunDial.h:120
QColor m_outer_color
The outer color of the background gradient.
Definition SunDial.h:121
Resource< Vector< 2, fltp04 > > location
The 2D direction resource representing the current lighting direction.
Definition SunDial.h:112
void paintEvent(QPaintEvent *paint_event) override
Paints the dial including the background gradient, knob, and decorations.
QColor m_inner_color
The inner color of the background gradient.
Definition SunDial.h:122
Vector< 2, fltp04 > knobLocation() const
Returns the current position of the dial knob in widget coordinates.
Vector< 2, fltp04 > centerPoint() const
Returns the center point of the dial in widget coordinates.
fltp04 m_knob_radius
The radius ratio of the knob relative to the widget size.
Definition SunDial.h:127
virtual void mouseReleaseEvent(QMouseEvent *) override
Handles mouse release events to stop dragging the dial knob.
Definition SunDial.h:91
void setKnobColor(QColor inner, QColor outer)
Sets the gradient colors for the dial knob.
bool m_dragging
Whether the user is currently dragging the knob.
Definition SunDial.h:128
QSize sizeHint() const override
Returns the recommended size for this dial widget.
Definition SunDial.h:84
void setBackgroundColor(QColor inner, QColor outer)
Sets the gradient colors for the dial background.
QColor m_knob_inner_color
The inner color of the knob gradient.
Definition SunDial.h:124
fltp04 knobRadius() const
Returns the radius of the dial knob in pixels, scaled to the widget size.
Definition SunDial.h:71
virtual void mousePressEvent(QMouseEvent *ev) override
Handles mouse press events to begin dragging the dial knob.
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
The primary namespace for the NDEVR SDK.
constexpr t_type getMin(const t_type &left, const t_type &right)
Finds the minimum of the given arguments based on the < operator Author: Tyler Parke Date: 2017-11-05...
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...