VPTissue Reference Manual
PTreeMenu.h
Go to the documentation of this file.
1 #ifndef PTREE_MENU_H_INCLUDED
2 #define PTREE_MENU_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 
24 #include <boost/property_tree/ptree.hpp>
25 #include <QMenu>
26 
27 class QAction;
28 class QSignalMapper;
29 
30 namespace SimShell {
31 namespace Gui {
32 
39 class PTreeMenu : public QMenu, public HasUnsavedChanges
40 {
41  Q_OBJECT
42 public:
47  PTreeMenu(QString const& title, QString const& path_prefix = QString(), QWidget* parent = 0);
48 
50  virtual ~PTreeMenu();
51 
53  virtual bool IsOpened() const;
54 
61  bool OpenPTree(boost::property_tree::ptree const& pt, int depth = -1);
62 
63 signals:
64  void ItemTriggered(QString const& subtree = QString());
65 
66 protected:
68  virtual void InternalForceClose();
69 
71  virtual bool InternalIsClean() const;
72 
74  virtual bool InternalSave();
75 
76 private:
78  void AddAllAction();
79 
81  void OpenPTreeInternal(boost::property_tree::ptree const& pt, int remaining_depth);
82 
83 private:
84  bool m_opened;
85  QAction* m_action_all; // the "All..."-action
86  QString m_path;
87  QSignalMapper* m_signal_mapper;
88 
89 };
90 
91 } // namespace
92 } // namespace
93 
94 #endif // end_of_inclde_guard
virtual bool InternalSave()
Definition: PTreeMenu.cpp:72
virtual ~PTreeMenu()
Destructor does not do a thing, except be virtual.
Definition: PTreeMenu.cpp:43
virtual bool IsOpened() const
Test whether menu is in opened state.
Definition: PTreeMenu.cpp:77
see the online Qt documentation
virtual bool InternalIsClean() const
Definition: PTreeMenu.cpp:67
virtual void InternalForceClose()
Definition: PTreeMenu.cpp:55
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
bool OpenPTree(boost::property_tree::ptree const &pt, int depth=-1)
Open a ptree.
Definition: PTreeMenu.cpp:82
PTreeMenu(QString const &title, QString const &path_prefix=QString(), QWidget *parent=0)
Definition: PTreeMenu.cpp:34
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32