1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*
* spinbox2private.h - private classes for SpinBox2 (for TQt 3)
* Program: kalarm
* Copyright © 2005,2006,2008 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SPINBOX2PRIVATE_H
#define SPINBOX2PRIVATE_H
#include <tqcanvas.h>
#include "spinbox.h"
/*=============================================================================
= Class ExtraSpinBox
* Extra pair of spin buttons for SpinBox2.
* The widget is actually a whole spin box, but only the buttons are displayed.
=============================================================================*/
class ExtraSpinBox : public SpinBox
{
Q_OBJECT
TQ_OBJECT
public:
explicit ExtraSpinBox(TQWidget* tqparent, const char* name = 0)
: SpinBox(tqparent, name), mNewStylePending(false) { }
ExtraSpinBox(int minValue, int maxValue, int step, TQWidget* tqparent, const char* name = 0)
: SpinBox(minValue, maxValue, step, tqparent, name), mNewStylePending(false) { }
signals:
void styleUpdated();
protected:
virtual void paintEvent(TQPaintEvent*);
virtual void styleChange(TQStyle&) { mNewStylePending = true; }
private:
bool mNewStylePending; // style has changed, but not yet tqrepainted
};
/*=============================================================================
= Class SpinMirror
* Displays the left-to-right mirror image of a pair of spin buttons, for use
* as the extra spin buttons in a SpinBox2. All mouse clicks are passed on to
* the real extra pair of spin buttons for processing.
* Mirroring in this way allows styles with rounded corners to display correctly.
=============================================================================*/
class SpinMirror : public TQCanvasView
{
Q_OBJECT
TQ_OBJECT
public:
explicit SpinMirror(SpinBox*, TQFrame* spinFrame, TQWidget* tqparent = 0, const char* name = 0);
void setReadOnly(bool ro) { mReadOnly = ro; }
bool isReadOnly() const { return mReadOnly; }
void setNormalButtons(const TQPixmap&);
void redraw(const TQPixmap&);
public slots:
virtual void resize(int w, int h);
void redraw();
protected:
virtual void contentsMousePressEvent(TQMouseEvent* e) { contentsMouseEvent(e); }
virtual void contentsMouseReleaseEvent(TQMouseEvent* e) { contentsMouseEvent(e); }
virtual void contentsMouseMoveEvent(TQMouseEvent* e) { contentsMouseEvent(e); }
virtual void contentsMouseDoubleClickEvent(TQMouseEvent* e) { contentsMouseEvent(e); }
virtual void contentsWheelEvent(TQWheelEvent*);
virtual bool event(TQEvent*);
private:
void contentsMouseEvent(TQMouseEvent*);
SpinBox* mSpinbox; // spinbox whose spin buttons are being mirrored
TQFrame* mSpinFrame; // widget containing mSpinbox's spin buttons
TQWidget* mSpinWidget; // spin buttons in mSpinbox
TQPixmap mNormalButtons; // image of spin buttons in unpressed state
bool mReadOnly; // value cannot be changed
};
#endif // SPINBOX2PRIVATE_H
|