PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/Frameworks/AppKit/rhino.platform/CPToolbarItem.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 292 lines | 292 code | 0 blank | 0 comment | 0 complexity | 6586c7198c678b23e93d2a2db1597425 MD5 | raw file
  1I;21;Foundation/CPObject.jI;21;Foundation/CPString.jI;16;AppKit/CPImage.jI;15;AppKit/CPView.jc;9667;
  2CPToolbarItemVisibilityPriorityStandard=0;
  3CPToolbarItemVisibilityPriorityLow=-1000;
  4CPToolbarItemVisibilityPriorityHigh=1000;
  5CPToolbarItemVisibilityPriorityUser=2000;
  6CPToolbarSeparatorItemIdentifier="CPToolbarSeparatorItemIdentifier";
  7CPToolbarSpaceItemIdentifier="CPToolbarSpaceItemIdentifier";
  8CPToolbarFlexibleSpaceItemIdentifier="CPToolbarFlexibleSpaceItemIdentifier";
  9CPToolbarShowColorsItemIdentifier="CPToolbarShowColorsItemIdentifier";
 10CPToolbarShowFontsItemIdentifier="CPToolbarShowFontsItemIdentifier";
 11CPToolbarCustomizeToolbarItemIdentifier="CPToolbarCustomizeToolbarItemIdentifier";
 12CPToolbarPrintItemIdentifier="CPToolbarPrintItemIdentifier";
 13var _1=objj_allocateClassPair(CPObject,"CPToolbarItem"),_2=_1.isa;
 14class_addIvars(_1,[new objj_ivar("_itemIdentifier"),new objj_ivar("_toolbar"),new objj_ivar("_label"),new objj_ivar("_paletteLabel"),new objj_ivar("_toolTip"),new objj_ivar("_tag"),new objj_ivar("_target"),new objj_ivar("_action"),new objj_ivar("_isEnabled"),new objj_ivar("_image"),new objj_ivar("_alternateImage"),new objj_ivar("_view"),new objj_ivar("_minSize"),new objj_ivar("_maxSize"),new objj_ivar("_visibilityPriority")]);
 15objj_registerClassPair(_1);
 16objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 17class_addMethods(_1,[new objj_method(sel_getUid("initWithItemIdentifier:"),function(_3,_4,_5){
 18with(_3){
 19_3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPObject")},"init");
 20if(_3){
 21_itemIdentifier=_5;
 22_tag=0;
 23_isEnabled=YES;
 24_minSize=CGSizeMakeZero();
 25_maxSize=CGSizeMakeZero();
 26_visibilityPriority=CPToolbarItemVisibilityPriorityStandard;
 27}
 28return _3;
 29}
 30}),new objj_method(sel_getUid("itemIdentifier"),function(_6,_7){
 31with(_6){
 32return _itemIdentifier;
 33}
 34}),new objj_method(sel_getUid("toolbar"),function(_8,_9){
 35with(_8){
 36return _toolbar;
 37}
 38}),new objj_method(sel_getUid("label"),function(_a,_b){
 39with(_a){
 40return _label;
 41}
 42}),new objj_method(sel_getUid("setLabel:"),function(_c,_d,_e){
 43with(_c){
 44_label=_e;
 45}
 46}),new objj_method(sel_getUid("paletteLabel"),function(_f,_10){
 47with(_f){
 48return _paletteLabel;
 49}
 50}),new objj_method(sel_getUid("setPaletteLabel:"),function(_11,_12,_13){
 51with(_11){
 52_paletteLabel=_13;
 53}
 54}),new objj_method(sel_getUid("toolTip"),function(_14,_15){
 55with(_14){
 56if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("toolTip"))){
 57return objj_msgSend(_view,"toolTip");
 58}
 59return _toolTip;
 60}
 61}),new objj_method(sel_getUid("setToolTip:"),function(_16,_17,_18){
 62with(_16){
 63if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setToolTip:"))){
 64objj_msgSend(view,"setToolTip:",_18);
 65}
 66_toolTip=_18;
 67}
 68}),new objj_method(sel_getUid("tag"),function(_19,_1a){
 69with(_19){
 70if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("tag"))){
 71return objj_msgSend(_view,"tag");
 72}
 73return _tag;
 74}
 75}),new objj_method(sel_getUid("setTag:"),function(_1b,_1c,_1d){
 76with(_1b){
 77if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setTag:"))){
 78objj_msgSend(_view,"setTag:",_1d);
 79}
 80_tag=_1d;
 81}
 82}),new objj_method(sel_getUid("target"),function(_1e,_1f){
 83with(_1e){
 84if(_view){
 85return objj_msgSend(_view,"respondsToSelector:",sel_getUid("target"))?objj_msgSend(_view,"target"):nil;
 86}
 87return _target;
 88}
 89}),new objj_method(sel_getUid("setTarget:"),function(_20,_21,_22){
 90with(_20){
 91if(!_view){
 92_target=_22;
 93}else{
 94if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setTarget:"))){
 95objj_msgSend(_view,"setTarget:",_22);
 96}
 97}
 98}
 99}),new objj_method(sel_getUid("action"),function(_23,_24){
100with(_23){
101if(_view){
102return objj_msgSend(_view,"respondsToSelector:",sel_getUid("action"))?objj_msgSend(_view,"action"):nil;
103}
104return _action;
105}
106}),new objj_method(sel_getUid("setAction:"),function(_25,_26,_27){
107with(_25){
108if(!_view){
109_action=_27;
110}else{
111if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setAction:"))){
112objj_msgSend(_view,"setAction:",_27);
113}
114}
115}
116}),new objj_method(sel_getUid("isEnabled"),function(_28,_29){
117with(_28){
118if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("isEnabled"))){
119return objj_msgSend(_view,"isEnabled");
120}
121return _isEnabled;
122}
123}),new objj_method(sel_getUid("setEnabled:"),function(_2a,_2b,_2c){
124with(_2a){
125if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setEnabled:"))){
126objj_msgSend(_view,"setEnabled:",_2c);
127}
128_isEnabled=_2c;
129}
130}),new objj_method(sel_getUid("image"),function(_2d,_2e){
131with(_2d){
132if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("image"))){
133return objj_msgSend(_view,"image");
134}
135return _image;
136}
137}),new objj_method(sel_getUid("setImage:"),function(_2f,_30,_31){
138with(_2f){
139if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setImage:"))){
140objj_msgSend(_view,"setImage:",_31);
141}
142_image=_31;
143if(!_image){
144return;
145}
146if(_minSize.width==0&&_minSize.height==0&&_maxSize.width==0&&_maxSize.height==0){
147var _32=objj_msgSend(_image,"size");
148if(_32.width>0||_32.height>0){
149objj_msgSend(_2f,"setMinSize:",_32);
150objj_msgSend(_2f,"setMaxSize:",_32);
151}
152}
153}
154}),new objj_method(sel_getUid("setAlternateImage:"),function(_33,_34,_35){
155with(_33){
156if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("setAlternateImage:"))){
157objj_msgSend(_view,"setAlternateImage:",_35);
158}
159_alternateImage=_35;
160}
161}),new objj_method(sel_getUid("alternateImage"),function(_36,_37){
162with(_36){
163if(objj_msgSend(_view,"respondsToSelector:",sel_getUid("alternateIamge"))){
164return objj_msgSend(_view,"alternateImage");
165}
166return _alternateImage;
167}
168}),new objj_method(sel_getUid("view"),function(_38,_39){
169with(_38){
170return _view;
171}
172}),new objj_method(sel_getUid("setView:"),function(_3a,_3b,_3c){
173with(_3a){
174if(_view==_3c){
175return;
176}
177_view=_3c;
178if(_view){
179if(_tag!==0&&objj_msgSend(_view,"respondsToSelector:",sel_getUid("setTag:"))){
180objj_msgSend(_view,"setTag:",_tag);
181}
182_target=nil;
183_action=nil;
184}
185}
186}),new objj_method(sel_getUid("minSize"),function(_3d,_3e){
187with(_3d){
188return _minSize;
189}
190}),new objj_method(sel_getUid("setMinSize:"),function(_3f,_40,_41){
191with(_3f){
192_minSize=CGSizeMakeCopy(_41);
193_maxSize=CGSizeMake(MAX(_minSize.width,_maxSize.width),MAX(_minSize.height,_maxSize.height));
194}
195}),new objj_method(sel_getUid("maxSize"),function(_42,_43){
196with(_42){
197return _maxSize;
198}
199}),new objj_method(sel_getUid("setMaxSize:"),function(_44,_45,_46){
200with(_44){
201_maxSize=CGSizeMakeCopy(_46);
202_minSize=CGSizeMake(MIN(_minSize.width,_maxSize.width),MIN(_minSize.height,_maxSize.height));
203}
204}),new objj_method(sel_getUid("visibilityPriority"),function(_47,_48){
205with(_47){
206return _visibilityPriority;
207}
208}),new objj_method(sel_getUid("setVisibilityPriority:"),function(_49,_4a,_4b){
209with(_49){
210_visibilityPriority=_4b;
211}
212})]);
213var _1=objj_getClass("CPToolbarItem");
214if(!_1){
215objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPToolbarItem\""));
216}
217var _2=_1.isa;
218class_addMethods(_1,[new objj_method(sel_getUid("copy"),function(_4c,_4d){
219with(_4c){
220var _4e=objj_msgSend(objj_msgSend(objj_msgSend(_4c,"class"),"alloc"),"initWithItemIdentifier:",_itemIdentifier);
221if(_view){
222objj_msgSend(_4e,"setView:",objj_msgSend(CPKeyedUnarchiver,"unarchiveObjectWithData:",objj_msgSend(CPKeyedArchiver,"archivedDataWithRootObject:",_view)));
223}
224objj_msgSend(_4e,"setLabel:",_label);
225objj_msgSend(_4e,"setPaletteLabel:",_paletteLabel);
226objj_msgSend(_4e,"setToolTip:",objj_msgSend(_4c,"toolTip"));
227objj_msgSend(_4e,"setTag:",objj_msgSend(_4c,"tag"));
228objj_msgSend(_4e,"setTarget:",objj_msgSend(_4c,"target"));
229objj_msgSend(_4e,"setAction:",objj_msgSend(_4c,"action"));
230objj_msgSend(_4e,"setEnabled:",objj_msgSend(_4c,"isEnabled"));
231objj_msgSend(_4e,"setImage:",_image);
232objj_msgSend(_4e,"setAlternateImage:",_alternateImage);
233objj_msgSend(_4e,"setMinSize:",_minSize);
234objj_msgSend(_4e,"setMaxSize:",_maxSize);
235objj_msgSend(_4e,"setVisibilityPriority:",_visibilityPriority);
236return _4e;
237}
238})]);
239var _4f=nil,_50=nil;
240var _1=objj_getClass("CPToolbarItem");
241if(!_1){
242objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPToolbarItem\""));
243}
244var _2=_1.isa;
245class_addMethods(_2,[new objj_method(sel_getUid("_separatorItemView"),function(_51,_52){
246with(_51){
247if(!_4f){
248_4f=objj_msgSend(objj_msgSend(CPView,"alloc"),"initWithFrame:",CGRectMake(0,0,2,32));
249sizes={};
250sizes["CPToolbarItemSeparator"]=[CGSizeMake(2,26),CGSizeMake(2,1),CGSizeMake(2,26)];
251objj_msgSend(_4f,"setBackgroundColor:",_CPControlThreePartImagePattern(YES,sizes,"CPToolbarItem","Separator"));
252}
253return _4f;
254}
255}),new objj_method(sel_getUid("_spaceItemView"),function(_53,_54){
256with(_53){
257if(!_50){
258_50=objj_msgSend(objj_msgSend(CPView,"alloc"),"initWithFrame:",CGRectMakeZero());
259}
260return _50;
261}
262}),new objj_method(sel_getUid("_standardItemWithItemIdentifier:"),function(_55,_56,_57){
263with(_55){
264var _58=objj_msgSend(objj_msgSend(CPToolbarItem,"alloc"),"initWithItemIdentifier:",_57);
265switch(_57){
266case CPToolbarSeparatorItemIdentifier:
267objj_msgSend(_58,"setView:",objj_msgSend(_55,"_separatorItemView"));
268objj_msgSend(_58,"setMinSize:",CGSizeMake(2,0));
269objj_msgSend(_58,"setMaxSize:",CGSizeMake(2,100000));
270return _58;
271case CPToolbarSpaceItemIdentifier:
272objj_msgSend(_58,"setView:",objj_msgSend(_55,"_spaceItemView"));
273objj_msgSend(_58,"setMinSize:",CGSizeMake(32,32));
274objj_msgSend(_58,"setMaxSize:",CGSizeMake(32,32));
275return _58;
276case CPToolbarFlexibleSpaceItemIdentifier:
277objj_msgSend(_58,"setView:",objj_msgSend(_55,"_spaceItemView"));
278objj_msgSend(_58,"setMinSize:",CGSizeMake(32,32));
279objj_msgSend(_58,"setMaxSize:",CGSizeMake(10000,32));
280return _58;
281case CPToolbarShowColorsItemIdentifier:
282return nil;
283case CPToolbarShowFontsItemIdentifier:
284return nil;
285case CPToolbarCustomizeToolbarItemIdentifier:
286return nil;
287case CPToolbarPrintItemIdentifier:
288return nil;
289}
290return nil;
291}
292})]);