lib

widget.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3 Copyright (C) 2004 Alexander Dymo <cloudtemple@mskat.net>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library 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
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KPROPERTY_PROPERTYWIDGET_H
22#define KPROPERTY_PROPERTYWIDGET_H
23
24#include <tqwidget.h>
25#include "koproperty_global.h"
26
27namespace KoProperty {
28
29class WidgetPrivate;
30class Property;
31
36class KOPROPERTY_EXPORT Widget : public TQWidget
37{
38 TQ_OBJECT
39
40
41 public:
42 Widget(Property *property, TQWidget *parent, const char *name="property_editor");
43 virtual ~Widget();
44
46 virtual TQVariant value() const = 0;
47
50 virtual void setValue(const TQVariant &value, bool emitChange=true) = 0;
51
53 virtual Property* property() const;
54
56 virtual void setProperty(Property *property);
57
59 virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value);
60
62 virtual void undo();
63
65 void setFocusWidget(TQWidget*focusProxy);
66
69
72 bool hasBorders() const;
73
79 bool isReadOnly() const;
80
84 void setReadOnly(bool readOnly);
85
88 bool visibleFlag() const;
89
90 signals:
91 void valueChanged(Widget *widget);
92 void acceptInput(Widget *widget);
93 void rejectInput(Widget *widget);
94
95 protected:
96 void setEditor(TQWidget* editor);
97
99 virtual bool eventFilter(TQObject* watched, TQEvent* e);
100
101 virtual void resizeEvent(TQResizeEvent *e);
102
103 void setLeavesTheSpaceForRevertButton(bool set);
104 void setHasBorders(bool set);
105
108 virtual void setReadOnlyInternal(bool readOnly) = 0;
109
113 void setVisibleFlag(bool visible);
114
115 protected:
116 WidgetPrivate *d;
117};
118
119}
120
121#endif
The base class representing a single property.
Definition property.h:177
virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value)
Definition widget.cpp:88
bool hasBorders() const
Definition widget.cpp:184
virtual void setValue(const TQVariant &value, bool emitChange=true)=0
virtual Property * property() const
Definition widget.cpp:72
void setVisibleFlag(bool visible)
Definition widget.cpp:227
virtual void setProperty(Property *property)
Definition widget.cpp:78
virtual void undo()
Definition widget.cpp:101
bool isReadOnly() const
Definition widget.cpp:208
void setReadOnly(bool readOnly)
Definition widget.cpp:214
bool leavesTheSpaceForRevertButton() const
Definition widget.cpp:166
virtual bool eventFilter(TQObject *watched, TQEvent *e)
Definition widget.cpp:108
virtual TQVariant value() const =0
void setFocusWidget(TQWidget *focusProxy)
Definition widget.cpp:152
virtual void setReadOnlyInternal(bool readOnly)=0
Namespace for a set of classes implementing generic properties framework.