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

/Frameworks/AppKit/rhino.platform/CPClipView.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 110 lines | 110 code | 0 blank | 0 comment | 0 complexity | d37ca63a79f47d92e6ba030a48ea5675 MD5 | raw file
  1i;8;CPView.jc;4242;
  2var _1=objj_allocateClassPair(CPView,"CPClipView"),_2=_1.isa;
  3class_addIvars(_1,[new objj_ivar("_documentView")]);
  4objj_registerClassPair(_1);
  5objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6class_addMethods(_1,[new objj_method(sel_getUid("setDocumentView:"),function(_3,_4,_5){
  7with(_3){
  8if(_documentView==_5){
  9return;
 10}
 11var _6=objj_msgSend(CPNotificationCenter,"defaultCenter");
 12if(_documentView){
 13objj_msgSend(_6,"removeObserver:name:object:",_3,CPViewFrameDidChangeNotification,_documentView);
 14objj_msgSend(_6,"removeObserver:name:object:",_3,CPViewBoundsDidChangeNotification,_documentView);
 15objj_msgSend(_documentView,"removeFromSuperview");
 16}
 17_documentView=_5;
 18if(_documentView){
 19objj_msgSend(_3,"addSubview:",_documentView);
 20objj_msgSend(_documentView,"setPostsFrameChangedNotifications:",YES);
 21objj_msgSend(_documentView,"setPostsBoundsChangedNotifications:",YES);
 22objj_msgSend(_6,"addObserver:selector:name:object:",_3,sel_getUid("viewFrameChanged:"),CPViewFrameDidChangeNotification,_documentView);
 23objj_msgSend(_6,"addObserver:selector:name:object:",_3,sel_getUid("viewBoundsChanged:"),CPViewBoundsDidChangeNotification,_documentView);
 24}
 25}
 26}),new objj_method(sel_getUid("documentView"),function(_7,_8){
 27with(_7){
 28return _documentView;
 29}
 30}),new objj_method(sel_getUid("constrainScrollPoint:"),function(_9,_a,_b){
 31with(_9){
 32if(!_documentView){
 33return {x:0,y:0};
 34}
 35var _c=objj_msgSend(_documentView,"frame");
 36_b.x=MAX(0,MIN(_b.x,MAX((_c.size.width)-(_bounds.size.width),0)));
 37_b.y=MAX(0,MIN(_b.y,MAX((_c.size.height)-(_bounds.size.height),0)));
 38return _b;
 39}
 40}),new objj_method(sel_getUid("setBoundsOrigin:"),function(_d,_e,_f){
 41with(_d){
 42if((_bounds.origin.x==_f.x&&_bounds.origin.y==_f.y)){
 43return;
 44}
 45objj_msgSendSuper({receiver:_d,super_class:objj_getClass("CPView")},"setBoundsOrigin:",_f);
 46var _10=objj_msgSend(_d,"superview");
 47if(objj_msgSend(_10,"isKindOfClass:",objj_msgSend(CPScrollView,"class"))){
 48objj_msgSend(_10,"reflectScrolledClipView:",_d);
 49}
 50}
 51}),new objj_method(sel_getUid("scrollToPoint:"),function(_11,_12,_13){
 52with(_11){
 53objj_msgSend(_11,"setBoundsOrigin:",objj_msgSend(_11,"constrainScrollPoint:",_13));
 54}
 55}),new objj_method(sel_getUid("viewBoundsChanged:"),function(_14,_15,_16){
 56with(_14){
 57objj_msgSend(_14,"_constrainScrollPoint");
 58}
 59}),new objj_method(sel_getUid("viewFrameChanged:"),function(_17,_18,_19){
 60with(_17){
 61objj_msgSend(_17,"_constrainScrollPoint");
 62}
 63}),new objj_method(sel_getUid("resizeSubviewsWithOldSize:"),function(_1a,_1b,_1c){
 64with(_1a){
 65objj_msgSendSuper({receiver:_1a,super_class:objj_getClass("CPView")},"resizeSubviewsWithOldSize:",_1c);
 66objj_msgSend(_1a,"_constrainScrollPoint");
 67}
 68}),new objj_method(sel_getUid("_constrainScrollPoint"),function(_1d,_1e){
 69with(_1d){
 70var _1f=objj_msgSend(_1d,"bounds").origin;
 71objj_msgSend(_1d,"scrollToPoint:",_1f);
 72if(!CGPointEqualToPoint(_1f,objj_msgSend(_1d,"bounds").origin)){
 73return;
 74}
 75var _20=objj_msgSend(_1d,"superview");
 76if(objj_msgSend(_20,"isKindOfClass:",objj_msgSend(CPScrollView,"class"))){
 77objj_msgSend(_20,"reflectScrolledClipView:",_1d);
 78}
 79}
 80}),new objj_method(sel_getUid("autoscroll:"),function(_21,_22,_23){
 81with(_21){
 82var _24=objj_msgSend(_21,"bounds"),_25=objj_msgSend(_21,"convertPoint:fromView:",objj_msgSend(_23,"locationInWindow"),nil);
 83if(CPRectContainsPoint(_24,_25)){
 84return NO;
 85}
 86var _26=CGRectMakeZero();
 87_26.origin=_25;
 88_26.size=CPSizeMake(10,10);
 89return objj_msgSend(_documentView,"scrollRectToVisible:",_26);
 90}
 91})]);
 92var _27="CPScrollViewDocumentView";
 93var _1=objj_getClass("CPClipView");
 94if(!_1){
 95objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPClipView\""));
 96}
 97var _2=_1.isa;
 98class_addMethods(_1,[new objj_method(sel_getUid("initWithCoder:"),function(_28,_29,_2a){
 99with(_28){
100if(_28=objj_msgSendSuper({receiver:_28,super_class:objj_getClass("CPView")},"initWithCoder:",_2a)){
101objj_msgSend(_28,"setDocumentView:",objj_msgSend(_2a,"decodeObjectForKey:",_27));
102}
103return _28;
104}
105}),new objj_method(sel_getUid("encodeWithCoder:"),function(_2b,_2c,_2d){
106with(_2b){
107objj_msgSendSuper({receiver:_2b,super_class:objj_getClass("CPView")},"encodeWithCoder:",_2d);
108objj_msgSend(_2d,"encodeObject:forKey:",_documentView,_27);
109}
110})]);