SHAPER  9.12.0
SHAPERGUI_ToolbarsMgr.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SHAPERGUI_ToolbarsMgr_H
21 #define SHAPERGUI_ToolbarsMgr_H
22 
23 #include "SHAPER_SHAPERGUI.h"
24 
25 #include <Qtx.h>
26 
27 #include <QDialog>
28 #include <QString>
29 #include <QStringList>
30 #include <QMap>
31 
32 class QListWidget;
33 class SHAPERGUI;
34 class QLabel;
35 
41 {
42  Q_OBJECT
43 public:
51  SHAPERGUI* theModule,
52  const QString& theToolbar,
53  const QIntList& theFreeItems,
54  const QIntList& theItemsList);
55 
57  QIntList freeItems() const;
58 
60  QIntList toolbarItems() const;
61 
62 protected:
66  virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
67 
68 private slots:
70  void onAddItem();
71 
73  void onDelItem();
74 
76  void onUp();
77 
79  void onDown();
80 
82  void onHelp();
83 
84 private:
85  QIntList getItems(QListWidget* theWidget, int theStart) const;
86 
87  SHAPERGUI* myModule;
88 
89  QListWidget* myCommandsList;
90  QListWidget* myItemsList;
91 };
92 
93 
99 {
100  Q_OBJECT
101 public:
104  SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule);
105 
107  QMap<QString, QIntList> result() const { return myResult; }
108 
110  bool isReset() const {
111  return myIsReset;
112  }
113 
114 private slots:
116  void onAdd();
117 
119  void onEdit();
120 
122  void onDelete();
123 
125  void onReset();
126 
128  void onHelp();
129 
131  void onDoubleClick(const QModelIndex& theIdx);
132 
133 private:
135  void updateToolbarsList();
136 
138  void updateNumber();
139 
140 private:
141  SHAPERGUI* myModule;
142  QMap<QString, QIntList> myResult;
143  QIntList myFreeCommands;
144 
145  QLabel* myFreeNbLbl;
146  QListWidget* myToolbarsList;
147 
148  bool myIsReset;
149 };
150 
151 
152 #endif
A dialog box for editing of toolbar items.
Definition: SHAPERGUI_ToolbarsMgr.h:41
SHAPERGUI_ToolbarItemsDlg(QWidget *theParent, SHAPERGUI *theModule, const QString &theToolbar, const QIntList &theFreeItems, const QIntList &theItemsList)
Constructor.
Definition: SHAPERGUI_ToolbarsMgr.cpp:260
QIntList freeItems() const
Returns list of free commands.
Definition: SHAPERGUI_ToolbarsMgr.cpp:450
virtual bool eventFilter(QObject *theObj, QEvent *theEvent)
An redifinition of a virtual function.
Definition: SHAPERGUI_ToolbarsMgr.cpp:409
QIntList toolbarItems() const
Returns list of commands in the toolbar.
Definition: SHAPERGUI_ToolbarsMgr.cpp:455
A dialog box for toolbars management.
Definition: SHAPERGUI_ToolbarsMgr.h:99
SHAPERGUI_ToolbarsDlg(SHAPERGUI *theModule)
Constructor.
Definition: SHAPERGUI_ToolbarsMgr.cpp:80
bool isReset() const
Returns a flag of resetted toolbars structure.
Definition: SHAPERGUI_ToolbarsMgr.h:110
QMap< QString, QIntList > result() const
Returns result of editing.
Definition: SHAPERGUI_ToolbarsMgr.h:107
An implementation of SALOME connector class for implementation of XGUI functionality as a module of S...
Definition: SHAPERGUI.h:47