API Documentation
Loading...
Searching...
No Matches
RibbonSubGroup.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: NDEVR
28File: RibbonSubGroup
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/RibbonLayoutMode.h>
34#include <NDEVR/Button.h>
35#include <NDEVR/QCustomLabel.h>
36class QGridLayout;
37namespace NDEVR
38{
39 class Button;
40 class QCustomLabel;
41 class Button;
42 /**--------------------------------------------------------------------------------------------------
43 \brief Represents a sub-section of "Tab" of a ribbon represting a grouping of buttons or widgets within
44 a tab that provide similar functions.
45 **/
46 class NDEVR_WIDGETS_API RibbonSubGroup : public QWidget
47 {
48 Q_OBJECT
49 friend class RibbonGroup;
50 public:
51 RibbonSubGroup(QWidget* parent = nullptr);
52 void init();
53 RibbonSubGroup(const TranslatedString& title, QWidget* parent = nullptr);
54 Button* addButton(Button* button, uint04 index = Constant<uint04>::Invalid, bool update_layout = false);
55 const Buffer<Button*>& buttons() const { return m_buttons; }
56 void removeButton(Button* button);
58 void clear();
59 void setIgnoredSize(bool ignored);
60 QSize sizeHint() const override;
61 QSize minimumSizeHint() const override;
62 void setSpacing(int spacing);
63 int currentPrimary() const;
64 int currentSecondary() const;
65 int largeButtonWidth() const;
66 int mediumButtonWidth() const;
67 void setIconSizeMultiplier(fltp04 size_multiplier);
69
70 Vector<2, int> estimatedSize() const { return m_estimated_size; }
71 virtual void setVisible(bool is_visible) override;
72
73 void setLayoutMode(RibbonLayoutMode layout_mode) { m_layout_mode = layout_mode; }
74
75 void setNumberOfRows(uint04 number_of_rows);
76 int marginThickness() const;
77 void setExpandingIcons(bool expanding);
78
79 void setTitle(const TranslatedString& title);
80 const TranslatedString& title() const { return m_title; }
82 void resizeEvent(QResizeEvent* resize_event) override;
83 void setFixedNumOfRows(uint01 fixed_num_of_rows);
85 virtual void sortButtons(const std::function<bool(Button*, Button*)>& sorter);
86 void setVertical(bool is_vertical);
87 signals:
89 private:
90 void updateButtonSize(uint04 button, int secondary_size, bool use_default);
91 bool event(QEvent* ev) override;
92 void customLayout();
93 void addToButtonSize(Button* button);
94 Vector<2, int> largeButtonSize() { return m_large_button_size; }
95 void updateLayout(QSize size);
96 int secondarySize();
97 void resetButtonState();
98 bool requestLarger();
99 bool requestLarger(int secondary_size);
100 bool requestSmaller(uint01 priority, uint04 col_count);
101 bool requestSmaller(uint01 priority, uint04 col_count, int secondary_size);
102 void autoFitIcons();
103 uint04 weight() const;
104 void updateLabel();
105 void _ribbonResizeEvent(int primary, int secondary);
106 protected:
108 QGridLayout* m_layout;
116
120
126 };
127}
#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
A core widget that allows the user to click one of many button types.
Definition Button.h:66
Displays translated text. No user interaction functionality is provided. The visual appearance of the...
Definition QCustomLabel.h:46
Represents the "Tab" of a widget. For example sections such as Home, View, Edit, Measurements would a...
Definition RibbonGroup.h:51
Represents a sub-section of "Tab" of a ribbon represting a grouping of buttons or widgets within a ta...
Definition RibbonSubGroup.h:47
RibbonSubGroup(QWidget *parent=nullptr)
int currentSecondary() const
QSize minimumSizeHint() const override
int marginThickness() const
void setSpacing(int spacing)
Vector< 2, int > m_full_size
Definition RibbonSubGroup.h:113
QSize sizeHint() const override
bool m_ignored_size
Definition RibbonSubGroup.h:122
void setIconSizeMultiplier(fltp04 size_multiplier)
QWidget * m_button_panel
Definition RibbonSubGroup.h:111
uint01 m_num_of_rows
Definition RibbonSubGroup.h:118
void setTitle(const TranslatedString &title)
void setLayoutMode(RibbonLayoutMode layout_mode)
Definition RibbonSubGroup.h:73
void setIgnoredSize(bool ignored)
bool m_auto_fill_table
Definition RibbonSubGroup.h:124
TranslatedString m_title
Definition RibbonSubGroup.h:117
Vector< 2, int > minSize() const
bool m_is_vertical
Definition RibbonSubGroup.h:121
Vector< 2, int > calcSize() const
QGridLayout * m_layout
Definition RibbonSubGroup.h:108
int m_last_width
Definition RibbonSubGroup.h:110
int largeButtonWidth() const
virtual void setVisible(bool is_visible) override
Vector< 2, int > m_estimated_size
Definition RibbonSubGroup.h:115
Button * addButton(Button *button, uint04 index=Constant< uint04 >::Invalid, bool update_layout=false)
const Buffer< Button * > & buttons() const
Definition RibbonSubGroup.h:55
Vector< 2, int > m_large_button_size
Definition RibbonSubGroup.h:114
RibbonLayoutMode m_layout_mode
Definition RibbonSubGroup.h:112
uint01 m_fixed_num_of_rows
Definition RibbonSubGroup.h:119
Vector< 2, int > estimatedSize() const
Definition RibbonSubGroup.h:70
QCustomLabel * m_label
Definition RibbonSubGroup.h:109
virtual void sortButtons(const std::function< bool(Button *, Button *)> &sorter)
void setExpandingIcons(bool expanding)
void removeButton(Button *button)
RibbonSubGroup(const TranslatedString &title, QWidget *parent=nullptr)
uint04 numOfColumns() const
void setNumberOfRows(uint04 number_of_rows)
const TranslatedString & title() const
Definition RibbonSubGroup.h:80
void setVertical(bool is_vertical)
void resizeEvent(QResizeEvent *resize_event) override
void setFixedNumOfRows(uint01 fixed_num_of_rows)
int currentPrimary() const
Buffer< Button * > m_buttons
Definition RibbonSubGroup.h:107
int mediumButtonWidth() const
bool m_expanding_icons
Definition RibbonSubGroup.h:123
fltp04 m_icon_size_multiplier
Definition RibbonSubGroup.h:125
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
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
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233