NDEVR
API Documentation
InterfaceOrientationController.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/QTTools.h>
4#include <NDEVR/Button.h>
5#include <NDEVR/RibbonLayoutMode.h>
6#include <QBoxLayout>
7#include <functional>
8class QSplitter;
9namespace NDEVR
10{
11 class PointWidget;
12 class QCustomTabWidget;
13 class Button;
15 class RibbonSubGroup;
27 class NDEVR_WIDGETS_API InterfaceOrientationController
28 {
29 public:
30 InterfaceOrientationController();
31 ~InterfaceOrientationController();
41 static bool isScreenHorizontal();
46 void setHorizontal(bool is_horizontal);
52 void run(QWidget* object, const std::function<void(bool is_horizontal)>& function);
59 void run(QBoxLayout* l, QBoxLayout::Direction horz = QBoxLayout::LeftToRight, QBoxLayout::Direction vert = QBoxLayout::TopToBottom);
65 void run(QCustomTabWidget* w, bool inverted_stack = false);
78 void run(QSplitter* splitter, bool inverted_splitter = false);
85 void run(PointWidget* widget, uint04 lines_horz = 2, uint04 lines_vert = 3);
92 void run(Ribbon* widget, RibbonLayoutMode horz_mode = RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode = RibbonLayoutMode::e_vertical);
99 void run(RibbonSubGroup* widget, RibbonLayoutMode horz_mode = RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode = RibbonLayoutMode::e_vertical);
104 void remove(QObject* widget);
109 static InterfaceOrientationController& Default();
110 private:
114 struct OrientationOption : public QObject
115 {
116 OrientationOption(InterfaceOrientationController* parent, QLayout* l, bool inverted_stack);
117 OrientationOption(InterfaceOrientationController* parent, QWidget* w, bool inverted_stack);
118 ~OrientationOption();
119 QLayout* layout = nullptr;
120 QWidget* widget = nullptr;
121 uint04 state_horz = Constant<uint04>::Invalid;
122 uint04 state_vert = Constant<uint04>::Invalid;
123 bool inverted = false;
125 virtual void setHorizontal(bool horizontal);
126 std::function<void(bool is_horizontal)> function;
127 private:
128 InterfaceOrientationController* m_parent;
129 };
130 private:
132 void addOption(OrientationOption* inter);
133 private:
134 Dictionary<QObject*, OrientationOption*> m_orientation_options;
135 bool m_is_horizontal;
136 };
137}
A core widget that allows the user to click one of many button types.
Definition Button.h:68
ButtonState
Defines the visual size and style of the button.
Definition Button.h:76
@ e_push_button
Standard push button style.
Definition Button.h:83
@ e_large
Large button with icon and text below.
Definition Button.h:77
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
This class is responsible for notifying and providing default layout logic when the orientation of th...
void run(Ribbon *widget, RibbonLayoutMode horz_mode=RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode=RibbonLayoutMode::e_vertical)
Registers a Ribbon to change its layout mode on orientation change.
void run(QBoxLayout *l, QBoxLayout::Direction horz=QBoxLayout::LeftToRight, QBoxLayout::Direction vert=QBoxLayout::TopToBottom)
Registers a QBoxLayout to switch direction on orientation change.
static InterfaceOrientationController & Default()
Returns the default global InterfaceOrientationController instance.
void run(QWidget *object, const std::function< void(bool is_horizontal)> &function)
Registers a widget with a custom callback for orientation changes.
void run(PointWidget *widget, uint04 lines_horz=2, uint04 lines_vert=3)
Registers a PointWidget to change its line count on orientation change.
void run(Button *w, Button::ButtonState horz=Button::ButtonState::e_push_button, Button::ButtonState vert=Button::ButtonState::e_large)
Registers a Button to change its state on orientation change.
void run(RibbonSubGroup *widget, RibbonLayoutMode horz_mode=RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode=RibbonLayoutMode::e_vertical)
Registers a RibbonSubGroup to change its layout mode on orientation change.
void run(QCustomTabWidget *w, bool inverted_stack=false)
Registers a QCustomTabWidget to update on orientation change.
void remove(QObject *widget)
Removes a widget from orientation tracking.
static bool isScreenHorizontal()
Returns whether the screen is currently in horizontal (landscape) orientation.
void setHorizontal(bool is_horizontal)
Sets the orientation mode and updates all registered widgets.
void run(QSplitter *splitter, bool inverted_splitter=false)
Registers a QSplitter to change orientation on layout change.
bool isHorizontalMode()
Returns whether the current mode is horizontal.
Allows the user to input an N-dimensional point (up to 4 dimensions) with an optional unit.
Definition PointWidget.h:58
A tab widget provides a tab area and a "page area" that is used to display pages related to each tab.
Represents a sub-section of "Tab" of a ribbon representing a grouping of buttons or widgets within a ...
The UI ribbon is a horizontal menu bar typically located at the top of the application interface or a...
Definition Ribbon.h:56
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
RibbonLayoutMode
The orientations a ribbon can take on.