NDEVR
API Documentation
DockItem.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: Widgets
28File: DockItem
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/RibbonArea.h>
35
36#include <NDEVR/UUID.h>
37#include <NDEVR/TranslatedString.h>
38#include <QObject>
39#include <QIcon>
40#include <QPointer>
41#include <functional>
42namespace NDEVR
43{
45 class SectionWidget;
46 class SectionContent;
47 class SectionIconTab;
48 class FloatingWidget;
49 class Button;
50 struct PopupInfo;
55 class NDEVR_WIDGETS_API DockItem : public QObject
56 {
57 public:
63 explicit DockItem(RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr);
69 virtual ~DockItem();
70
75 void setRibbonArea(RibbonArea ribbon_area);
111 virtual void swapWith(DockItem* other_widget);
116 void setClosable(bool closable);
121 void setHidable(bool hidable);
126 void setWindowable(bool hidable);
131 void setShowTab(bool show_tab);
136 void setMoveable(bool movable);
141 bool isDocked() const;
146 bool isDockVisible() const;
151 void setTabFlat(bool flat);
164 bool isClosable() const { return m_is_closable; }
169 bool isHidable() const { return m_is_hidable; }
174 bool isWindowable() const { return m_is_windowable; }
179 void setSettingsCallback(const std::function<void(PopupInfo)>& callback) { m_settings_callback = callback; }
184 std::function<void(PopupInfo)> settingsCallback() { return m_settings_callback; };
189 bool isMovable() const;
194 bool showTab() const;
199 bool useTabTitle() const;
204 virtual void setUseTabTitle(bool use_tab_title);
209 virtual void setDockSelected(bool selected);
214 bool isDockSelected() const { return m_is_selected; }
219 virtual void setIcon(const QIcon& icon);
224 virtual void setIconID(const StringView& icon);
229 virtual void setTitle(const TranslatedString& title);
234 virtual const TranslatedString& title() const { return m_title; }
235 protected:
239 virtual void createSectionContent();
243 virtual void initialize();
244
245 std::function<void(PopupInfo)> m_settings_callback;
251 QPointer<ContainerWidgetBase> m_container;
253 QIcon m_icon;
262 };
263}
A core widget that allows the user to click one of many button types.
Definition Button.h:68
The root class that manages a series of SectionContent that can share the same space or lay out in va...
virtual void initialize()
Initializes the dock item after construction, setting up internal state.
bool isMovable() const
Checks whether this dock item can be moved by the user.
void setShowTab(bool show_tab)
Sets whether the tab for this dock item is shown.
bool m_use_tab_title
Whether the tab title is used for display.
Definition DockItem.h:261
QPointer< ContainerWidgetBase > m_container
The container widget that owns this dock item.
Definition DockItem.h:251
SectionWidget * m_original_section
The section widget this item was originally docked in.
Definition DockItem.h:249
virtual void setUseTabTitle(bool use_tab_title)
Sets whether the tab title should be used for display.
bool m_show_tab
Whether the tab for this dock item is shown.
Definition DockItem.h:260
DockItem(ContainerWidgetBase *container=nullptr)
Constructs a DockItem with an optional container.
std::function< void(PopupInfo)> m_settings_callback
Callback invoked when the settings action is triggered.
Definition DockItem.h:245
bool isWindowable() const
Checks whether this dock item can be detached into a floating window.
Definition DockItem.h:174
void setDockArea(DropArea drop_area, SectionWidget *section)
Sets the drop area and target section for docking this item.
TranslatedString m_title
The translated display title.
Definition DockItem.h:254
void setHidable(bool hidable)
Sets whether this dock item can be hidden by the user.
SectionIconTab * titleWidget() const
Returns the icon/title tab widget associated with this dock item.
void setMoveable(bool movable)
Sets whether this dock item can be moved by the user.
SectionWidget * section() const
Returns the section widget that currently contains this dock item.
virtual void createSectionContent()
Creates the SectionContent used to represent this dock item in the docking system.
UUID m_uuid
The unique identifier for this dock item.
Definition DockItem.h:246
virtual void setContainer(ContainerWidgetBase *container)
Sets the container widget that owns this dock item.
DockItem(RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
Constructs a DockItem with a preferred ribbon area and optional container.
String m_icon_id
The icon resource identifier string.
Definition DockItem.h:252
bool m_is_movable
Whether the user can move this dock item.
Definition DockItem.h:258
void setRibbonArea(RibbonArea ribbon_area)
Sets the preferred ribbon area for this dock item.
SectionContent * m_section_content
The section content representing this dock item.
Definition DockItem.h:248
void setSettingsCallback(const std::function< void(PopupInfo)> &callback)
Sets the callback invoked when the settings action is triggered.
Definition DockItem.h:179
void setClosable(bool closable)
Sets whether this dock item can be closed by the user.
virtual void setIcon(const QIcon &icon)
Sets the icon displayed on this dock item's tab.
virtual const TranslatedString & title() const
Returns the display title of this dock item.
Definition DockItem.h:234
void moveTabToEnd()
Moves this dock item's tab to the end of the tab bar.
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.
Definition DockItem.h:169
SectionIconTab * m_icon_title
The icon/title tab widget for this dock item.
Definition DockItem.h:247
bool useTabTitle() const
Checks whether the tab title is used for display.
bool m_is_hidable
Whether the user can hide this dock item.
Definition DockItem.h:257
bool showTab() const
Checks whether the tab for this dock item is shown.
void moveTabToStart()
Moves this dock item's tab to the start of the tab bar.
virtual void setTitle(const TranslatedString &title)
Sets the display title for this dock item.
void setWindowable(bool hidable)
Sets whether this dock item can be detached into a floating window.
QIcon m_icon
The QIcon displayed on this dock item's tab.
Definition DockItem.h:253
bool m_is_windowable
Whether the user can detach this item into a floating window.
Definition DockItem.h:256
RibbonArea m_preferred_ribbon_area
The preferred ribbon area for this dock item.
Definition DockItem.h:250
bool m_is_closable
Whether the user can close this dock item.
Definition DockItem.h:255
bool isDocked() const
Checks whether this dock item is currently docked in a section.
ContainerWidgetBase * container() const
Returns the container widget that owns this dock item.
virtual void swapWith(DockItem *other_widget)
Swaps this dock item's position and section with another dock item.
virtual void setDockSelected(bool selected)
Sets whether this dock item is visually selected.
virtual void setIconID(const StringView &icon)
Sets the icon by resource identifier string.
bool isDockSelected() const
Checks whether this dock item is currently selected.
Definition DockItem.h:214
std::function< void(PopupInfo)> settingsCallback()
Returns the callback invoked when the settings action is triggered.
Definition DockItem.h:184
FloatingWidget * floatingWidget() const
Returns the floating widget if this dock item is currently floating.
void setTabFlat(bool flat)
Sets whether the tab for this dock item should have a flat appearance.
bool m_is_selected
Whether this dock item is currently selected.
Definition DockItem.h:259
bool isClosable() const
Checks whether this dock item can be closed by the user.
Definition DockItem.h:164
Used with the NDEVR API Widget Docking system for widgets that are floating.
The core container for objects using the NDEVR API Widget Docking system.
Provides a tab that contains an icon and some buttons used for either a tab if the section content is...
SectionWidget manages multiple instances of SectionContent.
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
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.
DropArea
relates where a widget should be dropped relative to another.
Definition RibbonArea.h:46
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71
Class which is used to pass arguments and requests for creating a popup dialog or widget.
Definition PopupInfo.h:16