/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

  1. I;21;Foundation/CPObject.jc;4943;
  2. var _CPCibWindowTemplateMinSizeKey = "_CPCibWindowTemplateMinSizeKey",
  3. _CPCibWindowTemplateMaxSizeKey = "_CPCibWindowTemplateMaxSizeKey",
  4. _CPCibWindowTemplateViewClassKey = "_CPCibWindowTemplateViewClassKey",
  5. _CPCibWindowTemplateWindowClassKey = "_CPCibWindowTemplateWindowClassKey",
  6. _CPCibWindowTemplateWindowRectKey = "_CPCibWindowTemplateWindowRectKey",
  7. _CPCibWindowTemplateWindowStyleMaskKey = "_CPCibWindowTempatStyleMaskKey",
  8. _CPCibWindowTemplateWindowTitleKey = "_CPCibWindowTemplateWindowTitleKey",
  9. _CPCibWindowTemplateWindowViewKey = "_CPCibWindowTemplateWindowViewKey",
  10. _CPCibWindowTemplateWindowIsFullBridgeKey = "_CPCibWindowTemplateWindowIsFullBridgeKey";
  11. {var the_class = objj_allocateClassPair(CPObject, "_CPCibWindowTemplate"),
  12. meta_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")]);
  13. objj_registerClassPair(the_class);
  14. objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  15. class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $_CPCibWindowTemplate__initWithCoder_(self, _cmd, aCoder)
  16. { with(self)
  17. {
  18. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
  19. if (self)
  20. {
  21. if (objj_msgSend(aCoder, "containsValueForKey:", _CPCibWindowTemplateMinSizeKey))
  22. _minSize = objj_msgSend(aCoder, "decodeSizeForKey:", _CPCibWindowTemplateMinSizeKey);
  23. if (objj_msgSend(aCoder, "containsValueForKey:", _CPCibWindowTemplateMaxSizeKey))
  24. _maxSize = objj_msgSend(aCoder, "decodeSizeForKey:", _CPCibWindowTemplateMaxSizeKey);
  25. _viewClass = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateViewClassKey);
  26. _windowClass = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowClassKey);
  27. _windowRect = objj_msgSend(aCoder, "decodeRectForKey:", _CPCibWindowTemplateWindowRectKey);
  28. _windowStyleMask = objj_msgSend(aCoder, "decodeIntForKey:", _CPCibWindowTemplateWindowStyleMaskKey);
  29. _windowTitle = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowTitleKey);
  30. _windowView = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowViewKey);
  31. _windowIsFullBridge = objj_msgSend(aCoder, "decodeObjectForKey:", _CPCibWindowTemplateWindowIsFullBridgeKey);
  32. }
  33. return self;
  34. }
  35. }), new objj_method(sel_getUid("encodeWithCoder:"), function $_CPCibWindowTemplate__encodeWithCoder_(self, _cmd, aCoder)
  36. { with(self)
  37. {
  38. if (_minSize)
  39. objj_msgSend(aCoder, "encodeSize:forKey:", _minSize, _CPCibWindowTemplateMinSizeKey);
  40. if (_maxSize)
  41. objj_msgSend(aCoder, "encodeSize:forKey:", _maxSize, _CPCibWindowTemplateMaxSizeKey);
  42. objj_msgSend(aCoder, "encodeObject:forKey:", _viewClass, _CPCibWindowTemplateViewClassKey);
  43. objj_msgSend(aCoder, "encodeObject:forKey:", _windowClass, _CPCibWindowTemplateWindowClassKey);
  44. objj_msgSend(aCoder, "encodeRect:forKey:", _windowRect, _CPCibWindowTemplateWindowRectKey);
  45. objj_msgSend(aCoder, "encodeInt:forKey:", _windowStyleMask, _CPCibWindowTemplateWindowStyleMaskKey);
  46. objj_msgSend(aCoder, "encodeObject:forKey:", _windowTitle, _CPCibWindowTemplateWindowTitleKey);
  47. objj_msgSend(aCoder, "encodeObject:forKey:", _windowView, _CPCibWindowTemplateWindowViewKey);
  48. objj_msgSend(aCoder, "encodeObject:forKey:", _windowIsFullBridge, _CPCibWindowTemplateWindowIsFullBridgeKey);
  49. }
  50. }), new objj_method(sel_getUid("windowClass"), function $_CPCibWindowTemplate__windowClass(self, _cmd)
  51. { with(self)
  52. {
  53. return _windowClass;
  54. }
  55. }), new objj_method(sel_getUid("_cibInstantiate"), function $_CPCibWindowTemplate___cibInstantiate(self, _cmd)
  56. { with(self)
  57. {
  58. var windowClass = CPClassFromString(objj_msgSend(self, "windowClass"));
  59. var theWindow = objj_msgSend(objj_msgSend(windowClass, "alloc"), "initWithContentRect:styleMask:", _windowRect, _windowStyleMask);
  60. if (_minSize)
  61. objj_msgSend(theWindow, "setMinSize:", _minSize);
  62. if (_maxSize)
  63. objj_msgSend(theWindow, "setMaxSize:", _maxSize);
  64. objj_msgSend(theWindow, "setLevel:", CPFloatingWindowLevel);
  65. objj_msgSend(theWindow, "setTitle:", _windowTitle);
  66. objj_msgSend(_windowView, "setAutoresizesSubviews:", NO);
  67. objj_msgSend(theWindow, "setContentView:", _windowView);
  68. objj_msgSend(_windowView, "setAutoresizesSubviews:", YES);
  69. if (objj_msgSend(_viewClass, "isKindOfClass:", objj_msgSend(CPToolbar, "class")))
  70. {
  71. objj_msgSend(theWindow, "setToolbar:", _viewClass);
  72. }
  73. objj_msgSend(theWindow, "setFullBridge:", _windowIsFullBridge);
  74. return theWindow;
  75. }
  76. })]);
  77. }