add more spacing
[personal-kdebase.git] / workspace / kdm / kfrontend / themer / kdmthemer.h
blob827886dea040f5203782cffa4354b11b54756cd5
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 KDMTHEMER_H
23 #define KDMTHEMER_H
25 #include <QMap>
26 #include <QObject>
28 class KdmItem;
30 class QDomNode;
31 class QPaintDevice;
32 class QRect;
34 /**
35 * @author Unai Garro
41 * The themer widget. Whatever drawn here is just themed
42 * according to a XML file set by the user.
46 class KdmThemer : public QObject {
47 Q_OBJECT
49 public:
51 * Construct and destruct the interface
54 KdmThemer( const QString &path,
55 const QMap<QString, bool> &types, QWidget *w );
56 ~KdmThemer();
58 bool isOK() { return rootItem != 0; }
60 const QString &baseDir() const { return basedir; }
62 KdmItem *findNode( const QString & ) const;
64 // must be called by parent widget
65 void widgetEvent( QEvent *e );
67 void setWidget( QWidget *w );
68 QWidget *widget() { return m_widget; }
70 void setTypeVisible( const QString &t, bool show );
71 bool typeVisible( const QString &t ) { return m_showTypes.value( t, false ); }
73 void paintBackground( QPaintDevice *dev, const QRect &rect, bool primaryScreen );
75 Q_SIGNALS:
76 void activated( const QString &id );
78 private:
79 QMap<QString, bool> m_showTypes;
81 // defines the directory the theme is in
82 QString basedir;
85 * Stores the root of the theme
87 KdmItem *rootItem;
89 bool m_geometryOutdated;
90 bool m_geometryInvalid;
92 QWidget *m_widget;
94 // methods
97 * Parses the XML file looking for the
98 * item list and adds those to the themer
100 void generateItems( KdmItem *parent, const QDomNode &node );
101 void generateLayouts( KdmItem *parent, const QDomNode &node );
103 void showStructure();
105 private Q_SLOTS:
106 void update( int x, int y, int w, int h );
107 void slotNeedPlacement();
108 void slotNeedPlugging();
113 #endif