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 class NDEVR_WIDGETS_API RibbonSubGroup : public QWidget
43 {
44 Q_OBJECT
45 friend class RibbonGroup;
46 public:
47 RibbonSubGroup(QWidget* parent = nullptr);
48 void init();
49 RibbonSubGroup(const TranslatedString& title, QWidget* parent = nullptr);
50 Button* addButton(Button* button, uint04 index = Constant<uint04>::NaN, bool update_layout = false);
51 const Buffer<Button*>& buttons() const { return m_buttons; }
52 void removeButton(Button* button);
53 Vector<2, int> calcSize() const;
54 void clear();
55 void setIgnoredSize(bool ignored);
56 QSize sizeHint() const override;
57 QSize minimumSizeHint() const override;
58 void setSpacing(int spacing);
59 int currentPrimary() const;
60 int currentSecondary() const;
61 int largeButtonWidth() const;
62 int mediumButtonWidth() const;
63 void setIconSizeMultiplier(fltp04 size_multiplier);
64 Vector<2, int> minSize() const;
65
66 Vector<2, int> estimatedSize() const { return m_estimated_size; }
67 virtual void setVisible(bool is_visible) override;
68
69 void setLayoutMode(RibbonLayoutMode layout_mode) { m_layout_mode = layout_mode; }
70
71 void setNumberOfRows(uint04 number_of_rows);
72 int marginThickness() const;
73 void setExpandingIcons(bool expanding);
74
75 void setTitle(const TranslatedString& title);
76 const TranslatedString& title() const { return m_title; }
77 uint04 numOfColumns() const;
78 void resizeEvent(QResizeEvent* resize_event) override;
79 void setFixedNumOfRows(uint01 fixed_num_of_rows);
80 void updateRibbonLayout();
81 virtual void sortButtons(const std::function<bool(Button*, Button*)>& sorter);
82 signals:
84 protected:
85 void setVertical(bool is_vertical);
86 void updateButtonSize(uint04 button, int secondary_size, bool use_default);
87 bool event(QEvent* ev) override;
88 void customLayout();
89 void addToButtonSize(Button* button);
90 Vector<2, int> largeButtonSize() { return m_large_button_size; }
91 void updateLayout(QSize size);
92 int secondarySize();
93 void resetButtonState();
94 bool requestLarger();
95 bool requestLarger(int secondary_size);
96 bool requestSmaller(uint01 priority, uint04 col_count);
97 bool requestSmaller(uint01 priority, uint04 col_count, int secondary_size);
98 void autoFitIcons();
99 uint04 weight() const;
100 void updateLabel();
101 void _ribbonResizeEvent(int primary, int secondary);
102 protected:
104 QGridLayout* m_layout;
112
116
122 };
123}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
Definition Button.h:60
Definition QCustomLabel.h:42
Definition RibbonGroup.h:47
Definition RibbonSubGroup.h:43
Vector< 2, int > largeButtonSize()
Definition RibbonSubGroup.h:90
Vector< 2, int > m_full_size
Definition RibbonSubGroup.h:109
bool m_ignored_size
Definition RibbonSubGroup.h:118
QWidget * m_button_panel
Definition RibbonSubGroup.h:107
uint01 m_num_of_rows
Definition RibbonSubGroup.h:114
void setLayoutMode(RibbonLayoutMode layout_mode)
Definition RibbonSubGroup.h:69
bool m_auto_fill_table
Definition RibbonSubGroup.h:120
TranslatedString m_title
Definition RibbonSubGroup.h:113
bool m_is_vertical
Definition RibbonSubGroup.h:117
QGridLayout * m_layout
Definition RibbonSubGroup.h:104
int m_last_width
Definition RibbonSubGroup.h:106
Vector< 2, int > m_estimated_size
Definition RibbonSubGroup.h:111
const Buffer< Button * > & buttons() const
Definition RibbonSubGroup.h:51
Vector< 2, int > m_large_button_size
Definition RibbonSubGroup.h:110
RibbonLayoutMode m_layout_mode
Definition RibbonSubGroup.h:108
uint01 m_fixed_num_of_rows
Definition RibbonSubGroup.h:115
Vector< 2, int > estimatedSize() const
Definition RibbonSubGroup.h:66
QCustomLabel * m_label
Definition RibbonSubGroup.h:105
const TranslatedString & title() const
Definition RibbonSubGroup.h:76
Buffer< Button * > m_buttons
Definition RibbonSubGroup.h:103
bool m_expanding_icons
Definition RibbonSubGroup.h:119
fltp04 m_icon_size_multiplier
Definition RibbonSubGroup.h:121
Any text displayed to the user should be defined as a TranslatedString which allows the.
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.
Definition BaseValues.hpp:152
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:93
RibbonLayoutMode
Definition RibbonLayoutMode.hpp:36
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:115
Definition BaseValues.hpp:267