libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
Layout

Containers that position and size their children from rules instead of pixel offsets: GuiRow, GuiColumn, GuiGrid and GuiOverlay (options per child in GuiItem), plus the platform-agnostic solver behind them and selection navigation across nested containers. More...

Classes

class  GuiLayout
 Base of the layout containers. Not used directly; see GuiRow, GuiColumn, GuiGrid, GuiOverlay. More...
 
class  GuiRow
 Lays children out left to right. More...
 
class  GuiColumn
 Lays children out top to bottom. More...
 
class  GuiGrid
 Lays children out in rows of a set number of columns. More...
 
class  GuiOverlay
 Stacks children in one box, each aligned inside it (centered by default). More...
 
struct  GuiInsets
 Space around the inside edge of a container. More...
 
struct  GuiStackItem
 One child of a stack, as the solver sees it. More...
 
struct  GuiStackSpec
 Rules for a row or column. More...
 
struct  GuiLayoutResult
 The solver's answer: the container's size and each item's rectangle. More...
 
struct  GuiGridItem
 One child of a grid. More...
 
struct  GuiGridSpec
 Rules for a grid, filled row by row. More...
 
struct  GuiOverlayItem
 One child of an overlay. More...
 
struct  GuiOverlaySpec
 Rules for an overlay: children share one box. More...
 
struct  GuiNavItem
 An item that selection can move between. More...
 

Enumerations

enum class  LAYOUT_ALIGN { LAYOUT_ALIGN::START , LAYOUT_ALIGN::CENTRE , LAYOUT_ALIGN::END , LAYOUT_ALIGN::STRETCH }
 How an item sits across the main direction of a stack, or inside a grid cell. More...
 
enum class  LAYOUT_JUSTIFY { LAYOUT_JUSTIFY::START , LAYOUT_JUSTIFY::CENTRE , LAYOUT_JUSTIFY::END , LAYOUT_JUSTIFY::SPACE_BETWEEN }
 How leftover space along a stack's main direction is spent (when no item grows). More...
 
enum class  NAV_DIR { LEFT , RIGHT , UP , DOWN }
 Directions for moving the selection. More...
 

Functions

GuiLayoutResult GuiSolveStack (const GuiStackSpec &spec, const std::vector< GuiStackItem > &items)
 Lays items out along one axis.
 
GuiLayoutResult GuiSolveGrid (const GuiGridSpec &spec, const std::vector< GuiGridItem > &items)
 Lays items out in rows.
 
GuiLayoutResult GuiSolveOverlay (const GuiOverlaySpec &spec, const std::vector< GuiOverlayItem > &items)
 Stacks items on top of each other in one box.
 
int GuiNavigate (const std::vector< GuiNavItem > &items, int current, NAV_DIR dir)
 Picks which item the selection moves to.
 

Variables

bool hasAlignH
 Per-child options passed to GuiLayout::add().
 

Detailed Description

Containers that position and size their children from rules instead of pixel offsets: GuiRow, GuiColumn, GuiGrid and GuiOverlay (options per child in GuiItem), plus the platform-agnostic solver behind them and selection navigation across nested containers.

Enumeration Type Documentation

◆ LAYOUT_ALIGN

enum class LAYOUT_ALIGN
strong

How an item sits across the main direction of a stack, or inside a grid cell.

Enumerator
START 

Top or left.

CENTRE 

Centered.

END 

Bottom or right.

STRETCH 

Fills the available space.

Definition at line 20 of file GuiLayoutSolver.h.

◆ LAYOUT_JUSTIFY

enum class LAYOUT_JUSTIFY
strong

How leftover space along a stack's main direction is spent (when no item grows).

Enumerator
START 

Items packed at the start.

CENTRE 

Items packed in the middle.

END 

Items packed at the end.

SPACE_BETWEEN 

First item at the start, last at the end, equal gaps between.

Definition at line 29 of file GuiLayoutSolver.h.

◆ NAV_DIR

enum class NAV_DIR
strong

Directions for moving the selection.

Definition at line 127 of file GuiLayoutSolver.h.

Function Documentation

◆ GuiNavigate()

int GuiNavigate ( const std::vector< GuiNavItem > & items,
int current,
NAV_DIR dir )

Picks which item the selection moves to.

Chooses the nearest selectable item in the direction, preferring ones that line up. Moving sideways past the end of a row continues on the next (or previous) row; moving up or down stops at the edge.

Parameters
itemsEverything on screen that could take the selection
currentIndex of the selected item, or -1 for none (picks the first in reading order)
dirDirection of travel
Returns
Index of the new selection, or -1 to leave it where it is

Definition at line 221 of file GuiLayoutSolver.cpp.

◆ GuiSolveGrid()

GuiLayoutResult GuiSolveGrid ( const GuiGridSpec & spec,
const std::vector< GuiGridItem > & items )

Lays items out in rows.

Without a fixed width, each column is as wide as its widest item; with one, the columns share the width equally. Rows are as tall as their tallest item.

Definition at line 99 of file GuiLayoutSolver.cpp.

◆ GuiSolveOverlay()

GuiLayoutResult GuiSolveOverlay ( const GuiOverlaySpec & spec,
const std::vector< GuiOverlayItem > & items )

Stacks items on top of each other in one box.

The box fits the largest non-background item.

Definition at line 165 of file GuiLayoutSolver.cpp.

◆ GuiSolveStack()

GuiLayoutResult GuiSolveStack ( const GuiStackSpec & spec,
const std::vector< GuiStackItem > & items )

Lays items out along one axis.

Items keep their natural size unless they grow (main axis) or stretch (cross axis). Space is never taken back: if the content is larger than a fixed container it overflows.

Definition at line 25 of file GuiLayoutSolver.cpp.

Variable Documentation

◆ hasAlignH

bool hasAlignH

Per-child options passed to GuiLayout::add().

Setters chain: row.add(&label, GuiItem().grow(1)) ! struct GuiItem { float growWeight; /*!< Share of leftover space along a stack's main axis (0 = none). Horizontal alignment was set.

Definition at line 24 of file GuiLayout.h.