mirror of
https://github.com/atom/atom.git
synced 2026-02-15 17:15:24 -05:00
Add initial panel API.
It can only add things to the left right now.
This commit is contained in:
@@ -10,6 +10,8 @@ Grim = require 'grim'
|
||||
TextEditor = require './text-editor'
|
||||
PaneContainer = require './pane-container'
|
||||
Pane = require './pane'
|
||||
Panel = require './panel'
|
||||
PanelElement = require './panel-element'
|
||||
ViewRegistry = require './view-registry'
|
||||
WorkspaceElement = require './workspace-element'
|
||||
|
||||
@@ -62,6 +64,10 @@ class Workspace extends Model
|
||||
modelConstructor: Workspace
|
||||
viewConstructor: WorkspaceElement
|
||||
|
||||
@addViewProvider
|
||||
modelConstructor: Panel
|
||||
viewConstructor: PanelElement
|
||||
|
||||
# Called by the Serializable mixin during deserialization
|
||||
deserializeParams: (params) ->
|
||||
for packageName in params.packagesWithActiveGrammars ? []
|
||||
@@ -277,6 +283,9 @@ class Workspace extends Model
|
||||
@onDidAddPaneItem ({item, pane, index}) ->
|
||||
callback({textEditor: item, pane, index}) if item instanceof TextEditor
|
||||
|
||||
onDidAddPanel: (callback) ->
|
||||
@emitter.on 'did-add-panel', callback
|
||||
|
||||
eachEditor: (callback) ->
|
||||
deprecate("Use Workspace::observeTextEditors instead")
|
||||
|
||||
@@ -659,3 +668,12 @@ class Workspace extends Model
|
||||
# added provider.
|
||||
addViewProvider: (providerSpec) ->
|
||||
@viewRegistry.addViewProvider(providerSpec)
|
||||
|
||||
###
|
||||
Section: Panels
|
||||
###
|
||||
|
||||
addLeftPanel: (options) ->
|
||||
panel = new Panel(_.extend(options, {@viewRegistry, orientation: 'left'}))
|
||||
@emitter.emit('did-add-panel', panel)
|
||||
panel
|
||||
|
||||
Reference in New Issue
Block a user