src/gui/widgets/qabstractscrollarea.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QABSTRACTSCROLLAREA_H
       
    43 #define QABSTRACTSCROLLAREA_H
       
    44 
       
    45 #include <QtGui/qframe.h>
       
    46 
       
    47 QT_BEGIN_HEADER
       
    48 
       
    49 QT_BEGIN_NAMESPACE
       
    50 
       
    51 QT_MODULE(Gui)
       
    52 
       
    53 #ifndef QT_NO_SCROLLAREA
       
    54 
       
    55 class QScrollBar;
       
    56 class QAbstractScrollAreaPrivate;
       
    57 
       
    58 class 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 
       
    64 public:
       
    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 
       
    92 protected Q_SLOTS:
       
    93     void setupViewport(QWidget *viewport);
       
    94 
       
    95 protected:
       
    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 
       
   125 private:
       
   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     friend class QWidgetPrivate;
       
   134 };
       
   135 
       
   136 #endif // QT_NO_SCROLLAREA
       
   137 
       
   138 QT_END_NAMESPACE
       
   139 
       
   140 QT_END_HEADER
       
   141 
       
   142 #endif // QABSTRACTSCROLLAREA_H