本文整理汇总了Golang中github.com/google/gxui.CreateEvent函数的典型用法代码示例。如果您正苦于以下问题:Golang CreateEvent函数的具体用法?Golang CreateEvent怎么用?Golang CreateEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Init
func (b *SplitterBar) Init(outer SplitterBarOuter, theme gxui.Theme) {
b.Control.Init(outer, theme)
b.outer = outer
b.theme = theme
b.onDragStart = gxui.CreateEvent(func(gxui.MouseEvent) {})
b.onDragEnd = gxui.CreateEvent(func(gxui.MouseEvent) {})
b.backgroundColor = gxui.Red
b.foregroundColor = gxui.Green
}
开发者ID:liulnn,项目名称:gxui,代码行数:10,代码来源:splitter_bar.go
示例2: 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.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)
}
开发者ID:langxj,项目名称:gxui,代码行数:26,代码来源:textbox.go
示例3: Init
func (s *ScrollBar) Init(outer ScrollBarOuter, theme gxui.Theme) {
s.Control.Init(outer, theme)
s.outer = outer
s.thickness = 10
s.minBarLength = 10
s.scrollPositionFrom = 0
s.scrollPositionTo = 100
s.scrollLimit = 100
s.onScroll = gxui.CreateEvent(s.SetScrollPosition)
// Interface compliance test
_ = gxui.ScrollBar(s)
}
开发者ID:langxj,项目名称:gxui,代码行数:14,代码来源:scroll_bar.go
示例4: getOnMouseScroll
func (m *InputEventHandler) getOnMouseScroll() gxui.Event {
if m.onMouseScroll == nil {
m.onMouseScroll = gxui.CreateEvent(m.MouseScroll)
}
return m.onMouseScroll
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例5: getOnMouseUp
func (m *InputEventHandler) getOnMouseUp() gxui.Event {
if m.onMouseUp == nil {
m.onMouseUp = gxui.CreateEvent(m.MouseUp)
}
return m.onMouseUp
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例6: OnLostFocus
func (f *Focusable) OnLostFocus(l func()) gxui.EventSubscription {
if f.onLostFocus == nil {
f.onLostFocus = gxui.CreateEvent(f.LostFocus)
}
return f.onLostFocus.Listen(l)
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:focusable.go
示例7: newViewport
//.........这里部分代码省略.........
v.scrollAccumY -= float64(ev.ScrollY)
v.Unlock()
v.onMouseScroll.Fire(ev)
} else {
v.Unlock()
}
})
}
v.pendingMouseScrollEvent.Point = p
v.scrollAccumX += xoff * platform.ScrollSpeed
v.scrollAccumY += yoff * platform.ScrollSpeed
v.pendingMouseScrollEvent.State = getMouseState(w)
v.Unlock()
})
wnd.SetMouseButtonCallback(func(w *glfw.Window, button glfw.MouseButton, action glfw.Action, mod glfw.ModifierKey) {
p := cursorPoint(w.GetCursorPos())
ev := gxui.MouseEvent{
Point: p,
Modifier: translateKeyboardModifier(mod),
}
ev.Button = translateMouseButton(button)
ev.State = getMouseState(w)
if action == glfw.Press {
v.onMouseDown.Fire(ev)
} else {
v.onMouseUp.Fire(ev)
}
})
wnd.SetKeyCallback(func(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {
ev := gxui.KeyboardEvent{
Key: translateKeyboardKey(key),
Modifier: translateKeyboardModifier(mods),
}
switch action {
case glfw.Press:
v.onKeyDown.Fire(ev)
case glfw.Release:
v.onKeyUp.Fire(ev)
case glfw.Repeat:
v.onKeyRepeat.Fire(ev)
}
})
wnd.SetCharModsCallback(func(w *glfw.Window, char rune, mods glfw.ModifierKey) {
if !unicode.IsControl(char) &&
!unicode.IsGraphic(char) &&
!unicode.IsLetter(char) &&
!unicode.IsMark(char) &&
!unicode.IsNumber(char) &&
!unicode.IsPunct(char) &&
!unicode.IsSpace(char) &&
!unicode.IsSymbol(char) {
return // Weird unicode character. Ignore
}
ev := gxui.KeyStrokeEvent{
Character: char,
Modifier: translateKeyboardModifier(mods),
}
v.onKeyStroke.Fire(ev)
})
wnd.SetRefreshCallback(func(w *glfw.Window) {
if v.canvas != nil {
v.render()
}
})
fw, fh := wnd.GetFramebufferSize()
posX, posY := wnd.GetPos()
// Pre-multiplied alpha blending
gl.BlendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
gl.Enable(gl.SCISSOR_TEST)
gl.Viewport(0, 0, fw, fh)
gl.Scissor(0, 0, int32(fw), int32(fh))
gl.ClearColor(kClearColorR, kClearColorG, kClearColorB, 1.0)
gl.Clear(gl.COLOR_BUFFER_BIT)
wnd.SwapBuffers()
v.window = wnd
v.driver = driver
v.onClose = driver.createAppEvent(func() {})
v.onResize = driver.createAppEvent(func() {})
v.onMouseMove = gxui.CreateEvent(func(gxui.MouseEvent) {})
v.onMouseEnter = driver.createAppEvent(func(gxui.MouseEvent) {})
v.onMouseExit = driver.createAppEvent(func(gxui.MouseEvent) {})
v.onMouseDown = driver.createAppEvent(func(gxui.MouseEvent) {})
v.onMouseUp = driver.createAppEvent(func(gxui.MouseEvent) {})
v.onMouseScroll = gxui.CreateEvent(func(gxui.MouseEvent) {})
v.onKeyDown = driver.createAppEvent(func(gxui.KeyboardEvent) {})
v.onKeyUp = driver.createAppEvent(func(gxui.KeyboardEvent) {})
v.onKeyRepeat = driver.createAppEvent(func(gxui.KeyboardEvent) {})
v.onKeyStroke = driver.createAppEvent(func(gxui.KeyStrokeEvent) {})
v.onDestroy = driver.createDriverEvent(func() {})
v.sizeDipsUnscaled = math.Size{W: width, H: height}
v.sizeDips = v.sizeDipsUnscaled.ScaleS(1 / v.scaling)
v.sizePixels = math.Size{W: fw, H: fh}
v.position = math.Point{X: posX, Y: posY}
return v
}
开发者ID:CodyGuo,项目名称:gxui,代码行数:101,代码来源:viewport.go
示例8: OnDetach
func (a *Attachable) OnDetach(f func()) gxui.EventSubscription {
if a.onDetach == nil {
a.onDetach = gxui.CreateEvent(func() {})
}
return a.onDetach.Listen(f)
}
开发者ID:langxj,项目名称:gxui,代码行数:6,代码来源:attachable.go
示例9: getOnMouseMove
func (m *InputEventHandler) getOnMouseMove() gxui.Event {
if m.onMouseMove == nil {
m.onMouseMove = gxui.CreateEvent(m.MouseMove)
}
return m.onMouseMove
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例10: getOnKeyStroke
func (m *InputEventHandler) getOnKeyStroke() gxui.Event {
if m.onKeyStroke == nil {
m.onKeyStroke = gxui.CreateEvent(m.KeyStroke)
}
return m.onKeyStroke
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例11: getOnKeyPress
func (m *InputEventHandler) getOnKeyPress() gxui.Event {
if m.onKeyPress == nil {
m.onKeyPress = gxui.CreateEvent(m.KeyPress)
}
return m.onKeyPress
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例12: getOnDoubleClick
func (m *InputEventHandler) getOnDoubleClick() gxui.Event {
if m.onDoubleClick == nil {
m.onDoubleClick = gxui.CreateEvent(m.DoubleClick)
}
return m.onDoubleClick
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例13: getOnKeyRepeat
func (m *InputEventHandler) getOnKeyRepeat() gxui.Event {
if m.onKeyRepeat == nil {
m.onKeyRepeat = gxui.CreateEvent(m.KeyRepeat)
}
return m.onKeyRepeat
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例14: Init
func (w *Window) Init(outer WindowOuter, driver gxui.Driver, width, height int, title string) {
w.Attachable.Init(outer)
w.BackgroundBorderPainter.Init(outer)
w.Container.Init(outer)
w.Paddable.Init(outer)
w.PaintChildren.Init(outer)
w.outer = outer
w.driver = driver
w.onClose = gxui.CreateEvent(func() {})
w.onResize = gxui.CreateEvent(func() {})
w.onMouseMove = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onMouseEnter = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onMouseExit = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onMouseDown = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onMouseUp = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onMouseScroll = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onKeyDown = gxui.CreateEvent(func(gxui.KeyboardEvent) {})
w.onKeyUp = gxui.CreateEvent(func(gxui.KeyboardEvent) {})
w.onKeyRepeat = gxui.CreateEvent(func(gxui.KeyboardEvent) {})
w.onKeyStroke = gxui.CreateEvent(func(gxui.KeyStrokeEvent) {})
w.onClick = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.onDoubleClick = gxui.CreateEvent(func(gxui.MouseEvent) {})
w.focusController = gxui.CreateFocusController(outer)
w.mouseController = gxui.CreateMouseController(outer, w.focusController)
w.keyboardController = gxui.CreateKeyboardController(outer)
w.onResize.Listen(func() {
w.outer.LayoutChildren()
w.Draw()
})
w.SetBorderPen(gxui.TransparentPen)
w.setViewport(driver.CreateWindowedViewport(width, height, title))
// Window starts shown
w.Attach()
// Interface compliance test
_ = gxui.Window(w)
}
开发者ID:4ydx,项目名称:gxui,代码行数:44,代码来源:window.go
示例15: OnHideList
func (l *DropDownList) OnHideList(f func()) gxui.EventSubscription {
if l.onHideList == nil {
l.onHideList = gxui.CreateEvent(f)
}
return l.onHideList.Listen(f)
}
开发者ID:linux-mac,项目名称:gxui,代码行数:6,代码来源:drop_down_list.go
示例16: getOnMouseEnter
func (m *InputEventHandler) getOnMouseEnter() gxui.Event {
if m.onMouseEnter == nil {
m.onMouseEnter = gxui.CreateEvent(m.MouseEnter)
}
return m.onMouseEnter
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例17: getOnMouseExit
func (m *InputEventHandler) getOnMouseExit() gxui.Event {
if m.onMouseExit == nil {
m.onMouseExit = gxui.CreateEvent(m.MouseExit)
}
return m.onMouseExit
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例18: OnSelectionChanged
func (l *List) OnSelectionChanged(f func(gxui.AdapterItem)) gxui.EventSubscription {
if l.onItemClicked == nil {
l.onSelectionChanged = gxui.CreateEvent(f)
}
return l.onSelectionChanged.Listen(f)
}
开发者ID:langxj,项目名称:gxui,代码行数:6,代码来源:list.go
示例19: getOnMouseDown
func (m *InputEventHandler) getOnMouseDown() gxui.Event {
if m.onMouseDown == nil {
m.onMouseDown = gxui.CreateEvent(m.MouseDown)
}
return m.onMouseDown
}
开发者ID:liulnn,项目名称:gxui,代码行数:6,代码来源:input_event_handler.go
示例20: OnChange
// OnChange registers f to be called when the node is expanded, collapsed or has
// a change in the number of children.
func (n *TreeToListNode) OnChange(f func()) gxui.EventSubscription {
if n.onChange == nil {
n.onChange = gxui.CreateEvent(f)
}
return n.onChange.Listen(f)
}
开发者ID:liulnn,项目名称:gxui,代码行数:8,代码来源:tree_to_list_node.go
注:本文中的github.com/google/gxui.CreateEvent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论