/Frameworks/AppKit/browser.platform/CPRadio.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 151 lines · 151 code · 0 blank · 0 comment · 0 complexity · 4ca451397b50896c5aedcba9432d0f04 MD5 · raw file

  1. I;21;Foundation/CPObject.jI;18;Foundation/CPSet.ji;10;CPButton.jc;5034;
  2. var _1=objj_allocateClassPair(CPButton,"CPRadio"),_2=_1.isa;
  3. class_addIvars(_1,[new objj_ivar("_radioGroup")]);
  4. objj_registerClassPair(_1);
  5. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(_1,[new objj_method(sel_getUid("initWithFrame:radioGroup:"),function(_3,_4,_5,_6){
  7. with(_3){
  8. _3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPButton")},"initWithFrame:",_5);
  9. if(_3){
  10. objj_msgSend(_3,"setRadioGroup:",_6||objj_msgSend(CPRadioGroup,"new"));
  11. objj_msgSend(_3,"setHighlightsBy:",CPContentsCellMask);
  12. objj_msgSend(_3,"setShowsStateBy:",CPContentsCellMask);
  13. objj_msgSend(_3,"setImagePosition:",CPImageLeft);
  14. objj_msgSend(_3,"setAlignment:",CPLeftTextAlignment);
  15. objj_msgSend(_3,"setBordered:",YES);
  16. }
  17. return _3;
  18. }
  19. }),new objj_method(sel_getUid("initWithFrame:"),function(_7,_8,_9){
  20. with(_7){
  21. return objj_msgSend(_7,"initWithFrame:radioGroup:",_9,nil);
  22. }
  23. }),new objj_method(sel_getUid("nextState"),function(_a,_b){
  24. with(_a){
  25. return CPOnState;
  26. }
  27. }),new objj_method(sel_getUid("setRadioGroup:"),function(_c,_d,_e){
  28. with(_c){
  29. if(_radioGroup===_e){
  30. return;
  31. }
  32. objj_msgSend(_radioGroup,"_removeRadio:",_c);
  33. _radioGroup=_e;
  34. objj_msgSend(_radioGroup,"_addRadio:",_c);
  35. }
  36. }),new objj_method(sel_getUid("radioGroup"),function(_f,_10){
  37. with(_f){
  38. return _radioGroup;
  39. }
  40. }),new objj_method(sel_getUid("setObjectValue:"),function(_11,_12,_13){
  41. with(_11){
  42. objj_msgSendSuper({receiver:_11,super_class:objj_getClass("CPButton")},"setObjectValue:",_13);
  43. if(objj_msgSend(_11,"state")===CPOnState){
  44. objj_msgSend(_radioGroup,"_setSelectedRadio:",_11);
  45. }
  46. }
  47. })]);
  48. class_addMethods(_2,[new objj_method(sel_getUid("radioWithTitle:theme:"),function(_14,_15,_16,_17){
  49. with(_14){
  50. return objj_msgSend(_14,"buttonWithTitle:theme:",_16,_17);
  51. }
  52. }),new objj_method(sel_getUid("radioWithTitle:"),function(_18,_19,_1a){
  53. with(_18){
  54. return objj_msgSend(_18,"buttonWithTitle:",_1a);
  55. }
  56. }),new objj_method(sel_getUid("standardButtonWithTitle:"),function(_1b,_1c,_1d){
  57. with(_1b){
  58. var _1e=objj_msgSend(objj_msgSend(CPRadio,"alloc"),"init");
  59. objj_msgSend(_1e,"setTitle:",_1d);
  60. return _1e;
  61. }
  62. }),new objj_method(sel_getUid("themeClass"),function(_1f,_20){
  63. with(_1f){
  64. return "radio";
  65. }
  66. })]);
  67. var _21="CPRadioRadioGroupKey";
  68. var _1=objj_getClass("CPRadio");
  69. if(!_1){
  70. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPRadio\""));
  71. }
  72. var _2=_1.isa;
  73. class_addMethods(_1,[new objj_method(sel_getUid("initWithCoder:"),function(_22,_23,_24){
  74. with(_22){
  75. _22=objj_msgSendSuper({receiver:_22,super_class:objj_getClass("CPButton")},"initWithCoder:",_24);
  76. if(_22){
  77. _radioGroup=objj_msgSend(_24,"decodeObjectForKey:",_21);
  78. }
  79. return _22;
  80. }
  81. }),new objj_method(sel_getUid("encodeWithCoder:"),function(_25,_26,_27){
  82. with(_25){
  83. objj_msgSendSuper({receiver:_25,super_class:objj_getClass("CPButton")},"encodeWithCoder:",_27);
  84. objj_msgSend(_27,"encodeObject:forKey:",_radioGroup,_21);
  85. }
  86. })]);
  87. var _1=objj_allocateClassPair(CPObject,"CPRadioGroup"),_2=_1.isa;
  88. class_addIvars(_1,[new objj_ivar("_radios"),new objj_ivar("_selectedRadio")]);
  89. objj_registerClassPair(_1);
  90. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  91. class_addMethods(_1,[new objj_method(sel_getUid("init"),function(_28,_29){
  92. with(_28){
  93. _28=objj_msgSendSuper({receiver:_28,super_class:objj_getClass("CPObject")},"init");
  94. if(_28){
  95. _radios=objj_msgSend(CPSet,"set");
  96. _selectedRadio=nil;
  97. }
  98. return _28;
  99. }
  100. }),new objj_method(sel_getUid("_addRadio:"),function(_2a,_2b,_2c){
  101. with(_2a){
  102. objj_msgSend(_radios,"addObject:",_2c);
  103. if(objj_msgSend(_2c,"state")===CPOnState){
  104. objj_msgSend(_2a,"_setSelectedRadio:",_2c);
  105. }
  106. }
  107. }),new objj_method(sel_getUid("_removeRadio:"),function(_2d,_2e,_2f){
  108. with(_2d){
  109. if(_selectedRadio===_2f){
  110. _selectedRadio=nil;
  111. }
  112. objj_msgSend(_radios,"removeObject:",_2f);
  113. }
  114. }),new objj_method(sel_getUid("_setSelectedRadio:"),function(_30,_31,_32){
  115. with(_30){
  116. if(_selectedRadio===_32){
  117. return;
  118. }
  119. objj_msgSend(_selectedRadio,"setState:",CPOffState);
  120. _selectedRadio=_32;
  121. }
  122. }),new objj_method(sel_getUid("selectedRadio"),function(_33,_34){
  123. with(_33){
  124. return _selectedRadio;
  125. }
  126. }),new objj_method(sel_getUid("radios"),function(_35,_36){
  127. with(_35){
  128. return objj_msgSend(_radios,"allObjects");
  129. }
  130. })]);
  131. var _37="CPRadioGroupRadiosKey",_38="CPRadioGroupSelectedRadioKey";
  132. var _1=objj_getClass("CPRadioGroup");
  133. if(!_1){
  134. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPRadioGroup\""));
  135. }
  136. var _2=_1.isa;
  137. class_addMethods(_1,[new objj_method(sel_getUid("initWithCoder:"),function(_39,_3a,_3b){
  138. with(_39){
  139. _39=objj_msgSendSuper({receiver:_39,super_class:objj_getClass("CPObject")},"init");
  140. if(_39){
  141. _radios=objj_msgSend(_3b,"decodeObjectForKey:",_37);
  142. _selectedRadio=objj_msgSend(_3b,"decodeObjectForKey:",_38);
  143. }
  144. return _39;
  145. }
  146. }),new objj_method(sel_getUid("encodeWithCoder:"),function(_3c,_3d,_3e){
  147. with(_3c){
  148. objj_msgSend(_3e,"encodeObject:forKey:",_radios,_37);
  149. objj_msgSend(_3e,"encodeObject:forKey:",_selectedRadio,_38);
  150. }
  151. })]);