1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/* This file is part of the KDE project
Copyright (C) 2002, 2003 Lucijan Busch <lucijan@gmx.at>
Copyright (C) 2003-2007 Jaroslaw Staniek <js@iidea.pl>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KEXIRELATIONVIEWTABLE_H
#define KEXIRELATIONVIEWTABLE_H
#include <qframe.h>
#include <qstringlist.h>
#include <qlabel.h>
#include <klistview.h>
#include <widget/kexifieldlistview.h>
class KexiRelationView;
class KexiRelationViewTable;
class KexiRelationViewTableContainerHeader;
namespace KexiDB
{
class TableOrQuerySchema;
}
class KEXIRELATIONSVIEW_EXPORT KexiRelationViewTableContainer : public QFrame
{
Q_OBJECT
public:
// KexiRelationViewTableContainer(KexiRelationView *parent, KexiDB::TableSchema *t);
KexiRelationViewTableContainer(
KexiRelationView *parent, KexiDB::TableOrQuerySchema *schema);
virtual ~KexiRelationViewTableContainer();
int globalY(const QString &field);
// KexiDB::TableSchema *table();
KexiRelationViewTable* tableView() const { return m_tableView; }
KexiDB::TableOrQuerySchema* schema() const;
int right() { return x() + width() - 1; }
int bottom() { return y() + height() - 1; }
signals:
void moved(KexiRelationViewTableContainer *);
void endDrag();
void gotFocus();
void contextMenuRequest(const QPoint& pos);
public slots:
virtual void setFocus();
virtual void unsetFocus();
protected slots:
void moved();
void slotContextMenu(KListView *lv, QListViewItem *i, const QPoint& p);
protected:
// KexiDB::TableSchema *m_table;
KexiRelationViewTableContainerHeader *m_tableHeader;
KexiRelationViewTable *m_tableView;
KexiRelationView *m_parent;
friend class KexiRelationViewTableContainerHeader;
};
/*
class KEXIRELATIONSVIEW_EXPORT KexiRelationViewTableItem : public KListViewItem
{
public:
KexiRelationViewTableItem(QListView *parent, QListViewItem *after,
QString key, QString field);
virtual void paintFocus ( QPainter * p, const QColorGroup & cg, const QRect & r );
};*/
class KEXIRELATIONSVIEW_EXPORT KexiRelationViewTable : public KexiFieldListView
{
Q_OBJECT
public:
KexiRelationViewTable(KexiDB::TableOrQuerySchema* tableOrQuerySchema,
KexiRelationView *view, QWidget *parent, const char *name = 0);
// KexiRelationViewTable(QWidget *parent, KexiRelationView *view, KexiDB::TableSchema *t, const char *name=0);
virtual ~KexiRelationViewTable();
// KexiDB::TableSchema *table() const { return m_table; };
int globalY(const QString &item);
// void setReadOnly(bool);
virtual QSize sizeHint() const;
signals:
void tableScrolling();
protected slots:
void slotDropped(QDropEvent *e);
void slotContentsMoving(int, int);
// void slotItemDoubleClicked( QListViewItem *i, const QPoint &, int );
protected:
virtual void contentsMousePressEvent( QMouseEvent * e );
virtual bool acceptDrag(QDropEvent *e) const;
//moved virtual QDragObject *dragObject();
virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item);
private:
// QStringList m_fieldList;
// KexiDB::TableSchema *m_table;
KexiRelationView *m_view;
// QPixmap m_keyIcon, m_noIcon;
};
class KEXIRELATIONSVIEW_EXPORT KexiRelationViewTableContainerHeader : public QLabel
{
Q_OBJECT
public:
KexiRelationViewTableContainerHeader(const QString& text,QWidget *parent);
virtual ~KexiRelationViewTableContainerHeader();
virtual void setFocus();
virtual void unsetFocus();
signals:
void moved();
void endDrag();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
void mousePressEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);
bool m_dragging;
int m_grabX;
int m_grabY;
int m_offsetX;
int m_offsetY;
QColor m_activeBG, m_activeFG, m_inactiveBG, m_inactiveFG;
};
#endif
|