#344 added focus navigation to checkboxes and radio buttons, refactor of enable handlers

This commit is contained in:
Mikayla Fischler
2023-09-23 14:31:37 -04:00
parent 1f9743efd0
commit 645a5f5137
8 changed files with 100 additions and 31 deletions

View File

@@ -321,6 +321,12 @@ function element.new(args, child_offset_x, child_offset_y)
---@param id element_id element identifier
function protected.on_removed(id) end
-- handle enabled
function protected.on_enabled() end
-- handle disabled
function protected.on_disabled() end
-- handle this element having been focused
function protected.on_focused() end
@@ -369,12 +375,6 @@ function element.new(args, child_offset_x, child_offset_y)
---@param max integer maximum allowed value
function protected.set_max(max) end
-- enable the control
function protected.enable() end
-- disable the control
function protected.disable() end
-- custom recolor command, varies by element if implemented
---@vararg cpair|color color(s)
function protected.recolor(...) end
@@ -599,7 +599,7 @@ function element.new(args, child_offset_x, child_offset_y)
function public.enable()
if not protected.enabled then
protected.enabled = true
protected.enable()
protected.on_enabled()
end
end
@@ -607,7 +607,7 @@ function element.new(args, child_offset_x, child_offset_y)
function public.disable()
if protected.enabled then
protected.enabled = false
protected.disable()
protected.on_disabled()
public.unfocus_all()
end
end