/Frameworks/AppKit/rhino.platform/CPPasteboard.j
http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 142 lines · 142 code · 0 blank · 0 comment · 0 complexity · 8be340e50f37cbadc23de0bbfcaadd7c MD5 · raw file
- I;21;Foundation/CPObject.jI;20;Foundation/CPArray.jI;25;Foundation/CPDictionary.jI;40;Foundation/CPPropertyListSerialization.jc;4493;
- CPGeneralPboard="CPGeneralPboard";
- CPFontPboard="CPFontPboard";
- CPRulerPboard="CPRulerPboard";
- CPFindPboard="CPFindPboard";
- CPDragPboard="CPDragPboard";
- CPColorPboardType="CPColorPboardType";
- CPFilenamesPboardType="CPFilenamesPboardType";
- CPFontPboardType="CPFontPboardType";
- CPHTMLPboardType="CPHTMLPboardType";
- CPStringPboardType="CPStringPboardType";
- CPURLPboardType="CPURLPboardType";
- CPImagePboardType="CPImagePboardType";
- var _1=nil;
- var _2=objj_allocateClassPair(CPObject,"CPPasteboard"),_3=_2.isa;
- class_addIvars(_2,[new objj_ivar("_types"),new objj_ivar("_owners"),new objj_ivar("_provided"),new objj_ivar("_changeCount"),new objj_ivar("_stateUID")]);
- objj_registerClassPair(_2);
- objj_addClassForBundle(_2,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
- class_addMethods(_2,[new objj_method(sel_getUid("_initWithName:"),function(_4,_5,_6){
- with(_4){
- _4=objj_msgSendSuper({receiver:_4,super_class:objj_getClass("CPObject")},"init");
- if(_4){
- _name=_6;
- _types=[];
- _owners=objj_msgSend(CPDictionary,"dictionary");
- _provided=objj_msgSend(CPDictionary,"dictionary");
- _changeCount=0;
- }
- return _4;
- }
- }),new objj_method(sel_getUid("addTypes:owner:"),function(_7,_8,_9,_a){
- with(_7){
- var i=0,_c=_9.length;
- for(;i<_c;++i){
- var _d=_9[i];
- if(!objj_msgSend(_owners,"objectForKey:",_d)){
- objj_msgSend(_types,"addObject:",_d);
- objj_msgSend(_provided,"removeObjectForKey:",_d);
- }
- objj_msgSend(_owners,"setObject:forKey:",_a,_d);
- }
- return ++_changeCount;
- }
- }),new objj_method(sel_getUid("declareTypes:owner:"),function(_e,_f,_10,_11){
- with(_e){
- objj_msgSend(_types,"setArray:",_10);
- _owners=objj_msgSend(CPDictionary,"dictionary");
- _provided=objj_msgSend(CPDictionary,"dictionary");
- var _12=_types.length;
- while(_12--){
- objj_msgSend(_owners,"setObject:forKey:",_11,_types[_12]);
- }
- return ++_changeCount;
- }
- }),new objj_method(sel_getUid("setData:forType:"),function(_13,_14,_15,_16){
- with(_13){
- objj_msgSend(_provided,"setObject:forKey:",_15,_16);
- return YES;
- }
- }),new objj_method(sel_getUid("setPropertyList:forType:"),function(_17,_18,_19,_1a){
- with(_17){
- return objj_msgSend(_17,"setData:forType:",objj_msgSend(CPPropertyListSerialization,"dataFromPropertyList:format:errorDescription:",_19,CPPropertyListXMLFormat_v1_0,nil),_1a);
- }
- }),new objj_method(sel_getUid("setString:forType:"),function(_1b,_1c,_1d,_1e){
- with(_1b){
- return objj_msgSend(_1b,"setPropertyList:forType:",_1d,_1e);
- }
- }),new objj_method(sel_getUid("availableTypeFromArray:"),function(_1f,_20,_21){
- with(_1f){
- return objj_msgSend(_types,"firstObjectCommonWithArray:",_21);
- }
- }),new objj_method(sel_getUid("types"),function(_22,_23){
- with(_22){
- return _types;
- }
- }),new objj_method(sel_getUid("changeCount"),function(_24,_25){
- with(_24){
- return _changeCount;
- }
- }),new objj_method(sel_getUid("dataForType:"),function(_26,_27,_28){
- with(_26){
- var _29=objj_msgSend(_provided,"objectForKey:",_28);
- if(_29){
- return _29;
- }
- var _2a=objj_msgSend(_owners,"objectForKey:",_28);
- if(_2a){
- objj_msgSend(_2a,"pasteboard:provideDataForType:",_26,_28);
- ++_changeCount;
- return objj_msgSend(_provided,"objectForKey:",_28);
- }
- return nil;
- }
- }),new objj_method(sel_getUid("propertyListForType:"),function(_2b,_2c,_2d){
- with(_2b){
- var _2e=objj_msgSend(_2b,"dataForType:",_2d);
- if(_2e){
- return objj_msgSend(CPPropertyListSerialization,"propertyListFromData:format:errorDescription:",_2e,CPPropertyListXMLFormat_v1_0,nil);
- }
- return nil;
- }
- }),new objj_method(sel_getUid("stringForType:"),function(_2f,_30,_31){
- with(_2f){
- return objj_msgSend(_2f,"propertyListForType:",_31);
- }
- }),new objj_method(sel_getUid("_generateStateUID"),function(_32,_33){
- with(_32){
- var _34=32;
- _stateUID="";
- while(_34--){
- _stateUID+=FLOOR(RAND()*16).toString(16).toUpperCase();
- }
- return _stateUID;
- }
- }),new objj_method(sel_getUid("_stateUID"),function(_35,_36){
- with(_35){
- return _stateUID;
- }
- })]);
- class_addMethods(_3,[new objj_method(sel_getUid("initialize"),function(_37,_38){
- with(_37){
- if(_37!=objj_msgSend(CPPasteboard,"class")){
- return;
- }
- objj_msgSend(_37,"setVersion:",1);
- _1=objj_msgSend(CPDictionary,"dictionary");
- }
- }),new objj_method(sel_getUid("generalPasteboard"),function(_39,_3a){
- with(_39){
- return objj_msgSend(CPPasteboard,"pasteboardWithName:",CPGeneralPboard);
- }
- }),new objj_method(sel_getUid("pasteboardWithName:"),function(_3b,_3c,_3d){
- with(_3b){
- var _3e=objj_msgSend(_1,"objectForKey:",_3d);
- if(_3e){
- return _3e;
- }
- _3e=objj_msgSend(objj_msgSend(CPPasteboard,"alloc"),"_initWithName:",_3d);
- objj_msgSend(_1,"setObject:forKey:",_3e,_3d);
- return _3e;
- }
- })]);