X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSHAPERGUI%2FSHAPERGUI_ToolbarsMgr.h;h=b09bf680a53e3db258bedf1aaf18da00ae38e5c5;hb=refs%2Fheads%2FCR35150;hp=1da7e8a2eb3bdb3f05f6fe61a5f09f7c8c04aa7e;hpb=e8094b2c51a1c0033489554f8015ac0d456a2d79;p=modules%2Fshaper.git diff --git a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h index 1da7e8a2e..b09bf680a 100644 --- a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h +++ b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef SHAPERGUI_ToolbarsMgr_H @@ -32,26 +31,60 @@ class QListWidget; class SHAPERGUI; +class QLabel; - +/** +* \ingroup Salome +* A dialog box for editing of toolbar items +*/ class SHAPERGUI_ToolbarItemsDlg : public QDialog { Q_OBJECT public: + /// Constructor + /// \param theParent a parent for the dialog + /// \param theModule a module with toolbars + /// \param theToolbar a name of the toolbar for editing + /// \param theFreeItems a list of commands out of toolbars + /// \param theItemsList a list of command in the toolbar SHAPERGUI_ToolbarItemsDlg(QWidget* theParent, SHAPERGUI* theModule, const QString& theToolbar, const QIntList& theFreeItems, const QIntList& theItemsList); + /// Returns list of free commands + QIntList freeItems() const; + + /// Returns list of commands in the toolbar + QIntList toolbarItems() const; + +protected: + /// An redifinition of a virtual function + /// \param theObj an object + /// \param theEvent an event + virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + private slots: + /// A slot for button to add an item to toolbar commands void onAddItem(); + + /// A slot for button to remove an item from toolbar commands void onDelItem(); + /// A slot to move a current item up in list of toolbar command + void onUp(); + + /// A slot to move a current item down in list of toolbar command + void onDown(); + + /// A slot on help call + void onHelp(); + private: + QIntList getItems(QListWidget* theWidget, int theStart) const; + SHAPERGUI* myModule; - QIntList myFreeItems; - QIntList myToolItems; QListWidget* myCommandsList; QListWidget* myItemsList; @@ -66,30 +99,53 @@ class SHAPERGUI_ToolbarsDlg : public QDialog { Q_OBJECT public: - SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule, - const QIntList& theActionsList, - const QMap& theToolbars); + /// Constructor + /// \param theModule a SHAPER module + SHAPERGUI_ToolbarsDlg(SHAPERGUI* theModule); + + /// Returns result of editing + QMap result() const { return myResult; } - QMap result() const { return myToolbars; } + /// Returns a flag of resetted toolbars structure + bool isReset() const { + return myIsReset; + } private slots: + /// A slot to add a new toolbar void onAdd(); + /// A slot to edit a current toolbar void onEdit(); + /// A slot to delete a current toolbar void onDelete(); + /// A slot to reset toolbars + void onReset(); + + /// A slot on help call + void onHelp(); + + /// A slot called on double click on item in list + void onDoubleClick(const QModelIndex& theIdx); + private: + /// Update content of toolbars list void updateToolbarsList(); - QIntList getFreeCommands() const; + /// Update number of free items + void updateNumber(); private: SHAPERGUI* myModule; - QIntList myActionsList; - QMap myToolbars; + QMap myResult; + QIntList myFreeCommands; + QLabel* myFreeNbLbl; QListWidget* myToolbarsList; + + bool myIsReset; };