Back to index

kdeartwork  4.3.2
kxsitem.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //
00003 // KDE xscreensaver configuration dialog
00004 //
00005 // Copyright (c)  Martin R. Jones <mjones@kde.org> 1999
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public
00009 // License as published by the Free Software Foundation;
00010 // version 2 of the License.
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 GNU
00015 // 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; see the file COPYING.  If not, write to
00019 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020 // Boston, MA 02110-1301, USA.
00021 
00022 #ifndef __KXSITEM_H__
00023 #define __KXSITEM_H__
00024 
00025 #include <KConfig>
00026 #include <QStringList>
00027 
00028 class QXmlAttributes;
00029 
00030 class KXSConfigItem
00031 {
00032 public:
00033   KXSConfigItem(const QString &name, KConfig &config);
00034   KXSConfigItem(const QString &name, const QXmlAttributes &attr);
00035   virtual ~KXSConfigItem() {}
00036 
00037   virtual QString command() = 0;
00038   virtual void save(KConfig &config) = 0;
00039   virtual void read(KConfig &config) = 0;
00040 
00041 protected:
00042   QString mName;
00043   QString mLabel;
00044 };
00045 
00046 class KXSRangeItem : public KXSConfigItem
00047 {
00048 public:
00049   KXSRangeItem(const QString &name, KConfig &config);
00050   KXSRangeItem(const QString &name, const QXmlAttributes &attr);
00051 
00052   virtual QString command();
00053   virtual void save(KConfig &config);
00054   virtual void read(KConfig &config);
00055 
00056 protected:
00057   QString mSwitch;
00058   int mMinimum;
00059   int mMaximum;
00060   int mValue;
00061   bool mInvert;
00062 };
00063 
00064 class KXSDoubleRangeItem : public KXSConfigItem
00065 {
00066 public:
00067   KXSDoubleRangeItem(const QString &name, KConfig &config);
00068   KXSDoubleRangeItem(const QString &name, const QXmlAttributes &attr);
00069 
00070   virtual QString command();
00071   virtual void read(KConfig &config);
00072   virtual void save(KConfig &config);
00073 
00074 protected:
00075   QString mSwitch;
00076   double mMinimum;
00077   double mMaximum;
00078   double mValue;
00079   bool mInvert;
00080 };
00081 
00082 class KXSBoolItem : public KXSConfigItem
00083 {
00084 public:
00085   KXSBoolItem(const QString &name, KConfig &config);
00086   KXSBoolItem(const QString &name, const QXmlAttributes &attr);
00087 
00088   virtual QString command();
00089   virtual void read(KConfig &config);
00090   virtual void save(KConfig &config);
00091 
00092 protected:
00093   QString mSwitchOn;
00094   QString mSwitchOff;
00095   bool    mValue;
00096 };
00097 
00098 class KXSSelectItem : public KXSConfigItem
00099 {
00100 public:
00101   KXSSelectItem(const QString &name, KConfig &config);
00102   KXSSelectItem(const QString &name, const QXmlAttributes &attr);
00103 
00104   virtual void addOption(const QXmlAttributes &attr);
00105 
00106   virtual QString command();
00107 
00108   virtual void read(KConfig &config);
00109   virtual void save(KConfig &config);
00110 
00111 protected:
00112   QStringList mOptions;
00113   QStringList mSwitches;
00114   int         mValue;
00115 };
00116 
00117 class KXSStringItem : public KXSConfigItem
00118 {
00119 public:
00120   KXSStringItem(const QString &name, KConfig &config);
00121   KXSStringItem(const QString &name, const QXmlAttributes &attr);
00122 
00123   virtual QString command();
00124   virtual void save(KConfig &config);
00125   virtual void read(KConfig &config);
00126 
00127 protected:
00128   QString mSwitch;
00129   QString mValue;
00130 };
00131 
00132 #endif
00133