keximacroproperty.h
1/* This file is part of the KDE project
2 Copyright (C) 2006 Sebastian Sauer <mail@dipe.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12 You should have received a copy of the GNU Library General Public License
13 along with this library; see the file COPYING.LIB. If not, write to
14 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
15 Boston, MA 02110-1301, USA.
16*/
17
18#ifndef KEXIMACROPROPERTY_H
19#define KEXIMACROPROPERTY_H
20
21#include <ksharedptr.h>
22#include <koproperty/property.h>
23#include <koproperty/factory.h>
24#include <koproperty/customproperty.h>
25#include <koproperty/widget.h>
26
27namespace KoMacro {
28 class Variable;
29 class MacroItem;
30}
31
33
39 : public TQObject
40 , public KoProperty::CustomProperty
41{
42 TQ_OBJECT
43
44
45 friend class KexiMacroPropertyWidget;
46
47 public:
48
50 explicit KexiMacroProperty(KoProperty::Property* parent, TDESharedPtr<KoMacro::MacroItem> macroitem, const TQString& name);
52 virtual ~KexiMacroProperty();
53
55 KoProperty::Property* parentProperty() const;
56
63 virtual void setValue(const TQVariant &value, bool rememberOldValue);
64
68 virtual TQVariant value() const;
69
72 virtual bool handleValue() const;
73
76 TDESharedPtr<KoMacro::MacroItem> macroItem() const;
77
80 TQString name() const;
81
85 TDESharedPtr<KoMacro::Variable> variable() const;
86
89 static KoProperty::Property* createProperty(TDESharedPtr<KoMacro::MacroItem> macroitem, const TQString& name);
90
91 signals:
92
95
96 private:
98 class Private;
100 Private* const d;
102 inline void init();
103};
104
110class KexiMacroPropertyFactory : public KoProperty::CustomPropertyFactory
111{
112 public:
114 explicit KexiMacroPropertyFactory(TQObject* parent);
117
121 virtual KoProperty::CustomProperty* createCustomProperty(KoProperty::Property* parent);
122
126 virtual KoProperty::Widget* createCustomWidget(KoProperty::Property* property);
127
133 static void initFactory();
134};
135
140class KexiMacroPropertyWidget : public KoProperty::Widget
141{
142 TQ_OBJECT
143
144
145 public:
147 explicit KexiMacroPropertyWidget(KoProperty::Property* property, TQWidget* parent = 0);
149 virtual ~KexiMacroPropertyWidget();
150
152 virtual TQVariant value() const;
153
156 virtual void setValue(const TQVariant& value, bool emitChange=true);
157
158 //virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value);
159
160 protected:
161
163 virtual void setReadOnlyInternal(bool readOnly);
164
165 private slots:
166
168 void slotComboBoxChanged();
169
171 void slotComboBoxActivated();
172
174 void slotWidgetValueChanged();
175
178 void slotPropertyValueChanged();
179
180 private:
182 class Private;
184 Private* const d;
185};
186
187#endif
188
Implementation of a KoProperty::CustomPropertyFactory to handle creation of KexiMacroProperty and Kex...
virtual KoProperty::CustomProperty * createCustomProperty(KoProperty::Property *parent)
virtual KoProperty::Widget * createCustomWidget(KoProperty::Property *property)
static void initFactory()
Initializes this factory.
virtual ~KexiMacroPropertyFactory()
Destructor.
Implementation of a KoProperty::Widget used to display and edit a KexiMacroProperty .
virtual void setReadOnlyInternal(bool readOnly)
Called if the value should be read only.
virtual void setValue(const TQVariant &value, bool emitChange=true)
Set the value value this widget has.
virtual TQVariant value() const
virtual ~KexiMacroPropertyWidget()
Destructor.
Implementation of a KoProperty::CustomProperty to have more control about the handling of our macro-p...
KoProperty::Property * parentProperty() const
TDESharedPtr< KoMacro::MacroItem > macroItem() const
static KoProperty::Property * createProperty(TDESharedPtr< KoMacro::MacroItem > macroitem, const TQString &name)
Factory function to create a new KoProperty::Property instance that will use a KexiMacroProperty as c...
virtual ~KexiMacroProperty()
Destructor.
virtual bool handleValue() const
Tells whether CustomProperty should be used to get the property's value.
TDESharedPtr< KoMacro::Variable > variable() const
virtual void setValue(const TQVariant &value, bool rememberOldValue)
This function is called by KoProperty::Property::setValue() when a custom property is set.
void valueChanged()
Emitted if setValue was called and the value changed.
TQString name() const
virtual TQVariant value() const
This function is called by KoProperty::Property::value() when a custom property is set and handleValu...