File: TInspectorAPI_Communicator.hxx

package info (click to toggle)
opencascade 7.3.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 278,376 kB
  • sloc: cpp: 1,136,010; ansic: 81,569; tcl: 14,864; cs: 5,173; java: 1,522; xml: 468; sh: 375; perl: 37; makefile: 25
file content (83 lines) | stat: -rw-r--r-- 3,707 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Created on: 2017-06-16
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. 

#ifndef TInspectorAPI_Communicator_H
#define TInspectorAPI_Communicator_H

#include <NCollection_List.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX > 0x060901
  #include <Standard_Handle.hxx>
#endif
#include <inspector/TInspectorAPI_PluginParameters.hxx>

//! The Communicator is an interface that should be implemented for a separate plugin
//! It will be placed in layout of the given parent. After the plugin is created, it is possible to
//! set container of parameters into plugin to provide the plugin's initialization by some external
//! objects(e.g. Interactive Context or OCAF Application). If the parameters are changed, it may be
//! applyed in UpdateContent function. The communicator can change parameters in the following cases:
//! - the plugin removes own processed parameters (e.g. file names, that was opened by the plugin)
//! - the plugin sends some parameters to another plugin(by name) (e.g. shape to be analized)
//!   (at the same time we should be careful here to do not change essential parameters of other plugins)
class TInspectorAPI_Communicator
{
public:

  //! Loads the plugin library
  //! \param thePluginName the name of the library
  //! \return an instance of the communicator or NULL
  static Standard_EXPORT TInspectorAPI_Communicator* LoadPluginLibrary (const TCollection_AsciiString& thePluginName);

  //! Sets parameters container, it should be used when the plugin is initialized or in update content
  //! \param theParameters a parameters container
  Standard_EXPORT virtual void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters) = 0;

  //! Provides the container with a parent where this container should be inserted.
  //! If Qt implementation, it should be QWidget with QLayout set inside
  //! \param theParent a parent class
  Standard_EXPORT virtual void SetParent (void* theParent) = 0;

  //! Provide container for actions available in inspector on general level
  //! \param theMenu if Qt implementation, it is QMenu object
  Standard_EXPORT virtual void FillActionsMenu (void* theMenu) { (void)theMenu; }

  //! Returns plugin preferences, empty implementation by default
  virtual void GetPreferences (TInspectorAPI_PreferencesDataMap&) {}

  //! Applies plugin preferences, empty implementation by default
  virtual void SetPreferences (const TInspectorAPI_PreferencesDataMap&) {}

  //! Calls update of the plugin's content
  Standard_EXPORT virtual void UpdateContent() = 0;

  //! Constructs the communicator.
  TInspectorAPI_Communicator() {}

  //! Destructor
  virtual ~TInspectorAPI_Communicator() {}
};

//! Declare plugin method
extern "C"
{
  //! Declares function to create an instance of communicator
  //! It should be implemented in a child plugin
  typedef TInspectorAPI_Communicator* (*COMMUNICATOR_INSTANCE)();
}
//! Defines name of the function that should be implemented in a child plugin
#define CREATE_COMMUNICATOR_FUNCTION_NAME "CreateCommunicator"

#endif