ImFusion SDK 4.3
DisplayLayout Class Reference

#include <ImFusion/GUI/DisplayLayout.h>

Tiling-based layouting class for arranging Views inside a Display in a non-overlapping fashion. More...

+ Inheritance diagram for DisplayLayout:

Detailed Description

Tiling-based layouting class for arranging Views inside a Display in a non-overlapping fashion.

This class serves as runtime representation to configure the placement and size of views inside a DisplayBase. It does so by recursively subdividing the available viewport either horizontally or vertically. Each tile is then consumed by exactly one View. Furthermore, it provides a handleInputEvent() function so that users can interactively change the layout with their mouse.

The DisplayLayout uses a local relative coordinate system where all edge positions are defined in [0..1] range independent of the actual pixel viewport size of the parent Display.

Note
Manually specifying a DisplayLayout through a series of recursive subdivisions can be unintuitive and cumbersome. We recommend using the DisplayLayoutConfig class instead. It describes the layout in a table/grid-like fashion and is much simpler to manually specify. Use loadConfiguration() and retrieveConfiguration() to convert between the two.
See also
DisplayBase, DisplayLayoutConfig, DisplayAutoLayouter

Public Types

enum  RepositionType { None , Vertical , Horizontal , Both }
 
enum  Edge { Left = 0 , Right = 1 , Bottom = 2 , Top = 3 }
 

Public Member Functions

virtual bool loadConfiguration (const DisplayLayoutConfig &config)
 Arranges cells according to the configuration.
 
virtual DisplayLayoutConfig retrieveConfiguration ()
 Generates a layout configuration from the current layout.
 
virtual void addView (GUI::View *view, Edge side, GUI::View *neighbor)
 Adds a new view at the specified side of the given node. If neighbor is 0, the view is inserted at a border edge.
 
virtual bool removeView (const GUI::View *view)
 Removes the given view from the layout.
 
virtual void removeAll ()
 Removes all views from the layout.
 
virtual void resizeView (GUI::View *view, float ratio, Edge side, bool split)
 Moves the specified edge of a view.
 
virtual void viewSize (GUI::View *view, float *left, float *right, float *bottom, float *top)
 Returns the relative view size.
 
virtual bool layout (const GL::Viewport &displaySize, const std::vector< GUI::View * > &views, bool animate=true)
 Sets the absolute size for each view depending on edge layout and displaySize.
 
virtual void setInteractionsEnabled (bool enable)
 Enables/Disables mouse interactions (enabled by default)
 
void setMargin (int m)
 Sets the margin between views.
 
void setMarginOnlyBetweenViews (bool enable)
 Sets whether the margin should only be applied between views but not between views and the border of the display.
 
EventResult handleInputEvent (const InputEvent &event)
 Handles incoming MouseEvents to resize the views of the current layout.
 

Protected Member Functions

GUI::EventResult handleMouseEvent (const GUI::MouseEvent &event)
 

Member Function Documentation

◆ retrieveConfiguration()

virtual DisplayLayoutConfig retrieveConfiguration ( )
virtual

Generates a layout configuration from the current layout.

This is not necessarily the same configuration that was loaded before. More specifically the configuration is generated by creating one row/column per edge and won't contain any sub-configuration.

◆ resizeView()

virtual void resizeView ( GUI::View * view,
float ratio,
Edge side,
bool split )
virtual

Moves the specified edge of a view.

Parameters
viewthe view to be moved
ratiothe new relative position of the edge defined by side
sidethe edge that should be moved
splitif true the edge is split (if possible) before moving

◆ layout()

virtual bool layout ( const GL::Viewport & displaySize,
const std::vector< GUI::View * > & views,
bool animate = true )
virtual

Sets the absolute size for each view depending on edge layout and displaySize.

Returns true if the layout has changed.

◆ setMargin()

void setMargin ( int m)
inline

Sets the margin between views.

Default is 0.

◆ setMarginOnlyBetweenViews()

void setMarginOnlyBetweenViews ( bool enable)
inline

Sets whether the margin should only be applied between views but not between views and the border of the display.

Disabled by default.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close