NDEVR
API Documentation
DrawCommandsWidget.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: DrawCommandsWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTModelManager.h>
34#if NDEVR_VIEWPORT
35#include <NDEVR/MouseController.h>
36#include <NDEVR/GeometryMaker.h>
37#include <QWidget>
38#include <QPointer>
39namespace Ui
40{
41 class DrawTool;
42}
43namespace NDEVR
44{
45 class Ribbon;
46 class Button;
47 class DesignWidget;
48 class RibbonGroup;
49 class Editor;
55 class NDEVR_API DrawCommandsWidget : public QWidget
56 {
57 Q_OBJECT
58 public:
64 DrawCommandsWidget(QTModelManager* manager, QWidget *parent = nullptr);
77 void setupRibbon(RibbonGroup* group, bool add_2D, bool add_3D);
87 void setControlEnabled(bool enabled);
92 void removeControl(bool keep_existing);
97 void hideEvent(QHideEvent *event) override;
102 void showLocalRibbon(bool show_ribbon);
119 protected:
124 void refreshUI(bool force);
150 signals:
156 bool requestVisibleSignal(bool visible);
162 protected slots:
168 void onSelectedSlot(Buffer<UUID> ids, bool is_selected);
180 public:
182 protected:
197 void setupRibbon2D(uint04 index, RibbonGroup* group);
203 void setupRibbon3D(uint04 index, RibbonGroup* group);
204 private:
206 Buffer<DynamicPointer<MouseController>> m_mouse_controllers;
207 GeometryMaker m_geometry_controller;
208 QTModelManager* m_manager;
209 Buffer<uint04> m_key_draw_action_indices;
210 Ribbon* m_draw_type_ribbon;
211
212 Buffer<Buffer<Button*>> m_mode_buttons;
213 Buffer<Buffer<Button*>> m_step_buttons;
214 Buffer<Buffer<Buffer<QAction*>>> m_step_actions;
215 QTResourceListener* m_enabled_listener;
216 uint04 m_last_step;
217 uint04 m_last_step_count;
219 UUID m_controller_id;
220 UUID m_last_id;
221 Buffer<Button*> m_finished_buttons;
222 Buffer<Button*> m_clear_buttons;
223 QWidget* m_draw_commands = nullptr;
224 QCustomStackedWidget* m_stack = nullptr;
225 //Buffer<Button*> m_lock_movement_buttons;
226 bool m_is_enabled;
227 };
228}
229#endif
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core widget that allows the user to click one of many button types.
Definition Button.h:68
A widget showing key properties of a DesignObject selection, used primarily in a SelectionWidget.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
void controlModeSet(GeometryMaker::GeometryCreateMode mode)
Emitted when the geometry creation mode changes.
StringView specIcon(GeometryMaker::GeometrySpecMode spec)
Returns the icon name for the given geometry spec mode.
TranslatedString specText(GeometryMaker::GeometrySpecMode spec)
Returns the display text for the given geometry spec mode.
void removeControl(bool keep_existing)
Removes the active drawing control, optionally preserving existing geometry.
Editor * customEditor()
Returns the custom editor for the current drawing mode, if any.
Resource< Model * > root_model
The root model under which new geometry is created.
DrawCommandsWidget(QTModelManager *manager, QWidget *parent=nullptr)
Constructs a DrawCommandsWidget bound to the given model manager.
void onSelectedSlot(Buffer< UUID > ids, bool is_selected)
Slot called when objects are selected or deselected in the viewport.
void updateSnapIcon()
Updates the snap button icon to reflect the current snap mode.
void updateSpecificContainer()
Updates the container showing spec-specific options for the current step.
void removeCustomDrawWidget(GeometryMaker::GeometryCreateMode create_mode)
Removes a custom editor widget for a specific drawing mode.
void setupRibbon(RibbonGroup *group, bool add_2D, bool add_3D)
Populates a ribbon group with draw mode buttons for 2D and/or 3D shapes.
void setStep(uint04 step, GeometryMaker::GeometrySpecMode mode)
Slot called to advance to a specific drawing step.
void setupRibbonStep(RibbonGroup *group)
Populates a ribbon group with step-by-step drawing controls.
void refreshUI(bool force)
Refreshes the UI to reflect the current drawing state.
void onDeletedSlot(UUID id)
Slot called when a drawn object is deleted.
void showLocalRibbon(bool show_ribbon)
Shows or hides the local ribbon containing draw mode buttons.
void hideEvent(QHideEvent *event) override
Handles the hide event by cleaning up active drawing state.
GeometryMaker::GeometryCreateMode mode() const
Returns the currently active geometry creation mode.
void addCustomDrawWidget(GeometryMaker::GeometryCreateMode create_mode, Editor *widget)
Registers a custom editor widget for a specific drawing mode.
void setupRibbon2D(uint04 index, RibbonGroup *group)
Sets up 2D drawing mode buttons in the ribbon.
void setupRibbonSteps(RibbonGroup *group)
Sets up ribbon step buttons within the given group.
void setupRibbon()
Sets up the local ribbon with draw mode buttons.
void setControlEnabled(bool enabled)
Enables or disables the drawing controls.
void setupRibbon3D(uint04 index, RibbonGroup *group)
Sets up 3D drawing mode buttons in the ribbon.
bool requestVisibleSignal(bool visible)
Emitted to request that this widget be shown or hidden.
void setControl(GeometryMaker::GeometryCreateMode mode)
Activates the specified geometry creation mode.
A base class for displaying options for editing a single DesignObject, typically a Model.
Definition Editor.h:58
A controller for creating basic geometry with the mouse such as polylines, circles,...
GeometryCreateMode
Internal key input handler for geometry creation shortcuts.
GeometrySpecMode
Enumerates the specification modes that control how geometry dimensions are defined relative to user ...
The main class for a layout where all widgets occupy the same same and only one widget is shown at a ...
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Definition Resource.h:42
Represents the "Tab" of a widget.
Definition RibbonGroup.h:52
The UI ribbon is a horizontal menu bar typically located at the top of the application interface or a...
Definition Ribbon.h:56
The core String View class for the NDEVR API.
Definition StringView.h:58
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
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.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...