VPTissue Reference Manual
PTreeContainer.h
Go to the documentation of this file.
1 #ifndef PTREE_CONTAINER_H_INCLUDED
2 #define PTREE_CONTAINER_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "gui/HasUnsavedChanges.h"
23 #include "IHasPTreeState.h"
24 
25 #include <QWidget>
26 #include <boost/property_tree/ptree.hpp>
27 
28 class QDockWidget;
29 
30 namespace SimShell {
31 namespace Gui {
32 
33 class MyDockWidget;
34 class PTreeEditorWindow;
35 class PTreeMenu;
36 
46 {
47  Q_OBJECT
48 public:
49  PTreeContainer(QString const & title, QWidget* parent = 0);
50  virtual ~PTreeContainer();
51 
56  bool Open(boost::property_tree::ptree const & pt, QString const & edit_path = "");
57 
58  void Undo();
59  void Redo();
60 
64  QDockWidget* GetDock() const;
65 
71  std::string GetEditPath() const;
72 
76  PTreeMenu* GetMenu() const;
77 
82  void SetOnlyEditData(bool);
83 
85  virtual boost::property_tree::ptree GetPTreeState() const;
86 
88  virtual bool IsOpened() const;
89 
91  virtual void SetPTreeState(const boost::property_tree::ptree&);
92 
93 signals:
94  void Applied(boost::property_tree::ptree const &);
95  void StatusChanged(QString const &);
96 
97 protected:
99  virtual void InternalForceClose();
100 
102  virtual bool InternalIsClean() const;
103 
105  virtual bool InternalSave();
106 
107 private slots:
108  void OpenPath(QString const & path);
109  void RefreshMenu(boost::property_tree::ptree const & pt);
110 
111 private:
112  bool m_opened;
113  MyDockWidget* m_dock;
114  PTreeMenu* m_menu;
115  QString m_title;
116  PTreeEditorWindow* m_window;
117 };
118 
119 } // namespace
120 } // namespace
121 
122 #endif // end_of_inclde_guard
void SetOnlyEditData(bool)
If true, the user can't insert, move, delete or edit keys.
bool Open(boost::property_tree::ptree const &pt, QString const &edit_path="")
Open ptree with given edit path.
QDockWidget with methods to import/export widget layout (x,y,width, ...) in ptree format...
Definition: MyDockWidget.h:35
Interface for objects that have non-critical state (metadata) information representable as a ptree...
see the online Qt documentation
QDockWidget * GetDock() const
Get the associated dock widget, containing the ptree editor.
PTreeMenu * GetMenu() const
Get the associated menu.
virtual bool InternalIsClean() const
Interface for HasUnsavedChanges.
Abstract class that represents the ability be in closed or opened state, and, if the latter...
A menu reflecting the structure of a ptree.
Definition: PTreeMenu.h:39
see the online Qt documentation
virtual boost::property_tree::ptree GetPTreeState() const
HasPtreeState interface.
virtual bool IsOpened() const
virtual void SetPTreeState(const boost::property_tree::ptree &)
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
std::string GetEditPath() const
Get the current edit path.
Small editor widget for a Boost Property Tree object.
For a given ptree, constructs PTreeMenu, QDockWidget, PTreeEditorWindow.