NDEVR
API Documentation
SelectionHighlightBar.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: SelectionHighlightBar
29Included in API: False
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/WidgetOptions.h>
34#include <NDEVR/Bounds.h>
35#include <NDEVR/VectorFunctions.h>
36#include <QPainter>
37#include <QApplication>
38#include <QStylePainter>
39#include <QPropertyAnimation>
40#include <QWidget>
41namespace NDEVR
42{
48 class SelectionHighlightBar : public QWidget
49 {
50 Q_OBJECT
51 Q_PROPERTY(double animation_percent READ animationPercent WRITE setAnimationPercent)
52 public:
57 SelectionHighlightBar(QWidget* parent = nullptr);
62 double animationPercent() const;
67 void setAnimationPercent(double animation_percent);
72 void moveHighlight(QWidget* widget);
77 void moveHighlight(const Bounds<1, int>& bounds);
82 void setVertical(bool vertical);
92 QSize sizeHint() const override;
93 protected:
97 void paintEvent(QPaintEvent*) override;
98 private:
102 void startAnimation();
103 private:
104 QPropertyAnimation* m_move_animation;
105 Bounds<1, int> m_old_draw_bounds;
106 Bounds<1, int> m_draw_bounds;
107 enum QEasingCurve::Type m_animation_type;
108 bool m_is_vertical;
109 int m_speed;
110 double m_animation_percent;
111 };
112}
113
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:54
void moveHighlight(QWidget *widget)
Moves the highlight bar to cover the given widget with an animated transition.
void setAnimationPercent(double animation_percent)
Sets the current animation progress percentage.
void paintEvent(QPaintEvent *) override
Paints the highlight bar at the current interpolated position.
Bounds< 1, int > currentBounds() const
Returns the current interpolated bounds of the highlight bar.
QSize sizeHint() const override
Returns the recommended size for this highlight bar widget.
SelectionHighlightBar(QWidget *parent=nullptr)
Constructs a SelectionHighlightBar with the given parent widget.
void setVertical(bool vertical)
Sets whether the highlight bar is oriented vertically or horizontally.
double animationPercent() const
Returns the current animation progress as a percentage from 0.0 to 1.0.
void moveHighlight(const Bounds< 1, int > &bounds)
Moves the highlight bar to the given 1D bounds with an animated transition.
The primary namespace for the NDEVR SDK.