API Documentation
Loading...
Searching...
No Matches
InterfaceOrientationController.h
Go to the documentation of this file.
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>
7class QSplitter;
8namespace NDEVR
9{
10 class PointWidget;
11 class QCustomTabWidget;
12 class Button;
13 class InterfaceOrientationController;
14 class RibbonSubGroup;
15 /**--------------------------------------------------------------------------------------------------
16 \brief This class is responsible for notifying and providing default layout logic when the orientation
17 of the widget changes, such as for a screen rotaton.
18 Espcially useful for phones that may change orientation. For example, QBoxLayouts will be set to
19 vertical when the screen is vertical and horizontal when the screen is horizontal.
20 Widgets can be added inverted, meaning the opposite of the default layout behavior will occur.
21 Widget will be layed out as soon as run is called on it, and subsequently when the interface layout
22 changes.
23 Provided widget is destroyed on the main thread, there is no need to automatically remove it from
24 the controller.
25 **/
27 {
28 public:
32 static bool isScreenHorizontal();
33 void setHorizontal(bool is_horizontal);
34 void run(QBoxLayout* l, QBoxLayout::Direction horz = QBoxLayout::LeftToRight, QBoxLayout::Direction vert = QBoxLayout::TopToBottom);
35 void run(QCustomTabWidget* w, bool inverted_stack = false);
36 void run(Button* w, Button::ButtonState horz = Button::ButtonState::e_push_button, Button::ButtonState vert = Button::ButtonState::e_large);
37 void run(QSplitter* splitter, bool inverted_splitter = false);
38 void run(PointWidget* widget, uint04 lines_horz = 2, uint04 lines_vert = 3);
39 void run(Ribbon* widget, RibbonLayoutMode horz_mode = RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode = RibbonLayoutMode::e_vertical);
40 void run(RibbonSubGroup* widget, RibbonLayoutMode horz_mode = RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode = RibbonLayoutMode::e_vertical);
41 void remove(QObject* widget);
43 private:
44 struct OrienationOption : public QObject
45 {
46 OrienationOption(InterfaceOrientationController* parent, QLayout* l, bool inverted_stack);
47 OrienationOption(InterfaceOrientationController* parent, QWidget* w, bool inverted_stack);
48 ~OrienationOption();
49 QLayout* layout = nullptr;
50 QWidget* widget = nullptr;
53 bool inverted = false;
54 virtual void setHorizontal(bool horizontal);
56 };
57 private:
58 void addOption(OrienationOption* inter);
59 private:
60 Dictionary<QObject*, OrienationOption*> m_orientation_options;
61 bool m_is_horizontal;
62 };
63}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:59
A core widget that allows the user to click one of many button types.
Definition Button.h:66
ButtonState
Definition Button.h:71
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
This class is responsible for notifying and providing default layout logic when the orientation of th...
Definition InterfaceOrientationController.h:27
void run(QSplitter *splitter, bool inverted_splitter=false)
void run(Ribbon *widget, RibbonLayoutMode horz_mode=RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode=RibbonLayoutMode::e_vertical)
void run(Button *w, Button::ButtonState horz=Button::ButtonState::e_push_button, Button::ButtonState vert=Button::ButtonState::e_large)
void run(PointWidget *widget, uint04 lines_horz=2, uint04 lines_vert=3)
void setHorizontal(bool is_horizontal)
void run(QCustomTabWidget *w, bool inverted_stack=false)
void run(RibbonSubGroup *widget, RibbonLayoutMode horz_mode=RibbonLayoutMode::e_horizontal, RibbonLayoutMode vert_mode=RibbonLayoutMode::e_vertical)
void run(QBoxLayout *l, QBoxLayout::Direction horz=QBoxLayout::LeftToRight, QBoxLayout::Direction vert=QBoxLayout::TopToBottom)
static InterfaceOrientationController & Default()
Allows the user to input an N-dimensional point (up to 4 dimensions) with an optinal unit....
Definition PointWidget.h:57
A tab widget provides a tab area and a "page area" that is used to display pages related to each tab....
Definition QCustomTabWidget.h:45
The UI ribbon is a horizontal menu bar typically located at the top of the application interface or a...
Definition Ribbon.h:54
Represents a sub-section of "Tab" of a ribbon represting a grouping of buttons or widgets within a ta...
Definition RibbonSubGroup.h:47
Definition ACIColor.h:37
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