Debian Codegraph @

contrib/qxt/src/qxtspanslider_p.h

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
4 **
5 ** This file is part of the QxtGui module of the Qxt library.
6 **
7 ** This library is free software; you can redistribute it and/or modify it
8 ** under the terms of the Common Public License, version 1.0, as published
9 ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 ** version 2.1, as published by the Free Software Foundation.
11 **
12 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 ** FITNESS FOR A PARTICULAR PURPOSE.
16 **
17 ** You should have received a copy of the CPL and the LGPL along with this
18 ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 ** included with the source distribution for more information.
20 ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 **
22 ** <http://libqxt.org> <[email protected]>
23 **
24 ****************************************************************************/
25 #ifndef QXTSPANSLIDER_P_H
26 #define QXTSPANSLIDER_P_H
27
28 #include <QStyle>
29 #include <QObject>
30 #include "qxtspanslider.h"
31
32 QT_FORWARD_DECLARE_CLASS(QStylePainter)
33 QT_FORWARD_DECLARE_CLASS(QStyleOptionSlider)
34
35 class QxtSpanSliderPrivate : public QObject, public QxtPrivate<QxtSpanSlider>
36 {
37 Q_OBJECT
38
39 public:
40 QXT_DECLARE_PUBLIC(QxtSpanSlider)
41
42 QxtSpanSliderPrivate();
43 void initStyleOption(QStyleOptionSlider* option, QxtSpanSlider::SpanHandle handle = QxtSpanSlider::UpperHandle) const;
44 int pick(const QPoint& pt) const
45 {
46 return qxt_p().orientation() == Qt::Horizontal ? pt.x() : pt.y();
47 }
48 int pixelPosToRangeValue(int pos) const;
49 void handleMousePress(const QPoint& pos, QStyle::SubControl& control, int value, QxtSpanSlider::SpanHandle handle);
50 void drawHandle(QStylePainter* painter, QxtSpanSlider::SpanHandle handle) const;
51 void setupPainter(QPainter* painter, Qt::Orientation orientation, qreal x1, qreal y1, qreal x2, qreal y2) const;
52 void drawSpan(QStylePainter* painter, const QRect& rect) const;
53 void triggerAction(QAbstractSlider::SliderAction action, bool main);
54 void swapControls();
55
56 int lower;
57 int upper;
58 int lowerPos;
59 int upperPos;
60 int offset;
61 int position;
62 QxtSpanSlider::SpanHandle lastPressed;
63 QxtSpanSlider::SpanHandle mainControl;
64 QStyle::SubControl lowerPressed;
65 QStyle::SubControl upperPressed;
66 QxtSpanSlider::HandleMovementMode movement;
67 bool firstMovement;
68 bool blockTracking;
69 bool showRail;
70
71 public Q_SLOTS:
72 void updateRange(int min, int max);
73 void movePressedHandle();
74 };
75
76 #endif // QXTSPANSLIDER_P_H