kexi

kexibrowser.h
1/* This file is part of the KDE project
2 Copyright (C) 2002, 2003 Lucijan Busch <lucijan@gmx.at>
3 Copyright (C) 2003-2006 Jaroslaw Staniek <js@iidea.pl>
4
5 This library 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 library 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 library; see the file COPYING.LIB. 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 KEXIBROWSER_H
22#define KEXIBROWSER_H
23
24#include <tdelistview.h>
25#include <tqasciidict.h>
26#include <tqintdict.h>
27
28class TQListViewItem;
29class TDEIconLoader;
30class TDEPopupMenu;
31class TDEAction;
32class TDEActionMenu;
33class TDEActionCollection;
34class TDEListView;
35class TDEToolBar;
36class KexiBrowserItem;
37class KexiView;
38class KexiMainWindow;
40class KexiBrowserListView;
41
42namespace KexiPart
43{
44 class Info;
45 class Item;
46 class Part;
47}
48class KexiProject;
49
51class KEXIEXTWIDGETS_EXPORT KexiBrowser : public TQWidget
52{
53 TQ_OBJECT
54
55
56 public:
57 enum Features {
58 Writable = 1,
59 ContextMenus = 2,
60 Toolbar = 4,
61 SingleClickOpensItemOptionEnabled = 8,
62 DefaultFeatures = Writable | ContextMenus | Toolbar
63 | SingleClickOpensItemOptionEnabled
64 };
65
66 KexiBrowser(TQWidget* parent, KexiMainWindow *mainWin, int features = DefaultFeatures);
67 virtual ~KexiBrowser();
68
75 void setProject(KexiProject* prj, const TQString& itemsMimeType = TQString(),
76 TQString* partManagerErrorMessages = 0);
77
81 TQString itemsMimeType() const;
82
83 KexiPart::Item* selectedPartItem() const;
84
85 void installEventFilter ( const TQObject * filterObj );
86 virtual bool eventFilter ( TQObject *o, TQEvent * e );
87
88 bool actionEnabled(const TQCString& actionName) const;
89
90 public slots:
91 KexiBrowserItem* addGroup(KexiPart::Info& info);
92 KexiBrowserItem* addItem(KexiPart::Item& item);
93 void slotRemoveItem(const KexiPart::Item &item);
94 virtual void setFocus();
95 void updateItemName(KexiPart::Item& item, bool dirty);
96 void selectItem(KexiPart::Item& item);
97 void clearSelection();
98 void clear();
99
102 void setReadOnly(bool set);
103
104 bool isReadOnly() const;
105
106 signals:
107 void openItem( KexiPart::Item*, int viewMode );
108
113 void openOrActivateItem( KexiPart::Item*, int viewMode );
114
115 void newItem( KexiPart::Info* );
116
117 void removeItem( KexiPart::Item* );
118
119 void renameItem( KexiPart::Item *item, const TQString& _newName, bool &succes );
120
121 void selectionChanged( KexiPart::Item* item );
122
123 void executeItem( KexiPart::Item* );
124
125 void exportItemAsDataTable( KexiPart::Item* );
126
127 void printItem( KexiPart::Item* );
128
129 void pageSetupForItem( KexiPart::Item* );
130
131 protected slots:
132 void slotContextMenu(TDEListView*, TQListViewItem *i, const TQPoint &point);
133 void slotExecuteItem(TQListViewItem *item);
134 void slotSelectionChanged(TQListViewItem* i);
135 void slotSettingsChanged(int);
136 void slotNewObjectPopupAboutToShow();
137
138 void slotNewObject();
139 void slotOpenObject();
140 void slotDesignObject();
141 void slotEditTextObject();
142 void slotRemove();
143 void slotCut();
144 void slotCopy();
145 void slotPaste();
146 void slotRename();
147 void slotExecuteObject();
148 void slotExportAsDataTable();
149 void slotPrintItem();
150 void slotPageSetupForItem();
151
152 protected:
153 void itemRenameDone();
154 KexiBrowserItem* addItem(KexiPart::Item& item, KexiBrowserItem *parent, KexiPart::Info* info);
155
156 KexiMainWindow *m_mainWin;
157 int m_features;
158 KexiBrowserListView *m_list;
159 TDEActionCollection *m_actions;
160 TQAsciiDict<KexiBrowserItem> m_baseItems;
161 TQIntDict<KexiBrowserItem> m_normalItems;
162 TDEPopupMenu *m_itemPopup, *m_partPopup;
163 TDEAction *m_deleteAction, *m_renameAction,
164 *m_newObjectAction, // *m_newObjectToolbarAction,
165 *m_openAction, *m_designAction, *m_editTextAction,
166 *m_executeAction,
167 *m_dataExportAction, *m_printAction, *m_pageSetupAction;
168 TDEActionMenu* m_exportActionMenu;
169 TDEPopupMenu* m_newObjectPopup;
170 int m_itemPopupTitle_id, m_partPopupTitle_id,
171 m_openAction_id, m_designAction_id, m_editTextAction_id,
172 m_executeAction_id,
173 m_exportActionMenu_id, m_exportActionMenu_id_sep,
174 m_printAction_id, m_pageSetupAction_id, m_pageSetupAction_id_sep;
175
176 KexiPart::Part *m_prevSelectedPart;
177 TDEToolBar *m_toolbar;
178 KexiSmallToolButton *m_newObjectToolButton, *m_deleteObjectToolButton;
179 TQString m_itemsMimeType;
180 bool m_singleClick : 1;
181 bool m_readOnly : 1;
182};
183
184#endif
List view item for the navigator widget (KexiBrowser) Used for creating group items as well as object...
The Main Kexi navigator widget.
Definition kexibrowser.h:52
void openOrActivateItem(KexiPart::Item *, int viewMode)
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Information about a Kexi Part (plugin).
Information about a single object that can be instantiated using Kexi Part.
The main class for kexi frontend parts like tables, queries, forms and reports.
Definition kexipart.h:66
A project's main controller.
Definition kexiproject.h:68
A small tool button with icon and optional text.