add status widget and attribute

This commit is contained in:
airstruck
2015-12-05 15:43:40 -05:00
parent 3daff0bcad
commit c21611748c
7 changed files with 62 additions and 55 deletions

View File

@@ -255,19 +255,7 @@ function Layout:getWidgetAt (x, y, root)
if root:isAt(x, y) then return root end
end
-- Internal, called from Widget:new
--[[
function Layout:addWidget (widget)
if widget.id then
self[widget.id] = widget
end
if widget.key then
self.accelerators[widget.key] = widget
end
end
]]
-- Add handlers for keyboard accelerators and tab focus
-- Add handlers for keyboard accelerators, tab focus, and mouse wheel scroll
function Layout:addDefaultHandlers ()
self.accelerators = {}
@@ -331,6 +319,7 @@ function Layout:addDefaultHandlers ()
end)
self:onWheelMove(function (event)
if not event.hit then return end
for widget in event.target:eachAncestor(true) do
if widget.scroll then
if not widget.scrollY then
@@ -354,6 +343,14 @@ function Layout:addDefaultHandlers ()
return false
end) -- wheel move
self:onEnter(function (event)
local statusWidget = (self.master or self).statusWidget
if not statusWidget then return end
statusWidget.text = event.target.status
return false
end)
end
Event.injectBinders(Layout)