mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
More refactoring of summary screen code, added module UIActionHandlers
This commit is contained in:
@@ -97,6 +97,10 @@ module MenuHandlers
|
||||
@@handlers[menu]&.clear
|
||||
end
|
||||
|
||||
def get(menu, option)
|
||||
return @@handlers[menu][option]
|
||||
end
|
||||
|
||||
def each(menu)
|
||||
return if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].each { |option, hash| yield option, hash }
|
||||
@@ -125,3 +129,34 @@ module MenuHandlers
|
||||
return option_hash[function].call(*args)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module UIActionHandlers
|
||||
@@handlers = {}
|
||||
|
||||
module_function
|
||||
|
||||
def add(menu, action, hash)
|
||||
@@handlers[menu] = HandlerHash.new if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].add(action, hash)
|
||||
end
|
||||
|
||||
def remove(menu, action)
|
||||
@@handlers[menu]&.remove(action)
|
||||
end
|
||||
|
||||
def clear(menu)
|
||||
@@handlers[menu]&.clear
|
||||
end
|
||||
|
||||
def get(menu, action)
|
||||
return @@handlers[menu][action]
|
||||
end
|
||||
|
||||
def each(menu)
|
||||
return if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].each { |action, hash| yield action, hash }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user