PageRenderTime 15ms CodeModel.GetById 7ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Frameworks/Debug/AppKit/rhino.platform/_CPCibWindowTemplate.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 109 lines | 77 code | 32 blank | 0 comment | 0 complexity | b3d9e12630095d84094dd24690be9196 MD5 | raw file
  1I;21;Foundation/CPObject.jc;4943;
  2
  3
  4var _CPCibWindowTemplateMinSizeKey = "_CPCibWindowTemplateMinSizeKey",
  5    _CPCibWindowTemplateMaxSizeKey = "_CPCibWindowTemplateMaxSizeKey",
  6
  7    _CPCibWindowTemplateViewClassKey = "_CPCibWindowTemplateViewClassKey",
  8    _CPCibWindowTemplateWindowClassKey = "_CPCibWindowTemplateWindowClassKey",
  9
 10    _CPCibWindowTemplateWindowRectKey = "_CPCibWindowTemplateWindowRectKey",
 11    _CPCibWindowTemplateWindowStyleMaskKey = "_CPCibWindowTempatStyleMaskKey",
 12    _CPCibWindowTemplateWindowTitleKey = "_CPCibWindowTemplateWindowTitleKey",
 13    _CPCibWindowTemplateWindowViewKey = "_CPCibWindowTemplateWindowViewKey",
 14
 15    _CPCibWindowTemplateWindowIsFullBridgeKey = "_CPCibWindowTemplateWindowIsFullBridgeKey";
 16
 17{var the_class = objj_allocateClassPair(CPObject, "_CPCibWindowTemplate"),
 18meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_minSize"), new objj_ivar("_maxSize"), new objj_ivar("_viewClass"), new objj_ivar("_windowClass"), new objj_ivar("_windowRect"), new objj_ivar("_windowStyleMask"), new objj_ivar("_windowTitle"), new objj_ivar("_windowView"), new objj_ivar("_windowIsFullBridge")]);
 19objj_registerClassPair(the_class);
 20objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 21class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $_CPCibWindowTemplate__initWithCoder_(self, _cmd, aCoder)
 22{ with(self)
 23{
 24    self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
 25
 26    if (self)
 27    {
 28        if (objj_msgSend(aCoder, "containsValueForKey:", _CPCibWindowTemplateMinSizeKey))
 29            _minSize = objj_msgSend(aCoder, "decodeSizeForKey:", _CPCibWindowTemplateMinSizeKey);
 30        if (objj_msgSend(aCoder, "containsValueForKey:", _CPCibWindowTemplateMaxSizeKey))
 31            _maxSize = objj_msgSend(aCoder, "decodeSizeForKey:", _CPCibWindowTemplateMaxSizeKey);
 32
 33        _viewClass = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateViewClassKey);
 34
 35        _windowClass = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowClassKey);
 36        _windowRect = objj_msgSend(aCoder, "decodeRectForKey:", _CPCibWindowTemplateWindowRectKey);
 37        _windowStyleMask = objj_msgSend(aCoder, "decodeIntForKey:", _CPCibWindowTemplateWindowStyleMaskKey);
 38
 39        _windowTitle = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowTitleKey);
 40        _windowView = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowViewKey);
 41
 42        _windowIsFullBridge = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowIsFullBridgeKey);
 43    }
 44
 45    return self;
 46}
 47}), new objj_method(sel_getUid("encodeWithCoder:"), function $_CPCibWindowTemplate__encodeWithCoder_(self, _cmd, aCoder)
 48{ with(self)
 49{
 50    if (_minSize)
 51        objj_msgSend(aCoder, "encodeSize:forKey:", _minSize, _CPCibWindowTemplateMinSizeKey);
 52    if (_maxSize)
 53        objj_msgSend(aCoder, "encodeSize:forKey:", _maxSize, _CPCibWindowTemplateMaxSizeKey);
 54
 55    objj_msgSend(aCoder, "encodeObject:forKey:", _viewClass, _CPCibWindowTemplateViewClassKey);
 56
 57    objj_msgSend(aCoder, "encodeObject:forKey:", _windowClass, _CPCibWindowTemplateWindowClassKey);
 58    objj_msgSend(aCoder, "encodeRect:forKey:", _windowRect, _CPCibWindowTemplateWindowRectKey);
 59    objj_msgSend(aCoder, "encodeInt:forKey:", _windowStyleMask, _CPCibWindowTemplateWindowStyleMaskKey);
 60
 61    objj_msgSend(aCoder, "encodeObject:forKey:", _windowTitle, _CPCibWindowTemplateWindowTitleKey);
 62    objj_msgSend(aCoder, "encodeObject:forKey:", _windowView, _CPCibWindowTemplateWindowViewKey);
 63
 64    objj_msgSend(aCoder, "encodeObject:forKey:", _windowIsFullBridge, _CPCibWindowTemplateWindowIsFullBridgeKey);
 65}
 66}), new objj_method(sel_getUid("windowClass"), function $_CPCibWindowTemplate__windowClass(self, _cmd)
 67{ with(self)
 68{
 69    return _windowClass;
 70}
 71}), new objj_method(sel_getUid("_cibInstantiate"), function $_CPCibWindowTemplate___cibInstantiate(self, _cmd)
 72{ with(self)
 73{
 74    var windowClass = CPClassFromString(objj_msgSend(self, "windowClass"));
 75
 76
 77
 78
 79
 80    var theWindow = objj_msgSend(objj_msgSend(windowClass, "alloc"), "initWithContentRect:styleMask:", _windowRect, _windowStyleMask);
 81
 82    if (_minSize)
 83        objj_msgSend(theWindow, "setMinSize:", _minSize);
 84    if (_maxSize)
 85        objj_msgSend(theWindow, "setMaxSize:", _maxSize);
 86    objj_msgSend(theWindow, "setLevel:", CPFloatingWindowLevel);
 87
 88
 89    objj_msgSend(theWindow, "setTitle:", _windowTitle);
 90
 91
 92    objj_msgSend(_windowView, "setAutoresizesSubviews:", NO);
 93
 94    objj_msgSend(theWindow, "setContentView:", _windowView);
 95
 96    objj_msgSend(_windowView, "setAutoresizesSubviews:", YES);
 97
 98    if (objj_msgSend(_viewClass, "isKindOfClass:", objj_msgSend(CPToolbar, "class")))
 99    {
100       objj_msgSend(theWindow, "setToolbar:", _viewClass);
101    }
102
103    objj_msgSend(theWindow, "setFullBridge:", _windowIsFullBridge);
104
105    return theWindow;
106}
107})]);
108}
109