mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 05:42:35 +00:00
Dialog's no longer need a fixed height, misc. dialog tweaks.
This commit is contained in:
@@ -2,32 +2,32 @@ module TAC
|
||||
class Dialog < CyberarmEngine::GuiState
|
||||
def setup
|
||||
theme(THEME)
|
||||
background Gosu::Color.new(0x88_000000)
|
||||
background Gosu::Color.new(0xaa_000000)
|
||||
|
||||
@title = @options[:title] ? @options[:title] : "#{self.class}"
|
||||
@window_width, @window_height = window.width, window.height
|
||||
@previous_state = window.previous_state
|
||||
|
||||
@dialog_root = stack width: 250, height: 400, border_thickness: 2, border_color: [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY] do
|
||||
@dialog_root = stack width: 0.25, border_thickness: 2, border_color: [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY] do
|
||||
# Title bar
|
||||
@titlebar = flow width: 1.0, height: 0.1 do
|
||||
@titlebar = flow width: 1.0 do
|
||||
background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY]
|
||||
|
||||
# title
|
||||
flow width: 0.855 do
|
||||
label @title, text_size: THEME_SUBHEADING_TEXT_SIZE, text_shadow_color: Gosu::Color::BLACK
|
||||
flow width: 0.9 do
|
||||
label @title, text_size: THEME_SUBHEADING_TEXT_SIZE, width: 1.0, text_align: :center, text_shadow: true, text_shadow_color: 0xff_222222, text_shadow_size: 1
|
||||
end
|
||||
|
||||
# Buttons
|
||||
flow width: 0.145 do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/cross.png"), image_width: 24, **THEME_DANGER_BUTTON do
|
||||
flow width: 0.0999 do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/cross.png"), image_width: 1.0, **THEME_DANGER_BUTTON do
|
||||
close
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Dialog body
|
||||
@dialog_content = stack width: 1.0, height: 0.9 do
|
||||
@dialog_content = stack width: 1.0 do
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,6 +35,10 @@ module TAC
|
||||
build
|
||||
end
|
||||
|
||||
@root_container.recalculate
|
||||
@root_container.recalculate
|
||||
@root_container.recalculate
|
||||
|
||||
center_dialog
|
||||
end
|
||||
|
||||
@@ -42,8 +46,12 @@ module TAC
|
||||
end
|
||||
|
||||
def center_dialog
|
||||
@dialog_root.style.x = window.width / 2 - @dialog_root.style.width / 2
|
||||
@dialog_root.style.y = window.height / 2 - @dialog_root.style.height / 2
|
||||
@dialog_root.style.x = window.width / 2 - @dialog_root.width / 2
|
||||
@dialog_root.style.y = window.height / 2 - @dialog_root.height / 2
|
||||
end
|
||||
|
||||
def name_filter(text)
|
||||
text.match(/[A-Za-z0-9._\- ]/) ? text : ""
|
||||
end
|
||||
|
||||
def draw
|
||||
@@ -57,10 +65,12 @@ module TAC
|
||||
super
|
||||
|
||||
if window.width != @window_width or window.height != @window_height
|
||||
center_dialog
|
||||
request_recalculate
|
||||
|
||||
@window_width, @window_height = window.width, window.height
|
||||
end
|
||||
|
||||
center_dialog
|
||||
end
|
||||
|
||||
def close
|
||||
|
||||
Reference in New Issue
Block a user