本文整理汇总了Golang中github.com/sqp/godock/widgets/cfbuild/cftype.Key.MakeWidget方法的典型用法代码示例。如果您正苦于以下问题:Golang Key.MakeWidget方法的具体用法?Golang Key.MakeWidget怎么用?Golang Key.MakeWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/sqp/godock/widgets/cfbuild/cftype.Key
的用法示例。
在下文中一共展示了Key.MakeWidget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: buildKey
// buildKey builds a Cairo-Dock configuration widget with the given keys.
//
func (build *builder) buildKey(key *cftype.Key) {
makeWidget := key.MakeWidget()
if makeWidget == nil {
makeWidget = cfwidget.Maker(key)
if makeWidget == nil {
build.Log().NewErrf("no make widget call", "type=%s [key=%s / %s]\n", key.Type, key.Group, key.Name)
return
}
}
// build.log.DEV(key.Name, string(key.Type), key.AuthorizedValues)
build.pKeyBox = nil
build.pLabel = nil
build.pWidgetBox = nil
build.pAdditionalItemsVBox = nil
fullSize := key.IsType(cftype.KeyListThemeApplet, cftype.KeyListViews, cftype.KeyEmptyFull, cftype.KeyHandbook)
if !key.IsType(cftype.KeyFrame) && !key.IsType(cftype.KeyExpander) && !key.IsType(cftype.KeySeparator) {
// Create Key box.
if key.IsType(cftype.KeyListThemeApplet, cftype.KeyListViews) {
build.pAdditionalItemsVBox = newgtk.Box(gtk.ORIENTATION_VERTICAL, 0)
build.pKeyBox = newgtk.Box(gtk.ORIENTATION_HORIZONTAL, cftype.MarginGUI)
build.PackWidget(build.pAdditionalItemsVBox, fullSize, fullSize, 0)
build.pAdditionalItemsVBox.PackStart(build.pKeyBox, false, false, 0)
} else {
if key.IsAlignedVertical {
build.log.Info("aligned /", strings.TrimSuffix(key.Name, "\n"))
build.pKeyBox = newgtk.Box(gtk.ORIENTATION_VERTICAL, cftype.MarginGUI)
} else {
build.pKeyBox = newgtk.Box(gtk.ORIENTATION_HORIZONTAL, cftype.MarginGUI)
}
build.PackWidget(build.pKeyBox, fullSize, fullSize, 0)
}
if key.Tooltip != "" {
build.pKeyBox.SetTooltipText(build.Translate(key.Tooltip))
}
// if (pControlWidgets != NULL)
// {
// CDControlWidget *cw = pControlWidgets->data;
// //g_print ("ctrl (%d widgets)\n", NbControlled);
// if (cw->pControlContainer == (pFrameVBox ? pFrameVBox : build))
// {
// //g_print ("ctrl (NbControlled:%d, iFirstSensitiveWidget:%d, iNbSensitiveWidgets:%d)\n", NbControlled, iFirstSensitiveWidget, iNbSensitiveWidgets);
// cw->NbControlled --;
// if (cw->iFirstSensitiveWidget > 0)
// cw->iFirstSensitiveWidget --;
// cw->iNonSensitiveWidget --;
// GtkWidget *w = (pAdditionalItemsVBox ? pAdditionalItemsVBox : pKeyBox);
// if (cw->iFirstSensitiveWidget == 0 && cw->iNbSensitiveWidgets > 0 && cw->iNonSensitiveWidget != 0) // on est dans la zone des widgets sensitifs.
// {
// //g_print (" => sensitive\n");
// cw->iNbSensitiveWidgets --;
// if (GTK_IS_EXPANDER (w))
// gtk_expander_set_expanded (GTK_EXPANDER (w), TRUE);
// }
// else
// {
// //g_print (" => unsensitive\n");
// if (!GTK_IS_EXPANDER (w))
// gtk_widget_set_sensitive (w, FALSE);
// }
// if (cw->iFirstSensitiveWidget == 0 && cw->NbControlled == 0)
// {
// pControlWidgets = g_list_delete_link (pControlWidgets, pControlWidgets);
// g_free (cw);
// }
// }
// }
// Key description on the left.
if key.Text != "" { // and maybe need to test different from "loading..." ?
build.pLabel = newgtk.Label("")
text := strings.TrimRight(build.Translate(key.Text), ":") // dirty hack against ugly trailing colon.
build.pLabel.SetMarkup(text)
build.pLabel.SetHAlign(gtk.ALIGN_START)
// margin-left
// GtkWidget *pAlign = gtk_alignment_new (0., 0.5, 0., 0.);
build.pKeyBox.PackStart(build.pLabel, false, false, 0)
}
// Key widgets on the right. In pWidgetBox, they will be stacked from left to right.
if !key.IsType(cftype.KeyTextLabel) {
build.pWidgetBox = newgtk.Box(gtk.ORIENTATION_HORIZONTAL, cftype.MarginGUI)
build.pKeyBox.PackEnd(build.pWidgetBox, fullSize, fullSize, 0)
}
}
// Build widget for the key, use the default for the type if not overridden.
makeWidget()
}