@@ -113,6 +113,7 @@ pub const Element = struct {
113113 translated : []const u8 = "" ,
114114 elements : ArrayListUnmanaged (TextElement ) = .empty ,
115115 line_height : f32 = 1 ,
116+ checkbox_size : Size = .{ .width = 0 , .height = 0 },
116117 on_texture : ? * Texture = null ,
117118 off_texture : ? * Texture = null ,
118119 on_change : Callback = .{ .func = null },
@@ -1023,7 +1024,7 @@ pub const Element = struct {
10231024 // the minimum that would be needed.
10241025 self .layout_label (display , parent_inner_width );
10251026 //err("{s} {s} use width {d}", .{ self.name, @tagName(self.type), choose });
1026- return self .rect .width + self .pad .left + display . checkbox () .width ;
1027+ return self .rect .width + self .pad .left + self . type . checkbox . checkbox_size .width ;
10271028 },
10281029 .fixed = > {
10291030 //err("{s} {s} use width {d}", .{ self.name, @tagName(self.type), choose });
@@ -1709,7 +1710,7 @@ pub const Element = struct {
17091710
17101711 /// Draw a radio box combined with a text label.
17111712 inline fn draw_checkbox (element : * Element , display : * Display , _ : Vector , _ : ? Clip , scroll_offset : Vector ) void {
1712- const checkbox = display . checkbox () ;
1713+ const checkbox = element . type . checkbox . checkbox_size ;
17131714 element .draw_label (display , scroll_offset , null );
17141715 var dest : Rect = .{
17151716 .x = element .rect .x + element .rect .width - checkbox .width - element .pad .left ,
@@ -2148,9 +2149,9 @@ pub const Element = struct {
21482149 /// Calculate how many pixels of text we can draw until we must wrap to
21492150 /// the next line. By default the width is whatever the parent element
21502151 /// has room for.
2151- fn word_wrap_line (element : * Element , display : * Display , max_parent_width : f32 ) f32 {
2152+ fn word_wrap_line (element : * Element , _ : * Display , max_parent_width : f32 ) f32 {
21522153 var element_padding = element .pad .left + element .pad .right ;
2153- if (element .type == .checkbox ) element_padding += display . checkbox () .width ;
2154+ if (element .type == .checkbox ) element_padding += element . type . checkbox . checkbox_size .width ;
21542155
21552156 // If a fixed width is specified, clamp to the fixed width
21562157 const wrap = switch (element .layout .x ) {
0 commit comments