mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 17:58:22 +01:00
appdock
This commit is contained in:
parent
710491bc66
commit
6c0f304767
@ -7,6 +7,9 @@ class AppDockTag extends Ant.OS.GUI.BaseTag
|
|||||||
me = @
|
me = @
|
||||||
@root.newapp = (a) -> me.addApp a
|
@root.newapp = (a) -> me.addApp a
|
||||||
|
|
||||||
|
__selectedApp__: (v) ->
|
||||||
|
|
||||||
|
|
||||||
addApp: (item) ->
|
addApp: (item) ->
|
||||||
@items.push item
|
@items.push item
|
||||||
@set "selectedApp", item.app
|
@set "selectedApp", item.app
|
||||||
@ -20,10 +23,38 @@ class AppDockTag extends Ant.OS.GUI.BaseTag
|
|||||||
e.id = me.aid()
|
e.id = me.aid()
|
||||||
e.data.app = item
|
e.data.app = item
|
||||||
me.get("onappselect") e
|
me.get("onappselect") e
|
||||||
for v in self.items
|
for v in @items
|
||||||
v.app.blur()
|
v.app.blur()
|
||||||
|
|
||||||
removeApp: (a) ->
|
removeApp: (a) ->
|
||||||
|
i = -1
|
||||||
|
for v, k in self.items
|
||||||
|
if v.app.pid == a.pid
|
||||||
|
i = k
|
||||||
|
break
|
||||||
|
|
||||||
|
if i != -1
|
||||||
|
delete @items[i].app
|
||||||
|
@items.splice(i, 1)
|
||||||
|
$($(@root).children()[i]).remove()
|
||||||
|
|
||||||
mount: () ->
|
mount: () ->
|
||||||
Ant.OS.announcer.trigger "sysdockloaded"
|
Ant.OS.announcer.trigger "sysdockloaded"
|
||||||
|
me = @
|
||||||
|
@root.contextmenuHandle = (e, m) ->
|
||||||
|
return if e.target is me.root
|
||||||
|
bt = $(e.target).closest "afx-button"
|
||||||
|
appidx = $(@root).children().indexOf bt
|
||||||
|
app = self.items[appidx].app
|
||||||
|
m.set "items", [
|
||||||
|
{ text: "__(Show)", dataid: "show" },
|
||||||
|
{ text: "__(Hide)", dataid: "hide" },
|
||||||
|
{ text: "__(Close)", dataid: "quit" }
|
||||||
|
]
|
||||||
|
m.set "onmenuselect", (evt) ->
|
||||||
|
console.log evt
|
||||||
|
### if(app[evt.item.data.dataid])
|
||||||
|
app[evt.item.data.dataid]() ###
|
||||||
|
m.show(e)
|
||||||
|
|
||||||
|
Ant.OS.GUI.define "afx-apps-dock", AppDockTag
|
Loading…
Reference in New Issue
Block a user