本文整理匯總了Golang中github.com/sqp/godock/widgets/cfbuild/cftype.Key.PackWidget方法的典型用法代碼示例。如果您正苦於以下問題:Golang Key.PackWidget方法的具體用法?Golang Key.PackWidget怎麽用?Golang Key.PackWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/sqp/godock/widgets/cfbuild/cftype.Key
的用法示例。
在下文中一共展示了Key.PackWidget方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Separator
// Separator adds a simple horizontal separator.
//
func Separator(key *cftype.Key) {
// GtkWidget *pAlign = gtk_alignment_new (.5, .5, 0.8, 1.);
// g_object_set (pAlign, "height-request", 12, NULL);
widget := newgtk.Separator(gtk.ORIENTATION_HORIZONTAL)
// gtk_container_add (GTK_CONTAINER (pAlign), pOneWidget);
key.PackWidget(widget, false, false, 0)
}
示例2: PackComboBoxWithIndexHandbooker
// PackComboBoxWithIndexHandbooker creates a combo box filled with the getList call.
//
func PackComboBoxWithIndexHandbooker(key *cftype.Key, index map[string]datatype.Handbooker) {
model := newModelSimple()
model.SetSortColumnId(RowName, gtk.SORT_ASCENDING)
widget, getValue := NewComboBoxWithModel(model, key.Log(), false, false, false)
value := key.Value().String()
details := handbook.New(key.Log())
key.PackWidget(details, false, false, 0)
widget.Connect("changed", func() {
name := key.Value().String()
pack, ok := index[name]
if ok {
details.SetPackage(pack)
} else {
key.Log().NewErr("key missing", "ComboHandbook select preview:", name)
}
})
fields := datatype.IndexHandbooksToFields(index)
saved := indexiter.NewByString(widget, key.Log())
iter := fillModelWithFields(key, model, fields, value, saved)
widget.SetActiveIter(iter) // Set iter after connect, to update with current value.
key.PackKeyWidget(key,
getValue,
func(uncast interface{}) { saved.SetActive(uncast.(string)) },
widget,
)
}