Files

30 lines
955 B
GDScript

class_name P91Widgets
extends RefCounted
static func label(value: String, font_size: int, color: Color) -> Label:
var result := Label.new()
result.text = value
result.add_theme_font_size_override("font_size", font_size)
result.add_theme_color_override("font_color", color)
return result
static func button(node_name: String, label_text: String, callback: Callable) -> Button:
var result := Button.new()
result.name = node_name
result.text = label_text
result.custom_minimum_size = Vector2(44, 44)
result.pressed.connect(callback, CONNECT_DEFERRED)
return result
static func style(fill: Color, border: Color, width: int) -> StyleBoxFlat:
var result := StyleBoxFlat.new()
result.bg_color = fill
result.border_color = border
result.set_border_width_all(width)
result.set_corner_radius_all(5)
result.content_margin_left = 10
result.content_margin_right = 10
result.content_margin_top = 7
result.content_margin_bottom = 7
return result