Skip to content

Commit

Permalink
Add method to get Gui document from view provider
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 21, 2016
1 parent 32aa72e commit 82f7944
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Gui/ViewProviderDocumentObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj)
DisplayMode.setValue(defmode);
}

Gui::Document* ViewProviderDocumentObject::getDocument() const
{
App::Document* pAppDoc = pcObject->getDocument();
return Gui::Application::Instance->getDocument(pAppDoc);
}

Gui::MDIView* ViewProviderDocumentObject::getActiveView() const
{
App::Document* pAppDoc = pcObject->getDocument();
Expand Down
3 changes: 3 additions & 0 deletions src/Gui/ViewProviderDocumentObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace App
namespace Gui {

class MDIView;
class Document;

class GuiExport ViewProviderDocumentObject : public ViewProvider
{
Expand Down Expand Up @@ -81,6 +82,8 @@ class GuiExport ViewProviderDocumentObject : public ViewProvider
virtual void updateData(const App::Property*){}
/// Get the object of this ViewProvider object
App::DocumentObject *getObject(void) const {return pcObject;}
/// Get the GUI document to this ViewProvider object
Gui::Document* getDocument() const;
/// Get the python wrapper for that ViewProvider
PyObject* getPyObject();

Expand Down

0 comments on commit 82f7944

Please sign in to comment.