kexi

variable.h

00001 /***************************************************************************
00002  * This file is part of the KDE project
00003  * copyright (C) 2005 by Sebastian Sauer (mail@dipe.org)
00004  * copyright (C) 2005 by Tobi Krebs (tobi.krebs@gmail.com)
00005  *
00006  * This program 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  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KOMACRO_VARIABLE_H
00021 #define KOMACRO_VARIABLE_H
00022 
00023 #include <qobject.h>
00024 #include <qdom.h>
00025 #include <qvariant.h>
00026 #include <ksharedptr.h>
00027 
00028 #include "metaparameter.h"
00029 
00030 namespace KoMacro {
00031 
00038     class KOMACRO_EXPORT Variable : public MetaParameter
00039     {
00040 
00044             Q_PROPERTY(QVariant variant READ variant WRITE setVariant)
00045 
00046             
00049             Q_PROPERTY(QObject* object READ object WRITE setObject)
00050 
00054             Q_PROPERTY(QString string READ toString)
00055 
00056         public:
00057 
00061             typedef QValueList<KSharedPtr<Variable > > List;
00062 
00066             typedef QMap<QString, KSharedPtr<Variable > > Map;
00067 
00071             explicit Variable();
00072 
00080             Variable(const QVariant& variant, const QString& name = QString::null, const QString& text = QString::null);
00081 
00087             Variable(const QObject* object);
00088 
00095             Variable(const QDomElement& element);
00096 
00100             virtual ~Variable();
00101 
00105             QString name() const;
00106 
00110             void setName(const QString& name);
00111 
00115             QString text() const;
00116 
00120             void setText(const QString& text);
00121 
00127             void setObject(const QObject* object);
00128 
00134             const QVariant variant() const;
00135 
00144             void setVariant(const QVariant& variant, bool detecttype = true);
00145 
00150             const QObject* object() const;
00151 
00156             operator QVariant () const;
00157 
00162             operator const QObject* () const;
00163 
00167             const QString toString() const;
00168 
00172             int toInt() const;
00173 
00182             List children() const;
00183 
00188             void appendChild(KSharedPtr<Variable> variable);
00189 
00193             void clearChildren();
00194 
00198             void setChildren(const List& children);
00199 
00200 #if 0
00201 
00205             bool isEnabled() const;
00206 
00211             void setEnabled(const bool enabled);
00212 #endif
00213         private:
00215             class Private;
00217             Private* const d;
00218     };
00219 
00220 }
00221 
00222 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys