本文整理匯總了Golang中github.com/nelsam/gxui.Theme.CreateScrollBar方法的典型用法代碼示例。如果您正苦於以下問題:Golang Theme.CreateScrollBar方法的具體用法?Golang Theme.CreateScrollBar怎麽用?Golang Theme.CreateScrollBar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/nelsam/gxui.Theme
的用法示例。
在下文中一共展示了Theme.CreateScrollBar方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Init
func (t *TextBox) Init(outer TextBoxOuter, driver gxui.Driver, theme gxui.Theme, font gxui.Font) {
t.List.Init(outer, theme)
t.Focusable.Init(outer)
t.outer = outer
t.driver = driver
t.font = font
t.onRedrawLines = gxui.CreateEvent(func() {})
t.controller = gxui.CreateTextBoxController()
t.adapter = &TextBoxAdapter{TextBox: t}
t.desiredWidth = 100
t.SetScrollBarEnabled(false) // Defaults to single line
t.OnGainedFocus(func() { t.onRedrawLines.Fire() })
t.OnLostFocus(func() { t.onRedrawLines.Fire() })
t.horizScroll = theme.CreateScrollBar()
t.horizScrollChild = t.AddChild(t.horizScroll)
t.horizScroll.SetOrientation(gxui.Horizontal)
t.horizScroll.OnScroll(func(from, to int) {
t.SetHorizOffset(from)
})
t.controller.OnTextChanged(func([]gxui.TextBoxEdit) {
t.onRedrawLines.Fire()
t.List.DataChanged(false)
})
t.controller.OnSelectionChanged(func() {
t.onRedrawLines.Fire()
})
t.List.SetAdapter(t.adapter)
// Interface compliance test
_ = gxui.TextBox(t)
}
示例2: Init
func (l *ScrollLayout) Init(outer ScrollLayoutOuter, theme gxui.Theme) {
l.Container.Init(outer, theme)
l.BackgroundBorderPainter.Init(outer)
l.outer = outer
l.theme = theme
l.canScrollX = true
l.canScrollY = true
scrollBarX := theme.CreateScrollBar()
scrollBarX.SetOrientation(gxui.Horizontal)
scrollBarX.OnScroll(func(from, to int) { l.SetScrollOffset(math.Point{X: from, Y: l.scrollOffset.Y}) })
scrollBarY := theme.CreateScrollBar()
scrollBarY.SetOrientation(gxui.Vertical)
scrollBarY.OnScroll(func(from, to int) { l.SetScrollOffset(math.Point{X: l.scrollOffset.X, Y: from}) })
l.scrollBarX = l.AddChild(scrollBarX)
l.scrollBarY = l.AddChild(scrollBarY)
l.SetMouseEventTarget(true)
// Interface compliance test
_ = gxui.ScrollLayout(l)
}
示例3: Init
func (l *List) Init(outer ListOuter, theme gxui.Theme) {
l.outer = outer
l.Container.Init(outer, theme)
l.BackgroundBorderPainter.Init(outer)
l.Focusable.Init(outer)
l.theme = theme
l.scrollBar = theme.CreateScrollBar()
l.scrollBarChild = l.AddChild(l.scrollBar)
l.scrollBarEnabled = true
l.scrollBar.OnScroll(func(from, to int) { l.SetScrollOffset(from) })
l.SetOrientation(gxui.Vertical)
l.SetBackgroundBrush(gxui.TransparentBrush)
l.SetMouseEventTarget(true)
l.details = make(map[gxui.AdapterItem]itemDetails)
// Interface compliance test
_ = gxui.List(l)
}