File indexing completed on 2024-05-19 12:54:54
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> 0003 Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KEXIOBJECTVIEWTABWIDGET_H 0022 #define KEXIOBJECTVIEWTABWIDGET_H 0023 0024 #include <QTabWidget> 0025 #include <KDbTristate> 0026 0027 class KexiObjectViewWidget; 0028 class KexiWindow; 0029 0030 //! @internal tab widget acting as central widget for KexiMainWindow 0031 class KexiObjectViewTabWidget : public QTabWidget 0032 { 0033 Q_OBJECT 0034 public: 0035 KexiObjectViewTabWidget(QWidget *parent, KexiObjectViewWidget *mainWidget); 0036 virtual ~KexiObjectViewTabWidget(); 0037 0038 //! @return window for tab @a index 0039 KexiWindow *window(int index); 0040 0041 public Q_SLOTS: 0042 void closeCurrentTab(); 0043 void closeAllTabs(); 0044 0045 //! Adds a new tab with empty container widget. @return index of the new tab. 0046 int addEmptyContainerTab(const QIcon &icon, const QString &label); 0047 0048 //! Sets window for tab @a index previously created using addEmptyContainerTab() 0049 void setWindowForTab(int index, KexiWindow *window); 0050 0051 protected: 0052 //! Shows context menu for tab at @a index at point @a point. 0053 //! If @a index is -1, context menu for empty area is requested. 0054 void showContextMenuForTab(int index, const QPoint& point); 0055 0056 //! Reimplemented to hide frame when no tabs are displayed 0057 virtual void paintEvent(QPaintEvent * event) override; 0058 0059 virtual void mousePressEvent(QMouseEvent *event) override; 0060 0061 KexiObjectViewWidget *m_mainWidget; 0062 0063 private: 0064 int m_tabIndex; 0065 0066 void setTabIndexFromContextMenu(int clickedIndex); 0067 }; 0068 0069 #endif