OpenStructure
build-dev-doc
stage
include
ost
gui
scene_win
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
>
28
#include <
ost/gui/scene_win/scene_win_model.hh
>
29
30
#include <QFlags>
31
#include <QVector>
32
#include <QAbstractItemModel>
33
#include <QTreeView>
34
namespace
ost
{
namespace
gui {
35
36
enum
ContextActionType
37
{
38
GFX_NODE
=0x1,
39
GFX_OBJECT
=0x2,
40
ENTITY
=0x4,
41
ENTITY_VIEW
=0x8,
42
CUSTOM_VIEW
=0x10,
43
NOT_VISIBLE
=0x20,
44
NOT_HIDDEN
=0x40,
45
NOT_SCENE
=0x80,
46
SINGLE
=0x100,
47
MULTI
=0x200,
48
VIEWS_SAME_OBJECT
=0x400,
49
MAP
=0x800,
50
MAP_ORIGINAL
=0x1000,
51
MAP_DOWNSAMPLED
=0x2000,
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);
62
~ContextMenu
(){};
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
ost::gui::ContextMenu
Definition:
context_menu.hh:58
ost::gui::ContextMenu::ShowMenu
void ShowMenu(const QPoint &pos)
ost::gui::ContextMenu::ContextMenu
ContextMenu(QTreeView *view, SceneWinModel *model)
ost::gui::ContextMenu::~ContextMenu
~ContextMenu()
Definition:
context_menu.hh:62
ost::gui::ContextMenu::AddAction
void AddAction(QAction *action, ContextActionTypes type)
ost::gui::ContextMenu::Rename
void Rename(QModelIndex index)
ost::gui::SceneWinModel
data model for scene win
Definition:
scene_win_model.hh:48
module_config.hh
DLLEXPORT_OST_GUI
#define DLLEXPORT_OST_GUI
Definition:
module_config.hh:33
ost::gui.action
action
Definition:
__init__.py:135
ost::gui::ContextActionType
ContextActionType
Definition:
context_menu.hh:37
ost::gui::MAP_DOWNSAMPLED
@ MAP_DOWNSAMPLED
Definition:
context_menu.hh:51
ost::gui::ENTITY
@ ENTITY
Definition:
context_menu.hh:40
ost::gui::NOT_SCENE
@ NOT_SCENE
Definition:
context_menu.hh:45
ost::gui::MAP_ORIGINAL
@ MAP_ORIGINAL
Definition:
context_menu.hh:50
ost::gui::SINGLE
@ SINGLE
Definition:
context_menu.hh:46
ost::gui::MULTI
@ MULTI
Definition:
context_menu.hh:47
ost::gui::MAP
@ MAP
Definition:
context_menu.hh:49
ost::gui::NOT_VISIBLE
@ NOT_VISIBLE
Definition:
context_menu.hh:43
ost::gui::CUSTOM_VIEW
@ CUSTOM_VIEW
Definition:
context_menu.hh:42
ost::gui::GFX_NODE
@ GFX_NODE
Definition:
context_menu.hh:38
ost::gui::NOT_HIDDEN
@ NOT_HIDDEN
Definition:
context_menu.hh:44
ost::gui::GFX_OBJECT
@ GFX_OBJECT
Definition:
context_menu.hh:39
ost::gui::MAP_DSAMPLED_AVAIL
@ MAP_DSAMPLED_AVAIL
Definition:
context_menu.hh:52
ost::gui::ENTITY_VIEW
@ ENTITY_VIEW
Definition:
context_menu.hh:41
ost::gui::VIEWS_SAME_OBJECT
@ VIEWS_SAME_OBJECT
Definition:
context_menu.hh:48
ost
Definition:
base.dox:1
scene_win_model.hh
Generated by
1.9.1