本文整理匯總了Golang中github.com/limetext/lime/backend.View.Window方法的典型用法代碼示例。如果您正苦於以下問題:Golang View.Window方法的具體用法?Golang View.Window怎麽用?Golang View.Window使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/limetext/lime/backend.View
的用法示例。
在下文中一共展示了View.Window方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: onNew
// Called when a new view is opened
func (t *qmlfrontend) onNew(v *backend.View) {
fv := &frontendView{bv: v}
v.Buffer().AddCallback(fv.bufferChanged)
v.Settings().AddOnChange("blah", fv.onChange)
fv.Title.Text = v.Buffer().FileName()
if len(fv.Title.Text) == 0 {
fv.Title.Text = "untitled"
}
w2 := t.windows[v.Window()]
w2.views = append(w2.views, fv)
tabs := w2.window.ObjectByName("tabs")
tab := tabs.Call("addTab", "", limeViewComponent).(qml.Object)
try_now := func() {
item := tab.Property("item").(qml.Object)
if item.Addr() == 0 {
// Happens as the item isn't actually loaded until we switch to the tab.
// Hence connecting to the loaded signal
return
}
item.Set("myView", fv)
}
tab.On("loaded", try_now)
try_now()
}
示例2: onNew
// Called when a new view is opened
func (t *qmlfrontend) onNew(v *backend.View) {
fv := &frontendView{bv: v}
v.Buffer().AddObserver(fv)
v.Settings().AddOnChange("blah", fv.onChange)
fv.Title.Text = v.Buffer().FileName()
if len(fv.Title.Text) == 0 {
fv.Title.Text = "untitled"
}
w2 := t.windows[v.Window()]
w2.views = append(w2.views, fv)
tabs := w2.window.ObjectByName("tabs")
tab := tabs.Call("addTab", "", limeViewComponent).(qml.Object)
try_now := func() {
item := tab.Property("item").(qml.Object)
if item.Addr() == 0 {
// Happens as the item isn't actually loaded until we switch to the tab.
// Hence connecting to the loaded signal
return
}
item.Set("myView", fv)
item.Set("fontSize", v.Settings().Get("font_size", 12).(float64))
item.Set("fontFace", v.Settings().Get("font_face", "Helvetica").(string))
}
tab.On("loaded", try_now)
try_now()
tabs.Set("currentIndex", tabs.Property("count").(int)-1)
}
示例3: onClose
// called when a view is closed
func (t *qmlfrontend) onClose(v *backend.View) {
w2 := t.windows[v.Window()]
for i := range w2.views {
if w2.views[i].bv == v {
w2.window.ObjectByName("tabs").Call("removeTab", i)
copy(w2.views[i:], w2.views[i+1:])
w2.views = w2.views[:len(w2.views)-1]
return
}
}
log4go.Error("Couldn't find closed view...")
}
示例4: onLoad
// called when a view has loaded
func (t *qmlfrontend) onLoad(v *backend.View) {
w2 := t.windows[v.Window()]
i := 0
for i, _ = range w2.views {
if w2.views[i].bv == v {
break
}
}
v2 := w2.views[i]
v2.Title.Text = v.Buffer().FileName()
t.qmlChanged(v2, &v2.Title)
}
示例5: onLoad
// called when a view has loaded
func (t *qmlfrontend) onLoad(v *backend.View) {
w2 := t.windows[v.Window()]
i := 0
for i, _ = range w2.views {
if w2.views[i].bv == v {
break
}
}
v2 := w2.views[i]
v2.Title.Text = v.Buffer().FileName()
tabs := w2.window.ObjectByName("tabs")
tab := tabs.Call("getTab", i).(qml.Object)
tab.Set("title", v2.Title.Text)
}