![]() |
ImFusion SDK 4.3
|
#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: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.
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) |
|
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.
|
virtual |
Moves the specified edge of a view.
| view | the view to be moved |
| ratio | the new relative position of the edge defined by side |
| side | the edge that should be moved |
| split | if true the edge is split (if possible) before moving |
|
virtual |
Sets the absolute size for each view depending on edge layout and displaySize.
Returns true if the layout has changed.
|
inline |
Sets the margin between views.
Default is 0.
|
inline |
Sets whether the margin should only be applied between views but not between views and the border of the display.
Disabled by default.