本文整理匯總了Golang中github.com/sqp/godock/libs/cdtype.Events.OnSubClick方法的典型用法代碼示例。如果您正苦於以下問題:Golang Events.OnSubClick方法的具體用法?Golang Events.OnSubClick怎麽用?Golang Events.OnSubClick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/sqp/godock/libs/cdtype.Events
的用法示例。
在下文中一共展示了Events.OnSubClick方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewApplet
// NewApplet creates a new applet instance.
//
func NewApplet(base cdtype.AppBase, events *cdtype.Events) cdtype.AppInstance {
app := &Applet{AppBase: base, weather: weather.New()}
app.SetConfig(&app.conf, app.actions()...)
// Events.
events.OnClick = app.DialogWeatherCurrent
events.OnMiddleClick = app.DialogWeatherCurrent
events.OnSubClick = app.DialogWeatherForecast
events.OnBuildMenu = func(menu cdtype.Menuer) {
var items []int
if app.weather.Current() != nil || app.weather.Forecast() != nil {
if app.weather.Current() != nil {
items = append(items, ActionShowCurrent)
}
items = append(items, ActionOpenWebpage, ActionRecheckNow)
}
items = append(items, ActionSetLocation)
app.Action().BuildMenu(menu, items)
}
// Weather polling.
app.Poller().Add(app.Check)
app.Poller().SetPreCheck(func() { app.SetEmblem(app.FileLocation("img", IconWork), EmblemWork) })
app.Poller().SetPostCheck(func() { app.SetEmblem("none", EmblemWork) })
return app
}