NDEVR
API Documentation
CustomModelLogic.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/ContextMenuManager.h>
4#include <NDEVR/QTModelManager.h>
5#include <NDEVR/DesignObjectDialog.h>
6#include <NDEVR/Pointer.h>
7#include <NDEVR/UUID.h>
8#include <NDEVR/String.h>
9#include <QMenu>
10#include <QAction>
11namespace NDEVR
12{
14 class SceneTree;
15 class CustomModelSorter;
16 class QTWindowManager;
17 class NDVSetupCallback;
18 class CustomDesignObjectDialogSetupCallback;
24 {
25 //Override the below to add custom program behavior
26 protected:
31 virtual void setupUI(WindowManager*) {}
40 virtual void addMenuItems(Model&, QTModelManager*, QMenu&, const Buffer<UUID>&, const SelectionInfo&) {}
50 virtual void executeMenuItems(Model&, QTModelManager*, QAction*, const Buffer<UUID>&, const SelectionInfo&, PopupInfo) {}
61 virtual void setupModel(Model&) {}
73 NDEVR_API void setSorter(const std::function<bool(const Model& a, const Model& b)>& sort_function);
78 virtual bool canBeHandledBySelectionWidget() const { return true; };
79 protected:
80 friend class CustomModelContextMenu;
81 friend class CustomModelTreeWidgets;
82 friend class CustomModelSorter;
83 friend class CustomDesignObjectDialogSetupCallback;
89 NDEVR_API CustomModelLogic(QTModelManager* manager, const StringView& type_name);
95 NDEVR_API CustomModelLogic(QTModelManager* manager, const Buffer<String>& type_names);
99 NDEVR_API virtual ~CustomModelLogic();
114 NDEVR_API CustomDesignObjectDialogSetupCallback* dialogSetupCallback();
120 public:
124 NDEVR_API virtual void registerAll();
129 NDEVR_API virtual const UUID& id() const;
134 NDEVR_API const Buffer<String>& typeNames() const;
135 protected:
139 CustomModelSorter* m_sorter = nullptr;
140 CustomDesignObjectDialogSetupCallback* m_dialog_callback = nullptr;
144 };
145}
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 ...
NDVSetupCallback * m_ndv_setup_callback
Callback for NDV file read setup.
CustomTreeWidgets * m_tree_button_menu
Callback for custom tree selection widgets.
CustomDesignObjectDialogSetupCallback * m_dialog_callback
Callback for customizing property dialogs.
NDVSetupCallback * ndvFileReadLogic()
Returns the NDV file read setup callback for this model logic.
virtual void setupUI(WindowManager *)
Override to set up custom UI elements for this model type.
ContextMenuCallback * m_custom_context_menu
Callback for custom context menu actions.
virtual ~CustomModelLogic()
Destructor.
const Buffer< String > & typeNames() const
Returns the type names handled by this custom model logic.
virtual const UUID & id() const
Returns the unique identifier for this custom model logic instance.
virtual void setTreeWidgetsForSelection(const Model &, Buffer< QWidget * > &, SceneTree *)
Override to provide custom tree widgets shown when the model is selected.
ContextMenuCallback * contextMenuCallback()
Returns the context menu callback for this model logic.
CustomDesignObjectDialogSetupCallback * dialogSetupCallback()
Returns the dialog setup callback for this model logic.
CustomTreeWidgets * treeWidgetCallback()
Returns the tree widget callback for this model logic.
virtual void registerAll()
Registers all callbacks (context menu, tree widgets, dialog, NDV) with the manager.
virtual bool canBeHandledBySelectionWidget() const
Returns whether this model type can be handled by the generic selection widget.
CustomModelLogic(QTModelManager *manager, const Buffer< String > &type_names)
Constructs a CustomModelLogic for multiple model type names.
virtual void executeMenuItems(Model &, QTModelManager *, QAction *, const Buffer< UUID > &, const SelectionInfo &, PopupInfo)
Override to handle execution of custom context menu actions.
Buffer< String > m_type_names
The model type names handled by this logic.
UUID m_id
The unique identifier for this logic instance.
CustomModelSorter * m_sorter
Custom sorting logic for the model type.
virtual void setupPropertiesDialog(DesignObjectDialog *, const DynamicPointer< QTDesignObject > &)
Override to customize property dialogs when objects of this type are created.
QTModelManager * m_manager
The model manager providing data context.
void setSorter(const std::function< bool(const Model &a, const Model &b)> &sort_function)
Sets a custom sorting function for models of this type.
CustomModelLogic(QTModelManager *manager, const StringView &type_name)
Constructs a CustomModelLogic for a single model type name.
virtual void setupModel(Model &)
Override to perform setup when a model of this type is read from an NDV file.
virtual void addMenuItems(Model &, QTModelManager *, QMenu &, const Buffer< UUID > &, const SelectionInfo &)
Override to add custom context menu items when a model of this type is selected.
Allows for modification or addition of the widgets shown when an object is selected by the user in th...
A popup dialog for showing options or information to the user for a particular DesignObject.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
A core class that represents a node on model hierarchy.
Definition Model.h:292
A callback service used to modify Model objects when they are imported using the NDVFactory.
Definition NDVFactory.h:52
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
Manages all windows and logic surrounding dialogs and views for displaying and managing a 3D environm...
Shows all objects in a QTModelManager in a tree hierarchy view that allows for user interaction.
Definition SceneTree.h:54
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Definition Selector.h:52
The core String View class for the NDEVR API.
Definition StringView.h:58
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
Manages all windows and logic surrounding dialogs and views for displaying and managing any environme...
The primary namespace for the NDEVR SDK.
Class which is used to pass arguments and requests for creating a popup dialog or widget.
Definition PopupInfo.h:16