kexi

variable.h
1/***************************************************************************
2 * This file is part of the KDE project
3 * copyright (C) 2005 by Sebastian Sauer (mail@dipe.org)
4 * copyright (C) 2005 by Tobi Krebs (tobi.krebs@gmail.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#ifndef KOMACRO_VARIABLE_H
21#define KOMACRO_VARIABLE_H
22
23#include <tqobject.h>
24#include <tqdom.h>
25#include <tqvariant.h>
26#include <ksharedptr.h>
27
28#include "metaparameter.h"
29
30namespace KoMacro {
31
38 class KOMACRO_EXPORT Variable : public MetaParameter
39 {
40
44 TQ_PROPERTY(TQVariant variant READ variant WRITE setVariant)
45
46
49 TQ_PROPERTY(TQObject* object READ object WRITE setObject)
50
51
54 TQ_PROPERTY(TQString string READ toString)
55
56 public:
57
61 typedef TQValueList<TDESharedPtr<Variable > > List;
62
66 typedef TQMap<TQString, TDESharedPtr<Variable > > Map;
67
71 explicit Variable();
72
80 Variable(const TQVariant& variant, const TQString& name = TQString(), const TQString& text = TQString());
81
87 Variable(const TQObject* object);
88
95 Variable(const TQDomElement& element);
96
100 virtual ~Variable();
101
105 TQString name() const;
106
110 void setName(const TQString& name);
111
115 TQString text() const;
116
120 void setText(const TQString& text);
121
127 void setObject(const TQObject* object);
128
134 const TQVariant variant() const;
135
144 void setVariant(const TQVariant& variant, bool detecttype = true);
145
150 const TQObject* object() const;
151
156 operator TQVariant () const;
157
162 operator const TQObject* () const;
163
167 const TQString toString() const;
168
172 int toInt() const;
173
182 List children() const;
183
188 void appendChild(TDESharedPtr<Variable> variable);
189
193 void clearChildren();
194
198 void setChildren(const List& children);
199
200#if 0
205 bool isEnabled() const;
206
211 void setEnabled(const bool enabled);
212#endif
213 private:
215 class Private;
217 Private* const d;
218 };
219
220}
221
222#endif
MetaParameter(const TQString &signatureargument=TQString())
Constructor.
void setText(const TQString &text)
Set the caption.
Definition variable.cpp:152
TQString text() const
Definition variable.cpp:147
void clearChildren()
Clear the list of children this Variable has.
Definition variable.cpp:226
TQString name() const
Definition variable.cpp:137
void appendChild(TDESharedPtr< Variable > variable)
Append a Variable to the list of children this Variable has.
Definition variable.cpp:221
Variable()
Default constructor.
Definition variable.cpp:79
void setVariant(const TQVariant &variant, bool detecttype=true)
Set the TQVariant.
Definition variable.cpp:165
TQMap< TQString, TDESharedPtr< Variable > > Map
A map of variables.
Definition variable.h:66
const TQVariant variant() const
Definition variable.cpp:157
TQValueList< TDESharedPtr< Variable > > List
Property to get and set a TQVariant as variable.
Definition variable.h:61
int toInt() const
Definition variable.cpp:211
List children() const
Definition variable.cpp:216
void setChildren(const List &children)
Set the children this Variable has.
Definition variable.cpp:231
const TQString toString() const
Definition variable.cpp:195
void setName(const TQString &name)
Set the name.
Definition variable.cpp:142
void setObject(const TQObject *object)
Set the TQObject.
Definition variable.cpp:179
const TQObject * object() const
Definition variable.cpp:173