• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang gdk.EventButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/gotk3/gotk3/gdk.EventButton的典型用法代码示例。如果您正苦于以下问题:Golang EventButton类的具体用法?Golang EventButton怎么用?Golang EventButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了EventButton类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: createAccountPopup

func (r *roster) createAccountPopup(jid string, account *account, bt *gdk.EventButton) {
	builder := builderForDefinition("AccountPopupMenu")
	obj, _ := builder.GetObject("accountMenu")
	mn := obj.(*gtk.Menu)

	builder.ConnectSignals(map[string]interface{}{
		"on_connect": func() {
			account.session.WantToBeOnline = true
			account.Connect()
		},
		"on_disconnect": func() {
			account.session.WantToBeOnline = false
			account.disconnect()
		},
		"on_edit": account.edit,
		"on_dump_info": func() {
			r.debugPrintRosterFor(account.session.GetConfig().Account)
		},
	})

	connx, _ := builder.GetObject("connectMenuItem")
	connect := connx.(*gtk.MenuItem)

	dconnx, _ := builder.GetObject("disconnectMenuItem")
	disconnect := dconnx.(*gtk.MenuItem)

	connect.SetSensitive(account.session.IsDisconnected())
	disconnect.SetSensitive(account.session.IsConnected())

	mn.ShowAll()
	mn.PopupAtMouseCursor(nil, nil, int(bt.Button()), bt.Time())
}
开发者ID:tanujmathur,项目名称:coyim,代码行数:32,代码来源:roster.go


示例2: createAccountPeerPopup

func (r *roster) createAccountPeerPopup(jid string, account *account, bt *gdk.EventButton) {
	builder := builderForDefinition("ContactPopupMenu")
	mn := getObjIgnoringErrors(builder, "contactMenu").(*gtk.Menu)

	builder.ConnectSignals(map[string]interface{}{
		"on_remove_contact": func() {
			account.session.RemoveContact(jid)
			r.ui.removePeer(account, jid)
			r.redraw()
		},
		"on_allow_contact_to_see_status": func() {
			account.session.ApprovePresenceSubscription(jid, "" /* generate id */)
		},
		"on_forbid_contact_to_see_status": func() {
			account.session.DenyPresenceSubscription(jid, "" /* generate id */)
		},
		"on_ask_contact_to_see_status": func() {
			account.session.RequestPresenceSubscription(jid)
		},
		"on_peer_fingerprints": func() {
			r.ui.showFingerprintsForPeer(jid, account)
		},
		"on_dump_info": func() {
			r.debugPrintRosterFor(account.session.GetConfig().Account)
		},
		"on_rename_signal": func() {
			r.renameContactPopup(account.session.GetConfig(), jid)
		},
	})

	mn.ShowAll()
	mn.PopupAtMouseCursor(nil, nil, int(bt.Button()), bt.Time())
}
开发者ID:tanujmathur,项目名称:coyim,代码行数:33,代码来源:roster.go


示例3: getAccountAndJidFromEvent

func (r *roster) getAccountAndJidFromEvent(bt *gdk.EventButton) (jid string, account *account, rowType string, ok bool) {
	x := bt.X()
	y := bt.Y()
	path := new(gtk.TreePath)
	found := r.view.GetPathAtPos(int(x), int(y), path, nil, nil, nil)
	if !found {
		return "", nil, "", false
	}
	iter, err := r.model.GetIter(path)
	if err != nil {
		return "", nil, "", false
	}
	jid = getFromModelIter(r.model, iter, indexJid)
	accountID := getFromModelIter(r.model, iter, indexAccountID)
	rowType = getFromModelIter(r.model, iter, indexRowType)
	account, ok = r.getAccount(accountID)
	return jid, account, rowType, ok
}
开发者ID:tanujmathur,项目名称:coyim,代码行数:18,代码来源:roster.go


示例4: buttonCallback

func buttonCallback(area *gtk.DrawingArea, event *gdk.Event, v DrawAreaClient) {
	ev := gdk.EventButton{event}
	pos := image.Point{int(ev.X()), int(ev.Y())}
	v.ButtonCallback(DrawArea{area, 0, 0, 0, 0}, ev.Type(), pos)
}
开发者ID:axel-freesp,项目名称:sge,代码行数:5,代码来源:drawarea.go



注:本文中的github.com/gotk3/gotk3/gdk.EventButton类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang glib.IdleAdd函数代码示例发布时间:2022-05-23
下一篇:
Golang cairo.Context类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap