/Frameworks/AppKit/rhino.platform/_CPCibCustomView.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 66 lines · 66 code · 0 blank · 0 comment · 0 complexity · fe177ae9b669788f2786d47139749265 MD5 · raw file

  1. i;8;CPView.jc;2703;
  2. var _1=objj_allocateClassPair(CPView,"_CPCibCustomView"),_2=_1.isa;
  3. class_addIvars(_1,[new objj_ivar("_className")]);
  4. objj_registerClassPair(_1);
  5. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(_1,[new objj_method(sel_getUid("customClassName"),function(_3,_4){
  7. with(_3){
  8. return _className;
  9. }
  10. })]);
  11. var _5="_CPCibCustomViewClassNameKey";
  12. var _1=objj_getClass("_CPCibCustomView");
  13. if(!_1){
  14. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"_CPCibCustomView\""));
  15. }
  16. var _2=_1.isa;
  17. class_addMethods(_1,[new objj_method(sel_getUid("initWithCoder:"),function(_6,_7,_8){
  18. with(_6){
  19. _6=objj_msgSendSuper({receiver:_6,super_class:objj_getClass("CPView")},"initWithCoder:",_8);
  20. if(_6){
  21. _className=objj_msgSend(_8,"decodeObjectForKey:",_5);
  22. }
  23. return _6;
  24. }
  25. }),new objj_method(sel_getUid("encodeWithCoder:"),function(_9,_a,_b){
  26. with(_9){
  27. objj_msgSendSuper({receiver:_9,super_class:objj_getClass("CPView")},"encodeWithCoder:",_b);
  28. objj_msgSend(_b,"encodeObject:forKey:",_className,_5);
  29. }
  30. }),new objj_method(sel_getUid("drawRect:"),function(_c,_d,_e){
  31. with(_c){
  32. var _f=objj_msgSend(_c,"bounds"),_10=objj_msgSend(objj_msgSend(CPGraphicsContext,"currentContext"),"graphicsPort");
  33. CGContextSetLineWidth(_10,1);
  34. CGContextSetStrokeColor(_10,objj_msgSend(CPColor,"colorWithCalibratedRed:green:blue:alpha:",169/255,173/255,178/255,1));
  35. CGContextStrokeRect(_10,CGRectInset(CGRectIntegral(_f),0.5,0.5));
  36. CGContextSetFillColor(_10,objj_msgSend(CPColor,"colorWithCalibratedRed:green:blue:alpha:",224/255,236/255,250/255,1));
  37. CGContextFillRect(_10,CGRectInset(_f,2,2));
  38. }
  39. }),new objj_method(sel_getUid("_cibInstantiate"),function(_11,_12){
  40. with(_11){
  41. var _13=CPClassFromString(_className);
  42. if(!_13){
  43. _13=objj_msgSend(CPView,"class");
  44. }
  45. if(_13===objj_msgSend(_11,"class")){
  46. _className="CPView";
  47. return _11;
  48. }
  49. var _14=objj_msgSend(objj_msgSend(_13,"alloc"),"initWithFrame:",objj_msgSend(_11,"frame"));
  50. if(_14){
  51. objj_msgSend(_14,"setBounds:",objj_msgSend(_11,"bounds"));
  52. var _15=objj_msgSend(objj_msgSend(_11,"subviews"),"copy"),_16=0,_17=_15.length;
  53. for(;_16<_17;++_16){
  54. objj_msgSend(_14,"addSubview:",_15[_16]);
  55. }
  56. objj_msgSend(_14,"setAutoresizingMask:",objj_msgSend(_11,"autoresizingMask"));
  57. objj_msgSend(_14,"setAutoresizesSubviews:",objj_msgSend(_11,"autoresizesSubviews"));
  58. objj_msgSend(_14,"setHitTests:",objj_msgSend(_11,"hitTests"));
  59. objj_msgSend(_14,"setHidden:",objj_msgSend(_11,"isHidden"));
  60. objj_msgSend(_14,"setAlphaValue:",objj_msgSend(_11,"alphaValue"));
  61. objj_msgSend(_superview,"replaceSubview:with:",_11,_14);
  62. objj_msgSend(_14,"setBackgroundColor:",objj_msgSend(_11,"backgroundColor"));
  63. }
  64. return _14;
  65. }
  66. })]);