NDEVR
API Documentation
ContextMenuManager.h
1#pragma once
2#include <NDEVR/SoftwareService.h>
3#include <NDEVR/PopupInfo.h>
4#include <NDEVR/SelectionInfo.h>
5#include <QMenu>
6namespace NDEVR
7{
34 class QTModelManager;
40 {
41 public:
53 virtual void addContextMenuItems(QTModelManager* manager, QMenu& menu, const Buffer<UUID>& ids, const SelectionInfo& cursor_location) = 0;
62 virtual void contextMenu(QTModelManager* manager, QAction* action, const Buffer<UUID>& ids, const SelectionInfo& cursor_location, PopupInfo origin) = 0;
63 };
64
69 {
70 public:
82 virtual void addContextMenuItems(QMenu& menu, const Buffer<UUID>& ids = Buffer<UUID>(), const SelectionInfo& selection_info = SelectionInfo());
90 virtual void contextMenu(QAction* action, const Buffer<UUID>& ids, const SelectionInfo& selection_info = SelectionInfo(), PopupInfo origin = PopupInfo());
96 virtual void addContextMenuCallback(const UUID& id, ContextMenuCallback* callback);
101 virtual void removeContextMenuCallback(const UUID& id);
107 virtual bool hasContextMenuCallback(const UUID& id) const;
113 virtual ContextMenuActions actionType(QAction* action);
114 protected:
117 };
118}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Allows for customization of what is shown when the user right-clicks or accesses the ContextMenu for ...
virtual void contextMenu(QTModelManager *manager, QAction *action, const Buffer< UUID > &ids, const SelectionInfo &cursor_location, PopupInfo origin)=0
Handles execution of a context menu action.
virtual ~ContextMenuCallback()
Destructor.
virtual void addContextMenuItems(QTModelManager *manager, QMenu &menu, const Buffer< UUID > &ids, const SelectionInfo &cursor_location)=0
Adds custom menu items to the context menu.
virtual void addContextMenuItems(QMenu &menu, const Buffer< UUID > &ids=Buffer< UUID >(), const SelectionInfo &selection_info=SelectionInfo())
Populates the menu with context-appropriate items for the given selection.
virtual ContextMenuActions actionType(QAction *action)
Determines the built-in action type for the given QAction.
virtual bool hasContextMenuCallback(const UUID &id) const
Checks whether a custom context menu callback exists for the given UUID.
virtual void addContextMenuCallback(const UUID &id, ContextMenuCallback *callback)
Registers a custom context menu callback for a specific object.
QTModelManager * m_manager
The model manager providing data context.
ContextMenuManager(QTModelManager *manager)
Constructs a ContextMenuManager.
virtual void contextMenu(QAction *action, const Buffer< UUID > &ids, const SelectionInfo &selection_info=SelectionInfo(), PopupInfo origin=PopupInfo())
Handles execution of a triggered context menu action.
virtual void removeContextMenuCallback(const UUID &id)
Removes a custom context menu callback by UUID.
Dictionary< UUID, ContextMenuCallback * > m_custom_context_callbacks
Custom callbacks keyed by UUID.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Definition Selector.h:52
Software Service Managers take a Software service to modify the behavior of the software.
Base interface for services that extend or modify software behavior through modules.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.
@ e_none
No defined value type.
ContextMenuActions
Default built-in context menu actions.
@ e_group
Group selected objects together.
@ e_make_visible
Make the selected object visible.
@ e_save
Save the selected object.
@ e_make_invisible
Make the selected object invisible.
@ e_explode
Explode a grouped object into its components.
@ e_hide_everything_except
Hide all objects except the selected one.
@ e_delete_object
Delete the selected object.
@ e_edit_material
Open the material editor for the selected object.
@ e_deploy_to_borehole
Deploy content to a borehole.
@ e_delete_from_library
Delete an object from the library.
@ e_station_lines_visible
Toggle visibility of station lines.
@ e_show_properties
Show the properties panel for the selected object.
@ e_deploy_to_station
Deploy content to a station.
@ e_station_axis_visible
Toggle visibility of station axis indicators.
@ e_add_station
Add a new station to the scene.
@ e_import_from_library
Import an object from the library.
@ e_station_text_visible
Toggle visibility of station text labels.
@ e_mesh
Perform a mesh operation on the selected object.
@ e_add_deployment
Add a new deployment.
Class which is used to pass arguments and requests for creating a popup dialog or widget.
Definition PopupInfo.h:16