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