本文整理汇总了Golang中github.com/sqp/godock/widgets/cfbuild/cftype.Key.BoxPage方法的典型用法代码示例。如果您正苦于以下问题:Golang Key.BoxPage方法的具体用法?Golang Key.BoxPage怎么用?Golang Key.BoxPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/sqp/godock/widgets/cfbuild/cftype.Key
的用法示例。
在下文中一共展示了Key.BoxPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Handbook
// Handbook adds a handbook widget to show basic applet informations.
//
func Handbook(key *cftype.Key) {
appletName := key.Value().String()
widget := handbook.New(key.Log())
widget.ShowVersion = true
book := key.Source().Handbook(appletName)
if widget == nil || book == nil {
key.Log().NewErr("Handbook no widget")
return
}
widget.SetPackage(book)
key.BoxPage().PackStart(widget, true, true, 0)
key.PackKeyWidget(key,
func() interface{} { return appletName },
func(uncast interface{}) {
appletName = uncast.(string)
book := key.Source().Handbook(appletName)
widget.SetPackage(book)
},
)
}
示例2: Frame
// Frame adds a simple or expanded frame widget.
//
func Frame(key *cftype.Key) {
if len(key.AuthorizedValues) == 0 {
key.SetFrame(nil)
key.SetFrameBox(nil)
return
}
value, img := "", ""
if key.AuthorizedValues[0] == "" {
key.Log().Info("WidgetFrame, need value case 1")
// value = g_key_file_get_string(pKeyFile, cGroupName, cKeyName, NULL) // utile ?
} else {
value = key.AuthorizedValues[0]
if len(key.AuthorizedValues) > 1 {
img = key.AuthorizedValues[1]
}
}
// Create the frame label with the optional icon.
label := newgtk.Label("")
// key.SetLabel(label)
label.SetMarkup(" " + common.Bold(key.Translate(value)) + " ")
var labelContainer gtk.IWidget
if img == "" {
labelContainer = label
} else {
box := newgtk.Box(gtk.ORIENTATION_HORIZONTAL, cftype.MarginIcon/2)
if icon, e := common.ImageNewFromFile(img, iconSizeFrame); !key.Log().Err(e, "Frame icon") { // TODO: fix size : int(gtk.ICON_SIZE_MENU)
box.Add(icon)
}
box.Add(label)
labelContainer = box
}
// Create the box that will contain next widgets (inside the frame).
box := newgtk.Box(gtk.ORIENTATION_VERTICAL, cftype.MarginGUI)
key.SetFrameBox(box)
frame := newgtk.Frame("")
key.SetFrame(frame)
frame.SetBorderWidth(cftype.MarginGUI)
frame.SetShadowType(gtk.SHADOW_OUT)
frame.Add(box)
// Set label and create the expander around the frame if needed.
switch key.Type {
case cftype.KeyFrame:
frame.SetLabelWidget(labelContainer)
key.BoxPage().PackStart(frame, false, false, 0)
case cftype.KeyExpander:
expand := newgtk.Expander("")
expand.SetExpanded(false)
expand.SetLabelWidget(labelContainer)
expand.Add(frame)
key.BoxPage().PackStart(expand, false, false, 0)
}
// SAME AS IN builder.go
// if (pControlWidgets != NULL)
// {
// cd_debug ("ctrl\n");
// CDControlWidget *cw = pControlWidgets->data;
// if (cw->pControlContainer == key.Box)
// {
// cd_debug ("ctrl (NbControlled:%d, iFirstSensitiveWidget:%d, iNbSensitiveWidgets:%d)", cw->NbControlled, cw->iFirstSensitiveWidget, cw->iNbSensitiveWidgets);
// cw->NbControlled --;
// if (cw->iFirstSensitiveWidget > 0)
// cw->iFirstSensitiveWidget --;
// cw->iNonSensitiveWidget --;
// GtkWidget *w = pExternFrame;
// if (cw->iFirstSensitiveWidget == 0 && cw->iNbSensitiveWidgets > 0 && cw->iNonSensitiveWidget != 0)
// {
// cd_debug (" => sensitive\n");
// cw->iNbSensitiveWidgets --;
// if (GTK_IS_EXPANDER (w))
// gtk_expander_set_expanded (GTK_EXPANDER (w), TRUE);
// }
// else
// {
// cd_debug (" => 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);
// }
// }
// }
}