1 #ifndef _KVI_CUSTOMTOOLBAR_H_ 2 #define _KVI_CUSTOMTOOLBAR_H_ 3 //============================================================================= 4 // 5 // File : KviCustomToolBar.h 6 // Creation date : Sun 21 Nov 2004 05:28:57 by Szymon Stefanek 7 // 8 // This file is part of the KVIrc IRC Client distribution 9 // Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net> 10 // 11 // This program is FREE software. You can redistribute it and/or 12 // modify it under the terms of the GNU General Public License 13 // as published by the Free Software Foundation; either version 2 14 // of the License, or (at your option) any later version. 15 // 16 // This program is distributed in the HOPE that it will be USEFUL, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 // See the GNU General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program. If not, write to the Free Software Foundation, 23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 // 25 //============================================================================= 26 27 #include "kvi_settings.h" 28 #include "KviToolBar.h" 29 #include "KviPointerHashTable.h" 30 31 #ifdef COMPILE_ON_WINDOWS 32 #include "KviCustomToolBarDescriptor.h" 33 #else 34 class KviCustomToolBarDescriptor; 35 #endif 36 37 class KVIRC_API KviCustomToolBar : public KviToolBar 38 { 39 friend class KviCustomToolBarDescriptor; 40 Q_OBJECT 41 protected: 42 KviCustomToolBar(KviCustomToolBarDescriptor * d, const QString & szLabel, Qt::ToolBarArea type = Qt::TopToolBarArea, const char * pcName = "unnamed_customtoolbar"); 43 44 public: 45 ~KviCustomToolBar(); 46 47 protected: 48 KviCustomToolBarDescriptor * m_pDescriptor; 49 KviPointerHashTable<void *, bool> * m_pFilteredChildren; 50 51 public: descriptor()52 KviCustomToolBarDescriptor * descriptor() { return m_pDescriptor; }; 53 protected: 54 void dragEnterEvent(QDragEnterEvent * e) override; 55 void dragMoveEvent(QDragMoveEvent * e) override; 56 void dragLeaveEvent(QDragLeaveEvent * e) override; 57 void dropEvent(QDropEvent * e) override; 58 void childEvent(QChildEvent * e) override; 59 bool eventFilter(QObject * o, QEvent * e) override; 60 QAction * actionForWidget(QWidget * pWidget); 61 void drag(QWidget * pChild, const QPoint & pnt); 62 void filterChild(QObject * o); 63 void unfilterChild(QObject * o); 64 void paintEvent(QPaintEvent * e) override; 65 void syncDescriptor(); 66 protected slots: 67 void beginCustomize(); 68 void endCustomize(); 69 void filteredChildDestroyed(); 70 }; 71 72 class KviCustomToolBarSeparator : public QWidget 73 { 74 Q_OBJECT 75 public: 76 KviCustomToolBarSeparator(KviCustomToolBar * pParent, const char * pcName); 77 78 protected: 79 KviCustomToolBar * m_pToolBar; 80 81 public: 82 QSize sizeHint() const override; 83 84 protected: 85 void paintEvent(QPaintEvent * e) override; 86 }; 87 88 #endif //_KVI_CUSTOMTOOLBAR_H_ 89