本文整理匯總了Golang中github.com/nelsam/gxui/themes/basic.Theme類的典型用法代碼示例。如果您正苦於以下問題:Golang Theme類的具體用法?Golang Theme怎麽用?Golang Theme使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Theme類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Init
func (p *ProjectAdder) Init(driver gxui.Driver, theme *basic.Theme) {
p.theme = theme
p.status = theme.CreateLabel()
p.path = NewFSLocator(driver, theme)
p.name = theme.CreateTextBox()
p.gopath = NewFSLocator(driver, theme)
}
示例2: New
// New creates and initializes a *Commander, then returns it.
func New(driver gxui.Driver, theme *basic.Theme, controller Controller) *Commander {
commander := &Commander{
theme: theme,
}
commander.Container.Init(commander, theme)
commander.BackgroundBorderPainter.Init(commander)
commander.SetMouseEventTarget(true)
commander.SetBackgroundBrush(gxui.TransparentBrush)
commander.SetBorderPen(gxui.TransparentPen)
mainLayout := theme.CreateLinearLayout()
mainLayout.SetDirection(gxui.TopToBottom)
mainLayout.SetSize(math.MaxSize)
commander.controller = controller
commander.menuBar = newMenuBar(commander, theme)
commander.box = newCommandBox(driver, theme, commander.controller)
mainLayout.AddChild(commander.menuBar)
subLayout := theme.CreateLinearLayout()
subLayout.SetDirection(gxui.BottomToTop)
subLayout.AddChild(commander.box)
subLayout.AddChild(commander.controller)
mainLayout.AddChild(subLayout)
commander.AddChild(mainLayout)
return commander
}
示例3: Init
func (p *Projects) Init(driver gxui.Driver, theme *basic.Theme) {
p.driver = driver
p.theme = theme
p.button = createIconButton(driver, theme, "projects.png")
p.projects = theme.CreateList()
p.projectsAdapter = gxui.CreateDefaultAdapter()
p.projectsAdapter.SetItems(settings.Projects())
p.projects.SetAdapter(p.projectsAdapter)
}
示例4: Init
func (b *findBox) Init(driver gxui.Driver, theme *basic.Theme, editor gxui.CodeEditor) {
b.TextBox.Init(b, driver, theme, theme.DefaultMonospaceFont())
b.editor = editor
b.SetTextColor(theme.TextBoxDefaultStyle.FontColor)
b.SetMargin(math.Spacing{L: 3, T: 3, R: 3, B: 3})
b.SetPadding(math.Spacing{L: 3, T: 3, R: 3, B: 3})
b.SetBackgroundBrush(theme.TextBoxDefaultStyle.Brush)
b.SetDesiredWidth(math.MaxSize.W)
b.SetMultiline(false)
}
示例5: newFileBox
func newFileBox(driver gxui.Driver, theme *basic.Theme) *fileBox {
file := new(fileBox)
file.TextBox.Init(file, driver, theme, theme.DefaultMonospaceFont())
file.SetTextColor(theme.TextBoxDefaultStyle.FontColor)
file.SetMargin(math.Spacing{L: 3, T: 3, R: 3, B: 3})
file.SetPadding(math.Spacing{L: 3, T: 3, R: 3, B: 3})
file.SetBackgroundBrush(theme.TextBoxDefaultStyle.Brush)
file.SetDesiredWidth(math.MaxSize.W)
file.SetMultiline(false)
return file
}
示例6: Init
func (n *Navigator) Init(driver gxui.Driver, theme *basic.Theme, cmdExecutor func(command commands.Command)) {
n.LinearLayout.Init(n, theme)
n.cmdExecutor = cmdExecutor
n.theme = theme
n.SetDirection(gxui.LeftToRight)
n.buttons = theme.CreateLinearLayout()
n.buttons.SetDirection(gxui.TopToBottom)
n.AddChild(n.buttons)
projects := new(Projects)
projects.Init(driver, theme)
n.Add(projects)
dirs := new(ProjectTree)
dirs.Init(driver, theme)
n.Add(dirs)
}
示例7: Init
func (d *ProjectTree) Init(driver gxui.Driver, theme *basic.Theme) {
d.driver = driver
d.theme = theme
d.button = createIconButton(driver, theme, "folder.png")
d.dirs = theme.CreateTree()
d.dirsAdapter = dirTree(os.Getenv("HOME"))
d.dirs.SetAdapter(d.dirsAdapter)
d.files = theme.CreateList()
d.filesAdapter = fileList(os.Getenv("HOME"))
d.files.SetAdapter(d.filesAdapter)
d.layout = newSplitterLayout(d.theme)
d.layout.SetOrientation(gxui.Vertical)
d.layout.AddChild(d.dirs)
d.layout.AddChild(d.files)
d.dirs.OnSelectionChanged(func(selection gxui.AdapterItem) {
d.filesAdapter = fileList(selection.(string))
d.files.SetAdapter(d.filesAdapter)
})
}
示例8: createIconButton
func createIconButton(driver gxui.Driver, theme *basic.Theme, iconPath string) gxui.Button {
button := theme.CreateButton()
button.SetType(gxui.PushButton)
fileBytes, err := assets.Asset(iconPath)
if err != nil {
panic(err)
}
f := bytes.NewBuffer(fileBytes)
src, _, err := image.Decode(f)
if err != nil {
panic(err)
}
src = resize.Resize(24, 24, src, resize.Bilinear)
rgba := image.NewRGBA(src.Bounds())
draw.Draw(rgba, src.Bounds(), src, image.ZP, draw.Src)
texture := driver.CreateTexture(rgba, 1)
icon := theme.CreateImage()
icon.SetTexture(texture)
button.AddChild(icon)
return button
}
示例9: Init
func (p *ProjectAdder) Init(driver gxui.Driver, theme *basic.Theme) {
p.path = NewFSLocator(driver, theme)
p.name = theme.CreateTextBox()
}
示例10: Init
func (p *ProjectOpener) Init(driver gxui.Driver, theme *basic.Theme) {
p.name = theme.CreateTextBox()
}
示例11: newDirLabel
func newDirLabel(theme *basic.Theme) *dirLabel {
label := new(dirLabel)
label.Label.Init(label, theme, theme.DefaultMonospaceFont(), theme.LabelStyle.FontColor)
label.SetMargin(math.Spacing{L: 3, T: 3, R: 3, B: 3})
return label
}