1 /****************************************************************************
2 ** $Id: qt/qframe.h 3.3.8 edited Jan 11 14:38 $
3 **
4 ** Definition of QFrame widget class
5 **
6 ** Created : 950201
7 **
8 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
9 **
10 ** This file is part of the widgets module of the Qt GUI Toolkit.
11 **
12 ** This file may be distributed under the terms of the Q Public License
13 ** as defined by Trolltech ASA of Norway and appearing in the file
14 ** LICENSE.QPL included in the packaging of this file.
15 **
16 ** This file may be distributed and/or modified under the terms of the
17 ** GNU General Public License version 2 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
20 **
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
24 **
25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27 **
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 ** information about Qt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
32 **
33 ** Contact info@trolltech.com if any conditions of this licensing are
34 ** not clear to you.
35 **
36 **********************************************************************/
37
38 #ifndef QFRAME_H
39 #define QFRAME_H
40
41 #ifndef QT_H
42 #include "qwidget.h"
43 #endif // QT_H
44
45 #ifndef QT_NO_FRAME
46
47 class Q_EXPORT QFrame : public QWidget
48 {
49 Q_OBJECT
50 Q_ENUMS( Shape Shadow )
51 Q_PROPERTY( int frameWidth READ frameWidth )
52 Q_PROPERTY( QRect contentsRect READ contentsRect )
53 Q_PROPERTY( Shape frameShape READ frameShape WRITE setFrameShape )
54 Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
55 Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
56 Q_PROPERTY( int margin READ margin WRITE setMargin )
57 Q_PROPERTY( int midLineWidth READ midLineWidth WRITE setMidLineWidth )
58 Q_PROPERTY( QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false )
59
60 public:
61 QFrame( QWidget* parent=0, const char* name=0, WFlags f=0 );
62
63 int frameStyle() const;
64 virtual void setFrameStyle( int );
65
66 int frameWidth() const;
67 QRect contentsRect() const;
68
69 #ifndef Q_QDOC
lineShapesOk()70 bool lineShapesOk() const { return TRUE; }
71 #endif
72
73 QSize sizeHint() const;
74
75 enum Shape { NoFrame = 0, // no frame
76 Box = 0x0001, // rectangular box
77 Panel = 0x0002, // rectangular panel
78 WinPanel = 0x0003, // rectangular panel (Windows)
79 HLine = 0x0004, // horizontal line
80 VLine = 0x0005, // vertical line
81 StyledPanel = 0x0006, // rectangular panel depending on the GUI style
82 PopupPanel = 0x0007, // rectangular panel depending on the GUI style
83 MenuBarPanel = 0x0008,
84 ToolBarPanel = 0x0009,
85 LineEditPanel = 0x000a,
86 TabWidgetPanel = 0x000b,
87 GroupBoxPanel = 0x000c,
88 MShape = 0x000f // mask for the shape
89 };
90 enum Shadow { Plain = 0x0010, // plain line
91 Raised = 0x0020, // raised shadow effect
92 Sunken = 0x0030, // sunken shadow effect
93 MShadow = 0x00f0 }; // mask for the shadow
94
95 Shape frameShape() const;
96 void setFrameShape( Shape );
97 Shadow frameShadow() const;
98 void setFrameShadow( Shadow );
99
100 int lineWidth() const;
101 virtual void setLineWidth( int );
102
103 int margin() const;
104 virtual void setMargin( int );
105
106 int midLineWidth() const;
107 virtual void setMidLineWidth( int );
108
109 QRect frameRect() const;
110 virtual void setFrameRect( const QRect & );
111
112 protected:
113 void paintEvent( QPaintEvent * );
114 void resizeEvent( QResizeEvent * );
115 virtual void drawFrame( QPainter * );
116 virtual void drawContents( QPainter * );
117 virtual void frameChanged();
118 void styleChange( QStyle& );
119
120 private:
121 void updateFrameWidth(bool=FALSE);
122 QRect frect;
123 int fstyle;
124 short lwidth;
125 short mwidth;
126 short mlwidth;
127 short fwidth;
128
129 void * d;
130 private: // Disabled copy constructor and operator=
131 #if defined(Q_DISABLE_COPY)
132 QFrame( const QFrame & );
133 QFrame &operator=( const QFrame & );
134 #endif
135 };
136
137
frameStyle()138 inline int QFrame::frameStyle() const
139 { return fstyle; }
140
frameShape()141 inline QFrame::Shape QFrame::frameShape() const
142 { return (Shape) ( fstyle & MShape ); }
143
frameShadow()144 inline QFrame::Shadow QFrame::frameShadow() const
145 { return (Shadow) ( fstyle & MShadow ); }
146
setFrameShape(QFrame::Shape s)147 inline void QFrame::setFrameShape( QFrame::Shape s )
148 { setFrameStyle( ( fstyle & MShadow ) | s ); }
149
setFrameShadow(QFrame::Shadow s)150 inline void QFrame::setFrameShadow( QFrame::Shadow s )
151 { setFrameStyle( ( fstyle & MShape ) | s ); }
152
lineWidth()153 inline int QFrame::lineWidth() const
154 { return lwidth; }
155
midLineWidth()156 inline int QFrame::midLineWidth() const
157 { return mlwidth; }
158
margin()159 inline int QFrame::margin() const
160 { return mwidth; }
161
frameWidth()162 inline int QFrame::frameWidth() const
163 { return fwidth; }
164
165
166 #endif // QT_NO_FRAME
167
168 #endif // QFRAME_H
169