Beispiel #1
0
// 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
}
Beispiel #2
0
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)
}