1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SHAPERGUI_ToolbarsMgr_H
21 #define SHAPERGUI_ToolbarsMgr_H
23 #include "SHAPER_SHAPERGUI.h"
29 #include <QStringList>
38 * A dialog box for editing of toolbar items
40 class SHAPERGUI_ToolbarItemsDlg : public QDialog
45 /// \param theParent a parent for the dialog
46 /// \param theModule a module with toolbars
47 /// \param theToolbar a name of the toolbar for editing
48 /// \param theFreeItems a list of commands out of toolbars
49 /// \param theItemsList a list of command in the toolbar
50 SHAPERGUI_ToolbarItemsDlg(QWidget* theParent,
52 const QString& theToolbar,
53 const QIntList& theFreeItems,
54 const QIntList& theItemsList);
56 /// Returns list of free commands
57 QIntList freeItems() const;
59 /// Returns list of commands in the toolbar
60 QIntList toolbarItems() const;
63 /// An redifinition of a virtual function
64 /// \param theObj an object
65 /// \param theEvent an event
66 virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
69 /// A slot for button to add an item to toolbar commands
72 /// A slot for button to remove an item from toolbar commands
75 /// A slot to move a current item up in list of toolbar command
78 /// A slot to move a current item down in list of toolbar command
81 /// A slot on help call
85 QIntList getItems(QListWidget* theWidget, int theStart) const;
89 QListWidget* myCommandsList;
90 QListWidget* myItemsList;
96 * A dialog box for toolbars management
98 class SHAPERGUI_ToolbarsDlg : public QDialog
103 /// \param theModule a SHAPER module
104 SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule);
106 /// Returns result of editing
107 QMap<QString, QIntList> result() const { return myResult; }
109 /// Returns a flag of resetted toolbars structure
110 bool isReset() const {
115 /// A slot to add a new toolbar
118 /// A slot to edit a current toolbar
121 /// A slot to delete a current toolbar
124 /// A slot to reset toolbars
127 /// A slot on help call
130 /// A slot called on double click on item in list
131 void onDoubleClick(const QModelIndex& theIdx);
134 /// Update content of toolbars list
135 void updateToolbarsList();
137 /// Update number of free items
142 QMap<QString, QIntList> myResult;
143 QIntList myFreeCommands;
146 QListWidget* myToolbarsList;