Change naming of Notebook methods

This commit is contained in:
Sasha Koshka 2024-09-12 15:10:29 -04:00
parent 8b80520f8c
commit 6130b84a27

View File

@ -33,26 +33,26 @@ type Notebook struct {
// NewNotebook creates a new tabbed notebook. // NewNotebook creates a new tabbed notebook.
func NewNotebook () *Notebook { func NewNotebook () *Notebook {
Notebook := &Notebook { notebook := &Notebook {
box: tomo.NewContainerBox(), box: tomo.NewContainerBox(),
} }
Notebook.box.SetRole(tomo.R("objects", "Notebook")) notebook.box.SetRole(tomo.R("objects", "Notebook"))
Notebook.box.SetAttr(tomo.ALayout(layouts.Column { false, true })) notebook.box.SetAttr(tomo.ALayout(layouts.Column { false, true }))
Notebook.tabsRow = tomo.NewContainerBox() notebook.tabsRow = tomo.NewContainerBox()
Notebook.tabsRow.SetRole(tomo.R("objects", "TabRow")) notebook.tabsRow.SetRole(tomo.R("objects", "TabRow"))
Notebook.box.Add(Notebook.tabsRow) notebook.box.Add(notebook.tabsRow)
Notebook.leftSpacer = tomo.NewBox() notebook.leftSpacer = tomo.NewBox()
Notebook.leftSpacer.SetRole(tomo.R("objects", "TabSpacer")) notebook.leftSpacer.SetRole(tomo.R("objects", "TabSpacer"))
Notebook.leftSpacer.SetTag("left", true) notebook.leftSpacer.SetTag("left", true)
Notebook.rightSpacer = tomo.NewBox() notebook.rightSpacer = tomo.NewBox()
Notebook.rightSpacer.SetRole(tomo.R("objects", "TabSpacer")) notebook.rightSpacer.SetRole(tomo.R("objects", "TabSpacer"))
Notebook.rightSpacer.SetTag("right", true) notebook.rightSpacer.SetTag("right", true)
Notebook.ClearTabs() notebook.Clear()
Notebook.setTabRowLayout() notebook.setTabRowLayout()
return Notebook return notebook
} }
// GetBox returns the underlying box. // GetBox returns the underlying box.
@ -75,8 +75,8 @@ func (this *Notebook) Activate (name string) {
this.active = name this.active = name
} }
// AddTab adds an object as a tab with the specified name. // Add adds an object as a tab with the specified name.
func (this *Notebook) AddTab (name string, root tomo.Object) { func (this *Notebook) Add (name string, root tomo.Object) {
tab := &tab { tab := &tab {
TextBox: tomo.NewTextBox(), TextBox: tomo.NewTextBox(),
name: name, name: name,
@ -104,8 +104,8 @@ func (this *Notebook) AddTab (name string, root tomo.Object) {
} }
} }
// RemoveTab removes the named tab. // Remove removes the named tab.
func (this *Notebook) RemoveTab (name string) { func (this *Notebook) Remove (name string) {
index, tab := this.findTab(name) index, tab := this.findTab(name)
if index < 0 { return } if index < 0 { return }
nextIndex := index - 1 nextIndex := index - 1
@ -123,8 +123,8 @@ func (this *Notebook) RemoveTab (name string) {
} }
} }
// ClearTabs removes all tabs. // Clear removes all tabs.
func (this *Notebook) ClearTabs () { func (this *Notebook) Clear () {
this.tabs = nil this.tabs = nil
this.tabsRow.Clear() this.tabsRow.Clear()
this.tabsRow.Add(this.leftSpacer) this.tabsRow.Add(this.leftSpacer)