00001 /* 00002 * Copyright (C) 2003 by Unai Garro <ugarro@users.sourceforge.net> 00003 * Copyright (C) 2004 by Enrico Ros <rosenric@dei.unipd.it> 00004 * Copyright (C) 2004 by Stephan Kulow <coolo@kde.org> 00005 * Copyright (C) 2004 by Oswald Buddenhagen <ossi@kde.org> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KDMTHEMER_H 00023 #define KDMTHEMER_H 00024 00025 #include <tqobject.h> 00026 #include <tqdom.h> 00027 00028 class KdmThemer; 00029 class KdmItem; 00030 class KdmPixmap; 00031 class KdmRect; 00032 class KdmBox; 00033 00034 class TQRect; 00035 class TQWidget; 00036 class TQEvent; 00037 00044 /* 00045 * The themer widget. Whatever drawn here is just themed 00046 * according to a XML file set by the user. 00047 */ 00048 00049 00050 class KdmThemer : public TQObject { 00051 Q_OBJECT 00052 00053 public: 00054 /* 00055 * Construct and destruct the interface 00056 */ 00057 00058 KdmThemer( const TQString &path, const TQString &mode, TQWidget *parent ); 00059 ~KdmThemer(); 00060 00061 bool isOK() { return rootItem != 0; } 00062 /* 00063 * Gives a sizeHint to the widget (parent size) 00064 */ 00065 //TQSize sizeHint() const{ return parentWidget()->size(); } 00066 00067 /* 00068 * Takes a shot of the current widget 00069 */ 00070 // void pixmap( const TQRect &r, TQPixmap *px ); 00071 00072 virtual // just to put the reference in the vmt 00073 KdmItem *findNode( const TQString & ) const; 00074 00075 void updateGeometry( bool force ); // force = true for external calls 00076 00077 // must be called by parent widget 00078 void widgetEvent( TQEvent *e ); 00079 00080 signals: 00081 void activated( const TQString &id ); 00082 00083 protected slots: 00084 void slotActivated( const TQString &id ); 00085 void slotPaintRoot(); 00086 00087 private: 00088 /* 00089 * Our display mode (e.g. console, remote, ...) 00090 */ 00091 TQString m_currentMode; 00092 00093 /* 00094 * The config file being used 00095 */ 00096 TQDomDocument domTree; 00097 00098 /* 00099 * Stores the root of the theme 00100 */ 00101 KdmItem *rootItem; 00102 00103 /* 00104 * The backbuffer 00105 */ 00106 TQPixmap *backBuffer; 00107 00108 // methods 00109 00110 /* 00111 * Test whether item needs to be displayed 00112 */ 00113 bool willDisplay( const TQDomNode &node ); 00114 00115 /* 00116 * Parses the XML file looking for the 00117 * item list and adds those to the themer 00118 */ 00119 void generateItems( KdmItem *parent = 0, const TQDomNode &node = TQDomNode() ); 00120 00121 void showStructure( TQObject *obj ); 00122 00123 TQWidget *widget(); 00124 }; 00125 00126 00127 #endif
1.6.1