API Documentation
Loading...
Searching...
No Matches
Ribbon.h
Go to the documentation of this file.
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: Ribbon
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/RibbonLayoutMode.h>
35#include <NDEVR/ContainerWidget.h>
36#include <NDEVR/QCustomDockWidget.h>
37#include <NDEVR/RibbonArea.h>
38#include <NDEVR/String.h>
39#include <NDEVR/BaseValues.h>
40#include <NDEVR/Dictionary.h>
41#include <QFrame>
42class QBoxLayout;
43namespace NDEVR
44{
45 class RibbonGroup;
46 /**--------------------------------------------------------------------------------------------------
47 \brief The UI ribbon is a horizontal menu bar typically located at the top of the application
48 interface or along the side. It organizes commands and tools into tabs and groups for easy access.
49 Each tab contains related functionality, categorized into sections such as File, Edit, View, etc.
50 Within these sections, buttons, dropdowns, and other controls allow users to interact with the application features efficiently.
51 The ribbon improves usability by presenting frequently-used commands in a visually organized manner.
52 **/
54 {
55 public:
56 explicit Ribbon(QWidget* parent = nullptr);
58 bool isVertical() { return m_is_vertical; };
59 const RibbonGroup& group(const TranslatedString& group_name) const;
60 void setGroupName(uint04 index, const TranslatedString& group_name);
61 void setInverseRibbonArea(bool inverse_ribbon_area);
62 RibbonGroup& group(const TranslatedString& group_name);
65 {
66 return m_groups[group_name];
67 }
68
71 {
72 return m_index_groups[index];
73 }
75 /// Handle window drag events
76 virtual RibbonGroup* addGroup(const TranslatedString& label);
77 virtual void addGroup(RibbonGroup* group);
78 virtual void removeGroup(const TranslatedString& label);
79 virtual void removeGroup(uint04 index);
80 virtual void removeAllGroups();
81 virtual bool hasGroup(const TranslatedString& group) const;
84 {
85 if (!hasGroup(location))
86 addGroup(location);
87 return group(location);
88 }
90 void resizeEvent(QResizeEvent *resize_event) override;
91 void setFixedNumOfRows(uint01 fixed_num_of_rows);
92 QSize sizeHint() const override;
93 QSize minimumSizeHint() const override;
95 void addTopLeftWidget(QWidget* widget);
96 void addBottomRightWidget(QWidget* widget);
97 void slideInIdx(uint04 idx, enum StackAnimationDirection direction = StackAnimationDirection::e_automatic) override {
98 QCustomStackedWidgetBase::slideInIdx(idx, direction);
99 }
100 void setTabLock(bool tab_lock) { ContainerWidgetBase::setTabLock(tab_lock); }
101 private:
102 virtual void _setVertical(bool is_vertical);
103 private:
104 bool m_is_vertical;
105 bool m_inverse_ribbon_area;
106 RibbonLayoutMode m_layout_mode;
107 uint01 m_fixed_num_of_rows;
109 Buffer<DockWidget<RibbonGroup>*> m_index_groups;
110 Buffer<QPointer<QWidget>> m_top_left_widgets;
111 Buffer<QPointer<QWidget>> m_bottom_right_widgets;
112 Buffer<TranslatedString> m_index_names;
113 };
114
115
116}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:59
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
The root class that manages a series of SectionContent that can share the same space or lay out in va...
Definition ContainerWidget.h:66
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Definition QCustomDockWidget.h:121
StackAnimationDirection
Definition QCustomStackedWidget.h:56
Represents the "Tab" of a widget. For example sections such as Home, View, Edit, Measurements would a...
Definition RibbonGroup.h:51
The UI ribbon is a horizontal menu bar typically located at the top of the application interface or a...
Definition Ribbon.h:54
DockWidget< RibbonGroup > * groupDock(uint04 index)
Definition Ribbon.h:70
Ribbon(QWidget *parent=nullptr)
QSize minimumSizeHint() const override
void setTabLock(bool tab_lock)
Definition Ribbon.h:100
QSize sizeHint() const override
void setLayoutMode(RibbonLayoutMode mode)
Dictionary< TranslatedString, DockWidget< RibbonGroup > * > & groups()
Definition Ribbon.h:94
virtual void removeAllGroups()
void setGroupName(uint04 index, const TranslatedString &group_name)
void updateRibbonLayout()
const RibbonGroup & group(const TranslatedString &group_name) const
void setInverseRibbonArea(bool inverse_ribbon_area)
void slideInIdx(uint04 idx, enum StackAnimationDirection direction=StackAnimationDirection::e_automatic) override
Definition Ribbon.h:97
virtual bool hasGroup(const TranslatedString &group) const
RibbonGroup & group(const TranslatedString &group_name)
RibbonGroup & operator[](const TranslatedString &location)
Definition Ribbon.h:83
bool isVertical()
Definition Ribbon.h:58
DockWidget< RibbonGroup > * groupDock(const TranslatedString &group_name)
Definition Ribbon.h:64
void addBottomRightWidget(QWidget *widget)
virtual void removeGroup(uint04 index)
RibbonGroup & group(uint04 index)
virtual void addGroup(RibbonGroup *group)
void resizeEvent(QResizeEvent *resize_event) override
void setFixedNumOfRows(uint01 fixed_num_of_rows)
virtual RibbonGroup * addGroup(const TranslatedString &label)
Handle window drag events.
void addTopLeftWidget(QWidget *widget)
virtual void removeGroup(const TranslatedString &label)
SectionWidget * section() const
DockWidget< RibbonGroup > * groupDock(const RibbonGroup *group)
SectionWidget manages multiple instances of SectionContent. It displays a title TAB,...
Definition SectionWidget.h:55
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
RibbonLayoutMode
The orientations a ribbon can take on.
Definition RibbonLayoutMode.hpp:39
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96