1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt3Support 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 The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22 ** following information to ensure the GNU Lesser General Public License
23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 **
26 ** As a special exception, The Qt Company gives you certain additional
27 ** rights. These rights are described in The Qt Company LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 **
30 ** GNU General Public License Usage
31 ** Alternatively, this file may be used under the terms of the GNU
32 ** General Public License version 3.0 as published by the Free Software
33 ** Foundation and appearing in the file LICENSE.GPL included in the
34 ** packaging of this file. Please review the following information to
35 ** ensure the GNU General Public License version 3.0 requirements will be
36 ** met: http://www.gnu.org/copyleft/gpl.html.
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef Q3GROUPBOX_H
43 #define Q3GROUPBOX_H
44
45 #include <QtGui/qgroupbox.h>
46
47 QT_BEGIN_HEADER
48
49 QT_BEGIN_NAMESPACE
50
QT_MODULE(Qt3SupportLight)51 QT_MODULE(Qt3SupportLight)
52
53 class Q3GroupBoxPrivate;
54
55 class Q_COMPAT_EXPORT Q3GroupBox : public QGroupBox
56 {
57 Q_OBJECT
58 public:
59 enum
60 #if defined(Q_MOC_RUN)
61 FrameShape
62 #else
63 DummyFrame
64 #endif
65 { Box = QFrame::Box, Sunken = QFrame::Sunken, Plain = QFrame::Plain,
66 Raised = QFrame::Raised, MShadow=QFrame::Shadow_Mask, NoFrame = QFrame::NoFrame,
67 Panel = QFrame::Panel, StyledPanel = QFrame::StyledPanel, HLine = QFrame::HLine,
68 VLine = QFrame::VLine,
69 WinPanel = QFrame::WinPanel,ToolBarPanel = QFrame::StyledPanel,
70 MenuBarPanel = QFrame::StyledPanel, PopupPanel = QFrame::StyledPanel,
71 LineEditPanel = QFrame::StyledPanel,TabWidgetPanel = QFrame::StyledPanel,
72 GroupBoxPanel = 0x0007,
73 MShape = QFrame::Shape_Mask};
74
75 typedef DummyFrame FrameShape;
76 Q_ENUMS(FrameShape)
77
78 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation DESIGNABLE false)
79 Q_PROPERTY(int columns READ columns WRITE setColumns DESIGNABLE false)
80
81 Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false)
82 Q_PROPERTY(FrameShape frameShape READ frameShape WRITE setFrameShape)
83 Q_PROPERTY(FrameShape frameShadow READ frameShadow WRITE setFrameShadow)
84 Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
85 Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth)
86 Q_PROPERTY(int margin READ margin WRITE setMargin)
87
88 public:
89 explicit Q3GroupBox(QWidget* parent=0, const char* name=0);
90 explicit Q3GroupBox(const QString &title,
91 QWidget* parent=0, const char* name=0);
92 Q3GroupBox(int strips, Qt::Orientation o,
93 QWidget* parent=0, const char* name=0);
94 Q3GroupBox(int strips, Qt::Orientation o, const QString &title,
95 QWidget* parent=0, const char* name=0);
96 ~Q3GroupBox();
97
98 virtual void setColumnLayout(int strips, Qt::Orientation o);
99
100 int columns() const;
101 void setColumns(int);
102
103 Qt::Orientation orientation() const;
104 void setOrientation(Qt::Orientation);
105
106 int insideMargin() const;
107 int insideSpacing() const;
108 void setInsideMargin(int m);
109 void setInsideSpacing(int s);
110
111 void addSpace(int);
112
113 void setFrameRect(QRect);
114 QRect frameRect() const;
115 #ifdef qdoc
116 void setFrameShadow(FrameShape);
117 FrameShape frameShadow() const;
118 void setFrameShape(FrameShape);
119 FrameShape frameShape() const;
120 #else
121 void setFrameShadow(DummyFrame);
122 DummyFrame frameShadow() const;
123 void setFrameShape(DummyFrame);
124 DummyFrame frameShape() const;
125 #endif
126 void setFrameStyle(int);
127 int frameStyle() const;
128 int frameWidth() const;
129 void setLineWidth(int);
130 int lineWidth() const;
131 void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
132 int margin() const
133 { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
134 void setMidLineWidth(int);
135 int midLineWidth() const;
136
137 protected:
138 void childEvent(QChildEvent *);
139 void resizeEvent(QResizeEvent *);
140 void changeEvent(QEvent *);
141 bool event(QEvent *);
142
143 private:
144 void skip();
145 void init();
146 void calculateFrame();
147 void insertWid(QWidget*);
148 void drawFrame(QPainter *p);
149
150 Q3GroupBoxPrivate * d;
151
152 Q_DISABLE_COPY(Q3GroupBox)
153 };
154
155 QT_END_NAMESPACE
156
157 QT_END_HEADER
158
159 #endif // Q3GROUPBOX_H
160