Salome HOME
Merge of GUI and Engine functionalities
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_ReduceStudyDlg.h
1 // Copyright (C) 2014  CEA/DEN, EDF R&D, 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 #include "GEOM_ToolsGUI.hxx"
24 #include <QDialog>
25 #include <QTreeWidget>
26 #include <QCheckBox>
27 #include <QButtonGroup>
28 #include <QGroupBox>
29
30 #include <GEOMUtils.hxx>
31 #include <GeometryGUI.h>
32 #include <GEOM_Displayer.h>
33
34 #include <set>
35
36 class GEOMToolsGUI_TreeWidgetItem : public QTreeWidgetItem
37 {
38
39 public:
40   GEOMToolsGUI_TreeWidgetItem( QTreeWidget*, const QStringList&, char*, bool, int = Type );
41   GEOMToolsGUI_TreeWidgetItem( QTreeWidgetItem*, const QStringList&, char*, bool, int = Type );
42   ~GEOMToolsGUI_TreeWidgetItem();
43
44   bool isVisible();
45   void setVisible( bool, QIcon& );
46
47   char* getStudyEntry() const;
48
49 private:
50   char* myStudyEntry;
51   bool myVisible;
52 };
53
54 class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_ReduceStudyDlg : public QDialog
55
56   Q_OBJECT
57
58 public:
59   GEOMToolsGUI_ReduceStudyDlg( const GEOM::string_array&, QWidget* );
60   ~GEOMToolsGUI_ReduceStudyDlg();
61
62 private slots:
63
64   void clickOnOk();
65   void clickOnCancel();
66   void clickOnHelp();
67
68   void onItemClicked(QTreeWidgetItem*, int );
69   void onHeaderClicked( int );
70
71   void selectionChanged();
72
73   void update();
74
75 private:
76
77   void init( const GEOM::string_array& theObjectEntries );
78   void createTreeWidget( QTreeWidget* );
79   QGroupBox* createButtonGroup( QButtonGroup* );
80   void checkVisibleIcon( QTreeWidget* );
81   void sortObjects( QTreeWidget*, std::set<std::string>& );
82   GEOMToolsGUI_TreeWidgetItem* addSubObject( QTreeWidget*, std::set<std::string>&, GEOM::GEOM_Object_var );
83   GEOMToolsGUI_TreeWidgetItem* findObjectInTree( QTreeWidget*, GEOM::GEOM_Object_var );
84
85   void unpublishObjects( std::set<std::string>& );
86   void removeObjects( std::set<std::string>& );
87
88   QTreeWidget* myTreeKeptObjects;
89   QTreeWidget* myTreeRemoveObjects;
90
91   QButtonGroup* myIntermediates;
92   QButtonGroup* mySubObjects;
93
94   QCheckBox* myCBRemoveEmptyFolder;
95   QCheckBox* myCBSoftRemoval;
96
97   std::set<std::string> myMainEntries;
98
99   QIcon myVisible;
100   QIcon myInvisible;
101
102   GEOM_Displayer myDisplayer;
103   int myStudyId;
104
105   std::set<std::string> myKeptObjects;
106   std::set<std::string> myParents;
107   std::set<std::string> myListSubObjects;
108   std::set<std::string> myOthers;
109
110   std::map<QTreeWidget*,bool> myMapTreeSelectAll;
111 };
112
113 #endif