qframe.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QFRAME_H
00043 #define QFRAME_H
00044 
00045 #include <QtGui/qwidget.h>
00046 
00047 QT_BEGIN_HEADER
00048 
00049 QT_BEGIN_NAMESPACE
00050 
00051 QT_MODULE(Gui)
00052 
00053 class QFramePrivate;
00054 
00055 class Q_GUI_EXPORT QFrame : public QWidget
00056 {
00057     Q_OBJECT
00058 
00059     Q_ENUMS(Shape Shadow)
00060     Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape)
00061     Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow)
00062     Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
00063     Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth)
00064     Q_PROPERTY(int frameWidth READ frameWidth)
00065     Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false)
00066 
00067 public:
00068     explicit QFrame(QWidget* parent = 0, Qt::WindowFlags f = 0);
00069     ~QFrame();
00070 
00071     int frameStyle() const;
00072     void setFrameStyle(int);
00073 
00074     int frameWidth() const;
00075 
00076     QSize sizeHint() const;
00077 
00078     enum Shape {
00079         NoFrame  = 0, // no frame
00080         Box = 0x0001, // rectangular box
00081         Panel = 0x0002, // rectangular panel
00082         WinPanel = 0x0003, // rectangular panel (Windows)
00083         HLine = 0x0004, // horizontal line
00084         VLine = 0x0005, // vertical line
00085         StyledPanel = 0x0006 // rectangular panel depending on the GUI style
00086 
00087 #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
00088         ,PopupPanel = StyledPanel, // rectangular panel depending on the GUI style
00089         MenuBarPanel = StyledPanel,
00090         ToolBarPanel = StyledPanel,
00091         LineEditPanel = StyledPanel,
00092         TabWidgetPanel = StyledPanel,
00093         GroupBoxPanel = StyledPanel
00094 #endif
00095     };
00096     enum Shadow {
00097         Plain = 0x0010, // plain line
00098         Raised = 0x0020, // raised shadow effect
00099         Sunken = 0x0030 // sunken shadow effect
00100     };
00101 
00102     enum StyleMask {
00103         Shadow_Mask = 0x00f0, // mask for the shadow
00104         Shape_Mask = 0x000f // mask for the shape
00105 #if defined(QT3_SUPPORT)
00106         ,MShadow = Shadow_Mask,
00107         MShape = Shape_Mask
00108 #endif
00109     };
00110 
00111     Shape frameShape() const;
00112     void setFrameShape(Shape);
00113     Shadow frameShadow() const;
00114     void setFrameShadow(Shadow);
00115 
00116     int lineWidth() const;
00117     void setLineWidth(int);
00118 
00119     int midLineWidth() const;
00120     void setMidLineWidth(int);
00121 
00122     QRect frameRect() const;
00123     void setFrameRect(const QRect &);
00124 
00125 protected:
00126     bool event(QEvent *e);
00127     void paintEvent(QPaintEvent *);
00128     void changeEvent(QEvent *);
00129     void drawFrame(QPainter *);
00130 
00131 #ifdef QT3_SUPPORT
00132 public:
00133     QT3_SUPPORT_CONSTRUCTOR QFrame(QWidget* parent, const char* name, Qt::WindowFlags f = 0);
00134 #endif
00135 
00136 protected:
00137     QFrame(QFramePrivate &dd, QWidget* parent = 0, Qt::WindowFlags f = 0);
00138 
00139 private:
00140     Q_DISABLE_COPY(QFrame)
00141     Q_DECLARE_PRIVATE(QFrame)
00142 };
00143 
00144 QT_END_NAMESPACE
00145 
00146 QT_END_HEADER
00147 
00148 #endif // QFRAME_H