source: trunk/src/gui/widgets/qabstractscrollarea.h@ 187

Last change on this file since 187 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 4.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QABSTRACTSCROLLAREA_H
43#define QABSTRACTSCROLLAREA_H
44
45#include <QtGui/qframe.h>
46
47QT_BEGIN_HEADER
48
49QT_BEGIN_NAMESPACE
50
51QT_MODULE(Gui)
52
53#ifndef QT_NO_SCROLLAREA
54
55class QScrollBar;
56class QAbstractScrollAreaPrivate;
57
58class Q_GUI_EXPORT QAbstractScrollArea : public QFrame
59{
60 Q_OBJECT
61 Q_PROPERTY(Qt::ScrollBarPolicy verticalScrollBarPolicy READ verticalScrollBarPolicy WRITE setVerticalScrollBarPolicy)
62 Q_PROPERTY(Qt::ScrollBarPolicy horizontalScrollBarPolicy READ horizontalScrollBarPolicy WRITE setHorizontalScrollBarPolicy)
63
64public:
65 explicit QAbstractScrollArea(QWidget* parent=0);
66 ~QAbstractScrollArea();
67
68 Qt::ScrollBarPolicy verticalScrollBarPolicy() const;
69 void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy);
70 QScrollBar *verticalScrollBar() const;
71 void setVerticalScrollBar(QScrollBar *scrollbar);
72
73 Qt::ScrollBarPolicy horizontalScrollBarPolicy() const;
74 void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy);
75 QScrollBar *horizontalScrollBar() const;
76 void setHorizontalScrollBar(QScrollBar *scrollbar);
77
78 QWidget *cornerWidget() const;
79 void setCornerWidget(QWidget *widget);
80
81 void addScrollBarWidget(QWidget *widget, Qt::Alignment alignment);
82 QWidgetList scrollBarWidgets(Qt::Alignment alignment);
83
84 QWidget *viewport() const;
85 void setViewport(QWidget *widget);
86 QSize maximumViewportSize() const;
87
88 QSize minimumSizeHint() const;
89
90 QSize sizeHint() const;
91
92protected Q_SLOTS:
93 void setupViewport(QWidget *viewport);
94
95protected:
96 QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent = 0);
97 void setViewportMargins(int left, int top, int right, int bottom);
98
99 bool event(QEvent *);
100 virtual bool viewportEvent(QEvent *);
101
102 void resizeEvent(QResizeEvent *);
103 void paintEvent(QPaintEvent *);
104 void mousePressEvent(QMouseEvent *);
105 void mouseReleaseEvent(QMouseEvent *);
106 void mouseDoubleClickEvent(QMouseEvent *);
107 void mouseMoveEvent(QMouseEvent *);
108#ifndef QT_NO_WHEELEVENT
109 void wheelEvent(QWheelEvent *);
110#endif
111#ifndef QT_NO_CONTEXTMENU
112 void contextMenuEvent(QContextMenuEvent *);
113#endif
114#ifndef QT_NO_DRAGANDDROP
115 void dragEnterEvent(QDragEnterEvent *);
116 void dragMoveEvent(QDragMoveEvent *);
117 void dragLeaveEvent(QDragLeaveEvent *);
118 void dropEvent(QDropEvent *);
119#endif
120
121 void keyPressEvent(QKeyEvent *);
122
123 virtual void scrollContentsBy(int dx, int dy);
124
125private:
126 Q_DECLARE_PRIVATE(QAbstractScrollArea)
127 Q_DISABLE_COPY(QAbstractScrollArea)
128 Q_PRIVATE_SLOT(d_func(), void _q_hslide(int))
129 Q_PRIVATE_SLOT(d_func(), void _q_vslide(int))
130 Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars())
131
132 friend class QStyleSheetStyle;
133};
134
135#endif // QT_NO_SCROLLAREA
136
137QT_END_NAMESPACE
138
139QT_END_HEADER
140
141#endif // QABSTRACTSCROLLAREA_H
Note: See TracBrowser for help on using the repository browser.