14bbbdcb |
1 | // Created on: 2017-06-16 |
2 | // Created by: Natalia ERMOLAEVA |
3 | // Copyright (c) 2017 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef TInspector_Communicator_H |
17 | #define TInspector_Communicator_H |
18 | |
0cb512c0 |
19 | #include <inspector/TInspector_Window.hxx> |
14bbbdcb |
20 | |
21 | #include <NCollection_List.hxx> |
22 | #include <Standard.hxx> |
23 | #include <Standard_Transient.hxx> |
24 | #include <TCollection_AsciiString.hxx> |
25 | |
26 | class QPushButton; |
27 | |
28 | //! \class TInspector_Communicator. |
29 | //! \brief This is a connector from TInspector window to: |
30 | //! - register tool plugin |
31 | //! - give parameters into plugin |
32 | class TInspector_Communicator |
33 | { |
34 | public: |
35 | |
36 | //! Constructor |
37 | Standard_EXPORT TInspector_Communicator(); |
38 | |
39 | //! Destructor |
40 | virtual ~TInspector_Communicator() {} |
41 | |
42 | //! Registers plugin into TInspector window |
43 | //! \param thePluginName a name of the plugin |
44 | void RegisterPlugin (const TCollection_AsciiString& thePluginName) { myWindow->RegisterPlugin (thePluginName); } |
45 | |
0cb512c0 |
46 | //! Returns list of registered plugins |
47 | //! \return container of plugin names |
48 | NCollection_List<TCollection_AsciiString> RegisteredPlugins() const { return myWindow->RegisteredPlugins(); } |
49 | |
14bbbdcb |
50 | //! Stores parameters for the plugin |
51 | //! \param theParameters container of parameters(e.g. AIS_InteractiveContext, TDocStd_Application) |
0cb512c0 |
52 | //! \param theAppend boolean state whethe the parameters should be added to existing |
53 | void Init (const NCollection_List<Handle(Standard_Transient)>& theParameters, |
54 | const Standard_Boolean theAppend = Standard_False) |
55 | { myWindow->Init ("", theParameters, theAppend); } |
14bbbdcb |
56 | |
57 | //! Stores parameters for the plugin |
58 | //! \param thePluginName a name of the plugin |
59 | //! \param theParameters container of parameters(e.g. AIS_InteractiveContext, TDocStd_Application) |
0cb512c0 |
60 | //! \param theAppend boolean state whethe the parameters should be added to existing |
14bbbdcb |
61 | void Init (const TCollection_AsciiString& thePluginName, |
0cb512c0 |
62 | const NCollection_List<Handle(Standard_Transient)>& theParameters, |
63 | const Standard_Boolean theAppend = Standard_False) |
64 | { myWindow->Init (thePluginName, theParameters, theAppend); } |
14bbbdcb |
65 | |
66 | //! UpdateContent for the TInspector window |
67 | void UpdateContent() { myWindow->UpdateContent(); } |
68 | |
69 | //! SetOpenButton for the TInspector window |
70 | void SetOpenButton (QPushButton* theButton) { myWindow->SetOpenButton (theButton); } |
71 | |
72 | //! OpenFile in TInspector window |
73 | void OpenFile (const TCollection_AsciiString& thePluginName, const TCollection_AsciiString& theFileName) |
74 | { myWindow->OpenFile (thePluginName, theFileName); } |
75 | |
76 | //! Activates plugin |
77 | //! \param thePluginName a name of the plugin |
78 | void Activate (const TCollection_AsciiString& thePluginName) { myWindow->ActivateTool (thePluginName); } |
79 | |
0cb512c0 |
80 | //! Set item selected in the active plugin |
81 | //! \param theItemName a containerr of name of items in plugin that should become selected |
82 | void SetSelected (const NCollection_List<TCollection_AsciiString>& theItemNames) { myWindow->SetSelected (theItemNames); } |
83 | |
84 | //! Sets objects to be selected in the plugin |
85 | //! \param theObjects an objects |
86 | Standard_EXPORT void SetSelected (const NCollection_List<Handle(Standard_Transient)>& theObjects) |
87 | { myWindow->SetSelected (theObjects); } |
88 | |
14bbbdcb |
89 | //! Change window visibility |
90 | //! \param theVisible boolean state |
91 | Standard_EXPORT virtual void SetVisible (const bool theVisible); |
92 | |
93 | private: |
94 | |
95 | TInspector_Window* myWindow; //!< current window |
96 | }; |
97 | |
98 | #endif |