ok/cancel buttons in file dialog
This commit is contained in:
parent
d71e7fcfc8
commit
07b4fce750
|
@ -1,5 +1,5 @@
|
||||||
draw_file_dialog = function()
|
draw_file_dialog = function()
|
||||||
draw_file_dialog_input()
|
-- border
|
||||||
App.color{r=0.6, g=0.7, b=0.6}
|
App.color{r=0.6, g=0.7, b=0.6}
|
||||||
love.graphics.rectangle('line',
|
love.graphics.rectangle('line',
|
||||||
Menu_left+5,
|
Menu_left+5,
|
||||||
|
@ -7,6 +7,19 @@ draw_file_dialog = function()
|
||||||
Safe_width-Menu_left-10,
|
Safe_width-Menu_left-10,
|
||||||
Safe_height-Menu_top-10,
|
Safe_height-Menu_top-10,
|
||||||
5,5)
|
5,5)
|
||||||
|
-- ok/cancel buttons (but with wider names)
|
||||||
|
local r = Safe_width-10
|
||||||
|
r = right_justified_button('cancel', r, Menu_top+5+3, function()
|
||||||
|
reset_file_dialog_state()
|
||||||
|
end)
|
||||||
|
r = right_justified_button('submit', r, Menu_top+5+3, function()
|
||||||
|
File_dialog_callback(File_dialog_input_text)
|
||||||
|
reset_file_dialog_state()
|
||||||
|
end)
|
||||||
|
File_dialog_input_right_margin = r
|
||||||
|
-- input
|
||||||
|
draw_file_dialog_input()
|
||||||
|
-- filtered files
|
||||||
App.color(Menu_background)
|
App.color(Menu_background)
|
||||||
love.graphics.rectangle('fill',
|
love.graphics.rectangle('fill',
|
||||||
Menu_left+5,
|
Menu_left+5,
|
||||||
|
|
|
@ -2,7 +2,7 @@ refresh_file_dialog_input_start = function()
|
||||||
local len = utf8.len(File_dialog_input_text)
|
local len = utf8.len(File_dialog_input_text)
|
||||||
for start=0,len do
|
for start=0,len do
|
||||||
local s = File_dialog_input_text:sub(start)
|
local s = File_dialog_input_text:sub(start)
|
||||||
if App.width(s) < Safe_width-Menu_left-15-15 then
|
if App.width(s) < File_dialog_input_right_margin-15 then
|
||||||
File_dialog_input_draw_suffix = s
|
File_dialog_input_draw_suffix = s
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
right_justified_button = function(name, x, y, callback)
|
right_justified_button = function(name, x, y, callback)
|
||||||
local w = App.width('settings')
|
local w = App.width(name)
|
||||||
local x = x-5-w-5
|
local x = x-5-w-5
|
||||||
styled_button('settings', x, y, callback)
|
styled_button(name, x, y, callback)
|
||||||
return x
|
return x-10
|
||||||
end
|
end
|
|
@ -0,0 +1 @@
|
||||||
|
File_dialog_input_right_margin = 0
|
Loading…
Reference in New Issue