NDEVR
API Documentation
CustomDockButton

A DockItem that represents a button. More...

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

Public Member Functions

 CustomDockButton (const TranslatedString &name, const std::function< void(SectionContent *)> &callback, ContainerWidgetBase *container=nullptr)
 Constructs a custom dock button with a name and callback.
 CustomDockButton (const TranslatedString &name, const std::function< void(SectionContent *)> &callback, RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
 Constructs a custom dock button with a name, callback, and ribbon area.
 CustomDockButton (const TranslatedString &name, RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
 Constructs a custom dock button with a name and ribbon area.
const std::function< void(SectionContent *)> & callback ()
 Returns the callback function associated with this button.
void closedSignal ()
 Emitted when the dock button is closed.
void removeButton ()
 Removes the button from its current section widget.
void setCallback (const std::function< void(SectionContent *)> &callback)
 Sets the callback function to invoke when the button is activated.
virtual void setupDialogButton (Button *button)
 Sets up the visual appearance and behavior of the dialog button.
void showButton (bool show_dock, SectionWidget *section)
 Shows or hides the dock button within the given section widget.
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.
virtual void setDockSelected (bool selected)
 Sets whether this dock item is visually selected.
void setHidable (bool hidable)
 Sets whether this dock item can be hidden by the user.
virtual void setIcon (const QIcon &icon)
 Sets the icon displayed on this dock item's tab.
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 setTitle (const TranslatedString &title)
 Sets the display title for this dock item.
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.

Private Member Functions

virtual void createSectionContent () override
 Creates the SectionContent used by this dock button.

Additional Inherited Members

Protected Member Functions inherited from DockItem
virtual void initialize ()
 Initializes the dock item after construction, setting up internal state.
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.

Detailed Description

A DockItem that represents a button.


These can be placed on the Docking widget to add functionality. For example, in touch mode we use this class to have a "Add View" button.

Definition at line 55 of file CustomDockButton.h.

Constructor & Destructor Documentation

◆ CustomDockButton() [1/3]

CustomDockButton::CustomDockButton ( const TranslatedString & name,
RibbonArea ribbon_area,
ContainerWidgetBase * container = nullptr )
explicit

Constructs a custom dock button with a name and ribbon area.

Parameters
[in]nameThe translated display name for the button.
[in]ribbon_areaThe ribbon area where this button should be placed.
[in]containerThe parent container widget, or nullptr.

References DockItem::container().

Referenced by CustomDockButton().

◆ CustomDockButton() [2/3]

CustomDockButton::CustomDockButton ( const TranslatedString & name,
const std::function< void(SectionContent *)> & callback,
RibbonArea ribbon_area,
ContainerWidgetBase * container = nullptr )
explicit

Constructs a custom dock button with a name, callback, and ribbon area.

Parameters
[in]nameThe translated display name for the button.
[in]callbackThe function to invoke when the button is activated, receiving the SectionContent.
[in]ribbon_areaThe ribbon area where this button should be placed.
[in]containerThe parent container widget, or nullptr.

References callback(), and DockItem::container().

◆ CustomDockButton() [3/3]

CustomDockButton::CustomDockButton ( const TranslatedString & name,
const std::function< void(SectionContent *)> & callback,
ContainerWidgetBase * container = nullptr )
explicit

Constructs a custom dock button with a name and callback.

Parameters
[in]nameThe translated display name for the button.
[in]callbackThe function to invoke when the button is activated, receiving the SectionContent.
[in]containerThe parent container widget, or nullptr.

References CustomDockButton(), callback(), and DockItem::container().

Member Function Documentation

◆ callback()

const std::function< void(SectionContent *)> & CustomDockButton::callback ( )

Returns the callback function associated with this button.

Returns
A const reference to the callback function.

Referenced by CustomDockButton(), CustomDockButton(), and setCallback().

◆ setCallback()

void CustomDockButton::setCallback ( const std::function< void(SectionContent *)> & callback)

Sets the callback function to invoke when the button is activated.

Parameters
[in]callbackThe callback receiving the associated SectionContent.

References callback().

◆ setupDialogButton()

virtual void CustomDockButton::setupDialogButton ( Button * button)
virtual

Sets up the visual appearance and behavior of the dialog button.

Parameters
[in]buttonThe Button widget to configure.

◆ showButton()

void CustomDockButton::showButton ( bool show_dock,
SectionWidget * section )

Shows or hides the dock button within the given section widget.

Parameters
[in]show_dockWhether to show the button.
[in]sectionThe section widget in which to show the button.

References DockItem::section().


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