kexi

kexirelationwidget.h
1/* This file is part of the KDE project
2 Copyright (C) 2002 Lucijan Busch <lucijan@gmx.at>
3 Copyright (C) 2003-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 KEXIRELATIONWIDGET_H
22#define KEXIRELATIONWIDGET_H
23
24//#include <tqwidget.h>
25//#include "kexiactionproxy.h"
26#include "kexiviewbase.h"
27#include "kexirelationview.h"
28
29class KComboBox;
30class KPushButton;
31class TDEPopupMenu;
32class TDEAction;
33class TQListViewItem;
34
35class KexiMainWindow;
36
37namespace KexiDB
38{
39 class Connection;
40 class TableSchema;
41 class Reference;
42}
43
44class KEXIRELATIONSVIEW_EXPORT KexiRelationWidget : public KexiViewBase
45{
46 TQ_OBJECT
47
48
49 public:
50 KexiRelationWidget(KexiMainWindow *win, TQWidget *parent, const char *name=0);
51 virtual ~KexiRelationWidget();
52
54 TablesDict* tables() const;
55 KexiRelationViewTableContainer* table(const TQString& name) const;
56 const ConnectionList* connections() const;
57
58// KexiRelationView *relationView() const { return m_relationView; }
59 void addTable(const TQString& t);
60
61// void openTable(KexiDB::TableSchema* table, bool designMode);
62
63 virtual TQSize sizeHint() const;
64
66 void objectCreated(const TQCString &mime, const TQCString& name);
67 void objectDeleted(const TQCString &mime, const TQCString& name);
68 void objectRenamed(const TQCString &mime, const TQCString& name, const TQCString& newName);
69
70 signals:
71 void tableAdded(KexiDB::TableSchema& t);
72 void tableHidden(KexiDB::TableSchema& t);
73 void tablePositionChanged(KexiRelationViewTableContainer*);
74 void aboutConnectionRemove(KexiRelationViewConnection*);
75 void tableFieldDoubleClicked( KexiDB::TableSchema* table, const TQString& fieldName );
76
77 public slots:
81 void addTable(KexiDB::TableSchema *t, const TQRect &rect = TQRect());
82
84 void addConnection(const SourceConnection& conn);
85
86 void removeSelectedObject();
87
89 void clear();
90
92 void removeAllConnections();
93
95 void hideAllTablesExcept( KexiDB::TableSchema::List* tables );
96
97 protected slots:
98 void slotAddTable();
99 void tableViewGotFocus();
100 void connectionViewGotFocus();
101 void emptyAreaGotFocus();
102 void tableContextMenuRequest(const TQPoint& pos);
103 void connectionContextMenuRequest(const TQPoint& pos);
104 void emptyAreaContextMenuRequest( const TQPoint& pos );
105 void openSelectedTable();
106 void designSelectedTable();
107 void slotTableHidden(KexiDB::TableSchema &table);
108 void aboutToShowPopupMenu();
109 void slotTableFieldDoubleClicked(TQListViewItem *i,const TQPoint&,int);
110
111 protected:
115 void executePopup( TQPoint pos = TQPoint(-1,-1) );
116
118 void invalidateActions();
119
121 void fillTablesCombo();
122
123 private:
124 KexiMainWindow *m_win;
125 KComboBox *m_tableCombo;
126 KPushButton *m_btnAdd;
127 KexiRelationView *m_relationView;
128 KexiDB::Connection *m_conn;
129
130 TDEPopupMenu *m_tableQueryPopup //over table/query
131 , *m_connectionPopup //over connection
132 , *m_areaPopup; //over outer area
133 TDEAction *m_openSelectedTableAction, *m_designSelectedTableAction;
134
135 int m_tableQueryPopupTitleID, m_connectionPopupTitleID;
136};
137
138#endif
Provides database connection, allowing queries and data modification.
Definition connection.h:62
TQPtrList< TableSchema > List
Type of tables list.
Definition tableschema.h:45
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Base class for single view embeddable of in KexiDialogBase.
High-level database connectivity library with database backend drivers.