1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2005 David Faure <faure@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. |
7 | |
8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 | Boston, MA 02110-1301, USA. |
17 | */ |
18 | |
19 | #ifndef KHBOX_H |
20 | #define KHBOX_H |
21 | |
22 | #include <kdeui_export.h> |
23 | |
24 | #include <QtGui/QFrame> |
25 | |
26 | class QChildEvent; |
27 | |
28 | /** |
29 | * A container widget which arranges its children horizontally. |
30 | * When using a KHBox you don't need to create a layout nor |
31 | * to add the child widgets to it. |
32 | * |
33 | * Both margin and spacing are initialized to 0. Use QHBoxLayout |
34 | * if you need standard layout margins. |
35 | * |
36 | * \image html khbox.png "KDE Horizontal Box containing three buttons" |
37 | * |
38 | * @see KVBox |
39 | */ |
40 | class KDEUI_EXPORT KHBox : public QFrame |
41 | { |
42 | Q_OBJECT |
43 | |
44 | public: |
45 | /** |
46 | * Creates a new hbox. |
47 | */ |
48 | explicit KHBox( QWidget* parent = 0 ); |
49 | |
50 | /** |
51 | * Destructor. |
52 | */ |
53 | ~KHBox(); |
54 | |
55 | /** |
56 | * Sets the @p margin of the hbox. |
57 | */ |
58 | void setMargin( int margin ); |
59 | |
60 | /** |
61 | * Sets the spacing between the child widgets to @p space. |
62 | * |
63 | * To get the default layout spacing, set @p space to -1. |
64 | */ |
65 | void setSpacing( int space ); |
66 | |
67 | /** |
68 | * Sets the stretch factor of @p widget to @p stretch. |
69 | */ |
70 | void setStretchFactor( QWidget* widget, int stretch ); |
71 | |
72 | /** |
73 | * Calculate the recommended size for this hbox. |
74 | */ |
75 | virtual QSize sizeHint() const; |
76 | |
77 | /** |
78 | * Calculate the recommended minimum size for this hbox. |
79 | */ |
80 | virtual QSize minimumSizeHint() const; |
81 | |
82 | protected: |
83 | /* |
84 | * @internal |
85 | */ |
86 | KHBox( bool vertical, QWidget* parent ); |
87 | |
88 | virtual void childEvent( QChildEvent* ev ); |
89 | |
90 | private: |
91 | class Private; |
92 | friend class Private; |
93 | Private* const d; |
94 | |
95 | Q_DISABLE_COPY(KHBox) |
96 | }; |
97 | |
98 | #endif |
99 | |