1 | /* $Id: QIAdvancedSlider.h 76581 2019-01-01 06:24:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIAdvancedSlider class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_extensions_QIAdvancedSlider_h
|
---|
19 | #define FEQT_INCLUDED_SRC_extensions_QIAdvancedSlider_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /* Forward declarations: */
|
---|
31 | class UIPrivateSlider;
|
---|
32 |
|
---|
33 | /** QWidget extension providing GUI with advanced QSlider functionality. */
|
---|
34 | class SHARED_LIBRARY_STUFF QIAdvancedSlider : public QWidget
|
---|
35 | {
|
---|
36 | Q_OBJECT;
|
---|
37 | Q_PROPERTY(int value READ value WRITE setValue);
|
---|
38 |
|
---|
39 | signals:
|
---|
40 |
|
---|
41 | /** Notifies about value changed to @a iValue. */
|
---|
42 | void valueChanged(int iValue);
|
---|
43 |
|
---|
44 | /** Notifies about slider moved to @a iValue. */
|
---|
45 | void sliderMoved(int iValue);
|
---|
46 |
|
---|
47 | /** Notifies about slider pressed. */
|
---|
48 | void sliderPressed();
|
---|
49 | /** Notifies about slider released. */
|
---|
50 | void sliderReleased();
|
---|
51 |
|
---|
52 | public:
|
---|
53 |
|
---|
54 | /** Constructs advanced-slider passing @a pParent to the base-class. */
|
---|
55 | QIAdvancedSlider(QWidget *pParent = 0);
|
---|
56 | /** Constructs advanced-slider passing @a pParent to the base-class.
|
---|
57 | * @param enmOrientation Brings the slider orientation. */
|
---|
58 | QIAdvancedSlider(Qt::Orientation enmOrientation, QWidget *pParent = 0);
|
---|
59 |
|
---|
60 | /** Returns the slider value. */
|
---|
61 | int value() const;
|
---|
62 |
|
---|
63 | /** Defines the slider range to be from @a iMin to @a iMax. */
|
---|
64 | void setRange(int iMin, int iMax);
|
---|
65 |
|
---|
66 | /** Defines the slider @a iMaximum. */
|
---|
67 | void setMaximum(int iMaximum);
|
---|
68 | /** Returns the slider maximum. */
|
---|
69 | int maximum() const;
|
---|
70 |
|
---|
71 | /** Defines the slider @a iMinimum. */
|
---|
72 | void setMinimum(int iMinimum);
|
---|
73 | /** Returns the slider minimum. */
|
---|
74 | int minimum() const;
|
---|
75 |
|
---|
76 | /** Defines the slider @a iPageStep. */
|
---|
77 | void setPageStep(int iPageStep);
|
---|
78 | /** Returns the slider page step. */
|
---|
79 | int pageStep() const;
|
---|
80 |
|
---|
81 | /** Defines the slider @a iSingleStep. */
|
---|
82 | void setSingleStep(int val);
|
---|
83 | /** Returns the slider single step. */
|
---|
84 | int singelStep() const;
|
---|
85 |
|
---|
86 | /** Defines the slider @a iTickInterval. */
|
---|
87 | void setTickInterval(int val);
|
---|
88 | /** Returns the slider tick interval. */
|
---|
89 | int tickInterval() const;
|
---|
90 |
|
---|
91 | /** Returns the slider orientation. */
|
---|
92 | Qt::Orientation orientation() const;
|
---|
93 |
|
---|
94 | /** Defines whether snapping is @a fEnabled. */
|
---|
95 | void setSnappingEnabled(bool fEnabled);
|
---|
96 | /** Returns whether snapping is enabled. */
|
---|
97 | bool isSnappingEnabled() const;
|
---|
98 |
|
---|
99 | /** Defines the optimal hint to be from @a iMin to @a iMax. */
|
---|
100 | void setOptimalHint(int iMin, int iMax);
|
---|
101 | /** Defines the warning hint to be from @a iMin to @a iMax. */
|
---|
102 | void setWarningHint(int iMin, int iMax);
|
---|
103 | /** Defines the error hint to be from @a iMin to @a iMax. */
|
---|
104 | void setErrorHint(int iMin, int iMax);
|
---|
105 |
|
---|
106 | public slots:
|
---|
107 |
|
---|
108 | /** Defines the slider @a enmOrientation. */
|
---|
109 | void setOrientation(Qt::Orientation enmOrientation);
|
---|
110 |
|
---|
111 | /** Defines current slider @a iValue. */
|
---|
112 | void setValue(int iValue);
|
---|
113 |
|
---|
114 | private slots:
|
---|
115 |
|
---|
116 | /** Handles the slider move to @a iValue. */
|
---|
117 | void sltSliderMoved(int iValue);
|
---|
118 |
|
---|
119 | private:
|
---|
120 |
|
---|
121 | /** Prepares all. */
|
---|
122 | void prepare(Qt::Orientation fOrientation = Qt::Horizontal);
|
---|
123 |
|
---|
124 | /** Returns snapped value for passed @a iValue. */
|
---|
125 | int snapValue(int iValue);
|
---|
126 |
|
---|
127 | /** Holds the private QSlider instance. */
|
---|
128 | UIPrivateSlider *m_pSlider;
|
---|
129 | /** Holds the whether slider snapping is enabled. */
|
---|
130 | bool m_fSnappingEnabled;
|
---|
131 | };
|
---|
132 |
|
---|
133 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIAdvancedSlider_h */
|
---|