tdeutils
tdecmodulecontainer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TDECMODULECONTAINER_H
00021 #define TDECMODULECONTAINER_H
00022
00023 #include <tqvaluelist.h>
00024 #include <tqstring.h>
00025 #include <tqstringlist.h>
00026
00027 #include <tdecmodule.h>
00028 #include <tdecmoduleloader.h>
00029
00030 class TQTabWidget;
00031 class TQWidget;
00032 class TQVBoxLayout;
00033
00034 class TDECModuleProxy;
00035
00053 class TDEUTILS_EXPORT TDECModuleContainer : public TDECModule
00054 {
00055 Q_OBJECT
00056 public:
00068 TDECModuleContainer( TQWidget* parent, const char* name, const TQStringList& mods );
00069
00087 TDECModuleContainer( TQWidget *parent, const char* name, const TQString& mods = TQString() );
00088
00096 void addModule( const TQString& module );
00097
00101 virtual ~TDECModuleContainer();
00102
00107 void save();
00108
00113 void load();
00114
00119 void defaults();
00120
00125 virtual TQString handbookSection() const;
00126
00127 protected:
00128
00135 void finalize();
00136
00137 typedef TQValueList<TDECModuleProxy*> ModuleList;
00138
00143 ModuleList changedModules;
00144
00148 ModuleList allModules;
00149
00150 private slots:
00151
00155 void tabSwitched( TQWidget * module );
00156
00157 void moduleChanged(TDECModuleProxy *proxy);
00158
00162 void runAsRoot();
00163
00167 void rootExited();
00168
00169 private:
00170
00171 void init();
00172
00173 class TDECModuleContainerPrivate;
00174 TDECModuleContainerPrivate *d;
00175
00176 };
00177
00194 #define KCMODULECONTAINER( modules, factoryName ) \
00195 extern "C" \
00196 { \
00197 TDECModule *create_## factoryName(TQWidget *parent, const char *name) \
00198 { \
00199 return new TDECModuleContainer( parent, name, TQString( modules ) ); \
00200 } \
00201 \
00202 bool test_## factoryName() \
00203 { \
00204 TQStringList modList = TQStringList::split( ",", TQString(modules).remove( " " )); \
00205 for ( TQStringList::Iterator it = modList.begin(); it != modList.end(); ++it ) \
00206 if ( TDECModuleLoader::testModule( *it ) ) \
00207 return true; \
00208 return false; \
00209 } \
00210 }
00211
00212 #endif // TDECMODULECONTAINER_H
00213