Skip to main content

Module region

Module region 

Source
Expand description

Region and layout management module for the matrix_gui framework.

This module provides utilities for defining and managing widget regions within the GUI. It includes:

  • Region: A struct representing a rectangular area with an associated widget ID
  • Layout functions for arranging widgets in grid patterns
  • Macros for generating region IDs and layouts at compile time

§Core Concepts

§Regions

A Region represents a rectangular area on the screen where a widget can be placed. Each region has an associated widget ID that uniquely identifies it.

§Layouts

The module provides several layout functions for arranging regions in grids:

  • Row-major: Regions are arranged left-to-right, top-to-bottom
  • Column-major: Regions are arranged top-to-bottom, left-to-right
  • Both runtime and compile-time variants are available

§Macros

The module provides several macros for generating region layouts:

  • [free_form_region!]: Define regions with custom positions and sizes
  • [region_id!]: Generate region ID enums
  • [grid_layout_row_major!]: Create row-major grid layouts
  • [grid_layout_column_major!]: Create column-major grid layouts
  • [grid_layout_row_major_with_start!]: Create grid layouts with custom start ID
  • [grid_layout_column_major_with_start!]: Create grid layouts with custom start ID

Structs§

Region
A region representing a rectangular area with an associated widget ID.

Functions§

const_grid_layout_column_major
Creates a column-major grid layout at compile time.
const_grid_layout_row_major
Creates a row-major grid layout at compile time.
grid_layout_column_major
Creates a column-major grid layout and returns it as an array.
grid_layout_column_major_mut
Creates a column-major grid layout in place.
grid_layout_row_major
Creates a row-major grid layout and returns it as an array.
grid_layout_row_major_mut
Creates a row-major grid layout in place.