kexi

keximacroproperty.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2006 Sebastian Sauer <mail@dipe.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012    You should have received a copy of the GNU Library General Public License
00013    along with this library; see the file COPYING.LIB.  If not, write to
00014    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00015    Boston, MA 02110-1301, USA.
00016 */
00017 
00018 #ifndef KEXIMACROPROPERTY_H
00019 #define KEXIMACROPROPERTY_H
00020 
00021 #include <ksharedptr.h>
00022 #include <koproperty/property.h>
00023 #include <koproperty/factory.h>
00024 #include <koproperty/customproperty.h>
00025 #include <koproperty/widget.h>
00026 
00027 namespace KoMacro {
00028     class Variable;
00029     class MacroItem;
00030 }
00031 
00032 class KexiMacroPropertyWidget;
00033 
00038 class KexiMacroProperty
00039     : public QObject
00040     , public KoProperty::CustomProperty
00041 {
00042         Q_OBJECT
00043 
00044         friend class KexiMacroPropertyWidget;
00045 
00046     public:
00047 
00049         explicit KexiMacroProperty(KoProperty::Property* parent, KSharedPtr<KoMacro::MacroItem> macroitem, const QString& name);
00051         virtual ~KexiMacroProperty();
00052 
00054         KoProperty::Property* parentProperty() const;
00055 
00062         virtual void setValue(const QVariant &value, bool rememberOldValue);
00063 
00067         virtual QVariant value() const;
00068 
00071         virtual bool handleValue() const;
00072 
00075         KSharedPtr<KoMacro::MacroItem> macroItem() const;
00076 
00079         QString name() const;
00080 
00084         KSharedPtr<KoMacro::Variable> variable() const;
00085 
00088         static KoProperty::Property* createProperty(KSharedPtr<KoMacro::MacroItem> macroitem, const QString& name);
00089 
00090     signals:
00091 
00093         void valueChanged();
00094 
00095     private:
00097         class Private;
00099         Private* const d;
00101         inline void init();
00102 };
00103 
00109 class KexiMacroPropertyFactory : public KoProperty::CustomPropertyFactory
00110 {
00111     public:
00113         explicit KexiMacroPropertyFactory(QObject* parent);
00115         virtual ~KexiMacroPropertyFactory();
00116 
00120         virtual KoProperty::CustomProperty* createCustomProperty(KoProperty::Property* parent);
00121 
00125         virtual KoProperty::Widget* createCustomWidget(KoProperty::Property* property);
00126 
00132         static void initFactory();
00133 };
00134 
00139 class KexiMacroPropertyWidget : public KoProperty::Widget
00140 {
00141         Q_OBJECT
00142 
00143     public:
00145         explicit KexiMacroPropertyWidget(KoProperty::Property* property, QWidget* parent = 0);
00147         virtual ~KexiMacroPropertyWidget();
00148 
00150         virtual QVariant value() const;
00151 
00154         virtual void setValue(const QVariant& value, bool emitChange=true);
00155 
00156         //virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00157 
00158     protected:
00159 
00161         virtual void setReadOnlyInternal(bool readOnly);
00162 
00163     private slots:
00164 
00166         void slotComboBoxChanged();
00167 
00169         void slotComboBoxActivated();
00170 
00172         void slotWidgetValueChanged();
00173 
00176         void slotPropertyValueChanged();
00177 
00178     private:
00180         class Private;
00182         Private* const d;
00183 };
00184 
00185 #endif
00186 
KDE Home | KDE Accessibility Home | Description of Access Keys