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) }
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) }) }