not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kdm / kfrontend / themer / kdmlayout.h
blobabd69b13fa992c1e99c7b0253eb3de3b7e41777c
1 /*
2 * Copyright (C) 2003 by Unai Garro <ugarro@users.sourceforge.net>
3 * Copyright (C) 2004 by Enrico Ros <rosenric@dei.unipd.it>
4 * Copyright (C) 2004 by Stephan Kulow <coolo@kde.org>
5 * Copyright (C) 2004 by Oswald Buddenhagen <ossi@kde.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef KDMLAYOUT_H
23 #define KDMLAYOUT_H
25 #include <QSize>
26 #include <QStack>
28 class KdmItem;
30 class QDomNode;
31 class QRect;
33 class KdmLayout {
35 public:
36 // virtual ~KdmLayout() {};
38 // Adds an item that will be managed
39 void addItem( KdmItem *item ) { m_children.append( item ); }
41 // Return false if any item are managed by this layouter
42 bool isEmpty() { return m_children.isEmpty(); }
44 // Updates the layout of all items knowing that the parent
45 // has the @p parentGeometry geometry
46 // virtual void update( QStack<QRect> &parentGeometries ) = 0;
48 protected:
49 QList<KdmItem *> m_children;
52 class KdmLayoutFixed : public KdmLayout {
54 public:
55 KdmLayoutFixed( const QDomNode &node );
57 // Updates the layout of all boxed items knowing that the parent
58 // has the @p parentGeometry geometry
59 void update( QStack<QSize> &parentSizes, const QRect &parentGeometry, bool force );
62 /**
63 * this is a container for a lot of other stuff
64 * but can be treated like a usual widget
67 class KdmLayoutBox : public KdmLayout {
69 public:
70 KdmLayoutBox( const QDomNode &node );
72 // Updates the layout of all boxed items knowing that they
73 // should fit into @p parentGeometry container
74 void update( QStack<QSize> &parentSizes, const QRect &parentGeometry, bool force );
76 // Computes the size hint of the box, telling which is the
77 // smallest size inside which boxed items will fit
78 QSize sizeHint( QStack<QSize> &parentSizes );
80 private:
81 struct {
82 bool isVertical;
83 int spacing;
84 int xpadding;
85 int ypadding;
86 int minwidth;
87 int minheight;
88 bool homogeneous;
89 } box;
90 // QSize hintedSize;
93 #endif