Function draw_button

Source
pub fn draw_button(
    rect: Rect,
    label: &str,
    variant: ButtonVariant,
    style: ButtonStyle,
    text: &mut TextSystem,
) -> Vec<DrawCmd>
Expand description

Produces immediate-mode draw commands for a text-only button snapshot.

ButtonVariant::Default preserves the supplied style; every other variant replaces it with default-theme styling for that variant. Only normal states are used. Non-inset shadows, background, one unwrapped label, and border are emitted in that order. The rectangle and custom geometry are not validated.

ยงExamples

use ailloli_ui_core::Rect;
use ailloli_ui_text::TextSystem;
use ailloli_ui_widgets::controls::{ButtonStyle, ButtonVariant};
use ailloli_ui_widgets::controls::button::draw_button;
let mut text = TextSystem::new();
let commands = draw_button(
    Rect::new(0.0, 0.0, 120.0, 36.0),
    "Save",
    ButtonVariant::Default,
    ButtonStyle::primary(),
    &mut text,
);
assert!(!commands.is_empty());