kexi

kexidatatable.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
4 Copyright (C) 2003-2006 Jaroslaw Staniek <js@iidea.pl>
5
6 This program 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 program 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 program; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22
23#include <tqlayout.h>
24#include <tqlabel.h>
25
26#include <kiconloader.h>
27#include <tdelocale.h>
28#include <tdeaction.h>
29#include <tdepopupmenu.h>
30
31#include <kexidb/cursor.h>
32
33#include "kexidatatableview.h"
34#include "kexidatatable.h"
35#include "kexidialogbase.h"
36
37KexiDataTable::KexiDataTable(KexiMainWindow *mainWin, TQWidget *parent,
38 const char *name, bool dbAware)
39// : KexiViewBase(mainWin, parent, name)
40 : KexiDataAwareView( mainWin, parent, name )
41{
42 KexiTableView *view;
43 if (dbAware)
44 view = new KexiDataTableView(this,
45 TQString("%1_datatableview").arg(name ? name : "KexiDataTableView").latin1());
46 else
47 view = new KexiTableView(0, this,
48 TQString("%1_tableview").arg(name ? name : "KexiTableView").latin1());
49
50 KexiDataAwareView::init( view, view, view );
51}
52
53KexiDataTable::KexiDataTable(KexiMainWindow *mainWin, TQWidget *parent,
54 KexiDB::Cursor *cursor, const char *name)
55 : KexiDataAwareView( mainWin, parent, name )
56{
57 KexiTableView *view = new KexiDataTableView(this, "view", cursor);
58 KexiDataAwareView::init( view, view, view );
59}
60
61KexiDataTable::~KexiDataTable()
62{
63}
64
65void
67{
68 if (!dynamic_cast<KexiDataTableView*>(mainWidget()))
69 return;
70 dynamic_cast<KexiDataTableView*>(mainWidget())->setData(c);
71}
72
74{
75}
76
77KexiTableView* KexiDataTable::tableView() const
78{
79 return dynamic_cast<KexiTableView*>(m_internalView);
80}
81
82#include "kexidatatable.moc"
Provides database cursor functionality.
Definition cursor.h:67
Provides a view displaying record-based data.
void init(TQWidget *viewWidget, KexiSharedActionClient *actionClient, KexiDataAwareObjectInterface *dataAwareObject, bool noDataAware=false)
Database aware table widget.
void setData(KexiDB::Cursor *cursor)
KexiDataTable(KexiMainWindow *mainWin, TQWidget *parent, const char *name=0, bool dbAware=true)
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
KexiTableView class provides a widget for displaying data in a tabular view.