tdecmodule.h
00001 /* 00002 This file is part of the KDE libraries 00003 00004 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 00021 */ 00022 00023 #ifndef TDECMODULE_H 00024 #define TDECMODULE_H 00025 00026 #include <tqwidget.h> 00027 00028 #include <tdelibs_export.h> 00029 00030 class TQStringList; 00031 00032 class TDEAboutData; 00033 class TDEConfigDialogManager; 00034 class TDEConfigSkeleton; 00035 class TDECModulePrivate; 00036 class TDEInstance; 00037 00069 class TDEUI_EXPORT TDECModule : public TQWidget 00070 { 00071 Q_OBJECT 00072 00073 public: 00074 00081 enum Button {Help=1, Default=2, Apply=16, 00082 Reset=4, /* obsolete, do not use! */ 00083 Cancel=8, /* obsolete, do not use! */ 00084 Ok=32, /* obsolete, do not use! */ 00085 SysDefault=64 /* obsolete, do not use! */ }; 00086 00087 /* 00088 * Base class for all KControlModules. 00089 * Make sure you have a TQStringList argument in your 00090 * implementation. 00091 */ 00092 TDECModule(TQWidget *parent=0, const char *name=0, const TQStringList &args=TQStringList() ); 00093 00094 TDECModule(TDEInstance *instance, TQWidget *parent=0, const TQStringList &args=TQStringList() ); 00095 00096 /* 00097 * Destroys the module. 00098 */ 00099 ~TDECModule(); 00100 00120 virtual void load(); 00121 // ### KDE 4: Call load() automatically through a single-shot timer 00122 // from the constructor // and change documentation 00123 00143 virtual void save(); 00144 00156 virtual void defaults(); 00157 00166 virtual void sysdefaults() { defaults(); } 00167 // KDE 4 deprecate 00168 00178 virtual TQString quickHelp() const; 00179 00188 virtual TQString handbookDocPath() const; 00189 00197 virtual TQString handbookSection() const; 00198 00206 virtual const TDEAboutData *aboutData() const; 00207 00212 void setAboutData( TDEAboutData* about ); 00213 00222 int buttons() const { return _btn; } 00223 00236 TQString rootOnlyMsg() const; 00237 00248 bool useRootOnlyMsg() const; 00249 00250 TDEInstance *instance() const; 00251 00256 const TQPtrList<TDEConfigDialogManager>& configs() const; 00257 00258 protected: 00269 TDEConfigDialogManager* addConfig( TDEConfigSkeleton *config, TQWidget* widget ); 00270 00276 void setQuickHelp( const TQString& help ); 00277 00278 signals: 00279 00287 void changed(bool state); 00288 00297 void quickHelpChanged(); 00298 00299 protected slots: 00300 00305 void changed(); 00306 00312 void widgetChanged(); 00313 00314 protected: 00315 00328 void setButtons(int btn) { _btn = btn; } 00329 00339 void setRootOnlyMsg(const TQString& msg); 00340 00349 void setUseRootOnlyMsg(bool on); 00350 00355 bool managedWidgetChangeState() const; 00356 00362 void unmanagedWidgetChangeState(bool); 00363 00364 private: 00365 00366 int _btn; 00367 protected: 00368 virtual void virtual_hook( int id, void* data ); 00369 private: 00370 TDECModulePrivate *d; 00371 00375 void init(); 00376 00377 }; 00378 00379 #endif //TDECMODULE_H 00380