當前位置: 首頁>>代碼示例>>Golang>>正文


Golang gdk.EventButton類代碼示例

本文整理匯總了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;未經允許,請勿轉載。