本文整理汇总了Golang中github.com/anaminus/gxui.Theme类的典型用法代码示例。如果您正苦于以下问题:Golang Theme类的具体用法?Golang Theme怎么用?Golang Theme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Theme类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Create
func (node addRootNode) Create(theme gxui.Theme) gxui.Control {
layout := theme.CreateLinearLayout()
layout.SetDirection(gxui.LeftToRight)
layout.SetHorizontalAlignment(gxui.AlignLeft)
layout.SetVerticalAlignment(gxui.AlignMiddle)
ctx := node.ctx
{
button := CreateButton(theme, "Add Instance")
button.OnClick(func(gxui.MouseEvent) {
ctx.ctxc.EnterContext(&InstanceContext{
Finished: func(child *rbxfile.Instance, ok bool) {
if !ok {
return
}
if err := ctx.session.Action.Do(cmd.AddRootInstance(ctx.session.Root, child)); err != nil {
ctx.ctxc.EnterContext(&AlertContext{
Title: "Error",
Text: "Failed to add instance:\n" + err.Error(),
Buttons: ButtonsOK,
})
return
}
if ctx.tree.Select(child) {
ctx.tree.Show(child)
}
},
})
})
layout.AddChild(button)
}
{
button := CreateButton(theme, "Add Model")
button.OnClick(func(gxui.MouseEvent) {
loadModel(ctx.ctxc, func(children []*rbxfile.Instance) {
ag := make(action.Group, len(children))
var first *rbxfile.Instance
for i, child := range children {
if first == nil {
first = child
}
ag[i] = cmd.AddRootInstance(ctx.session.Root, child)
}
if err := ctx.session.Action.Do(ag); err != nil {
ctx.ctxc.EnterContext(&AlertContext{
Title: "Error",
Text: "Failed to add objects:\n" + err.Error(),
Buttons: ButtonsOK,
})
return
}
if first != nil && ctx.tree.Select(first) {
ctx.tree.Show(first)
}
})
})
layout.AddChild(button)
}
return layout
}
开发者ID:Anaminus,项目名称:rbxplore,代码行数:59,代码来源:editor_ctx.go
示例2: Create
func (a FormatAdapter) Create(theme gxui.Theme, index int) gxui.Control {
l := theme.CreateLabel()
text := Format(index).String()
if text == "" {
text = "None"
}
l.SetText(text)
return l
}
开发者ID:Anaminus,项目名称:rbxplore,代码行数:9,代码来源:session.go
示例3: computeSize
func (l *classList) computeSize(theme gxui.Theme) {
s := math.Size{}
font := theme.DefaultFont()
for _, class := range l.list {
s = s.Max(font.Measure(&gxui.TextBlock{
Runes: []rune(class.Name),
}))
}
s.H = 22
l.size = s
}
开发者ID:Anaminus,项目名称:rbxplore,代码行数:11,代码来源:instance_ctx.go
示例4: CreateDialog
func CreateDialog(theme gxui.Theme) Dialog {
c := new(dialog)
c.actions = make(map[int]*dialogAction, 4)
c.newButton = theme.CreateButton
c.newLabel = theme.CreateLabel
c.title = theme.CreateLabel()
container := theme.CreateLinearLayout()
container.SetDirection(gxui.TopToBottom)
container.SetHorizontalAlignment(gxui.AlignLeft)
container.SetVerticalAlignment(gxui.AlignTop)
container.SetPadding(math.Spacing{L: 10, T: 10, R: 10, B: 10})
c.container = container
actionContainer := theme.CreateLinearLayout()
actionContainer.SetDirection(gxui.LeftToRight)
actionContainer.SetVerticalAlignment(gxui.AlignMiddle)
actionContainer.SetHorizontalAlignment(gxui.AlignCenter)
c.actionContainer = actionContainer
layout := theme.CreateLinearLayout()
layout.SetBackgroundBrush(gxui.Brush{Color: gxui.Color{0.2, 0.2, 0.2, 1}})
layout.SetDirection(gxui.TopToBottom)
layout.SetHorizontalAlignment(gxui.AlignCenter)
layout.AddChild(c.title)
layout.AddChild(container)
layout.AddChild(actionContainer)
c.control = layout
return c
}
开发者ID:Anaminus,项目名称:rbxplore,代码行数:32,代码来源:dialog.go
示例5: CreatePanel
func CreatePanel(theme gxui.Theme) Panel {
table := theme.CreateTableLayout()
table.SetSizeClamped(true, false)
scroll := theme.CreateScrollLayout()
scroll.SetScrollAxis(false, true)
scroll.SetChild(table)
panel := &panel{
control: scroll,
table: table,
theme: theme,
divider: 0.5,
itemHeight: 26,
}
scroll.SetScrollLength(panel.itemHeight)
panel.relayout()
return panel
}
开发者ID:Anaminus,项目名称:rbxplore,代码行数:17,代码来源:panel.go
示例6: Create
// Create returns a Control visualizing the item at the specified index.
func (l *classList) Create(theme gxui.Theme, index int) gxui.Control {
class := l.list[index]
label := theme.CreateLabel()
label.SetText(class.Name)
return label
}
开发者ID:Anaminus,项目名称:rbxplore,代码行数:7,代码来源:instance_ctx.go
注:本文中的github.com/anaminus/gxui.Theme类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论