gui: attach some icons to menu and nav tree

This commit is contained in:
mappu 2024-06-08 14:24:44 +12:00
parent 8b1e7064e7
commit 6234f02ea6
3 changed files with 7 additions and 0 deletions

View File

@ -98,6 +98,7 @@ func (f *TMainForm) boltAddDatabaseFromFile(path string) {
ld.nav = f.Buckets.Items().Add(nil, ld.displayName)
ld.nav.SetHasChildren(true) // dynamically populate in OnNavExpanding
ld.nav.SetImageIndex(imgDatabase)
navData := &navData{
ld: ld,
childrenLoaded: false, // will be loaded dynamically

View File

@ -46,17 +46,20 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
mnuFileOpen := vcl.NewMenuItem(mnuFile)
mnuFileOpen.SetCaption("Open Bolt database...")
mnuFileOpen.SetImageIndex(imgDatabaseAdd)
mnuFileOpen.SetShortCutFromString("Ctrl+O")
mnuFileOpen.SetOnClick(f.OnMnuFileOpenClick)
mnuFile.Add(mnuFileOpen)
mnuFileSqliteOpen := vcl.NewMenuItem(mnuFile)
mnuFileSqliteOpen.SetCaption("Open SQLite database...")
mnuFileSqliteOpen.SetImageIndex(imgDatabaseAdd)
mnuFileSqliteOpen.SetOnClick(f.OnMnuFileSqliteOpenClick)
mnuFile.Add(mnuFileSqliteOpen)
mnuFileSqliteMemory := vcl.NewMenuItem(mnuFile)
mnuFileSqliteMemory.SetCaption("New SQLite in-memory database")
mnuFileSqliteMemory.SetImageIndex(imgDatabaseAdd)
mnuFileSqliteMemory.SetOnClick(f.OnMnuFileSqliteMemoryClick)
mnuFile.Add(mnuFileSqliteMemory)
@ -70,10 +73,12 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
mnuFile.Add(mnuFileExit)
f.Menu = vcl.NewMainMenu(f)
f.Menu.SetImages(f.ImageList)
f.Menu.Items().Add(mnuFile)
f.Buckets = vcl.NewTreeView(f)
f.Buckets.SetParent(f)
f.Buckets.SetImages(f.ImageList)
f.Buckets.SetAlign(types.AlLeft)
f.Buckets.SetWidth(MY_WIDTH)
f.Buckets.SetReadOnly(true) // prevent click to rename on nodes

View File

@ -136,6 +136,7 @@ func (f *TMainForm) sqliteAddDatabaseFromFile(path string) {
}
ld.nav = f.Buckets.Items().Add(nil, ld.displayName)
ld.nav.SetImageIndex(imgDatabase)
ld.nav.SetHasChildren(true) // dynamically populate in OnNavExpanding
navData := &navData{
ld: ld,