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 TInspectorAPI_Communicator_H |
17 | #define TInspectorAPI_Communicator_H |
18 | |
19 | #include <NCollection_List.hxx> |
20 | #include <Standard_Transient.hxx> |
21 | #include <Standard_Version.hxx> |
22 | #if OCC_VERSION_HEX > 0x060901 |
23 | #include <Standard_Handle.hxx> |
24 | #endif |
0cb512c0 |
25 | #include <inspector/TInspectorAPI_PluginParameters.hxx> |
14bbbdcb |
26 | |
27 | //! The Communicator is an interface that should be implemented for a separate plugin |
28 | //! It will be placed in layout of the given parent. After the plugin is created, it is possible to |
29 | //! set container of parameters into plugin to provide the plugin's initialization by some external |
30 | //! objects(e.g. Interactive Context or OCAF Application). If the parameters are changed, it may be |
31 | //! applyed in UpdateContent function. The communicator can change parameters in the following cases: |
32 | //! - the plugin removes own processed parameters (e.g. file names, that was opened by the plugin) |
33 | //! - the plugin sends some parameters to another plugin(by name) (e.g. shape to be analized) |
34 | //! (at the same time we should be careful here to do not change essential parameters of other plugins) |
35 | class TInspectorAPI_Communicator |
36 | { |
37 | public: |
38 | |
39 | //! Loads the plugin library |
40 | //! \param thePluginName the name of the library |
41 | //! \return an instance of the communicator or NULL |
42 | static Standard_EXPORT TInspectorAPI_Communicator* LoadPluginLibrary (const TCollection_AsciiString& thePluginName); |
43 | |
44 | //! Sets parameters container, it should be used when the plugin is initialized or in update content |
45 | //! \param theParameters a parameters container |
46 | Standard_EXPORT virtual void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters) = 0; |
47 | |
48 | //! Provides the container with a parent where this container should be inserted. |
49 | //! If Qt implementation, it should be QWidget with QLayout set inside |
50 | //! \param theParent a parent class |
51 | Standard_EXPORT virtual void SetParent (void* theParent) = 0; |
52 | |
6822a3be |
53 | //! Provide container for actions available in inspector on general level |
54 | //! \param theMenu if Qt implementation, it is QMenu object |
55 | Standard_EXPORT virtual void FillActionsMenu (void* theMenu) { (void)theMenu; } |
56 | |
57 | //! Returns plugin preferences, empty implementation by default |
58 | virtual void GetPreferences (TInspectorAPI_PreferencesDataMap&) {} |
59 | |
60 | //! Applies plugin preferences, empty implementation by default |
61 | virtual void SetPreferences (const TInspectorAPI_PreferencesDataMap&) {} |
62 | |
14bbbdcb |
63 | //! Calls update of the plugin's content |
64 | Standard_EXPORT virtual void UpdateContent() = 0; |
65 | |
66 | //! Constructs the communicator. |
67 | TInspectorAPI_Communicator() {} |
68 | |
69 | //! Destructor |
70 | virtual ~TInspectorAPI_Communicator() {} |
71 | }; |
72 | |
73 | //! Declare plugin method |
74 | extern "C" |
75 | { |
76 | //! Declares function to create an instance of communicator |
77 | //! It should be implemented in a child plugin |
78 | typedef TInspectorAPI_Communicator* (*COMMUNICATOR_INSTANCE)(); |
79 | } |
80 | //! Defines name of the function that should be implemented in a child plugin |
81 | #define CREATE_COMMUNICATOR_FUNCTION_NAME "CreateCommunicator" |
82 | |
83 | #endif |