mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-18 05:21:47 +03:00
25 lines
534 B
Ruby
25 lines
534 B
Ruby
module GUI
|
|
# Helper methods to help creating a "button palette" kind of window.
|
|
module ButtonPalette
|
|
def add_button(label)
|
|
Button.new(@container).tap do |btn|
|
|
btn.glue_obj(true)
|
|
btn.set_label(label)
|
|
btn.event_handler = ->(event) do
|
|
case event
|
|
when LVGL::EVENT::CLICKED
|
|
yield
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def add_buttons(list)
|
|
list.each do |pair|
|
|
label, action = pair
|
|
add_button(label, &action)
|
|
end
|
|
end
|
|
end
|
|
end
|