本文整理匯總了Golang中github.com/limetext/backend.View.Window方法的典型用法代碼示例。如果您正苦於以下問題:Golang View.Window方法的具體用法?Golang View.Window怎麽用?Golang View.Window使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/limetext/backend.View
的用法示例。
在下文中一共展示了View.Window方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newView
func newView(bv *backend.View) *view {
v := &view{
id: int(bv.Id()),
bv: bv,
Title: bv.FileName(),
}
if len(v.Title) == 0 {
v.Title = "untitled"
}
bv.AddObserver(v)
bv.Settings().AddOnChange("qml.view.syntax", v.onChange)
bv.Settings().AddOnChange("qml.view.syntaxfile", func(name string) {
if name != "syntax" {
return
}
syn := bv.Settings().String("syntax", "Plain Text")
syntax := backend.GetEditor().GetSyntax(syn)
w := fe.windows[bv.Window()]
w.qw.Call("setSyntaxStatus", syntax.Name())
})
bv.Settings().AddOnChange("qml.view.tabSize", func(name string) {
if name != "tab_size" {
return
}
ts := bv.Settings().Int("tab_size", 4)
w := fe.windows[bv.Window()]
w.qw.Call("setIndentStatus", strconv.Itoa(ts))
})
return v
}
示例2: onNew
// Called when a new view is opened
func (f *frontend) onNew(bv *backend.View) {
w := f.windows[bv.Window()]
v := newView(bv)
w.views[bv] = v
if w.qw != nil {
w.qw.Call("addTab", v.id, v)
w.qw.Call("activateTab", v.id)
}
}
示例3: onLoad
// called when a view has loaded
func (f *frontend) onLoad(bv *backend.View) {
w := f.windows[bv.Window()]
v := w.views[bv]
if v == nil {
log.Error("Couldn't find loaded view")
return
}
v.Title = bv.FileName()
w.qw.Call("setTabTitle", v.id, v.Title)
}
示例4: onClose
// called when a view is closed
func (f *frontend) onClose(bv *backend.View) {
w := f.windows[bv.Window()]
v := w.views[bv]
if v == nil {
log.Error("Couldn't find closed view...")
return
}
w.qw.Call("removeTab", v.id)
delete(w.views, bv)
}
示例5: onStatusChanged
func (f *frontend) onStatusChanged(bv *backend.View) {
w := f.windows[bv.Window()]
v := w.views[bv]
if v == nil {
log.Error("Couldn't find status changed view")
return
}
if v.qv == nil {
return
}
v.qv.Call("onStatusChanged")
}
示例6: onSelectionModified
func (f *frontend) onSelectionModified(bv *backend.View) {
w := f.windows[bv.Window()]
v := w.views[bv]
if v == nil {
log.Error("Couldn't find modified view")
return
}
if v.qv == nil {
return
}
v.qv.Call("onSelectionModified")
}