PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

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