NDEVR
API Documentation
NDEVRRibbon

The Ribbon that typically appears on the top of the window or, in touch mode, to the side of the window. More...

Inheritance diagram for NDEVRRibbon:
[legend]
Collaboration diagram for NDEVRRibbon:
[legend]

Classes

class  NDEVRRibbonWidget
 Internal widget used for custom size hint calculations in the ribbon layout. More...

Public Member Functions

 NDEVRRibbon (MainWindow *window, WindowManager *window_manager, QTModelManager *manager, RibbonArea area)
 Constructs the ribbon attached to a main window.
 NDEVRRibbon (WindowManager *window_manager, QTModelManager *manager, RibbonArea area)
 Constructs the ribbon without a main window reference.
void addButtonToGeneralFile (Button *button, bool disable_with_no_project)
 Adds a button to the general/file tab.
void addButtonToGeneralHome (Button *button, bool disable_with_no_project)
 Adds a button to the general/home tab.
void addLeftWidget (QWidget *widget)
 Adds a widget to the left of the normal ribbon objects.
void addRightWidget (QWidget *widget)
 Adds a widget to the right of the normal ribbon objects.
RibbonGroupeditRibbonGroup ()
 Gets the ribbon group for objects on the "edit" tab.
RibbonSubGrouphomeFileRibbonSubGroup ()
 Gets the ribbon sub-group for objects on the "home/file" tab.
RibbonSubGrouphomeGeneralRibbonSubGroup ()
 Gets the ribbon sub-group for objects on the "home/general" tab.
RibbonGrouphomeRibbonGroup ()
 Gets the ribbon group for objects on the "home" tab.
const NDEVRRibbonOptionsoptions () const
 Gets the active options of the ribbon.
Ribbonribbon () const
 Gets the underlying ribbon object used for this widget.
void setIsVertical (bool is_vertical)
 Defines whether buttons are layed out horizontally, or vertically.
void setMainButtonCallback (const std::function< void(const PopupInfo &)> &main_callback)
 Sets a callback for when the round "Main" button is pressed.
void setRibbonOptions (const NDEVRRibbonOptions &options)
 Sets the ribbon options and immediately refreshes the widget.
void setSceneVisible (bool scene_visible)
 To be called by WindowManager when a scene is added or removed from the program.
void setup ()
 To be called by WindowManager when UI is ready to be displayed.
Public Member Functions inherited from QCustomDockWidget
 QCustomDockWidget (QWidget *main_widget, ContainerWidgetBase *container=nullptr)
 Constructs a dock widget wrapping a main widget with an optional container.
 QCustomDockWidget (QWidget *main_widget, RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
 Constructs a dock widget wrapping a main widget with a specified ribbon area.
 QCustomDockWidget (RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
 Constructs a dock widget with a specified ribbon area and optional container.
virtual ~QCustomDockWidget ()
 Destroys the dock widget and cleans up associated resources.
void closedSignal ()
 Emitted when the dock widget is closed.
SectionContentcontent () const
 Returns the SectionContent associated with this dock widget.
void dockSelectedSignal (bool)
 Emitted when the dock widget selection state changes.
void fullscreenSignal (bool is_fullscreen)
 Emitted when the dock widget enters or exits fullscreen mode.
int height () const
 Returns the current height of the dock widget.
void highlightDock (bool highlight)
 Highlights or un-highlights the dock widget visually.
QIcon icon () const
 Returns the icon displayed in the dock title bar.
bool isDockFullscreen () const
 Returns whether the dock is currently displayed in fullscreen mode.
bool isVisible () const
 Returns whether the dock widget is currently visible to the user.
QWidget * mainWidget ()
 Returns the main widget displayed inside the dock.
void minimizedSignal ()
 Emitted when the dock widget is minimized.
virtual void removeButton (Button *button)
 Removes a previously registered button from this dock widget.
void removeDock (bool delete_when_finished)
 Removes the dock from its container.
void setAllowAutoHideTitle (bool allow_auto_hide)
 Sets whether the title bar can be automatically hidden when not needed.
virtual void setDockSelected (bool selected) override
 Sets the selected state of the dock, updating visual indicators.
virtual void setIcon (const QIcon &icon) override
 Sets the icon displayed in the dock title bar.
void setIconSlot (const QIcon &icon)
 Slot to set the dock icon from a QIcon.
void setMainWidget (QWidget *widget)
 Sets the main widget displayed inside the dock.
void setSize (QSize size)
 Sets the preferred size of the dock widget.
void setSizeHint (const QSize &size)
 Sets the preferred size hint for the dock widget.
virtual void setTitle (const TranslatedString &title) override
 Sets the title text displayed in the dock title bar.
void setTitleSlot (const QString &title)
 Slot to set the dock title from a QString.
void setupButton (Button *button)
 Configures a button to toggle the visibility of this dock widget.
virtual void setupDialogButton (Button *button)
 Sets up a button as a dialog toggle button for this dock widget.
void setVisible (bool visible)
 Sets the visibility of the dock widget.
void setWindowFlag (Qt::WindowType type, bool on=true)
 Sets or clears a specific window flag.
void setWindowFlags (Qt::WindowFlags type)
 Sets the window flags for the dock widget when floating.
void showDock (bool show_dock)
 Shows or hides the dock widget.
void showDock (bool show_dock, const PopupInfo &start_location, const PopupInfo &end_location, SectionWidget *section=nullptr)
 Shows or hides the dock with start and end animation locations.
void showDock (bool show_dock, const PopupInfo &start_location, SectionWidget *section=nullptr)
 Shows or hides the dock with a popup start location.
void showDock (bool show_dock, DropArea area, SectionWidget *section)
 Shows or hides the dock in a specific drop area within a section.
void showDockFullscreen (bool show_dock, const PopupInfo &start_location=PopupInfo())
 Shows or hides the dock in fullscreen mode.
QSize sizeHint () const
 Returns the recommended size for the dock widget.
int width () const
 Returns the current width of the dock widget.
void windowIconChanged (const QIcon &icon)
 Emitted when the window icon changes.
QString windowTitle () const
 Returns the window title of the dock widget.
void windowTitleChanged (const TranslatedString &new_title)
 Emitted when the window title changes.
Public Member Functions inherited from DockItem
 DockItem (ContainerWidgetBase *container=nullptr)
 Constructs a DockItem with an optional container.
 DockItem (RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
 Constructs a DockItem with a preferred ribbon area and optional container.
ContainerWidgetBasecontainer () const
 Returns the container widget that owns this dock item.
FloatingWidgetfloatingWidget () const
 Returns the floating widget if this dock item is currently floating.
bool isClosable () const
 Checks whether this dock item can be closed by the user.
bool isDocked () const
 Checks whether this dock item is currently docked in a section.
bool isDockSelected () const
 Checks whether this dock item is currently selected.
bool isDockVisible () const
 Checks whether this dock item is currently visible in its dock.
bool isHidable () const
 Checks whether this dock item can be hidden by the user.
bool isMovable () const
 Checks whether this dock item can be moved by the user.
bool isWindowable () const
 Checks whether this dock item can be detached into a floating window.
void moveTabToEnd ()
 Moves this dock item's tab to the end of the tab bar.
void moveTabToStart ()
 Moves this dock item's tab to the start of the tab bar.
SectionWidgetsection () const
 Returns the section widget that currently contains this dock item.
void setClosable (bool closable)
 Sets whether this dock item can be closed by the user.
virtual void setContainer (ContainerWidgetBase *container)
 Sets the container widget that owns this dock item.
void setDockArea (DropArea drop_area, SectionWidget *section)
 Sets the drop area and target section for docking this item.
void setHidable (bool hidable)
 Sets whether this dock item can be hidden by the user.
virtual void setIconID (const StringView &icon)
 Sets the icon by resource identifier string.
void setMoveable (bool movable)
 Sets whether this dock item can be moved by the user.
void setRibbonArea (RibbonArea ribbon_area)
 Sets the preferred ribbon area for this dock item.
void setSettingsCallback (const std::function< void(PopupInfo)> &callback)
 Sets the callback invoked when the settings action is triggered.
void setShowTab (bool show_tab)
 Sets whether the tab for this dock item is shown.
void setTabFlat (bool flat)
 Sets whether the tab for this dock item should have a flat appearance.
std::function< void(PopupInfo)> settingsCallback ()
 Returns the callback invoked when the settings action is triggered.
virtual void setUseTabTitle (bool use_tab_title)
 Sets whether the tab title should be used for display.
void setWindowable (bool hidable)
 Sets whether this dock item can be detached into a floating window.
bool showTab () const
 Checks whether the tab for this dock item is shown.
virtual void swapWith (DockItem *other_widget)
 Swaps this dock item's position and section with another dock item.
virtual const TranslatedStringtitle () const
 Returns the display title of this dock item.
SectionIconTabtitleWidget () const
 Returns the icon/title tab widget associated with this dock item.
bool useTabTitle () const
 Checks whether the tab title is used for display.
Public Member Functions inherited from BasicKeyController
 BasicKeyController (const TranslatedString &key_controller_title)
 Constructs a BasicKeyController with the given title.
virtual void addKeyOption (const KeyOption &option)
 Adds a new key option mapping to this controller.
const Buffer< KeyOption > & currentKeyMaps () const
 Returns the current set of key option mappings.
virtual void getINI (INIFactory &factory) override
 Serializes or deserializes key controller settings to/from an INI file.
const TranslatedStringkeyControllerTitle () const
 Returns the display title of this key controller.
bool processKeyEvent (const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) final override
 Processes a key event by matching it against registered key options.
virtual void setKeyOption (const KeyOption &option)
 Sets or updates an existing key option mapping.
Public Member Functions inherited from INIInterface
 INIInterface ()
 Constructs an INIInterface with no default INI file.
 INIInterface (const File &default_ini)
 Constructs an INIInterface with the specified default INI file.
virtual ~INIInterface ()
 Virtual destructor for safe polymorphic cleanup.
virtual void finishReadingINI (INIFactory &)
 Called after reading an INI file.
virtual void prepareForINI (INIFactory &)
 Called before reading or writing an INI file.
virtual bool readINIOptions ()
 Reads INI options from the default INI file.
virtual bool readINIOptions (File &ini_file)
 Reads INI options from the specified INI file.
virtual bool saveINIOptions (bool multithead=false)
 Saves INI options to the default INI file.
virtual bool saveINIOptions (File &ini_file, bool multithead=false)
 Saves INI options to the specified INI file.
void setDefaultINIFile (const File &file)
 Sets the default INI file path used for reading and writing options.
virtual void writeToLog (const StringView &title, LogPtr log, uint01 log_level=2U)
 Writes the current INI options to the specified log with a title.
virtual void writeToLog (LogPtr log, uint01 log_level=2U)
 Writes the current INI options to the specified log.

Protected Member Functions

void createDrawRibbonGroup ()
 Creates the draw ribbon group and populates it with drawing action buttons.
void createEditRibbonGroup ()
 Creates the edit ribbon group and populates it with edit action buttons.
RibbonGroupdrawRibbonGroup ()
 Gets or creates the draw ribbon group.
void initializeRibbon ()
 Creates and initializes all ribbon groups, buttons, and layout.
RibbonGroupmeasureRibbonGroup ()
 Gets or creates the measure ribbon group.
void onClearAllSlot ()
 Handles clearing all project data.
virtual bool processKeyEvent (const StringView &id, const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) override
 Processes a key event identified by its string ID.
void refreshWidget ()
 Refreshes the widget layout and visibility based on current options.
void resetKeyControllerToDefaults () override
 Resets all key mappings to their default values.
void retranslate ()
 Retranslates all UI text for the current locale.
void showDraw (bool visible)
 Shows or hides the draw ribbon tab.
void showEdit (bool visible)
 Shows or hides the edit ribbon tab.
void showHome (bool visible)
 Shows or hides the home ribbon tab.
void showMeasure (bool visible)
 Shows or hides the measure ribbon tab.
void showView (bool visible)
 Shows or hides the view ribbon tab.
void updateButtonStates ()
 Updates enabled/disabled states of all buttons based on current application state.
void updateUndoRedoSlot (UUID last_command)
 Updates the undo/redo button states when the command history changes.
RibbonGroupviewRibbonGroup ()
 Gets or creates the view ribbon group.
Protected Member Functions inherited from QCustomDockWidget
virtual void createSectionContent () override
 Creates the SectionContent that represents this dock in the container system.
void onCloseButtonClicked ()
 Slot invoked when the close button is clicked.
void onFullscreenButtonClicked (bool fullscreen)
 Slot invoked when the fullscreen button is clicked.
Protected Member Functions inherited from DockItem
virtual void initialize ()
 Initializes the dock item after construction, setting up internal state.

Protected Attributes

Buttonm_about_button = nullptr
 The about/info button.
QTResourceListenerm_background_listener = nullptr
 Listener for background task resource changes.
Buffer< Button * > m_buttons_to_add_to_home_file_subgroup
 Buttons queued for adding to the home/file subgroup.
Buffer< Button * > m_buttons_to_add_to_home_general_subgroup
 Buttons queued for adding to the home/general subgroup.
QTResourceListenerm_command_listener = nullptr
 Listener for command history resource changes.
Buffer< QPointer< Button > > m_disable_with_no_project_buttons
 Buttons that should be disabled when no project is loaded.
RibbonGroupm_draw_ribbon_group = nullptr
 The draw tab ribbon group.
RibbonGroupm_edit_ribbon_group = nullptr
 The edit tab ribbon group.
Buttonm_exit_button = nullptr
 The exit application button.
Buttonm_export_button = nullptr
 The export button.
RibbonSubGroupm_home_file_subgroup = nullptr
 The file subgroup within the home tab.
RibbonSubGroupm_home_general_subgroup = nullptr
 The general subgroup within the home tab.
RibbonGroupm_home_ribbon_group = nullptr
 The home tab ribbon group.
Buttonm_import_file_button = nullptr
 The import file button.
bool m_is_vertical = false
 Whether the ribbon is in vertical layout mode.
LayerWidgetm_layer_tools_dock = nullptr
 The layer tools dock widget.
Buffer< QWidget * > m_left_widgets
 Widgets added to the left side of the ribbon.
Buttonm_log_button = nullptr
 The application log button.
std::function< void(const PopupInfo &)> m_main_button_callback
 Custom callback for the main button press.
QWidget * m_main_button_widget = nullptr
 The container widget for the main icon button.
Buttonm_main_icon_button = nullptr
 The main application icon button.
MainWindowm_main_window = nullptr
 The main application window.
RibbonGroupm_measure_ribbon_group = nullptr
 The measure tab ribbon group.
QTModelManagerm_model_manager = nullptr
 The model manager for accessing design data.
Buttonm_open_button = nullptr
 The open project button.
Buttonm_project_browser = nullptr
 The project file browser button.
Buttonm_project_settings_button = nullptr
 The project settings button.
Buttonm_redo_button = nullptr
 The redo button.
Ribbonm_ribbon = nullptr
 The underlying ribbon widget.
NDEVRRibbonOptions m_ribbon_options
 The current ribbon visibility options.
Buffer< QWidget * > m_right_widgets
 Widgets added to the right side of the ribbon.
Buttonm_save_as_button = nullptr
 The save-as button.
Buttonm_save_button = nullptr
 The save button.
bool m_scene_visible = false
 Whether a 3D scene is currently visible.
Buttonm_settings_button = nullptr
 The application settings button.
SnapsEditorWidgetm_snaps_dock = nullptr
 The snap settings editor dock widget.
Buffer< Button * > m_touch_theme_buttons
 Buttons for switching touch/desktop mode.
Buffer< Button * > m_ui_theme_buttons
 Buttons for switching UI themes.
Buttonm_undo_button = nullptr
 The undo button.
RibbonGroupm_view_ribbon_group = nullptr
 The view tab ribbon group.
Buttonm_wifi_button = nullptr
 The wifi status/settings button.
WindowManagerm_window_manager = nullptr
 The window manager for UI coordination.
Buffer< Button * > m_window_theme_buttons
 Buttons for switching window color themes.
Protected Attributes inherited from QCustomDockWidget
Buffer< Button * > m_buttons_to_add
 Buttons queued to be added to the dock title bar.
bool m_highlight_dock
 Whether the dock is currently highlighted.
QPointer< QWidget > m_main_widget
 The main widget displayed inside the dock.
QSize m_size_hint
 The preferred size hint for the dock widget.
Protected Attributes inherited from DockItem
QPointer< ContainerWidgetBasem_container
 The container widget that owns this dock item.
QIcon m_icon
 The QIcon displayed on this dock item's tab.
String m_icon_id
 The icon resource identifier string.
SectionIconTabm_icon_title
 The icon/title tab widget for this dock item.
bool m_is_closable
 Whether the user can close this dock item.
bool m_is_hidable
 Whether the user can hide this dock item.
bool m_is_movable
 Whether the user can move this dock item.
bool m_is_selected
 Whether this dock item is currently selected.
bool m_is_windowable
 Whether the user can detach this item into a floating window.
SectionWidgetm_original_section
 The section widget this item was originally docked in.
RibbonArea m_preferred_ribbon_area
 The preferred ribbon area for this dock item.
SectionContentm_section_content
 The section content representing this dock item.
std::function< void(PopupInfo)> m_settings_callback
 Callback invoked when the settings action is triggered.
bool m_show_tab
 Whether the tab for this dock item is shown.
TranslatedString m_title
 The translated display title.
bool m_use_tab_title
 Whether the tab title is used for display.
UUID m_uuid
 The unique identifier for this dock item.
Protected Attributes inherited from BasicKeyController
TranslatedString m_key_controller_title
 The display title for this key controller.
Buffer< KeyOptionm_key_options
 The collection of registered key option mappings.
bool m_save_ini_on_change_key_option_change = false
 Whether to automatically save INI settings when a key option changes.
Protected Attributes inherited from INIInterface
File m_default_ini
 The default file path used for reading and writing INI options.

Detailed Description

The Ribbon that typically appears on the top of the window or, in touch mode, to the side of the window.


Contains high level buttons and widgets for the application.

Author: Tyler Parke

Date: 2023-01-16

Definition at line 154 of file NDEVRRibbon.h.

Constructor & Destructor Documentation

◆ NDEVRRibbon() [1/2]

NDEVRRibbon::NDEVRRibbon ( MainWindow * window,
WindowManager * window_manager,
QTModelManager * manager,
RibbonArea area )

Constructs the ribbon attached to a main window.

Parameters
[in]windowThe main application window.
[in]window_managerThe window manager for UI coordination.
[in]managerThe model manager for accessing design data.
[in]areaThe docking area for the ribbon.

Referenced by NDEVRRibbon().

◆ NDEVRRibbon() [2/2]

NDEVRRibbon::NDEVRRibbon ( WindowManager * window_manager,
QTModelManager * manager,
RibbonArea area )

Constructs the ribbon without a main window reference.

Parameters
[in]window_managerThe window manager for UI coordination.
[in]managerThe model manager for accessing design data.
[in]areaThe docking area for the ribbon.

References NDEVRRibbon().

Member Function Documentation

◆ addButtonToGeneralFile()

void NDEVRRibbon::addButtonToGeneralFile ( Button * button,
bool disable_with_no_project )

Adds a button to the general/file tab.


Button is disabled or enabled automatically based on the disable_with_no_project flag

Author: Tyler Parke

Date: 2020-05-21

Parameters: button - The button to add to the ribbon disable_with_no_project - if true, button will be disabled until a project is loaded or created

◆ addButtonToGeneralHome()

void NDEVRRibbon::addButtonToGeneralHome ( Button * button,
bool disable_with_no_project )

Adds a button to the general/home tab.


Button is disabled or enabled automatically based on the disable_with_no_project flag

Author: Tyler Parke

Date: 2020-05-21

Parameters: button - The button to add to the ribbon disable_with_no_project - if true, button will be disabled until a project is loaded or created

◆ addLeftWidget()

void NDEVRRibbon::addLeftWidget ( QWidget * widget)

Adds a widget to the left of the normal ribbon objects.


Author: Tyler Parke

Date: 2023-01-16

Parameters: widget - The widget to be added to the left of the normal ribbon objects

◆ addRightWidget()

void NDEVRRibbon::addRightWidget ( QWidget * widget)

Adds a widget to the right of the normal ribbon objects.


Author: Tyler Parke

Date: 2023-01-16

Parameters: widget - The widget to be added to the right of the normal ribbon objects

◆ editRibbonGroup()

RibbonGroup * NDEVRRibbon::editRibbonGroup ( )

Gets the ribbon group for objects on the "edit" tab.


Author: Tyler Parke

Date: 2023-01-16

Returns
the "edit" tab ribbon group

◆ homeFileRibbonSubGroup()

RibbonSubGroup * NDEVRRibbon::homeFileRibbonSubGroup ( )

Gets the ribbon sub-group for objects on the "home/file" tab.


Note buttons should be generally be added with "addButtonToGeneralFile" and not this function

Author: Tyler Parke

Date: 2023-01-16

Returns
the "home/file" tab ribbon subgroup

◆ homeGeneralRibbonSubGroup()

RibbonSubGroup * NDEVRRibbon::homeGeneralRibbonSubGroup ( )

Gets the ribbon sub-group for objects on the "home/general" tab.


Note buttons should be generally be added with "addButtonToGeneralHome" and not this function

Author: Tyler Parke

Date: 2023-01-16

Returns
the "home/general" tab ribbon subgroup

◆ homeRibbonGroup()

RibbonGroup * NDEVRRibbon::homeRibbonGroup ( )

Gets the ribbon group for objects on the "home" tab.


Author: Tyler Parke

Date: 2023-01-16

Returns
the "home" tab ribbon group

◆ options()

const NDEVRRibbonOptions & NDEVRRibbon::options ( ) const
inline

Gets the active options of the ribbon.


Can be copied, modified and set with setRibbonOptions

Author: Tyler Parke

Date: 2023-01-16

Returns
the active ribbon options

Definition at line 221 of file NDEVRRibbon.h.

References m_ribbon_options.

Referenced by setRibbonOptions().

◆ processKeyEvent()

virtual bool NDEVRRibbon::processKeyEvent ( const StringView & id,
const KeyEvent & key_event,
DesignObjectLookup * lookup,
Camera * camera )
overrideprotectedvirtual

Processes a key event identified by its string ID.

Subclasses implement specific behavior.

Parameters
[in]idThe string identifier of the key option that matched.
[in]key_eventThe key event to process.
[in]lookupThe design object lookup context.
[in]cameraThe active camera context.
Returns
True if the key event was handled, false otherwise.

Implements BasicKeyController.

◆ resetKeyControllerToDefaults()

void NDEVRRibbon::resetKeyControllerToDefaults ( )
overrideprotectedvirtual

Resets all key mappings to their default values.

Subclasses must implement this.

Implements BasicKeyController.

◆ ribbon()

Ribbon * NDEVRRibbon::ribbon ( ) const
inline

Gets the underlying ribbon object used for this widget.


Author: Tyler Parke

Date: 2023-01-16

Returns
a copy of the buffer.

Definition at line 244 of file NDEVRRibbon.h.

References m_ribbon.

◆ setIsVertical()

void NDEVRRibbon::setIsVertical ( bool is_vertical)

Defines whether buttons are layed out horizontally, or vertically.


Typically called by windowmanager based on application vertical or horizontal mode

Author: Tyler Parke

Date: 2020-05-21

Parameters: is_vertical - Use to set whether or not the ribbon is vertical

◆ setMainButtonCallback()

void NDEVRRibbon::setMainButtonCallback ( const std::function< void(const PopupInfo &)> & main_callback)

Sets a callback for when the round "Main" button is pressed.


The default behavior is to open the "About" page. Will revert to default behavior if parameter is null.

Author: Tyler Parke

Date: 2020-05-21

Parameters: main_callback - The callback for when the button is pressed.

◆ setRibbonOptions()

void NDEVRRibbon::setRibbonOptions ( const NDEVRRibbonOptions & options)

Sets the ribbon options and immediately refreshes the widget.


Author: Tyler Parke

Date: 2023-01-16

Parameters: options - The options to apply to the ribbon

References options().

◆ setSceneVisible()

void NDEVRRibbon::setSceneVisible ( bool scene_visible)

To be called by WindowManager when a scene is added or removed from the program.


Author: Tyler Parke

Date: 2023-01-16

Parameters: scene_visible - Whether the scene is visible

◆ setup()

void NDEVRRibbon::setup ( )

To be called by WindowManager when UI is ready to be displayed.


Author: Tyler Parke

Date: 2023-01-16


The documentation for this class was generated from the following file: