OpenMS
Loading...
Searching...
No Matches
TOPPViewMenu.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11// OpenMS_GUI config
12#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13
18
19#include <QObject>
20
21#include <vector>
22
23class QAction;
24class QMenu;
25
26namespace OpenMS
27{
28 class TOPPViewBase;
29 class EnhancedWorkspace;
30 class RecentFilesMenu;
31
32 enum class TV_STATUS
33 {
36 HAS_MIRROR_MODE, // implies 1D View
39 };
40
43 FS_TV OPENMS_GUI_DLLAPI operator+(const TV_STATUS left, const TV_STATUS right);
44
47 FS_LAYER OPENMS_GUI_DLLAPI operator+(const LayerDataBase::DataType left, const LayerDataBase::DataType right);
48
49
57 : public QObject
58 {
59 Q_OBJECT
60 public:
67 TOPPViewMenu(TOPPViewBase* const parent, EnhancedWorkspace* const ws, RecentFilesMenu* const recent_files);
68
70 void addWindowToggle(QAction* const window_toggle);
71
72 public slots:
74 void update(const FS_TV status, const LayerDataBase::DataType layer_type);
75
76 private:
78 {
79 ActionRequirement_(QAction* action, const FS_TV& needs, const FS_LAYER layer_set)
80 : action_(action), needs_(needs), layer_set_(layer_set) {}
81 ActionRequirement_(QAction* action, const TV_STATUS& needs, const FS_LAYER layer_set)
82 : action_(action), needs_(needs), layer_set_(layer_set) {}
83
87 void enableAction(const FS_TV status, const LayerDataBase::DataType layer_type);
88
89 private:
90 QAction* action_;
93 };
94
98 QAction* addAction_(QAction* action, const TV_STATUS req, const FS_LAYER layer_set = FS_LAYER());
100 QAction* addAction_(QAction* action, const FS_TV req, const FS_LAYER layer_set = FS_LAYER());
101
103 std::vector<ActionRequirement_> menu_items_;
104
107 };
108
109} //namespace
110
Definition EnhancedWorkspace.h:27
Manages recent files opened by the user and provides a QMenu to go with it.
Definition RecentFilesMenu.h:35
Main window of TOPPView tool.
Definition TOPPViewBase.h:103
The file menu items for TOPPView.
Definition TOPPViewMenu.h:58
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:103
void update(const FS_TV status, const LayerDataBase::DataType layer_type)
enable/disable entries according to a given state of TOPPViewBase
QAction * addAction_(QAction *action, const TV_STATUS req, const FS_LAYER layer_set=FS_LAYER())
QMenu * m_windows_
the windows submenu (holds all windows added via addWindowToggle())
Definition TOPPViewMenu.h:106
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.
QAction * addAction_(QAction *action, const FS_TV req, const FS_LAYER layer_set=FS_LAYER())
overload for multiple requirements
void addWindowToggle(QAction *const window_toggle)
add a menu entry at 'Windows -> [Windowname]' to allow hiding/showing a TOPPView subwindow (e....
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
FlagSet< LayerDataBase::DataType > FS_LAYER
Definition TOPPViewMenu.h:45
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'
TV_STATUS
Definition TOPPViewMenu.h:33
DataType
Definition LayerDataBase.h:74
Definition TOPPViewMenu.h:78
QAction * action_
Definition TOPPViewMenu.h:90
FS_TV needs_
Definition TOPPViewMenu.h:91
FS_LAYER layer_set_
Definition TOPPViewMenu.h:92
ActionRequirement_(QAction *action, const FS_TV &needs, const FS_LAYER layer_set)
Definition TOPPViewMenu.h:79
ActionRequirement_(QAction *action, const TV_STATUS &needs, const FS_LAYER layer_set)
Definition TOPPViewMenu.h:81
void enableAction(const FS_TV status, const LayerDataBase::DataType layer_type)