/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

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