PageRenderTime 23ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/AppKit/rhino.platform/_CPHUDWindowView.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 119 lines | 119 code | 0 blank | 0 comment | 0 complexity | 8e9272bdcc23ac14a30a891ed7dcdb38 MD5 | raw file
  1c;6989;
  2var _1=nil,_2=nil;
  3var _3=26;
  4var _4=objj_allocateClassPair(_CPWindowView,"_CPHUDWindowView"),_5=_4.isa;
  5class_addIvars(_4,[new objj_ivar("_toolbarView"),new objj_ivar("_titleField"),new objj_ivar("_closeButton")]);
  6objj_registerClassPair(_4);
  7objj_addClassForBundle(_4,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  8class_addMethods(_4,[new objj_method(sel_getUid("contentRectForFrameRect:"),function(_6,_7,_8){
  9with(_6){
 10var _9=objj_msgSend(objj_msgSend(_6,"class"),"contentRectForFrameRect:",_8);
 11if(objj_msgSend(objj_msgSend(objj_msgSend(_6,"window"),"toolbar"),"isVisible")){
 12toolbarHeight=CGRectGetHeight(objj_msgSend(objj_msgSend(_6,"toolbarView"),"frame"));
 13_9.origin.y+=toolbarHeight;
 14_9.size.height-=toolbarHeight;
 15}
 16return _9;
 17}
 18}),new objj_method(sel_getUid("frameRectForContentRect:"),function(_a,_b,_c){
 19with(_a){
 20var _d=objj_msgSend(objj_msgSend(_a,"class"),"frameRectForContentRect:",_c);
 21if(objj_msgSend(objj_msgSend(objj_msgSend(_a,"window"),"toolbar"),"isVisible")){
 22toolbarHeight=CGRectGetHeight(objj_msgSend(objj_msgSend(_a,"toolbarView"),"frame"));
 23_d.origin.y-=toolbarHeight;
 24_d.size.height+=toolbarHeight;
 25}
 26return _d;
 27}
 28}),new objj_method(sel_getUid("initWithFrame:styleMask:"),function(_e,_f,_10,_11){
 29with(_e){
 30_e=objj_msgSendSuper({receiver:_e,super_class:objj_getClass("_CPWindowView")},"initWithFrame:styleMask:",_10,_11);
 31if(_e){
 32var _12=objj_msgSend(_e,"bounds");
 33objj_msgSend(_e,"setBackgroundColor:",_1);
 34_titleField=objj_msgSend(objj_msgSend(CPTextField,"alloc"),"initWithFrame:",CGRectMakeZero());
 35objj_msgSend(_titleField,"setHitTests:",NO);
 36objj_msgSend(_titleField,"setFont:",objj_msgSend(CPFont,"systemFontOfSize:",11));
 37objj_msgSend(_titleField,"setTextColor:",objj_msgSend(CPColor,"whiteColor"));
 38objj_msgSend(_titleField,"setTextShadowColor:",objj_msgSend(CPColor,"blackColor"));
 39objj_msgSend(_titleField,"setTextShadowOffset:",CGSizeMake(0,1));
 40objj_msgSend(_titleField,"setAutoresizingMask:",CPViewWidthSizable);
 41objj_msgSend(_titleField,"setLineBreakMode:",CPLineBreakByTruncatingTail);
 42objj_msgSend(_titleField,"setAlignment:",CPCenterTextAlignment);
 43objj_msgSend(_titleField,"setStringValue:","Untitled");
 44objj_msgSend(_titleField,"sizeToFit");
 45objj_msgSend(_titleField,"setAutoresizingMask:",CPViewWidthSizable);
 46objj_msgSend(_titleField,"setStringValue:","");
 47objj_msgSend(_titleField,"setFrame:",CGRectMake(20,3,CGRectGetWidth(objj_msgSend(_e,"bounds"))-40,CGRectGetHeight(objj_msgSend(_titleField,"frame"))));
 48objj_msgSend(_e,"addSubview:",_titleField);
 49if(_styleMask&CPClosableWindowMask){
 50var _13=objj_msgSend(_CPHUDWindowViewCloseImage,"size");
 51_closeButton=objj_msgSend(objj_msgSend(CPButton,"alloc"),"initWithFrame:",CGRectMake(4,4,_13.width,_13.height));
 52objj_msgSend(_closeButton,"setBordered:",NO);
 53objj_msgSend(_closeButton,"setImage:",_CPHUDWindowViewCloseImage);
 54objj_msgSend(_closeButton,"setAlternateImage:",_CPHUDWindowViewCloseActiveImage);
 55objj_msgSend(_e,"addSubview:",_closeButton);
 56}
 57objj_msgSend(_e,"setResizeIndicatorOffset:",CGSizeMake(5,5));
 58}
 59return _e;
 60}
 61}),new objj_method(sel_getUid("viewDidMoveToWindow"),function(_14,_15){
 62with(_14){
 63objj_msgSend(_closeButton,"setTarget:",objj_msgSend(_14,"window"));
 64objj_msgSend(_closeButton,"setAction:",sel_getUid("performClose:"));
 65}
 66}),new objj_method(sel_getUid("setTitle:"),function(_16,_17,_18){
 67with(_16){
 68objj_msgSend(_titleField,"setStringValue:",_18);
 69}
 70}),new objj_method(sel_getUid("toolbarView"),function(_19,_1a){
 71with(_19){
 72return _toolbarView;
 73}
 74}),new objj_method(sel_getUid("toolbarLabelColor"),function(_1b,_1c){
 75with(_1b){
 76return objj_msgSend(CPColor,"whiteColor");
 77}
 78}),new objj_method(sel_getUid("toolbarLabelShadowColor"),function(_1d,_1e){
 79with(_1d){
 80return objj_msgSend(CPColor,"blackColor");
 81}
 82}),new objj_method(sel_getUid("toolbarOffset"),function(_1f,_20){
 83with(_1f){
 84return CGSizeMake(0,_3);
 85}
 86}),new objj_method(sel_getUid("tile"),function(_21,_22){
 87with(_21){
 88objj_msgSendSuper({receiver:_21,super_class:objj_getClass("_CPWindowView")},"tile");
 89var _23=objj_msgSend(_21,"window"),_24=objj_msgSend(_21,"bounds"),_25=CGRectGetWidth(_24);
 90objj_msgSend(_titleField,"setFrame:",CGRectMake(20,3,_25-40,CGRectGetHeight(objj_msgSend(_titleField,"frame"))));
 91var _26=objj_msgSend(_21,"toolbarMaxY");
 92objj_msgSend(objj_msgSend(_23,"contentView"),"setFrameOrigin:",CGPointMake(0,_26,_25,CGRectGetHeight(_24)-_26));
 93}
 94})]);
 95class_addMethods(_5,[new objj_method(sel_getUid("initialize"),function(_27,_28){
 96with(_27){
 97if(_27!=objj_msgSend(_CPHUDWindowView,"class")){
 98return;
 99}
100var _29=objj_msgSend(CPBundle,"bundleForClass:",_27);
101_1=objj_msgSend(CPColor,"colorWithPatternImage:",objj_msgSend(objj_msgSend(CPNinePartImage,"alloc"),"initWithImageSlices:",[objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground0.png"),CPSizeMake(6,78)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground1.png"),CPSizeMake(1,78)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground2.png"),CPSizeMake(6,78)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground3.png"),CPSizeMake(6,1)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground4.png"),CPSizeMake(1,1)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground5.png"),CPSizeMake(6,1)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground6.png"),CPSizeMake(6,6)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground7.png"),CPSizeMake(6,6)),objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","CPWindow/HUD/CPWindowHUDBackground8.png"),CPSizeMake(6,6))]));
102_CPHUDWindowViewCloseImage=objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","HUDTheme/WindowClose.png"),CPSizeMake(20,20));
103_CPHUDWindowViewCloseActiveImage=objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(_29,"pathForResource:","HUDTheme/WindowCloseActive.png"),CPSizeMake(20,20));
104}
105}),new objj_method(sel_getUid("contentRectForFrameRect:"),function(_2a,_2b,_2c){
106with(_2a){
107var _2d=CGRectMakeCopy(_2c),_2e=_3;
108_2d.origin.y+=_2e;
109_2d.size.height-=_2e;
110return _2d;
111}
112}),new objj_method(sel_getUid("frameRectForContentRect:"),function(_2f,_30,_31){
113with(_2f){
114var _32=CGRectMakeCopy(_31),_33=_3;
115_32.origin.y-=_33;
116_32.size.height+=_33;
117return _32;
118}
119})]);