Salome HOME
Updated copyright comment
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_ReduceStudyDlg.h
1 // Copyright (C) 2014-2024  CEA, EDF, OPEN CASCADE
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 GEOMTOOLSGUI_REDUCESTUDYDLG_H
21 #define GEOMTOOLSGUI_REDUCESTUDYDLG_H
22
23 // internal includes
24 #include "GEOM_ToolsGUI.hxx"
25
26 // GEOM includes
27 #include <GEOMUtils.hxx>
28 #include <GeometryGUI.h>
29 #include <GEOM_Displayer.h>
30
31 // Qt includes
32 #include <QDialog>
33 #include <QTreeWidget>
34 #include <QCheckBox>
35 #include <QButtonGroup>
36 #include <QGroupBox>
37
38 // Cpp includes
39 #include <set>
40
41 class GEOMToolsGUI_TreeWidgetItem : public QTreeWidgetItem
42 {
43
44 public:
45   GEOMToolsGUI_TreeWidgetItem( QTreeWidget*, const QStringList&, char*, int = Type );
46   GEOMToolsGUI_TreeWidgetItem( QTreeWidgetItem*, const QStringList&, char*, int = Type );
47   ~GEOMToolsGUI_TreeWidgetItem();
48
49   bool    isVisible();
50   void    setVisible( bool, QIcon& );
51
52   char*   getStudyEntry() const;
53
54 private:
55   bool    myVisible;
56   char*   myStudyEntry;
57
58 };
59
60 class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_ReduceStudyDlg : public QDialog
61
62   Q_OBJECT
63
64 public:
65   GEOMToolsGUI_ReduceStudyDlg( QWidget* );
66   ~GEOMToolsGUI_ReduceStudyDlg();
67
68 private slots:
69   void                          onItemClicked(QTreeWidgetItem*, int );
70   void                          onHeaderClicked( int );
71
72   void                          selectionChanged();
73
74   void                          update();
75
76   void                          clickOnOk();
77   void                          clickOnHelp();
78
79 private:
80   void                          init( const std::set<std::string>& theObjectEntries );
81   std::set<std::string>         getSelectedObjects() const;
82
83   void                          createTreeWidget( QTreeWidget* );
84   QGroupBox*                    createButtonGroup( QButtonGroup* );
85
86   void                          addObjectsToTree( QTreeWidget*, std::set<std::string>& );
87   GEOMToolsGUI_TreeWidgetItem*  addSubObject( QTreeWidget*, std::set<std::string>&, GEOM::GEOM_Object_var );
88   GEOMToolsGUI_TreeWidgetItem*  findObjectInTree( QTreeWidget*, GEOM::GEOM_Object_var );
89
90   void                          checkVisibleIcon( QTreeWidget* );
91   bool                          isObjectDrawable( std::string );
92
93   void                          unpublishObjects( std::set<std::string>& );
94
95   void                          removeObjects( std::set<std::string>& );
96   void                          removeObject( std::string& );
97
98   void                          removeEmptyFolders();
99   void                          getEmptyFolders( _PTR(SObject), std::set<std::string>& );
100
101   QTreeWidget*                  myTreeKeptObjects;
102   QTreeWidget*                  myTreeRemoveObjects;
103   std::map<QTreeWidget*,bool>   myMapTreeSelectAll;
104
105   QButtonGroup*                 myGroupIntermediates;
106   QButtonGroup*                 myGroupSubObjects;
107
108   QCheckBox*                    myCBRemoveEmptyFolder;
109   QCheckBox*                    myCBSoftRemoval;
110
111   std::set<std::string>         myMainEntries;
112
113   std::set<std::string>         myKeptObjects;
114   std::set<std::string>         myRemovedObjects;
115   std::set<std::string>         myListParents;
116   std::set<std::string>         myListSubObjects;
117
118   QIcon                         myVisible;
119   QIcon                         myInvisible;
120
121   GEOM_Displayer                myDisplayer;
122   SalomeApp_Application*        myApp;
123
124 };
125
126 #endif