| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 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 qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #ifndef QFRAME_H | 
|---|
| 43 | #define QFRAME_H | 
|---|
| 44 |  | 
|---|
| 45 | #include <QtGui/qwidget.h> | 
|---|
| 46 |  | 
|---|
| 47 | QT_BEGIN_HEADER | 
|---|
| 48 |  | 
|---|
| 49 | QT_BEGIN_NAMESPACE | 
|---|
| 50 |  | 
|---|
| 51 | QT_MODULE(Gui) | 
|---|
| 52 |  | 
|---|
| 53 | class QFramePrivate; | 
|---|
| 54 |  | 
|---|
| 55 | class Q_GUI_EXPORT QFrame : public QWidget | 
|---|
| 56 | { | 
|---|
| 57 | Q_OBJECT | 
|---|
| 58 |  | 
|---|
| 59 | Q_ENUMS(Shape Shadow) | 
|---|
| 60 | Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape) | 
|---|
| 61 | Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow) | 
|---|
| 62 | Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) | 
|---|
| 63 | Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth) | 
|---|
| 64 | Q_PROPERTY(int frameWidth READ frameWidth) | 
|---|
| 65 | Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false) | 
|---|
| 66 |  | 
|---|
| 67 | public: | 
|---|
| 68 | explicit QFrame(QWidget* parent = 0, Qt::WindowFlags f = 0); | 
|---|
| 69 | ~QFrame(); | 
|---|
| 70 |  | 
|---|
| 71 | int frameStyle() const; | 
|---|
| 72 | void setFrameStyle(int); | 
|---|
| 73 |  | 
|---|
| 74 | int frameWidth() const; | 
|---|
| 75 |  | 
|---|
| 76 | QSize sizeHint() const; | 
|---|
| 77 |  | 
|---|
| 78 | enum Shape { | 
|---|
| 79 | NoFrame  = 0, // no frame | 
|---|
| 80 | Box = 0x0001, // rectangular box | 
|---|
| 81 | Panel = 0x0002, // rectangular panel | 
|---|
| 82 | WinPanel = 0x0003, // rectangular panel (Windows) | 
|---|
| 83 | HLine = 0x0004, // horizontal line | 
|---|
| 84 | VLine = 0x0005, // vertical line | 
|---|
| 85 | StyledPanel = 0x0006 // rectangular panel depending on the GUI style | 
|---|
| 86 |  | 
|---|
| 87 | #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN) | 
|---|
| 88 | ,PopupPanel = StyledPanel, // rectangular panel depending on the GUI style | 
|---|
| 89 | MenuBarPanel = StyledPanel, | 
|---|
| 90 | ToolBarPanel = StyledPanel, | 
|---|
| 91 | LineEditPanel = StyledPanel, | 
|---|
| 92 | TabWidgetPanel = StyledPanel, | 
|---|
| 93 | GroupBoxPanel = StyledPanel | 
|---|
| 94 | #endif | 
|---|
| 95 | }; | 
|---|
| 96 | enum Shadow { | 
|---|
| 97 | Plain = 0x0010, // plain line | 
|---|
| 98 | Raised = 0x0020, // raised shadow effect | 
|---|
| 99 | Sunken = 0x0030 // sunken shadow effect | 
|---|
| 100 | }; | 
|---|
| 101 |  | 
|---|
| 102 | enum StyleMask { | 
|---|
| 103 | Shadow_Mask = 0x00f0, // mask for the shadow | 
|---|
| 104 | Shape_Mask = 0x000f // mask for the shape | 
|---|
| 105 | #if defined(QT3_SUPPORT) | 
|---|
| 106 | ,MShadow = Shadow_Mask, | 
|---|
| 107 | MShape = Shape_Mask | 
|---|
| 108 | #endif | 
|---|
| 109 | }; | 
|---|
| 110 |  | 
|---|
| 111 | Shape frameShape() const; | 
|---|
| 112 | void setFrameShape(Shape); | 
|---|
| 113 | Shadow frameShadow() const; | 
|---|
| 114 | void setFrameShadow(Shadow); | 
|---|
| 115 |  | 
|---|
| 116 | int lineWidth() const; | 
|---|
| 117 | void setLineWidth(int); | 
|---|
| 118 |  | 
|---|
| 119 | int midLineWidth() const; | 
|---|
| 120 | void setMidLineWidth(int); | 
|---|
| 121 |  | 
|---|
| 122 | QRect frameRect() const; | 
|---|
| 123 | void setFrameRect(const QRect &); | 
|---|
| 124 |  | 
|---|
| 125 | protected: | 
|---|
| 126 | bool event(QEvent *e); | 
|---|
| 127 | void paintEvent(QPaintEvent *); | 
|---|
| 128 | void changeEvent(QEvent *); | 
|---|
| 129 | void drawFrame(QPainter *); | 
|---|
| 130 |  | 
|---|
| 131 | #ifdef QT3_SUPPORT | 
|---|
| 132 | public: | 
|---|
| 133 | QT3_SUPPORT_CONSTRUCTOR QFrame(QWidget* parent, const char* name, Qt::WindowFlags f = 0); | 
|---|
| 134 | #endif | 
|---|
| 135 |  | 
|---|
| 136 | protected: | 
|---|
| 137 | QFrame(QFramePrivate &dd, QWidget* parent = 0, Qt::WindowFlags f = 0); | 
|---|
| 138 |  | 
|---|
| 139 | private: | 
|---|
| 140 | Q_DISABLE_COPY(QFrame) | 
|---|
| 141 | Q_DECLARE_PRIVATE(QFrame) | 
|---|
| 142 | }; | 
|---|
| 143 |  | 
|---|
| 144 | QT_END_NAMESPACE | 
|---|
| 145 |  | 
|---|
| 146 | QT_END_HEADER | 
|---|
| 147 |  | 
|---|
| 148 | #endif // QFRAME_H | 
|---|