NDEVR
API Documentation
SectionTab.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: SectionTab
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/RibbonArea.h>
35#include <QWidget>
36#include <QIcon>
37namespace NDEVR
38{
39 class TranslatedString;
40 class SectionContent;
41 class String;
42 class FloatingWidget;
47 class NDEVR_WIDGETS_API SectionTab : public QWidget
48 {
49 Q_OBJECT
50 public:
56 SectionTab(SectionContent* content, QWidget* parent);
57 virtual ~SectionTab();
62 bool isActiveTab() const;
67 void setActiveTab(bool active);
72 virtual void setFloatingWidget(FloatingWidget* widget);
77 virtual void setFullscreen(bool fullscreen);
83 protected:
88 virtual void mousePressEvent(QMouseEvent* event) override;
93 virtual void mouseReleaseEvent(QMouseEvent* ev) override;
98 virtual void mouseMoveEvent(QMouseEvent* ev) override;
103 virtual void leaveEvent(QEvent* event) override;
112 signals:
117 void moveableUpdated(bool is_moveable);
122 void closableUpdated(bool is_closeable);
127 void fullscreenUpdated(bool is_fullscreen);
132 void isShownUpdated(bool is_shown);
147 void fullscreenSignal(bool fullscreen);
160 public:
172 void setRoundedCorners(int radius_tl, int radius_tr, int radius_bl, int radius_br);
177 void setIsShown(bool shown);
183 bool event(QEvent* event) override;
188 virtual bool isMovable() const;
193 virtual bool isShown() const;
198 virtual QIcon getIcon() const { return QIcon(); };
203 virtual TranslatedString getTitle() const;
209 virtual void setLocation(RibbonArea area, bool is_docked) = 0;
214 virtual void setDocked(bool is_docked) = 0;
219 virtual void setSelected(bool is_selected) = 0;
220 protected:
228 private:
229 bool m_is_shown;
230 int m_radius_tl = 0;
231 int m_radius_tr = 0;
232 int m_radius_bl = 0;
233 int m_radius_br = 0;
234 };
235}
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.
void receiveFullScreenButtonClicked()
Processes a fullscreen button click by emitting the fullscreenSignal.
virtual TranslatedString getTitle() const
Returns the translated title text displayed on this tab.
QPointF m_drag_start_pos
The global position where a drag operation started.
Definition SectionTab.h:223
void clickedSignal(SectionContent *content)
Emitted when the tab is clicked.
bool event(QEvent *event) override
Processes generic events such as style changes.
virtual bool isMovable() const
Returns whether this tab can be moved (dragged) by the user.
bool m_tab_moving
Whether the tab is currently being dragged.
Definition SectionTab.h:225
void updateRoundedCorners()
Updates the rounded corner radii based on the current docking position.
void isShownUpdated(bool is_shown)
Emitted when the shown state of this tab changes.
QPointF m_local_drag_pos
The local position within the tab where the drag started.
Definition SectionTab.h:224
void updateClosableSignal()
Emitted to request an update of the closable state.
virtual void setDocked(bool is_docked)=0
Sets whether this tab is in a docked state.
void setActiveTab(bool active)
Sets whether this tab is the active (selected) tab.
void updateMoveableSignal()
Emitted to request an update of the moveable state.
void setSectionContent(SectionContent *content)
Sets the section content associated with this tab.
virtual void setSelected(bool is_selected)=0
Sets the selected visual state of this tab.
SectionTab(SectionContent *content, QWidget *parent)
Constructs a SectionTab associated with the given section content and parent widget.
virtual void mouseMoveEvent(QMouseEvent *ev) override
Handles mouse move events during tab dragging.
bool m_active_tab
Whether this is the currently active tab.
Definition SectionTab.h:226
void fullscreenSignal(bool fullscreen)
Emitted when the fullscreen state is toggled.
FloatingWidget * m_floating_widget
The floating widget hosting this tab, if any.
Definition SectionTab.h:222
SectionContent * m_content
The section content this tab represents.
Definition SectionTab.h:221
void closableUpdated(bool is_closeable)
Emitted when the closable state of this tab changes.
void setRoundedCorners(int radius_tl, int radius_tr, int radius_bl, int radius_br)
Sets the rounded corner radii for each corner of the tab.
virtual void setLocation(RibbonArea area, bool is_docked)=0
Sets the layout location and docked state of this tab.
void setIsShown(bool shown)
Sets whether this tab should be shown or hidden.
virtual void mouseReleaseEvent(QMouseEvent *ev) override
Handles mouse release events to complete tab dragging or selection.
void closedSignal(SectionContent *content)
Emitted when the tab's close action is triggered.
void moveableUpdated(bool is_moveable)
Emitted when the moveable state of this tab changes.
virtual void leaveEvent(QEvent *event) override
Handles the leave event when the mouse exits the tab.
void activeTabChanged()
Emitted when the active tab changes.
virtual void mousePressEvent(QMouseEvent *event) override
Handles mouse press events to initiate tab dragging.
virtual QIcon getIcon() const
Returns the icon displayed on this tab.
Definition SectionTab.h:198
bool m_is_fullscreen
Whether the associated content is in fullscreen mode.
Definition SectionTab.h:227
bool isActiveTab() const
Returns whether this tab is currently the active (selected) tab.
void receiveCloseButtonClicked()
Processes a close button click by emitting the closedSignal.
virtual void setFullscreen(bool fullscreen)
Sets whether the associated content is displayed in fullscreen mode.
virtual void setFloatingWidget(FloatingWidget *widget)
Assigns the floating widget that contains this tab when undocked.
virtual bool isShown() const
Returns whether this tab is currently shown.
void fullscreenUpdated(bool is_fullscreen)
Emitted when the fullscreen state of this tab changes.
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...
The primary namespace for the NDEVR SDK.
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71