1 | /**********************************************************************
|
---|
2 | ** $Id: qgroupbox.h 2 2005-11-16 15:49:26Z dmik $
|
---|
3 | **
|
---|
4 | ** Definition of QGroupBox widget class
|
---|
5 | **
|
---|
6 | ** Created : 950203
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-2000 Trolltech AS. 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 AS 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 QGROUPBOX_H
|
---|
39 | #define QGROUPBOX_H
|
---|
40 |
|
---|
41 | #ifndef QT_H
|
---|
42 | #include "qframe.h"
|
---|
43 | #endif // QT_H
|
---|
44 |
|
---|
45 | #ifndef QT_NO_GROUPBOX
|
---|
46 |
|
---|
47 |
|
---|
48 | class QAccel;
|
---|
49 | class QGroupBoxPrivate;
|
---|
50 | class QVBoxLayout;
|
---|
51 | class QGridLayout;
|
---|
52 | class QSpacerItem;
|
---|
53 |
|
---|
54 | class Q_EXPORT QGroupBox : public QFrame
|
---|
55 | {
|
---|
56 | Q_OBJECT
|
---|
57 | Q_PROPERTY( QString title READ title WRITE setTitle )
|
---|
58 | Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment )
|
---|
59 | Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation DESIGNABLE false )
|
---|
60 | Q_PROPERTY( int columns READ columns WRITE setColumns DESIGNABLE false )
|
---|
61 | Q_PROPERTY( bool flat READ isFlat WRITE setFlat )
|
---|
62 | #ifndef QT_NO_CHECKBOX
|
---|
63 | Q_PROPERTY( bool checkable READ isCheckable WRITE setCheckable )
|
---|
64 | Q_PROPERTY( bool checked READ isChecked WRITE setChecked )
|
---|
65 | #endif
|
---|
66 | public:
|
---|
67 | QGroupBox( QWidget* parent=0, const char* name=0 );
|
---|
68 | QGroupBox( const QString &title,
|
---|
69 | QWidget* parent=0, const char* name=0 );
|
---|
70 | QGroupBox( int strips, Orientation o,
|
---|
71 | QWidget* parent=0, const char* name=0 );
|
---|
72 | QGroupBox( int strips, Orientation o, const QString &title,
|
---|
73 | QWidget* parent=0, const char* name=0 );
|
---|
74 | ~QGroupBox();
|
---|
75 |
|
---|
76 | virtual void setColumnLayout(int strips, Orientation o);
|
---|
77 |
|
---|
78 | QString title() const { return str; }
|
---|
79 | virtual void setTitle( const QString &);
|
---|
80 |
|
---|
81 | int alignment() const { return align; }
|
---|
82 | virtual void setAlignment( int );
|
---|
83 |
|
---|
84 | int columns() const;
|
---|
85 | void setColumns( int );
|
---|
86 |
|
---|
87 | Orientation orientation() const { return dir; }
|
---|
88 | void setOrientation( Orientation );
|
---|
89 |
|
---|
90 | int insideMargin() const;
|
---|
91 | int insideSpacing() const;
|
---|
92 | void setInsideMargin( int m );
|
---|
93 | void setInsideSpacing( int s );
|
---|
94 |
|
---|
95 | void addSpace( int );
|
---|
96 | QSize sizeHint() const;
|
---|
97 |
|
---|
98 | bool isFlat() const;
|
---|
99 | void setFlat( bool b );
|
---|
100 | bool isCheckable() const;
|
---|
101 | #ifndef QT_NO_CHECKBOX
|
---|
102 | void setCheckable( bool b );
|
---|
103 | #endif
|
---|
104 | bool isChecked() const;
|
---|
105 | void setEnabled(bool on);
|
---|
106 |
|
---|
107 | #ifndef QT_NO_CHECKBOX
|
---|
108 | public slots:
|
---|
109 | void setChecked( bool b );
|
---|
110 |
|
---|
111 | signals:
|
---|
112 | void toggled( bool );
|
---|
113 | #endif
|
---|
114 | protected:
|
---|
115 | bool event( QEvent * );
|
---|
116 | void childEvent( QChildEvent * );
|
---|
117 | void resizeEvent( QResizeEvent * );
|
---|
118 | void paintEvent( QPaintEvent * );
|
---|
119 | void focusInEvent( QFocusEvent * );
|
---|
120 | void fontChange( const QFont & );
|
---|
121 |
|
---|
122 | private slots:
|
---|
123 | void fixFocus();
|
---|
124 | void setChildrenEnabled( bool b );
|
---|
125 |
|
---|
126 | private:
|
---|
127 | void skip();
|
---|
128 | void init();
|
---|
129 | void calculateFrame();
|
---|
130 | void insertWid( QWidget* );
|
---|
131 | void setTextSpacer();
|
---|
132 | #ifndef QT_NO_CHECKBOX
|
---|
133 | void updateCheckBoxGeometry();
|
---|
134 | #endif
|
---|
135 | QString str;
|
---|
136 | int align;
|
---|
137 | int lenvisible;
|
---|
138 | #ifndef QT_NO_ACCEL
|
---|
139 | QAccel * accel;
|
---|
140 | #endif
|
---|
141 | QGroupBoxPrivate * d;
|
---|
142 |
|
---|
143 | QVBoxLayout *vbox;
|
---|
144 | QGridLayout *grid;
|
---|
145 | int row;
|
---|
146 | int col : 30;
|
---|
147 | uint bFlat : 1;
|
---|
148 | int nRows, nCols;
|
---|
149 | Orientation dir;
|
---|
150 | int spac, marg;
|
---|
151 |
|
---|
152 | private: // Disabled copy constructor and operator=
|
---|
153 | #if defined(Q_DISABLE_COPY)
|
---|
154 | QGroupBox( const QGroupBox & );
|
---|
155 | QGroupBox &operator=( const QGroupBox & );
|
---|
156 | #endif
|
---|
157 | };
|
---|
158 |
|
---|
159 |
|
---|
160 | #endif // QT_NO_GROUPBOX
|
---|
161 |
|
---|
162 | #endif // QGROUPBOX_H
|
---|