kexi

kexirelationviewconnection.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
4
5 This program 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 program 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 program; see the file COPYING. 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 KEXIRELATIONVIEWCONNECTION_H
22#define KEXIRELATIONVIEWCONNECTION_H
23
24#include <tqstring.h>
25#include <tqguardedptr.h>
26
27class TQPainter;
28class KexiRelationViewTableContainer;
30
31class KEXIRELATIONSVIEW_EXPORT KexiRelationViewConnection
32{
33 public:
34
35 KexiRelationViewConnection(KexiRelationViewTableContainer *masterTbl,
36 KexiRelationViewTableContainer *detailsTbl, struct SourceConnection &s, KexiRelationView *parent);
37 ~KexiRelationViewConnection();
38
39
40 /*
41 C++PROGRAMMIERER bestehen darauf, daß der Elefant eine Klasse sei,
42 und somit schließlich seine Fang-Methoden selbst mitzubringen habe.
43
44 http://www.c-plusplus.de ;)
45 */
46 void drawConnection(TQPainter *p);
47
48 bool selected() { return m_selected; }
49 void setSelected(bool s) { m_selected = s; }
50
51 const TQRect connectionRect();
52 const TQRect oldRect() const { return m_oldRect; }
53
54 KexiRelationViewTableContainer *masterTable() { return m_masterTable; }
55 KexiRelationViewTableContainer *detailsTable() { return m_detailsTable; }
56 TQString masterField() const { return m_masterField; }
57 TQString detailsField() const { return m_detailsField; }
58
59
60 bool matchesPoint(const TQPoint &p, int tolerance=3);
61// SourceConnection connection() { return m_conn; }
62
63 TQString toString() const;
64
65 private:
66 TQGuardedPtr<KexiRelationViewTableContainer> m_masterTable;
67 TQGuardedPtr<KexiRelationViewTableContainer> m_detailsTable;
68 TQString m_masterField;
69 TQString m_detailsField;
70 TQRect m_oldRect;
71 bool m_selected;
72 TQGuardedPtr<KexiRelationView> m_parent;
73};
74
75#endif
provides a view for displaying relations between database tables.