dgui: Scrollbar width changeable after initialization

Closes #699
This commit is contained in:
fireclawthefox 2019-08-02 23:23:01 +02:00 committed by rdb
parent c395460390
commit 2b64a7d74f

View File

@ -33,7 +33,7 @@ class DirectScrolledFrame(DirectFrame):
('canvasSize', (-1, 1, -1, 1), self.setCanvasSize),
('manageScrollBars', 1, self.setManageScrollBars),
('autoHideScrollBars', 1, self.setAutoHideScrollBars),
('scrollBarWidth', 0.08, None),
('scrollBarWidth', 0.08, self.setScrollBarWidth),
('borderWidth', (0.01, 0.01), self.setBorderWidth),
)
@ -72,6 +72,11 @@ class DirectScrolledFrame(DirectFrame):
# Call option initialization functions
self.initialiseoptions(DirectScrolledFrame)
def setScrollBarWidth(self):
w = self['scrollBarWidth']
self.verticalScroll["frameSize"] = (-w / 2.0, w / 2.0, -1, 1)
self.horizontalScroll["frameSize"] = (-1, 1, -w / 2.0, w / 2.0)
def setCanvasSize(self):
f = self['canvasSize']
self.guiItem.setVirtualFrame(f[0], f[1], f[2], f[3])