/Frameworks/BlendKit/objj.platform/BKShowcaseController.j

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

  1. I;16;AppKit/CPTheme.jI;15;AppKit/CPView.ji;13;BKUtilities.jc;5383;
  2. var _1=objj_allocateClassPair(CPObject,"BKShowcaseController"),_2=_1.isa;
  3. objj_registerClassPair(_1);
  4. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  5. class_addMethods(_1,[new objj_method(sel_getUid("applicationDidFinishLaunching:"),function(_3,_4,_5){
  6. with(_3){
  7. var _6=objj_msgSend(objj_msgSend(CPWindow,"alloc"),"initWithContentRect:styleMask:",CGRectMakeZero(),CPBorderlessBridgeWindowMask),_7=objj_msgSend(_6,"contentView"),_8=objj_msgSend(_7,"bounds"),_9=BKThemeDescriptorClasses();
  8. var _a=objj_msgSend(objj_msgSend(CPTabView,"alloc"),"initWithFrame:",_8);
  9. objj_msgSend(_a,"setAutoresizingMask:",CPViewWidthSizable|CPViewHeightSizable);
  10. objj_msgSend(_7,"addSubview:",_a);
  11. var _b=0,_c=objj_msgSend(_9,"count");
  12. for(;_b<_c;++_b){
  13. var _d=_9[_b],_e=objj_msgSend(objj_msgSend(CPTabViewItem,"alloc"),"initWithIdentifier:",objj_msgSend(_d,"themeName")),_f=BKThemeObjectTemplatesForClass(_d),_10=objj_msgSend(_f,"count"),_11=[],_12=CGSizeMake(0,0);
  14. while(_10--){
  15. var _13=_f[_10],_14=objj_msgSend(_13,"valueForKey:","themedObject");
  16. if(objj_msgSend(_14,"isKindOfClass:",objj_msgSend(CPView,"class"))){
  17. var _15=objj_msgSend(_14,"frame").size,_16=objj_msgSend(objj_msgSend(_13,"valueForKey:","label"),"sizeWithFont:",objj_msgSend(CPFont,"boldSystemFontOfSize:",12)).width+20;
  18. if(_15.width>_12.width){
  19. _12.width=_15.width;
  20. }
  21. if(_16>_12.width){
  22. _12.width=_16;
  23. }
  24. if(_15.height>_12.height){
  25. _12.height=_15.height;
  26. }
  27. objj_msgSend(_11,"addObject:",_13);
  28. }
  29. }
  30. _12.width+=20;
  31. _12.height+=30;
  32. var _17=objj_msgSend(objj_msgSend(CPCollectionView,"alloc"),"initWithFrame:",CGRectMakeZero()),_18=objj_msgSend(objj_msgSend(CPCollectionViewItem,"alloc"),"init");
  33. var _19=nil;
  34. if(objj_msgSend(_d,"respondsToSelector:",sel_getUid("themeShowcaseBackgroundColor"))){
  35. _19=objj_msgSend(_d,"themeShowcaseBackgroundColor");
  36. }
  37. objj_msgSend(_18,"setView:",objj_msgSend(objj_msgSend(BKShowcaseCell,"alloc"),"initWithShowcaseBackgroundColor:",_19));
  38. objj_msgSend(_17,"setItemPrototype:",_18);
  39. objj_msgSend(_17,"setMinItemSize:",_12);
  40. objj_msgSend(_17,"setMaxItemSize:",_12);
  41. objj_msgSend(_17,"setVerticalMargin:",5);
  42. objj_msgSend(_17,"setContent:",_11);
  43. objj_msgSend(_e,"setLabel:",objj_msgSend(_d,"themeName"));
  44. objj_msgSend(_e,"setView:",_17);
  45. objj_msgSend(_a,"addTabViewItem:",_e);
  46. }
  47. objj_msgSend(_6,"orderFront:",_3);
  48. }
  49. })]);
  50. var _1=objj_allocateClassPair(CPView,"BKShowcaseCell"),_2=_1.isa;
  51. class_addIvars(_1,[new objj_ivar("_showcaseBackgroundColor"),new objj_ivar("_backgroundView"),new objj_ivar("_view"),new objj_ivar("_label")]);
  52. objj_registerClassPair(_1);
  53. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  54. class_addMethods(_1,[new objj_method(sel_getUid("initWithShowcaseBackgroundColor:"),function(_1a,_1b,_1c){
  55. with(_1a){
  56. _1a=objj_msgSendSuper({receiver:_1a,super_class:objj_getClass("CPView")},"init");
  57. if(_1a){
  58. _showcaseBackgroundColor=_1c;
  59. }
  60. return _1a;
  61. }
  62. }),new objj_method(sel_getUid("setSelected:"),function(_1d,_1e,_1f){
  63. with(_1d){
  64. }
  65. }),new objj_method(sel_getUid("setRepresentedObject:"),function(_20,_21,_22){
  66. with(_20){
  67. if(!_label){
  68. _label=objj_msgSend(objj_msgSend(CPTextField,"alloc"),"initWithFrame:",CGRectMakeZero());
  69. objj_msgSend(_label,"setAlignment:",CPCenterTextAlignment);
  70. objj_msgSend(_label,"setAutoresizingMask:",CPViewMinYMargin|CPViewWidthSizable);
  71. objj_msgSend(_label,"setFont:",objj_msgSend(CPFont,"boldSystemFontOfSize:",12));
  72. objj_msgSend(_20,"addSubview:",_label);
  73. }
  74. objj_msgSend(_label,"setStringValue:",objj_msgSend(_22,"valueForKey:","label"));
  75. objj_msgSend(_label,"sizeToFit");
  76. objj_msgSend(_label,"setFrame:",CGRectMake(0,CGRectGetHeight(objj_msgSend(_20,"bounds"))-CGRectGetHeight(objj_msgSend(_label,"frame")),CGRectGetWidth(objj_msgSend(_20,"bounds")),CGRectGetHeight(objj_msgSend(_label,"frame"))));
  77. if(!_backgroundView){
  78. _backgroundView=objj_msgSend(objj_msgSend(CPView,"alloc"),"init");
  79. objj_msgSend(_backgroundView,"setBackgroundColor:",_showcaseBackgroundColor);
  80. objj_msgSend(_20,"addSubview:",_backgroundView);
  81. }
  82. objj_msgSend(_backgroundView,"setFrame:",CGRectMake(0,0,CGRectGetWidth(objj_msgSend(_20,"bounds")),CGRectGetMinY(objj_msgSend(_label,"frame"))));
  83. objj_msgSend(_backgroundView,"setAutoresizingMask:",CPViewWidthSizable|CPViewHeightSizable);
  84. if(_view){
  85. objj_msgSend(_view,"removeFromSuperview");
  86. }
  87. _view=objj_msgSend(_22,"valueForKey:","themedObject");
  88. objj_msgSend(_view,"setTheme:",nil);
  89. objj_msgSend(_view,"setAutoresizingMask:",CPViewMinXMargin|CPViewMaxXMargin|CPViewMinYMargin|CPViewMaxYMargin);
  90. objj_msgSend(_view,"setFrameOrigin:",CGPointMake((CGRectGetWidth(objj_msgSend(_backgroundView,"bounds"))-CGRectGetWidth(objj_msgSend(_view,"frame")))/2,(CGRectGetHeight(objj_msgSend(_backgroundView,"bounds"))-CGRectGetHeight(objj_msgSend(_view,"frame")))/2));
  91. objj_msgSend(_backgroundView,"addSubview:",_view);
  92. }
  93. }),new objj_method(sel_getUid("initWithCoder:"),function(_23,_24,_25){
  94. with(_23){
  95. _23=objj_msgSendSuper({receiver:_23,super_class:objj_getClass("CPView")},"initWithCoder:",_25);
  96. if(_23){
  97. _showcaseBackgroundColor=objj_msgSend(_25,"decodeObjectForKey:","showcase-background-color");
  98. }
  99. return _23;
  100. }
  101. }),new objj_method(sel_getUid("encodeWithCoder:"),function(_26,_27,_28){
  102. with(_26){
  103. objj_msgSendSuper({receiver:_26,super_class:objj_getClass("CPView")},"encodeWithCoder:",_28);
  104. objj_msgSend(_28,"encodeObject:forKey:",_showcaseBackgroundColor,"showcase-background-color");
  105. }
  106. })]);