1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
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 |
149 | |