mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
osx.coffee is dead.
Split Chrome into App and Window, in app.coffee and window.coffee
This commit is contained in:
62
src/window.coffee
Normal file
62
src/window.coffee
Normal file
@@ -0,0 +1,62 @@
|
||||
$ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class Window
|
||||
controller: null
|
||||
document: null
|
||||
nswindow: null
|
||||
panes: []
|
||||
|
||||
constructor: (options={}) ->
|
||||
@controller = options.controller
|
||||
@document = options.document
|
||||
@nswindow = options.controller?.window
|
||||
|
||||
addPane: (position, html) ->
|
||||
Editor = require 'editor'
|
||||
|
||||
verticalDiv = $('#app-vertical')
|
||||
horizontalDiv = $('#app-horizontal')
|
||||
|
||||
el = document.createElement "div"
|
||||
el.setAttribute 'class', "pane " + position
|
||||
el.innerHTML = html
|
||||
|
||||
el.addEventListener 'DOMNodeInsertedIntoDocument', ->
|
||||
Editor.resize()
|
||||
, false
|
||||
|
||||
el.addEventListener 'DOMNodeRemovedFromDocument', ->
|
||||
Editor.resize()
|
||||
, false
|
||||
|
||||
switch position
|
||||
when 'top', 'main'
|
||||
verticalDiv.prepend el
|
||||
when 'left'
|
||||
horizontalDiv.prepend el
|
||||
when 'bottom'
|
||||
verticalDiv.append el
|
||||
when 'right'
|
||||
horizontalDiv.append el
|
||||
else
|
||||
throw "I DON'T KNOW HOW TO DEAL WITH #{position}"
|
||||
|
||||
close: ->
|
||||
@controller.close()
|
||||
|
||||
isDirty: ->
|
||||
@nswindow.isDocumentEdited()
|
||||
|
||||
# Set the active window's dirty status.
|
||||
setDirty: (bool) ->
|
||||
@nswindow.setDocumentEdited bool
|
||||
|
||||
inspector:->
|
||||
@_inspector ?= WindowController.webView.inspector
|
||||
|
||||
title: ->
|
||||
@nswindow.title
|
||||
|
||||
setTitle: (title) ->
|
||||
@nswindow.title = title
|
||||
Reference in New Issue
Block a user