-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscrollbar.lua
More file actions
33 lines (27 loc) · 894 Bytes
/
scrollbar.lua
File metadata and controls
33 lines (27 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--
-- Extends core.scrollbar to allow propagating force status to child elements.
--
---@type core.scrollbar
local CoreScrollBar = require "core.scrollbar"
---@class widget.scrollbar : core.scrollbar
---@overload fun(parent?:widget, options?:table):widget.scrollbar
---@field super widget.scrollbar
---@field widget_parent widget
local ScrollBar = CoreScrollBar:extend()
function ScrollBar:new(parent, options)
self.widget_parent = parent
ScrollBar.super.new(self, options)
end
function ScrollBar:set_forced_status(status)
ScrollBar.super.set_forced_status(self, status)
if self.widget_parent and self.widget_parent.childs then
for _, child in pairs(self.widget_parent.childs) do
if self.direction == "v" then
child.v_scrollbar:set_forced_status(status)
else
child.h_scrollbar:set_forced_status(status)
end
end
end
end
return ScrollBar