OpenStructure
context_menu.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_SCENE_WIN_CONTEXT_MENU_HH
20 #define OST_GUI_SCENE_WIN_CONTEXT_MENU_HH
21 
22 /*
23  Author: Stefan Scheuber
24  */
25 
26 
27 #include <ost/gui/module_config.hh>
29 
30 #include <QFlags>
31 #include <QVector>
32 #include <QAbstractItemModel>
33 #include <QTreeView>
34 namespace ost { namespace gui {
35 
37 {
38  GFX_NODE=0x1,
40  ENTITY=0x4,
44  NOT_HIDDEN=0x40,
45  NOT_SCENE=0x80,
46  SINGLE=0x100,
47  MULTI=0x200,
49  MAP=0x800,
50  MAP_ORIGINAL=0x1000,
52  MAP_DSAMPLED_AVAIL=0x4000
53 };
54 
55 Q_DECLARE_FLAGS(ContextActionTypes, ContextActionType)
56 
57 
58 class DLLEXPORT_OST_GUI ContextMenu : public QObject {
59  Q_OBJECT
60 public:
61  ContextMenu(QTreeView* view, SceneWinModel* model);
63 
64  void ShowMenu(const QPoint& pos);
65  void Rename(QModelIndex index);
66 
67  void AddAction(QAction* action,ContextActionTypes type);
68 
69 private slots:
70  void AddView();
71  void Rename();
72  void DeleteView();
73 
74 private:
75  QVector<std::pair<QAction*, ContextActionTypes> > actions_;
76 
77  QTreeView* view_;
78  SceneWinModel* model_;
79 };
80 
81 }}
82 
83 Q_DECLARE_OPERATORS_FOR_FLAGS(ost::gui::ContextActionTypes)
84 
85 #endif
void ShowMenu(const QPoint &pos)
ContextMenu(QTreeView *view, SceneWinModel *model)
void AddAction(QAction *action, ContextActionTypes type)
void Rename(QModelIndex index)
data model for scene win
#define DLLEXPORT_OST_GUI
@ MAP_DOWNSAMPLED
Definition: context_menu.hh:51
@ MAP_DSAMPLED_AVAIL
Definition: context_menu.hh:52
@ VIEWS_SAME_OBJECT
Definition: context_menu.hh:48
Definition: base.dox:1