OpenMS
2.6.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
OpenMS
VISUAL
TOPPViewMenu.h
Go to the documentation of this file.
1
// --------------------------------------------------------------------------
2
// OpenMS -- Open-Source Mass Spectrometry
3
// --------------------------------------------------------------------------
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6
//
7
// This software is released under a three-clause BSD license:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of any author or any participating institution
14
// may be used to endorse or promote products derived from this software
15
// without specific prior written permission.
16
// For a full list of authors, refer to the file AUTHORS.
17
// --------------------------------------------------------------------------
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
//
30
// --------------------------------------------------------------------------
31
// $Maintainer: Chris Bielow $
32
// $Authors: Chris Bielow $
33
// --------------------------------------------------------------------------
34
35
#pragma once
36
37
// OpenMS_GUI config
38
#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39
40
#include <
OpenMS/DATASTRUCTURES/FlagSet.h
>
41
#include <
OpenMS/KERNEL/StandardTypes.h
>
42
#include <
OpenMS/VISUAL/EnhancedWorkspace.h
>
43
#include <
OpenMS/VISUAL/LayerData.h
>
44
45
#include <QObject>
46
47
#include <vector>
48
49
class
QAction;
50
class
QMenu;
51
52
namespace
OpenMS
53
{
54
class
TOPPViewBase;
55
class
EnhancedWorkspace;
56
class
RecentFilesMenu;
57
58
enum class
TV_STATUS
59
{
60
HAS_CANVAS
,
61
HAS_LAYER
,
62
HAS_MIRROR_MODE
,
// implies 1D View
63
IS_1D_VIEW
,
64
TOPP_IDLE
65
};
66
67
using
FS_TV
=
FlagSet<TV_STATUS>
;
69
FS_TV
OPENMS_GUI_DLLAPI
operator+
(
const
TV_STATUS
left,
const
TV_STATUS
right);
70
71
using
FS_LAYER
=
FlagSet<LayerData::DataType>
;
73
FS_LAYER
OPENMS_GUI_DLLAPI
operator+
(
const
LayerData::DataType
left,
const
LayerData::DataType
right);
74
75
82
class
TOPPViewMenu
83
:
public
QObject
84
{
85
Q_OBJECT
86
public
:
93
TOPPViewMenu
(
TOPPViewBase
*
const
parent,
EnhancedWorkspace
*
const
ws,
RecentFilesMenu
*
const
recent_files);
94
96
void
addWindowToggle
(QAction*
const
window_toggle);
97
98
public
slots:
100
void
update
(
const
FS_TV
status,
const
LayerData::DataType
layer_type);
101
102
private
:
103
struct
ActionRequirement_
104
{
105
ActionRequirement_
(QAction* action,
const
FS_TV
& needs,
const
FS_LAYER
layer_set)
106
:
action_
(action),
needs_
(needs),
layer_set_
(layer_set) {}
107
ActionRequirement_
(QAction* action,
const
TV_STATUS
& needs,
const
FS_LAYER
layer_set)
108
:
action_
(action),
needs_
(needs),
layer_set_
(layer_set) {}
109
113
void
enableAction
(
const
FS_TV
status,
const
LayerData::DataType
layer_type);
114
115
private
:
116
QAction*
action_
;
117
FS_TV
needs_
;
118
FS_LAYER
layer_set_
;
119
};
120
124
QAction*
addAction_
(QAction* action,
const
TV_STATUS
req,
const
FS_LAYER
layer_set =
FS_LAYER
());
126
QAction*
addAction_
(QAction* action,
const
FS_TV
req,
const
FS_LAYER
layer_set =
FS_LAYER
());
127
129
std::vector<ActionRequirement_>
menu_items_
;
130
132
QMenu*
m_windows_
;
133
};
134
135
}
//namespace
136
OpenMS::TOPPViewMenu::ActionRequirement_::enableAction
void enableAction(const FS_TV status, const LayerData::DataType layer_type)
QObject
OpenMS::EnhancedWorkspace
Definition:
EnhancedWorkspace.h:51
OpenMS::TV_STATUS::HAS_LAYER
OpenMS::TOPPViewMenu::m_windows_
QMenu * m_windows_
the windows submenu (holds all windows added via addWindowToggle())
Definition:
TOPPViewMenu.h:132
OpenMS::TOPPViewBase
Main window of TOPPView tool.
Definition:
TOPPViewBase.h:123
OpenMS::FS_LAYER
FlagSet< LayerData::DataType > FS_LAYER
Definition:
TOPPViewMenu.h:71
OpenMS::TOPPViewMenu::ActionRequirement_::ActionRequirement_
ActionRequirement_(QAction *action, const FS_TV &needs, const FS_LAYER layer_set)
Definition:
TOPPViewMenu.h:105
OpenMS::TV_STATUS
TV_STATUS
Definition:
TOPPViewMenu.h:58
OpenMS::operator+
FS_TV operator+(const TV_STATUS left, const TV_STATUS right)
allow + operations on the enum, e.g. 'HAS_CANVAS + HAS_LAYER + IS_1D_VIEW'
OpenMS::TV_STATUS::IS_1D_VIEW
OpenMS
Main OpenMS namespace.
Definition:
FeatureDeconvolution.h:46
OpenMS::TV_STATUS::HAS_CANVAS
OpenMS::TOPPViewMenu::ActionRequirement_::ActionRequirement_
ActionRequirement_(QAction *action, const TV_STATUS &needs, const FS_LAYER layer_set)
Definition:
TOPPViewMenu.h:107
OpenMS::RecentFilesMenu
Manages recent files opened by the user and provides a QMenu to go with it.
Definition:
RecentFilesMenu.h:58
OpenMS::TV_STATUS::HAS_MIRROR_MODE
OpenMS::TOPPViewMenu
The file menu items for TOPPView.
Definition:
TOPPViewMenu.h:82
OpenMS::TOPPViewMenu::menu_items_
std::vector< ActionRequirement_ > menu_items_
holds all actions which have a set of requirements, i.e. depend on the state of TOPPViewBase
Definition:
TOPPViewMenu.h:129
OpenMS::TOPPViewMenu::ActionRequirement_::needs_
FS_TV needs_
Definition:
TOPPViewMenu.h:117
OpenMS::TOPPViewMenu::TOPPViewMenu
TOPPViewMenu(TOPPViewBase *const parent, EnhancedWorkspace *const ws, RecentFilesMenu *const recent_files)
Constructor which connects slots/signals of this class with the objects given as arguments.
OpenMS::TOPPViewMenu::update
void update(const FS_TV status, const LayerData::DataType layer_type)
enable/disable entries according to a given state of TOPPViewBase
OpenMS::FlagSet< TV_STATUS >
OpenMS::TV_STATUS::TOPP_IDLE
OpenMS::TOPPViewMenu::ActionRequirement_
Definition:
TOPPViewMenu.h:103
OpenMS::LayerData::DataType
DataType
Definition:
LayerData.h:96
LayerData.h
FlagSet.h
OpenMS::TOPPViewMenu::addAction_
QAction * addAction_(QAction *action, const TV_STATUS req, const FS_LAYER layer_set=FS_LAYER())
OpenMS::TOPPViewMenu::addWindowToggle
void addWindowToggle(QAction *const window_toggle)
add a menu entry at 'Windows -> [Windowname]' to allow hiding/showing a TOPPView subwindow (e....
OpenMS::TOPPViewMenu::ActionRequirement_::layer_set_
FS_LAYER layer_set_
Definition:
TOPPViewMenu.h:118
StandardTypes.h
EnhancedWorkspace.h
OpenMS::TOPPViewMenu::ActionRequirement_::action_
QAction * action_
Definition:
TOPPViewMenu.h:116
Generated on Fri Oct 30 2020 15:50:50 for OpenMS by
1.8.16