Files
timecrafters_configuration_…/lib/dialogs/confirm_dialog.rb

33 lines
833 B
Ruby

module TAC
class Dialog
class ConfirmDialog < Dialog
def build
color = @options[:dangerous] ? Palette::DANGEROUS : Palette::ALERT
@dialog_root.style.border_color = [ color, darken(color, 50) ]
@titlebar.style.background = [ color, darken(color, 50) ]
background Gosu::Color::GRAY
label @options[:message]
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
close
end
button "Proceed", width: 0.475, **TAC::THEME_DANGER_BUTTON do
try_commit(true)
end
end
def try_commit(force = false)
if not @options[:dangerous] || force
close
@options[:callback_method].call
end
end
end
end
end
end