~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/widgets/qabstractspinbox.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the widgets module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QABSTRACTSPINBOX_H
 
30
#define QABSTRACTSPINBOX_H
 
31
 
 
32
#include <QtGui/qwidget.h>
 
33
#include <QtGui/qvalidator.h>
 
34
 
 
35
class QLineEdit;
 
36
 
 
37
class QAbstractSpinBoxPrivate;
 
38
class Q_GUI_EXPORT QAbstractSpinBox : public QWidget
 
39
{
 
40
    Q_OBJECT
 
41
 
 
42
    Q_ENUMS(ButtonSymbols)
 
43
    Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
 
44
    Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
 
45
    Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
 
46
    Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
 
47
    Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols)
 
48
    Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText)
 
49
    Q_PROPERTY(QString text READ text)
 
50
 
 
51
public:
 
52
    explicit QAbstractSpinBox(QWidget *parent = 0);
 
53
    ~QAbstractSpinBox();
 
54
 
 
55
    enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01,
 
56
                           StepDownEnabled = 0x02 };
 
57
    Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag)
 
58
 
 
59
    enum ButtonSymbols { UpDownArrows, PlusMinus };
 
60
 
 
61
    ButtonSymbols buttonSymbols() const;
 
62
    void setButtonSymbols(ButtonSymbols bs);
 
63
 
 
64
    QString text() const;
 
65
 
 
66
    QString specialValueText() const;
 
67
    void setSpecialValueText(const QString &s);
 
68
 
 
69
    bool wrapping() const;
 
70
    void setWrapping(bool w);
 
71
 
 
72
    void setReadOnly(bool r);
 
73
    bool isReadOnly() const;
 
74
 
 
75
    void setAlignment(Qt::Alignment flag);
 
76
    Qt::Alignment alignment() const;
 
77
 
 
78
    void setFrame(bool);
 
79
    bool hasFrame() const;
 
80
 
 
81
    QSize sizeHint() const;
 
82
    QSize minimumSizeHint() const;
 
83
 
 
84
    void interpretText();
 
85
    bool event(QEvent *event);
 
86
 
 
87
    virtual QValidator::State validate(QString &input, int &pos) const;
 
88
    virtual void fixup(QString &input) const;
 
89
 
 
90
    virtual void stepBy(int steps);
 
91
public slots:
 
92
    void stepUp();
 
93
    void stepDown();
 
94
    void selectAll();
 
95
    virtual void clear();
 
96
 
 
97
protected:
 
98
    void resizeEvent(QResizeEvent *e);
 
99
    void keyPressEvent(QKeyEvent *e);
 
100
    void keyReleaseEvent(QKeyEvent *e);
 
101
    void wheelEvent(QWheelEvent *e);
 
102
    void focusInEvent(QFocusEvent *e);
 
103
    void focusOutEvent(QFocusEvent *e);
 
104
    void contextMenuEvent(QContextMenuEvent *e);
 
105
    void changeEvent(QEvent *e);
 
106
    void closeEvent(QCloseEvent *e);
 
107
    void hideEvent(QHideEvent *e);
 
108
    void mousePressEvent(QMouseEvent *e);
 
109
    void mouseReleaseEvent(QMouseEvent *e);
 
110
    void mouseMoveEvent(QMouseEvent *e);
 
111
    void timerEvent(QTimerEvent *e);
 
112
    void paintEvent(QPaintEvent *e);
 
113
    void showEvent(QShowEvent *e);
 
114
 
 
115
    QLineEdit *lineEdit() const;
 
116
    void setLineEdit(QLineEdit *e);
 
117
 
 
118
    virtual StepEnabled stepEnabled() const;
 
119
signals:
 
120
    void editingFinished();
 
121
protected:
 
122
    QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = 0);
 
123
 
 
124
private:
 
125
    Q_PRIVATE_SLOT(d_func(), void editorTextChanged(const QString &))
 
126
    Q_PRIVATE_SLOT(d_func(), void editorCursorPositionChanged(int, int))
 
127
 
 
128
    Q_DECLARE_PRIVATE(QAbstractSpinBox)
 
129
    Q_DISABLE_COPY(QAbstractSpinBox)
 
130
};
 
131
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
 
132
#endif // QABSTRACTSPINBOX_H