~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/formeditor/factories/stdwidgetfactory.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2003 by Lucijan Busch <lucijan@kde.org>
 
3
   Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
 
4
   Copyright (C) 2009 Jarosław Staniek <staniek@kde.org>
 
5
 
 
6
   This library 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
 
 
11
   This library is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
   Library General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU Library General Public License
 
17
   along with this library; see the file COPYING.LIB.  If not, write to
 
18
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
 * Boston, MA 02110-1301, USA.
 
20
*/
 
21
 
 
22
#ifndef STDWIDGETFACTORY_H
 
23
#define STDWIDGETFACTORY_H
 
24
 
 
25
#include <QFrame>
 
26
#include <QPixmap>
 
27
#include <QLabel>
 
28
#include <QList>
 
29
#include <QMenu>
 
30
 
 
31
#include "widgetfactory.h"
 
32
#include "container.h"
 
33
#include "FormWidgetInterface.h"
 
34
 
 
35
class QTreeWidgetItem;
 
36
class QTreeWidget;
 
37
 
 
38
namespace KoProperty
 
39
{
 
40
class Set;
 
41
}
 
42
 
 
43
//! A picture label widget for use within forms
 
44
class KexiPictureLabel : public QLabel, public KFormDesigner::FormWidgetInterface
 
45
{
 
46
    Q_OBJECT
 
47
 
 
48
public:
 
49
    KexiPictureLabel(const QPixmap &pix, QWidget *parent);
 
50
    virtual ~KexiPictureLabel();
 
51
 
 
52
    virtual bool setProperty(const char *name, const QVariant &value);
 
53
};
 
54
 
 
55
//! A line widget for use within forms
 
56
class Line : public QFrame, public KFormDesigner::FormWidgetInterface
 
57
{
 
58
    Q_OBJECT
 
59
    Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
 
60
 
 
61
public:
 
62
    Line(Qt::Orientation orient, QWidget *parent);
 
63
    virtual ~Line();
 
64
 
 
65
    void setOrientation(Qt::Orientation orient);
 
66
    Qt::Orientation orientation() const;
 
67
};
 
68
 
 
69
//! Factory for all basic widgets, including Spring (not containers)
 
70
class StdWidgetFactory : public KFormDesigner::WidgetFactory
 
71
{
 
72
    Q_OBJECT
 
73
 
 
74
public:
 
75
    StdWidgetFactory(QObject *parent, const QVariantList &args);
 
76
    ~StdWidgetFactory();
 
77
 
 
78
    virtual QWidget* createWidget(const QByteArray &classname, QWidget *parent, const char *name,
 
79
                                  KFormDesigner::Container *container,
 
80
                                  CreateWidgetOptions options = DefaultOptions);
 
81
 
 
82
    virtual bool createMenuActions(const QByteArray &classname, QWidget *w,
 
83
                                   QMenu *menu, KFormDesigner::Container *container);
 
84
    virtual bool startInlineEditing(InlineEditorCreationArguments& args);
 
85
    virtual bool previewWidget(const QByteArray &classname, QWidget *widget,
 
86
                               KFormDesigner::Container *container);
 
87
    virtual bool clearWidgetContent(const QByteArray &classname, QWidget *w);
 
88
 
 
89
    virtual bool saveSpecialProperty(const QByteArray &classname,
 
90
                                     const QString &name, const QVariant &value, QWidget *w,
 
91
                                     QDomElement &parentNode, QDomDocument &parent);
 
92
    virtual bool readSpecialProperty(const QByteArray &classname, QDomElement &node,
 
93
                                     QWidget *w, KFormDesigner::ObjectTreeItem *item);
 
94
 
 
95
    virtual void setPropertyOptions(KoProperty::Set& set, const KFormDesigner::WidgetInfo& info, QWidget *w);
 
96
 
 
97
    //! Moved into public for EditRichTextAction
 
98
    bool editRichText(QWidget *w, QString &text) const { return KFormDesigner::WidgetFactory::editRichText(w, text); }
 
99
 
 
100
    //! Moved into public for EditRichTextAction
 
101
    void changeProperty(KFormDesigner::Form *form, QWidget *widget, const char *name,
 
102
        const QVariant &value) { KFormDesigner::WidgetFactory::changeProperty(form, widget, name, value); }
 
103
 
 
104
public slots:
 
105
// moved to EditRichTextAction
 
106
//    void  editText();
 
107
#ifndef KEXI_FORMS_NO_LIST_WIDGET
 
108
    void  editListContents();
 
109
#endif
 
110
 
 
111
protected:
 
112
    virtual bool isPropertyVisibleInternal(const QByteArray &classname, QWidget *w,
 
113
                                           const QByteArray &property, bool isTopLevel);
 
114
    virtual bool changeInlineText(KFormDesigner::Form *form, QWidget *widget,
 
115
                                  const QString &text, QString &oldText);
 
116
    virtual void resizeEditor(QWidget *editor, QWidget *widget, const QByteArray &classname);
 
117
#ifndef KEXI_FORMS_NO_LIST_WIDGET
 
118
    void saveTreeItem(QTreeWidgetItem *item, QDomNode &parentNode, QDomDocument &domDoc);
 
119
    void readTreeItem(QDomElement &node, QTreeWidgetItem *parent, QTreeWidget *treewidget);
 
120
#endif
 
121
 
 
122
private:
 
123
//  KFormDesigner::Container *m_container;
 
124
//  QWidget *m_widget;
 
125
};
 
126
 
 
127
#endif