1 #ifndef _KVI_CUSTOMTOOLBARDESCRIPTOR_H_ 2 #define _KVI_CUSTOMTOOLBARDESCRIPTOR_H_ 3 //============================================================================= 4 // 5 // File : KviCustomToolBarDescriptor.h 6 // Creation date : Sun 05 Dec 2004 18:20:58 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 "KviPointerList.h" 29 #include "KviQString.h" 30 31 class KviConfigurationFile; 32 class KviCustomToolBar; 33 class KviKvsScript; 34 35 class KVIRC_API KviCustomToolBarDescriptor 36 { 37 friend class KviCustomToolBar; 38 friend class KviCustomToolBarManager; 39 40 protected: 41 KviCustomToolBarDescriptor(QString szId, const QString & szLabelCode); 42 43 public: 44 ~KviCustomToolBarDescriptor(); 45 46 protected: 47 QString m_szId; 48 QString m_szIconId; 49 QString m_szParsedLabel; 50 KviPointerList<QString> * m_pActions; 51 KviCustomToolBar * m_pToolBar = nullptr; 52 int m_iInternalId; 53 bool m_bVisibleAtStartup = false; 54 KviKvsScript * m_pLabelScript = nullptr; 55 56 public: iconId()57 const QString & iconId() const { return m_szIconId; } 58 const QString & label(); 59 const QString & labelCode() const; id()60 const QString & id() const { return m_szId; } internalId()61 int internalId() const { return m_iInternalId; } // useful only for KviMainWindow toolBar()62 KviCustomToolBar * toolBar() const { return m_pToolBar; } 63 KviCustomToolBar * createToolBar(); setIconId(const QString & szIconId)64 void setIconId(const QString & szIconId) { m_szIconId = szIconId; } 65 bool addAction(const QString & szAction); 66 bool removeAction(const QString & szAction); 67 bool removeAction(unsigned int iAction); 68 void clear(); 69 void rename(const QString & szNewName); actions()70 KviPointerList<QString> * actions() const { return m_pActions; } 71 void updateToolBar(); 72 73 protected: 74 void createLabelScript(const QString & szNewLabelCode); 75 void fillToolBar(); 76 bool load(KviConfigurationFile * cfg); 77 void save(KviConfigurationFile * cfg); 78 void registerToolBar(KviCustomToolBar * t); 79 void unregisterToolBar(KviCustomToolBar * t); 80 }; 81 82 #endif //_KVI_CUSTOMTOOLBARDESCRIPTOR_H_ 83