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