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

« back to all changes in this revision

Viewing changes to kexi/plugins/forms/widgets/kexidbform.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) 2004 Lucijan Busch <lucijan@kde.org>
 
3
   Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
 
4
   Copyright (C) 2005-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
#ifndef KEXIDBFORM_H
 
22
#define KEXIDBFORM_H
 
23
 
 
24
#include <qpixmap.h>
 
25
#include <QDragMoveEvent>
 
26
#include <QEvent>
 
27
#include <QDropEvent>
 
28
 
 
29
#include <formeditor/form.h>
 
30
#include <formeditor/FormWidget.h>
 
31
#include <formeditor/FormWidgetInterface.h>
 
32
#include "kexiformdataiteminterface.h"
 
33
 
 
34
class KexiDataAwareObjectInterface;
 
35
class KexiFormScrollView;
 
36
 
 
37
//! @short A DB-aware form widget, acting as form's toplevel widget
 
38
class KEXIFORMUTILS_EXPORT KexiDBForm : public QWidget,
 
39
                                        public KFormDesigner::FormWidget,
 
40
                                        public KexiFormDataItemInterface,
 
41
                                        public KFormDesigner::FormWidgetInterface
 
42
{
 
43
    Q_OBJECT
 
44
    Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource)
 
45
    Q_PROPERTY(QString dataSourcePartClass READ dataSourcePartClass WRITE setDataSourcePartClass)
 
46
    Q_PROPERTY(bool autoTabStops READ autoTabStops WRITE setAutoTabStops)
 
47
    //original "size" property is not designable, so here's a custom (not storable) replacement
 
48
    Q_PROPERTY(QSize sizeInternal READ sizeInternal WRITE resizeInternal STORED false)
 
49
public:
 
50
    KexiDBForm(QWidget *parent, KexiDataAwareObjectInterface* dataAwareObject);
 
51
    virtual ~KexiDBForm();
 
52
 
 
53
    KexiDataAwareObjectInterface* dataAwareObject() const;
 
54
 
 
55
    inline QString dataSource() const {
 
56
        return KexiFormDataItemInterface::dataSource();
 
57
    }
 
58
    inline QString dataSourcePartClass() const {
 
59
        return KexiFormDataItemInterface::dataSourcePartClass();
 
60
    }
 
61
 
 
62
    //! no effect
 
63
    QVariant value() {
 
64
        return QVariant();
 
65
    }
 
66
 
 
67
    virtual void setInvalidState(const QString& displayText);
 
68
 
 
69
    virtual void drawRect(const QRect& r, int type);
 
70
    virtual void drawRects(const QList<QRect> &list, int type);
 
71
    virtual void initBuffer();
 
72
    virtual void clearForm();
 
73
    virtual void highlightWidgets(QWidget *from, QWidget *to/*, const QPoint &p*/);
 
74
 
 
75
    virtual QSize sizeHint() const;
 
76
 
 
77
    bool autoTabStops() const;
 
78
 
 
79
    QList<QWidget*>* orderedFocusWidgets() const;
 
80
 
 
81
    QList<QWidget*>* orderedDataAwareWidgets() const;
 
82
 
 
83
    void updateTabStopsOrder(KFormDesigner::Form* form);
 
84
 
 
85
    void updateTabStopsOrder();
 
86
 
 
87
    virtual bool eventFilter(QObject * watched, QEvent * e);
 
88
 
 
89
    virtual bool valueIsNull();
 
90
    virtual bool valueIsEmpty();
 
91
    virtual bool isReadOnly() const;
 
92
    virtual QWidget* widget();
 
93
    virtual bool cursorAtStart();
 
94
    virtual bool cursorAtEnd();
 
95
    virtual void clear();
 
96
 
 
97
    bool preview() const;
 
98
 
 
99
//    virtual void setCursor(const QCursor & cursor);
 
100
 
 
101
public slots:
 
102
    void setAutoTabStops(bool set);
 
103
    inline void setDataSource(const QString &ds) {
 
104
        KexiFormDataItemInterface::setDataSource(ds);
 
105
    }
 
106
    inline void setDataSourcePartClass(const QString &partClass) {
 
107
        KexiFormDataItemInterface::setDataSourcePartClass(partClass);
 
108
    }
 
109
 
 
110
    //! This implementation just disables read only widget
 
111
    virtual void setReadOnly(bool readOnly);
 
112
 
 
113
    //! @internal for sizeInternal property
 
114
    QSize sizeInternal() const {
 
115
        return QWidget::size();
 
116
    }
 
117
 
 
118
    //! @internal for sizeInternal property
 
119
    void resizeInternal(const QSize& s) {
 
120
        QWidget::resize(s);
 
121
    }
 
122
 
 
123
signals:
 
124
    void handleDragMoveEvent(QDragMoveEvent *e);
 
125
    void handleDropEvent(QDropEvent *e);
 
126
 
 
127
protected:
 
128
    //! no effect
 
129
    virtual void setValueInternal(const QVariant&, bool) {}
 
130
 
 
131
    //! Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface
 
132
    virtual void dragMoveEvent(QDragMoveEvent *e);
 
133
 
 
134
    //! Used to emit handleDropEvent() signal needed to control dropping on the container's surface
 
135
    virtual void dropEvent(QDropEvent *e);
 
136
 
 
137
    //! called from KexiFormScrollView::initDataContents()
 
138
    void updateReadOnlyFlags();
 
139
//  virtual void paintEvent( QPaintEvent * );
 
140
 
 
141
    //! Points to a currently edited data item.
 
142
    //! It is cleared when the focus is moved to other
 
143
    KexiFormDataItemInterface *editedItem;
 
144
 
 
145
    class Private;
 
146
    Private * const d;
 
147
 
 
148
    friend class KexiFormScrollView;
 
149
};
 
150
 
 
151
#endif