buttonIcon
Parameters
- src:std.builtin.SourceLocation
- std.builtin.SourceLocation
- name:[]const u8
- []const u8
- tvg_bytes:[]const u8
- []const u8
- init_opts:ButtonWidget.InitOptions
- ButtonWidget.InitOptions
- icon_opts:IconRenderOptions
- IconRenderOptions
- opts:Options
- Options
Source
Implementation
pub fn buttonIcon(src: std.builtin.SourceLocation, name: []const u8, tvg_bytes: []const u8, init_opts: ButtonWidget.InitOptions, icon_opts: IconRenderOptions, opts: Options) bool {
// set label on the button and clear role on icon so they don't duplicate
const defaults = Options{ .padding = Rect.all(4), .label = .{ .text = name } };
var bw: ButtonWidget = undefined;
bw.init(src, init_opts, defaults.override(opts));
bw.processEvents();
bw.drawBackground();
// When someone passes min_size_content to buttonIcon, they want the icon
// to be that size, so we pass it through.
icon(
@src(),
name,
tvg_bytes,
icon_opts,
opts.strip().override(bw.style()).override(.{ .gravity_x = 0.5, .gravity_y = 0.5, .min_size_content = opts.min_size_content, .expand = .ratio, .color_text = opts.color_text, .role = .none }),
);
const click = bw.clicked();
bw.drawFocus();
bw.deinit();
return click;
}