PageRenderTime 25ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/Debug/AppKit/browser.platform/CPWindowController.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 141 lines | 140 code | 1 blank | 0 comment | 0 complexity | dfc6f30bcd86d764fa394495b5b69cec MD5 | raw file
  1I;21;Foundation/CPObject.jI;21;Foundation/CPString.ji;13;CPResponder.ji;10;CPWindow.ji;12;CPDocument.jc;6333;
  2{var the_class = objj_allocateClassPair(CPResponder, "CPWindowController"),
  3meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_owner"), new objj_ivar("_window"), new objj_ivar("_document"), new objj_ivar("_windowCibName")]);
  4objj_registerClassPair(the_class);
  5objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6class_addMethods(the_class, [new objj_method(sel_getUid("initWithWindow:"), function $CPWindowController__initWithWindow_(self, _cmd, aWindow)
  7{ with(self)
  8{
  9    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPResponder") }, "init");
 10    if (self)
 11    {
 12        objj_msgSend(self, "setWindow:", aWindow);
 13        objj_msgSend(self, "setNextResponder:", CPApp);
 14    }
 15    return self;
 16}
 17}), new objj_method(sel_getUid("initWithWindowCibName:"), function $CPWindowController__initWithWindowCibName_(self, _cmd, aWindowCibName)
 18{ with(self)
 19{
 20    return objj_msgSend(self, "initWithWindowCibName:owner:", aWindowCibName, self);
 21}
 22}), new objj_method(sel_getUid("initWithWindowCibName:owner:"), function $CPWindowController__initWithWindowCibName_owner_(self, _cmd, aWindowCibName, anOwner)
 23{ with(self)
 24{
 25    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPResponder") }, "init");
 26    if (self)
 27    {
 28        _owner = anOwner;
 29        _windowCibName = aWindowCibName;
 30        objj_msgSend(self, "setNextResponder:", CPApp);
 31    }
 32    return self;
 33}
 34}), new objj_method(sel_getUid("loadWindow"), function $CPWindowController__loadWindow(self, _cmd)
 35{ with(self)
 36{
 37    objj_msgSend(self, "windowWillLoad");
 38    objj_msgSend(self, "setWindow:", CPApp._keyWindow = objj_msgSend(objj_msgSend(CPWindow, "alloc"), "initWithContentRect:styleMask:", CPRectMakeZero(), CPBorderlessBridgeWindowMask|CPTitledWindowMask|CPClosableWindowMask|CPResizableWindowMask));
 39    objj_msgSend(self, "windowDidLoad");
 40}
 41}), new objj_method(sel_getUid("showWindow:"), function $CPWindowController__showWindow_(self, _cmd, aSender)
 42{ with(self)
 43{
 44    var theWindow = objj_msgSend(self, "window");
 45 if (objj_msgSend(theWindow, "respondsToSelector:", sel_getUid("becomesKeyOnlyIfNeeded")) && objj_msgSend(theWindow, "becomesKeyOnlyIfNeeded"))
 46        objj_msgSend(theWindow, "orderFront:", aSender);
 47    else
 48        objj_msgSend(theWindow, "makeKeyAndOrderFront:", aSender);
 49}
 50}), new objj_method(sel_getUid("isWindowLoaded"), function $CPWindowController__isWindowLoaded(self, _cmd)
 51{ with(self)
 52{
 53    return _window;
 54}
 55}), new objj_method(sel_getUid("window"), function $CPWindowController__window(self, _cmd)
 56{ with(self)
 57{
 58    if (!_window)
 59         objj_msgSend(self, "loadWindow");
 60    return _window;
 61}
 62}), new objj_method(sel_getUid("setWindow:"), function $CPWindowController__setWindow_(self, _cmd, aWindow)
 63{ with(self)
 64{
 65    _window = aWindow;
 66    objj_msgSend(_window, "setWindowController:", self);
 67    objj_msgSend(_window, "setNextResponder:", self);
 68}
 69}), new objj_method(sel_getUid("windowDidLoad"), function $CPWindowController__windowDidLoad(self, _cmd)
 70{ with(self)
 71{
 72    objj_msgSend(_document, "windowControllerDidLoadNib:", self);
 73    objj_msgSend(self, "synchronizeWindowTitleWithDocumentName");
 74}
 75}), new objj_method(sel_getUid("windowWillLoad"), function $CPWindowController__windowWillLoad(self, _cmd)
 76{ with(self)
 77{
 78    objj_msgSend(_document, "windowControllerWillLoadNib:", self);
 79}
 80}), new objj_method(sel_getUid("setDocument:"), function $CPWindowController__setDocument_(self, _cmd, aDocument)
 81{ with(self)
 82{
 83    if (_document == aDocument)
 84        return;
 85    var defaultCenter = objj_msgSend(CPNotificationCenter, "defaultCenter");
 86    if (_document)
 87    {
 88        objj_msgSend(defaultCenter, "removeObserver:name:object:", self, CPDocumentWillSaveNotification, _document);
 89        objj_msgSend(defaultCenter, "removeObserver:name:object:", self, CPDocumentDidSaveNotification, _document);
 90        objj_msgSend(defaultCenter, "removeObserver:name:object:", self, CPDocumentDidFailToSaveNotification, _document);
 91    }
 92    _document = aDocument;
 93    if (_document)
 94    {
 95        objj_msgSend(defaultCenter, "addObserver:selector:name:object:", self, sel_getUid("_documentWillSave:"), CPDocumentWillSaveNotification, _document);
 96        objj_msgSend(defaultCenter, "addObserver:selector:name:object:", self, sel_getUid("_documentDidSave:"), CPDocumentDidSaveNotification, _document);
 97        objj_msgSend(defaultCenter, "addObserver:selector:name:object:", self, sel_getUid("_documentDidFailToSave:"), CPDocumentDidFailToSaveNotification, _document);
 98        objj_msgSend(self, "setDocumentEdited:", objj_msgSend(_document, "isDocumentEdited"));
 99    }
100    objj_msgSend(self, "synchronizeWindowTitleWithDocumentName");
101}
102}), new objj_method(sel_getUid("_documentWillSave:"), function $CPWindowController___documentWillSave_(self, _cmd, aNotification)
103{ with(self)
104{
105    objj_msgSend(objj_msgSend(self, "window"), "setDocumentSaving:", YES);
106}
107}), new objj_method(sel_getUid("_documentDidSave:"), function $CPWindowController___documentDidSave_(self, _cmd, aNotification)
108{ with(self)
109{
110    objj_msgSend(objj_msgSend(self, "window"), "setDocumentSaving:", NO);
111}
112}), new objj_method(sel_getUid("_documentDidFailToSave:"), function $CPWindowController___documentDidFailToSave_(self, _cmd, aNotification)
113{ with(self)
114{
115    objj_msgSend(objj_msgSend(self, "window"), "setDocumentSaving:", NO);
116}
117}), new objj_method(sel_getUid("document"), function $CPWindowController__document(self, _cmd)
118{ with(self)
119{
120    return _document;
121}
122}), new objj_method(sel_getUid("setDocumentEdited:"), function $CPWindowController__setDocumentEdited_(self, _cmd, isEdited)
123{ with(self)
124{
125    objj_msgSend(objj_msgSend(self, "window"), "setDocumentEdited:", isEdited);
126}
127}), new objj_method(sel_getUid("synchronizeWindowTitleWithDocumentName"), function $CPWindowController__synchronizeWindowTitleWithDocumentName(self, _cmd)
128{ with(self)
129{
130    if (!_document || !_window)
131        return;
132    objj_msgSend(_window, "setTitle:", objj_msgSend(self, "windowTitleForDocumentDisplayName:", objj_msgSend(_document, "displayName")));
133}
134}), new objj_method(sel_getUid("windowTitleForDocumentDisplayName:"), function $CPWindowController__windowTitleForDocumentDisplayName_(self, _cmd, aDisplayName)
135{ with(self)
136{
137    return aDisplayName;
138}
139})]);
140}
141