pite_core/nodes/
button.rs1use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
7
8pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
9 type_name: "Button",
10 description: "Clickable rectangle with a caption. Fires the engine-owned `pressed` signal.",
11 inherits: Some("Control"),
12 abstract_class: false,
13 props: PROPS,
14};
15
16pub static PROPS: &[PropSchema] = &[
17 PropSchema {
18 key: "text",
19 label: "Text",
20 doc: "Caption drawn centered on the button.",
21 default_value: DefaultPropVal::Str(""),
22 hint: PropHint::Text,
23 read_only: false,
24 },
25 PropSchema {
26 key: "color",
27 label: "Color",
28 doc: "Fill color as sRGB hex with alpha, e.g. `#334155ff`.",
29 default_value: DefaultPropVal::Color([51, 65, 85, 255]),
30 hint: PropHint::Color,
31 read_only: false,
32 },
33 PropSchema {
34 key: "size",
35 label: "Size",
36 doc: "Hit rectangle size in world units; both rendering and click hit-testing use it.",
37 default_value: DefaultPropVal::Vec2(120.0, 40.0),
38 hint: PropHint::Vec2 { speed: 1.0 },
39 read_only: false,
40 },
41 PropSchema {
42 key: "disabled",
43 label: "Disabled",
44 doc: "When true the button draws dimmed and ignores clicks.",
45 default_value: DefaultPropVal::Bool(false),
46 hint: PropHint::Bool,
47 read_only: false,
48 },
49];