NDEVR
API Documentation
InterfaceOrientationController

This class is responsible for notifying and providing default layout logic when the orientation of the widget changes, such as for a screen rotaton. More...

Public Member Functions

bool isHorizontalMode ()
 Returns whether the current mode is horizontal.
void remove (QObject *widget)
 Removes a widget from orientation tracking.
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 (PointWidget *widget, uint04 lines_horz=2, uint04 lines_vert=3)
 Registers a PointWidget to change its line count 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.
void run (QCustomTabWidget *w, bool inverted_stack=false)
 Registers a QCustomTabWidget to update on orientation change.
void run (QSplitter *splitter, bool inverted_splitter=false)
 Registers a QSplitter to change orientation on layout change.
void run (QWidget *object, const std::function< void(bool is_horizontal)> &function)
 Registers a widget with a custom callback for orientation changes.
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 (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 setHorizontal (bool is_horizontal)
 Sets the orientation mode and updates all registered widgets.

Static Public Member Functions

static InterfaceOrientationController & Default ()
 Returns the default global InterfaceOrientationController instance.
static bool isScreenHorizontal ()
 Returns whether the screen is currently in horizontal (landscape) orientation.

Detailed Description

This class is responsible for notifying and providing default layout logic when the orientation of the widget changes, such as for a screen rotaton.


Especially useful for phones that may change orientation. For example, QBoxLayouts will be set to vertical when the screen is vertical and horizontal when the screen is horizontal. Widgets can be added inverted, meaning the opposite of the default layout behavior will occur. Widget will be laid out as soon as run is called on it, and subsequently when the interface layout changes. Provided widget is destroyed on the main thread, there is no need to automatically remove it from the controller.

Definition at line 27 of file InterfaceOrientationController.h.

Member Function Documentation

◆ Default()

InterfaceOrientationController & InterfaceOrientationController::Default ( )
static

Returns the default global InterfaceOrientationController instance.

Returns
A reference to the default controller.

References setHorizontal().

Referenced by TransitIncidentPedestrianEditor::TransitIncidentPedestrianEditor(), and TransitIncidentVehiclesEditor::TransitIncidentVehiclesEditor().

◆ isHorizontalMode()

bool InterfaceOrientationController::isHorizontalMode ( )

Returns whether the current mode is horizontal.

Returns
True if horizontal mode is active.

◆ isScreenHorizontal()

bool InterfaceOrientationController::isScreenHorizontal ( )
static

Returns whether the screen is currently in horizontal (landscape) orientation.

Returns
True if the screen is horizontal.

◆ remove()

void InterfaceOrientationController::remove ( QObject * widget)

Removes a widget from orientation tracking.

Parameters
[in]widgetThe widget to remove.

◆ run() [1/8]

void InterfaceOrientationController::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.

Parameters
[in]wThe button to manage.
[in]horzButton state when horizontal.
[in]vertButton state when vertical.

References Button::e_large, and Button::e_push_button.

◆ run() [2/8]

void InterfaceOrientationController::run ( PointWidget * widget,
uint04 lines_horz = 2,
uint04 lines_vert = 3 )

Registers a PointWidget to change its line count on orientation change.

Parameters
[in]widgetThe point widget to manage.
[in]lines_horzNumber of lines when horizontal.
[in]lines_vertNumber of lines when vertical.

◆ run() [3/8]

void InterfaceOrientationController::run ( QBoxLayout * l,
QBoxLayout::Direction horz = QBoxLayout::LeftToRight,
QBoxLayout::Direction vert = QBoxLayout::TopToBottom )

Registers a QBoxLayout to switch direction on orientation change.

Parameters
[in]lThe box layout to manage.
[in]horzDirection when horizontal.
[in]vertDirection when vertical.

◆ run() [4/8]

void InterfaceOrientationController::run ( QCustomTabWidget * w,
bool inverted_stack = false )

Registers a QCustomTabWidget to update on orientation change.

Parameters
[in]wThe tab widget to manage.
[in]inverted_stackWhether to invert the default orientation behavior.

◆ run() [5/8]

void InterfaceOrientationController::run ( QSplitter * splitter,
bool inverted_splitter = false )

Registers a QSplitter to change orientation on layout change.

Parameters
[in]splitterThe splitter to manage.
[in]inverted_splitterWhether to invert the default orientation behavior.

◆ run() [6/8]

void InterfaceOrientationController::run ( QWidget * object,
const std::function< void(bool is_horizontal)> & function )

Registers a widget with a custom callback for orientation changes.

Parameters
[in]objectThe widget to track (automatically removed on destruction).
[in]functionCallback invoked with true for horizontal, false for vertical.

Referenced by TransitIncidentPedestrianEditor::TransitIncidentPedestrianEditor(), and TransitIncidentVehiclesEditor::TransitIncidentVehiclesEditor().

◆ run() [7/8]

void InterfaceOrientationController::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.

Parameters
[in]widgetThe ribbon to manage.
[in]horz_modeLayout mode when horizontal.
[in]vert_modeLayout mode when vertical.

◆ run() [8/8]

void InterfaceOrientationController::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.

Parameters
[in]widgetThe ribbon sub-group to manage.
[in]horz_modeLayout mode when horizontal.
[in]vert_modeLayout mode when vertical.

◆ setHorizontal()

void InterfaceOrientationController::setHorizontal ( bool is_horizontal)

Sets the orientation mode and updates all registered widgets.

Parameters
[in]is_horizontalWhether to use horizontal layout.

Referenced by Default().


The documentation for this class was generated from the following file: