OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2011 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 #if OST_IMG_ENABLED
50  ,MAP=0x800,
51  MAP_ORIGINAL=0x1000,
52  MAP_DOWNSAMPLED=0x2000,
53  MAP_DSAMPLED_AVAIL=0x4000
54 #endif
55 };
56 
57 Q_DECLARE_FLAGS(ContextActionTypes, ContextActionType)
58 
59 
60 class DLLEXPORT_OST_GUI ContextMenu : public QObject {
61  Q_OBJECT
62 public:
63  ContextMenu(QTreeView* view, SceneWinModel* model);
65 
66  void ShowMenu(const QPoint& pos);
67  void Rename(QModelIndex index);
68 
69  void AddAction(QAction* action,ContextActionTypes type);
70 
71 private slots:
72  void AddView();
73  void Rename();
74  void DeleteView();
75 
76 private:
77  QVector<std::pair<QAction*, ContextActionTypes> > actions_;
78 
79  QTreeView* view_;
80  SceneWinModel* model_;
81 };
82 
83 }}
84 
85 Q_DECLARE_OPERATORS_FOR_FLAGS(ost::gui::ContextActionTypes)
86 
87 #endif
#define DLLEXPORT_OST_GUI
data model for scene win