boing 0.7.0

A safe wrapper over libui-ng-sys
Documentation
// SPDX-License-Identifier: MPL-2.0

//! A tabular collection of controls.

use crate::prelude::*;

impl Ui {
    /// Creates a new [`Grid`].
    pub fn create_grid<'ui>(&'ui self) -> Result<&'ui mut Grid, crate::Error> {
        unsafe { call_libui_new_fn!(ui: self, fn: uiNewGrid() -> Grid) }
    }
}

/// A tabular collection of controls.
#[subcontrol(handle = "uiGrid")]
pub struct Grid;

impl Grid<'_> {
    /// Determines if this grid is padded.
    ///
    /// Grids are not padded by default.
    #[inline]
    pub fn is_padded(&self) -> bool {
        bool_from_libui(unsafe { uiGridPadded(self.as_ptr()) })
    }

    /// Sets whether or not this grid is padded.
    #[inline]
    pub fn set_padded(&self, value: bool) {
        unsafe { uiGridSetPadded(self.as_ptr(), value.into()) }
    }
}