kexi

kexibrowser.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002, 2003 Lucijan Busch <lucijan@gmx.at>
00003    Copyright (C) 2003-2006 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIBROWSER_H
00022 #define KEXIBROWSER_H
00023 
00024 #include <klistview.h>
00025 #include <qasciidict.h>
00026 #include <qintdict.h>
00027 
00028 class QListViewItem;
00029 class KIconLoader;
00030 class KPopupMenu;
00031 class KAction;
00032 class KActionMenu;
00033 class KActionCollection;
00034 class KListView;
00035 class KToolBar;
00036 class KexiBrowserItem;
00037 class KexiView;
00038 class KexiMainWindow;
00039 class KexiSmallToolButton;
00040 class KexiBrowserListView;
00041 
00042 namespace KexiPart
00043 {
00044     class Info;
00045     class Item;
00046     class Part;
00047 }
00048 
00050 class KEXIMAIN_EXPORT KexiBrowser : public QWidget
00051 {
00052     Q_OBJECT
00053 
00054     public:
00055         KexiBrowser(KexiMainWindow *mainWin);
00056         virtual ~KexiBrowser(); 
00057 
00058         KexiPart::Item* selectedPartItem() const;
00059 
00060         void installEventFilter ( const QObject * filterObj );
00061         virtual bool eventFilter ( QObject *o, QEvent * e );
00062 
00063         bool actionEnabled(const QCString& actionName) const;
00064 //      virtual bool isExecuteArea( const QPoint& point );
00065 
00066     public slots:
00067         void addGroup(KexiPart::Info& info);
00068         void addItem(KexiPart::Item& item);
00069         void slotRemoveItem(const KexiPart::Item &item);
00070         virtual void setFocus();
00071         void updateItemName(KexiPart::Item& item, bool dirty);
00072         void highlightItem(KexiPart::Item& item);
00073 //      virtual void rename(QListViewItem *item, int c);
00074         void clear();
00075 
00078         void setReadOnly(bool set);
00079 
00080         bool isReadOnly() const;
00081 
00082     signals: 
00083         void openItem( KexiPart::Item*, int viewMode );
00084 
00089         void openOrActivateItem( KexiPart::Item*, int viewMode );
00090 
00091         void newItem( KexiPart::Info* );
00092 
00093         void removeItem( KexiPart::Item* );
00094 
00095         void renameItem( KexiPart::Item *item, const QString& _newName, bool &succes );
00096 
00097         void selectionChanged(KexiPart::Item* item);
00098 
00099         void exportItemAsDataTable( KexiPart::Item* );
00100 
00101         void printItem( KexiPart::Item* );
00102 
00103         void pageSetupForItem( KexiPart::Item* );
00104 
00105 //      void actionAvailable(const char *name, bool avail);
00106 
00107     protected slots:
00108         void slotContextMenu(KListView*, QListViewItem *i, const QPoint &point);
00109         void slotExecuteItem(QListViewItem *item);
00110         void slotSelectionChanged(QListViewItem* i);
00111         void slotSettingsChanged(int);
00112         void slotNewObjectPopupAboutToShow();
00113 
00114         void slotNewObject();
00115         void slotOpenObject();
00116         void slotDesignObject();
00117         void slotEditTextObject();
00119         void slotRemove();
00120         void slotCut();
00121         void slotCopy();
00122         void slotPaste();
00123         void slotRename();
00124         void slotExportAsDataTable();
00125         void slotPrintItem();
00126         void slotPageSetupForItem();
00127 
00128     protected:
00129         void itemRenameDone();
00130 
00131         KexiMainWindow *m_mainWin;
00132         KexiBrowserListView *m_list;
00133         KActionCollection *m_actions;
00134         QAsciiDict<KexiBrowserItem> m_baseItems;
00135         QIntDict<KexiBrowserItem> m_normalItems;
00136         KPopupMenu *m_itemPopup, *m_partPopup;
00137         KAction *m_deleteAction, *m_renameAction, 
00138             *m_newObjectAction, // *m_newObjectToolbarAction,
00139             *m_openAction, *m_designAction, *m_editTextAction,
00140             *m_dataExportAction, *m_printAction, *m_pageSetupAction;
00141         KActionMenu* m_exportActionMenu;
00142         KPopupMenu* m_newObjectPopup;
00143         int m_itemPopupTitle_id, m_partPopupTitle_id, 
00144             m_openAction_id, m_designAction_id, m_editTextAction_id,
00145             m_exportActionMenu_id, m_exportActionMenu_id_sep,
00146             m_printAction_id, m_pageSetupAction_id, m_pageSetupAction_id_sep;
00147 
00148         KexiPart::Part *m_prevSelectedPart;
00149         KToolBar *m_toolbar;
00150         KexiSmallToolButton *m_newObjectToolButton, *m_deleteObjectToolButton;
00151         bool m_singleClick : 1;
00152         bool m_readOnly : 1;
00153 };
00154 
00155 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys