33#include <NDEVR/RibbonLayoutMode.h>
34#include <NDEVR/Button.h>
35#include <NDEVR/QCustomLabel.h>
50 friend class RibbonGroup;
158 virtual void setVisible(
bool is_visible)
override;
194 void resizeEvent(QResizeEvent* resize_event)
override;
226 void updateButtonSize(
uint04 button,
int secondary_size,
bool use_default);
227 bool event(QEvent* ev)
override;
229 void addToButtonSize(
Button* button);
231 void updateLayout(QSize size);
233 void resetButtonState();
234 bool requestLarger();
235 bool requestLarger(
int secondary_size);
237 bool requestSmaller(
uint01 priority,
uint04 col_count,
int secondary_size);
241 void _ribbonResizeEvent(
int primary,
int secondary);
The equivelent of std::vector but with a bit more control.
Displays translated text.
Buffer< Button::ButtonState > m_available_button_states
Allowed button states for adaptive resizing.
int m_last_width
Last known width, used to detect resize changes.
virtual void sortButtons(const std::function< bool(Button *, Button *)> &sorter)
Sorts the buttons in this sub-group using the given comparison function.
Button * addButton(Button *button, uint04 index=Constant< uint04 >::Invalid, bool update_layout=false)
Adds a button to this sub-group at the specified index.
QSize sizeHint() const override
Returns the recommended size for this sub-group.
bool m_is_vertical
Whether the layout is vertical.
RibbonSubGroup(QWidget *parent=nullptr)
Constructs a ribbon sub-group widget.
Vector< 2, int > estimatedSize() const
Returns the estimated size of this sub-group.
void init()
Initializes the sub-group layout and label after construction.
void setIconSizeMultiplier(fltp04 size_multiplier)
Sets a multiplier applied to icon sizes in this sub-group.
void setExpandingIcons(bool expanding)
Sets whether icons should expand to fill available space.
Buffer< QPointer< Button > > m_buttons
Ordered list of buttons in the sub-group.
uint01 m_fixed_num_of_rows
Fixed number of rows, or 0 for automatic.
bool m_expanding_icons
Whether icons expand to fill available space.
const Buffer< QPointer< Button > > & buttons() const
Returns the list of buttons in this sub-group.
void cleanupEmpty()
Removes any buttons that have been destroyed or are empty.
void setAvailableButtonStates(const Buffer< Button::ButtonState > &available_button_states)
Sets the available button states that buttons may cycle through during resize.
Vector< 2, int > minSize() const
Returns the minimum size as a 2D vector (primary, secondary).
bool isEmpty() const
Returns whether this sub-group has no buttons.
bool m_ignored_size
Whether this sub-group's size is ignored during layout.
int mediumButtonWidth() const
Returns the width of a medium button in the current layout.
void setSpacing(int spacing)
Sets the spacing between buttons in the layout.
int largeButtonWidth() const
Returns the width of a large button in the current layout.
bool m_auto_fill_table
Whether to automatically fill the layout grid.
const TranslatedString & title() const
Returns the title of this sub-group.
QCustomLabel * m_label
Label displaying the sub-group title.
QWidget * m_button_panel
Panel widget containing the buttons.
Vector< 2, int > m_full_size
The full calculated size of the sub-group.
uint04 numOfColumns() const
Returns the number of columns in the current button layout.
void setNumberOfRows(uint04 number_of_rows)
Sets the number of rows used for laying out buttons.
QSize minimumSizeHint() const override
Returns the minimum recommended size for this sub-group.
Vector< 2, int > m_large_button_size
The size of a large button in the current layout.
int currentPrimary() const
Returns the current size along the primary layout axis.
void updateRibbonLayoutIfNeeded()
Updates the ribbon layout only if changes have been detected.
void updateRibbonLayout()
Updates the ribbon layout of this sub-group.
RibbonSubGroup(const TranslatedString &title, QWidget *parent=nullptr)
Constructs a ribbon sub-group with a title.
RibbonLayoutMode m_layout_mode
The current layout mode.
Vector< 2, int > calcSize() const
Calculates the ideal size for this sub-group based on its buttons.
void requestLayoutUpdate()
Signal emitted when the sub-group requests a parent layout update.
TranslatedString m_title
The displayed title of the sub-group.
uint01 m_num_of_rows
Current number of layout rows.
void setLayoutMode(RibbonLayoutMode layout_mode)
Sets the layout mode for button arrangement.
int currentSecondary() const
Returns the current size along the secondary layout axis.
void setFixedNumOfRows(uint01 fixed_num_of_rows)
Sets a fixed number of rows for the layout.
QGridLayout * m_layout
Grid layout managing button placement.
fltp04 m_icon_size_multiplier
Multiplier applied to icon sizes.
void setIgnoredSize(bool ignored)
Sets whether this sub-group's size should be ignored during layout calculations.
void removeButton(Button *button)
Removes a button from this sub-group.
Vector< 2, int > m_estimated_size
The estimated size used for layout planning.
void setVertical(bool is_vertical)
Sets whether the sub-group layout is vertical.
int marginThickness() const
Returns the margin thickness around the sub-group content.
void clear()
Removes all buttons from this sub-group.
void setTitle(const TranslatedString &title)
Sets the displayed title for this sub-group.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
RibbonLayoutMode
The orientations a ribbon can take on.