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 DFBrowser_Communicator_H
17 #define DFBrowser_Communicator_H
18 
19 #include <inspector/DFBrowser_Window.hxx>
20 #include <inspector/TInspectorAPI_Communicator.hxx>
21 
22 #include <Standard.hxx>
23 #include <Standard_Macro.hxx>
24 
25 #include <Standard_WarningsDisable.hxx>
26 #include <QObject>
27 #include <Standard_WarningsRestore.hxx>
28 
29 class DFBrowser_Window;
30 
31 //! \class DFBrowser_Communicator.
32 //! \brief This is a connector from TInspector application to DFBrowser view
33 class DFBrowser_Communicator : public QObject, public TInspectorAPI_Communicator
34 {
35 public:
36 
37   //! Constructor
38   Standard_EXPORT DFBrowser_Communicator();
39 
40   //! Destructor
~DFBrowser_Communicator()41   virtual ~DFBrowser_Communicator() {}
42 
43   //! Provides the container with a parent where this container should be inserted.
44   //! If Qt implementation, it should be QWidget with QLayout set inside
45   //! \param theParent a parent class
SetParent(void * theParent)46   virtual void SetParent (void* theParent) Standard_OVERRIDE { myWindow->SetParent (theParent); }
47 
48   //! Sets parameters container, it should be used when the plugin is initialized or in update content
49   //! \param theParameters a parameters container
50   Standard_EXPORT virtual void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters) Standard_OVERRIDE;
51 
52   //! Provides container for actions available in inspector on general level
53   //! \param theMenu if Qt implementation, it is QMenu object
FillActionsMenu(void * theMenu)54   Standard_EXPORT virtual void FillActionsMenu (void* theMenu) Standard_OVERRIDE { myWindow->FillActionsMenu (theMenu); }
55 
56   //! Returns plugin preferences, empty implementation by default
57   //! \param theItem container of preference elements
GetPreferences(TInspectorAPI_PreferencesDataMap & theItem)58   virtual void GetPreferences (TInspectorAPI_PreferencesDataMap& theItem) Standard_OVERRIDE
59   { myWindow->GetPreferences (theItem); }
60 
61   //! Stores plugin preferences, empty implementation by default
62   //! \param theItem container of preference elements
SetPreferences(const TInspectorAPI_PreferencesDataMap & theItem)63   virtual void SetPreferences (const TInspectorAPI_PreferencesDataMap& theItem) Standard_OVERRIDE
64   { myWindow->SetPreferences (theItem); }
65 
66   //! Updates content of the current window
UpdateContent()67   virtual void UpdateContent() Standard_OVERRIDE { myWindow->UpdateContent(); }
68 
69 private:
70 
71   DFBrowser_Window* myWindow; //!< the current window
72 };
73 
74 #endif
75