1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SHAPERGUI_ToolbarsMgr_H
22 #define SHAPERGUI_ToolbarsMgr_H
24 #include "SHAPER_SHAPERGUI.h"
30 #include <QStringList>
39 * A dialog box for editing of toolbar items
41 class SHAPERGUI_ToolbarItemsDlg : public QDialog
46 /// \param theParent a parent for the dialog
47 /// \param theModule a module with toolbars
48 /// \param theToolbar a name of the toolbar for editing
49 /// \param theFreeItems a list of commands out of toolbars
50 /// \param theItemsList a list of command in the toolbar
51 SHAPERGUI_ToolbarItemsDlg(QWidget* theParent,
53 const QString& theToolbar,
54 const QIntList& theFreeItems,
55 const QIntList& theItemsList);
57 /// Returns list of free commands
58 QIntList freeItems() const;
60 /// Returns list of commands in the toolbar
61 QIntList toolbarItems() const;
64 /// An redifinition of a virtual function
65 /// \param theObj an object
66 /// \param theEvent an event
67 virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
70 /// A slot for button to add an item to toolbar commands
73 /// A slot for button to remove an item from toolbar commands
76 /// A slot to move a current item up in list of toolbar command
79 /// A slot to move a current item down in list of toolbar command
83 QIntList getItems(QListWidget* theWidget, int theStart) const;
87 QListWidget* myCommandsList;
88 QListWidget* myItemsList;
94 * A dialog box for toolbars management
96 class SHAPERGUI_ToolbarsDlg : public QDialog
101 /// \param theModule a SHAPER module
102 SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule);
104 /// Returns result of editing
105 QMap<QString, QIntList> result() const { return myResult; }
108 /// A slot to add a new toolbar
111 /// A slot to edit a current toolbar
114 /// A slot to delete a current toolbar
117 /// A slot called on double click on item in list
118 void onDoubleClick(const QModelIndex& theIdx);
121 /// Update content of toolbars list
122 void updateToolbarsList();
124 /// Update number of free items
129 QMap<QString, QIntList> myResult;
130 QIntList myFreeCommands;
133 QListWidget* myToolbarsList;