gui: attach some icons to menu and nav tree
This commit is contained in:
parent
8b1e7064e7
commit
6234f02ea6
1
bolt.go
1
bolt.go
@ -98,6 +98,7 @@ func (f *TMainForm) boltAddDatabaseFromFile(path string) {
|
|||||||
|
|
||||||
ld.nav = f.Buckets.Items().Add(nil, ld.displayName)
|
ld.nav = f.Buckets.Items().Add(nil, ld.displayName)
|
||||||
ld.nav.SetHasChildren(true) // dynamically populate in OnNavExpanding
|
ld.nav.SetHasChildren(true) // dynamically populate in OnNavExpanding
|
||||||
|
ld.nav.SetImageIndex(imgDatabase)
|
||||||
navData := &navData{
|
navData := &navData{
|
||||||
ld: ld,
|
ld: ld,
|
||||||
childrenLoaded: false, // will be loaded dynamically
|
childrenLoaded: false, // will be loaded dynamically
|
||||||
|
5
main.go
5
main.go
@ -46,17 +46,20 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
|||||||
|
|
||||||
mnuFileOpen := vcl.NewMenuItem(mnuFile)
|
mnuFileOpen := vcl.NewMenuItem(mnuFile)
|
||||||
mnuFileOpen.SetCaption("Open Bolt database...")
|
mnuFileOpen.SetCaption("Open Bolt database...")
|
||||||
|
mnuFileOpen.SetImageIndex(imgDatabaseAdd)
|
||||||
mnuFileOpen.SetShortCutFromString("Ctrl+O")
|
mnuFileOpen.SetShortCutFromString("Ctrl+O")
|
||||||
mnuFileOpen.SetOnClick(f.OnMnuFileOpenClick)
|
mnuFileOpen.SetOnClick(f.OnMnuFileOpenClick)
|
||||||
mnuFile.Add(mnuFileOpen)
|
mnuFile.Add(mnuFileOpen)
|
||||||
|
|
||||||
mnuFileSqliteOpen := vcl.NewMenuItem(mnuFile)
|
mnuFileSqliteOpen := vcl.NewMenuItem(mnuFile)
|
||||||
mnuFileSqliteOpen.SetCaption("Open SQLite database...")
|
mnuFileSqliteOpen.SetCaption("Open SQLite database...")
|
||||||
|
mnuFileSqliteOpen.SetImageIndex(imgDatabaseAdd)
|
||||||
mnuFileSqliteOpen.SetOnClick(f.OnMnuFileSqliteOpenClick)
|
mnuFileSqliteOpen.SetOnClick(f.OnMnuFileSqliteOpenClick)
|
||||||
mnuFile.Add(mnuFileSqliteOpen)
|
mnuFile.Add(mnuFileSqliteOpen)
|
||||||
|
|
||||||
mnuFileSqliteMemory := vcl.NewMenuItem(mnuFile)
|
mnuFileSqliteMemory := vcl.NewMenuItem(mnuFile)
|
||||||
mnuFileSqliteMemory.SetCaption("New SQLite in-memory database")
|
mnuFileSqliteMemory.SetCaption("New SQLite in-memory database")
|
||||||
|
mnuFileSqliteMemory.SetImageIndex(imgDatabaseAdd)
|
||||||
mnuFileSqliteMemory.SetOnClick(f.OnMnuFileSqliteMemoryClick)
|
mnuFileSqliteMemory.SetOnClick(f.OnMnuFileSqliteMemoryClick)
|
||||||
mnuFile.Add(mnuFileSqliteMemory)
|
mnuFile.Add(mnuFileSqliteMemory)
|
||||||
|
|
||||||
@ -70,10 +73,12 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
|||||||
mnuFile.Add(mnuFileExit)
|
mnuFile.Add(mnuFileExit)
|
||||||
|
|
||||||
f.Menu = vcl.NewMainMenu(f)
|
f.Menu = vcl.NewMainMenu(f)
|
||||||
|
f.Menu.SetImages(f.ImageList)
|
||||||
f.Menu.Items().Add(mnuFile)
|
f.Menu.Items().Add(mnuFile)
|
||||||
|
|
||||||
f.Buckets = vcl.NewTreeView(f)
|
f.Buckets = vcl.NewTreeView(f)
|
||||||
f.Buckets.SetParent(f)
|
f.Buckets.SetParent(f)
|
||||||
|
f.Buckets.SetImages(f.ImageList)
|
||||||
f.Buckets.SetAlign(types.AlLeft)
|
f.Buckets.SetAlign(types.AlLeft)
|
||||||
f.Buckets.SetWidth(MY_WIDTH)
|
f.Buckets.SetWidth(MY_WIDTH)
|
||||||
f.Buckets.SetReadOnly(true) // prevent click to rename on nodes
|
f.Buckets.SetReadOnly(true) // prevent click to rename on nodes
|
||||||
|
@ -136,6 +136,7 @@ func (f *TMainForm) sqliteAddDatabaseFromFile(path string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ld.nav = f.Buckets.Items().Add(nil, ld.displayName)
|
ld.nav = f.Buckets.Items().Add(nil, ld.displayName)
|
||||||
|
ld.nav.SetImageIndex(imgDatabase)
|
||||||
ld.nav.SetHasChildren(true) // dynamically populate in OnNavExpanding
|
ld.nav.SetHasChildren(true) // dynamically populate in OnNavExpanding
|
||||||
navData := &navData{
|
navData := &navData{
|
||||||
ld: ld,
|
ld: ld,
|
||||||
|
Loading…
Reference in New Issue
Block a user