/Frameworks/Debug/AppKit/rhino.platform/CPScrollView.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 423 lines · 422 code · 1 blank · 0 comment · 0 complexity · 0540e83e0056441909793e6ede9e71b0 MD5 · raw file

  1. i;8;CPView.ji;12;CPClipView.ji;12;CPScroller.jc;21410;
  2. {var the_class = objj_allocateClassPair(CPView, "CPScrollView"),
  3. meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_contentView"), new objj_ivar("_hasVerticalScroller"), new objj_ivar("_hasHorizontalScroller"), new objj_ivar("_autohidesScrollers"), new objj_ivar("_verticalScroller"), new objj_ivar("_horizontalScroller"), new objj_ivar("_recursionCount"), new objj_ivar("_verticalLineScroll"), new objj_ivar("_verticalPageScroll"), new objj_ivar("_horizontalLineScroll"), new objj_ivar("_horizontalPageScroll")]);
  4. objj_registerClassPair(the_class);
  5. objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(the_class, [new objj_method(sel_getUid("initWithFrame:"), function $CPScrollView__initWithFrame_(self, _cmd, aFrame)
  7. { with(self)
  8. {
  9. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPView") }, "initWithFrame:", aFrame);
  10. if (self)
  11. {
  12. _verticalLineScroll = 10.0;
  13. _verticalPageScroll = 10.0;
  14. _horizontalLineScroll = 10.0;
  15. _horizontalPageScroll = 10.0;
  16. _contentView = objj_msgSend(objj_msgSend(CPClipView, "alloc"), "initWithFrame:", objj_msgSend(self, "bounds"));
  17. objj_msgSend(self, "addSubview:", _contentView);
  18. objj_msgSend(self, "setHasVerticalScroller:", YES);
  19. objj_msgSend(self, "setHasHorizontalScroller:", YES);
  20. }
  21. return self;
  22. }
  23. }), new objj_method(sel_getUid("contentSize"), function $CPScrollView__contentSize(self, _cmd)
  24. { with(self)
  25. {
  26. return objj_msgSend(_contentView, "frame").size;
  27. }
  28. }), new objj_method(sel_getUid("documentView"), function $CPScrollView__documentView(self, _cmd)
  29. { with(self)
  30. {
  31. return objj_msgSend(_contentView, "documentView");
  32. }
  33. }), new objj_method(sel_getUid("setContentView:"), function $CPScrollView__setContentView_(self, _cmd, aContentView)
  34. { with(self)
  35. {
  36. if (!aContentView)
  37. return;
  38. var documentView = objj_msgSend(aContentView, "documentView");
  39. if (documentView)
  40. objj_msgSend(documentView, "removeFromSuperview");
  41. objj_msgSend(_contentView, "removeFromSuperview");
  42. var size = objj_msgSend(self, "contentSize");
  43. _contentView = aContentView;
  44. objj_msgSend(_contentView, "setFrame:", CGRectMake(0.0, 0.0, size.width, size.height));
  45. objj_msgSend(_contentView, "setDocumentView:", documentView);
  46. objj_msgSend(self, "addSubview:", _contentView);
  47. }
  48. }), new objj_method(sel_getUid("contentView"), function $CPScrollView__contentView(self, _cmd)
  49. { with(self)
  50. {
  51. return _contentView;
  52. }
  53. }), new objj_method(sel_getUid("setDocumentView:"), function $CPScrollView__setDocumentView_(self, _cmd, aView)
  54. { with(self)
  55. {
  56. objj_msgSend(_contentView, "setDocumentView:", aView);
  57. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  58. }
  59. }), new objj_method(sel_getUid("reflectScrolledClipView:"), function $CPScrollView__reflectScrolledClipView_(self, _cmd, aClipView)
  60. { with(self)
  61. {
  62. if(_contentView !== aClipView)
  63. return;
  64. if (_recursionCount > 5)
  65. return;
  66. ++_recursionCount;
  67. var documentView = objj_msgSend(self, "documentView");
  68. if (!documentView)
  69. {
  70. if (_autohidesScrollers)
  71. {
  72. objj_msgSend(_verticalScroller, "setHidden:", YES);
  73. objj_msgSend(_horizontalScroller, "setHidden:", YES);
  74. }
  75. else
  76. {
  77. }
  78. objj_msgSend(_contentView, "setFrame:", objj_msgSend(self, "bounds"));
  79. --_recursionCount;
  80. return;
  81. }
  82. var documentFrame = objj_msgSend(documentView, "frame"),
  83. contentViewFrame = objj_msgSend(self, "bounds"),
  84. scrollPoint = objj_msgSend(_contentView, "bounds").origin,
  85. difference = { width:CPRectGetWidth(documentFrame) - CPRectGetWidth(contentViewFrame), height:CPRectGetHeight(documentFrame) - CPRectGetHeight(contentViewFrame) },
  86. shouldShowVerticalScroller = (!_autohidesScrollers || difference.height > 0.0) && _hasVerticalScroller,
  87. shouldShowHorizontalScroller = (!_autohidesScrollers || difference.width > 0.0) && _hasHorizontalScroller,
  88. wasShowingVerticalScroller = !objj_msgSend(_verticalScroller, "isHidden"),
  89. wasShowingHorizontalScroller = !objj_msgSend(_horizontalScroller, "isHidden"),
  90. verticalScrollerWidth = (objj_msgSend(_verticalScroller, "frame").size.width);
  91. horizontalScrollerHeight = (objj_msgSend(_horizontalScroller, "frame").size.height);
  92. if (_autohidesScrollers)
  93. {
  94. if (shouldShowVerticalScroller)
  95. shouldShowHorizontalScroller = (!_autohidesScrollers || difference.width > -verticalScrollerWidth) && _hasHorizontalScroller;
  96. if (shouldShowHorizontalScroller)
  97. shouldShowVerticalScroller = (!_autohidesScrollers || difference.height > -horizontalScrollerHeight) && _hasVerticalScroller;
  98. }
  99. objj_msgSend(_verticalScroller, "setHidden:", !shouldShowVerticalScroller);
  100. objj_msgSend(_verticalScroller, "setEnabled:", difference.height > 0.0);
  101. objj_msgSend(_horizontalScroller, "setHidden:", !shouldShowHorizontalScroller);
  102. objj_msgSend(_horizontalScroller, "setEnabled:", difference.width > 0.0);
  103. if (shouldShowVerticalScroller)
  104. {
  105. var verticalScrollerHeight = CPRectGetHeight(contentViewFrame);
  106. if (shouldShowHorizontalScroller)
  107. verticalScrollerHeight -= horizontalScrollerHeight;
  108. difference.width += verticalScrollerWidth;
  109. contentViewFrame.size.width -= verticalScrollerWidth;
  110. objj_msgSend(_verticalScroller, "setFloatValue:knobProportion:", (difference.height <= 0.0) ? 0.0 : scrollPoint.y / difference.height, CPRectGetHeight(contentViewFrame) / CPRectGetHeight(documentFrame));
  111. objj_msgSend(_verticalScroller, "setFrame:", CPRectMake(CPRectGetMaxX(contentViewFrame), 0.0, verticalScrollerWidth, verticalScrollerHeight));
  112. }
  113. else if (wasShowingVerticalScroller)
  114. objj_msgSend(_verticalScroller, "setFloatValue:knobProportion:", 0.0, 1.0);
  115. if (shouldShowHorizontalScroller)
  116. {
  117. difference.height += horizontalScrollerHeight;
  118. contentViewFrame.size.height -= horizontalScrollerHeight;
  119. objj_msgSend(_horizontalScroller, "setFloatValue:knobProportion:", (difference.width <= 0.0) ? 0.0 : scrollPoint.x / difference.width, CPRectGetWidth(contentViewFrame) / CPRectGetWidth(documentFrame));
  120. objj_msgSend(_horizontalScroller, "setFrame:", CPRectMake(0.0, CPRectGetMaxY(contentViewFrame), CPRectGetWidth(contentViewFrame), horizontalScrollerHeight));
  121. }
  122. else if (wasShowingHorizontalScroller)
  123. objj_msgSend(_horizontalScroller, "setFloatValue:knobProportion:", 0.0, 1.0);
  124. objj_msgSend(_contentView, "setFrame:", contentViewFrame);
  125. --_recursionCount;
  126. }
  127. }), new objj_method(sel_getUid("setHorizontalScroller:"), function $CPScrollView__setHorizontalScroller_(self, _cmd, aScroller)
  128. { with(self)
  129. {
  130. if (_horizontalScroller === aScroller)
  131. return;
  132. objj_msgSend(_horizontalScroller, "removeFromSuperview");
  133. objj_msgSend(_horizontalScroller, "setTarget:", nil);
  134. objj_msgSend(_horizontalScroller, "setAction:", nil);
  135. _horizontalScroller = aScroller;
  136. objj_msgSend(_horizontalScroller, "setTarget:", self);
  137. objj_msgSend(_horizontalScroller, "setAction:", sel_getUid("_horizontalScrollerDidScroll:"));
  138. objj_msgSend(self, "addSubview:", _horizontalScroller);
  139. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  140. }
  141. }), new objj_method(sel_getUid("horizontalScroller"), function $CPScrollView__horizontalScroller(self, _cmd)
  142. { with(self)
  143. {
  144. return _horizontalScroller;
  145. }
  146. }), new objj_method(sel_getUid("setHasHorizontalScroller:"), function $CPScrollView__setHasHorizontalScroller_(self, _cmd, shouldHaveHorizontalScroller)
  147. { with(self)
  148. {
  149. if (_hasHorizontalScroller === shouldHaveHorizontalScroller)
  150. return;
  151. _hasHorizontalScroller = shouldHaveHorizontalScroller;
  152. if (_hasHorizontalScroller && !_horizontalScroller)
  153. objj_msgSend(self, "setHorizontalScroller:", objj_msgSend(objj_msgSend(CPScroller, "alloc"), "initWithFrame:", CGRectMake(0.0, 0.0, CPRectGetWidth(objj_msgSend(self, "bounds")), objj_msgSend(CPScroller, "scrollerWidth"))));
  154. else if (!_hasHorizontalScroller && _horizontalScroller)
  155. {
  156. objj_msgSend(_horizontalScroller, "setHidden:", YES);
  157. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  158. }
  159. }
  160. }), new objj_method(sel_getUid("hasHorizontalScroller"), function $CPScrollView__hasHorizontalScroller(self, _cmd)
  161. { with(self)
  162. {
  163. return _hasHorizontalScroller;
  164. }
  165. }), new objj_method(sel_getUid("setVerticalScroller:"), function $CPScrollView__setVerticalScroller_(self, _cmd, aScroller)
  166. { with(self)
  167. {
  168. if (_verticalScroller === aScroller)
  169. return;
  170. objj_msgSend(_verticalScroller, "removeFromSuperview");
  171. objj_msgSend(_verticalScroller, "setTarget:", nil);
  172. objj_msgSend(_verticalScroller, "setAction:", nil);
  173. _verticalScroller = aScroller;
  174. objj_msgSend(_verticalScroller, "setTarget:", self);
  175. objj_msgSend(_verticalScroller, "setAction:", sel_getUid("_verticalScrollerDidScroll:"));
  176. objj_msgSend(self, "addSubview:", _verticalScroller);
  177. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  178. }
  179. }), new objj_method(sel_getUid("verticalScroller"), function $CPScrollView__verticalScroller(self, _cmd)
  180. { with(self)
  181. {
  182. return _verticalScroller;
  183. }
  184. }), new objj_method(sel_getUid("setHasVerticalScroller:"), function $CPScrollView__setHasVerticalScroller_(self, _cmd, shouldHaveVerticalScroller)
  185. { with(self)
  186. {
  187. if (_hasVerticalScroller === shouldHaveVerticalScroller)
  188. return;
  189. _hasVerticalScroller = shouldHaveVerticalScroller;
  190. if (_hasVerticalScroller && !_verticalScroller)
  191. objj_msgSend(self, "setVerticalScroller:", objj_msgSend(objj_msgSend(CPScroller, "alloc"), "initWithFrame:", CPRectMake(0.0, 0.0, objj_msgSend(CPScroller, "scrollerWidth"), CPRectGetHeight(objj_msgSend(self, "bounds")))));
  192. else if (!_hasVerticalScroller && _verticalScroller)
  193. {
  194. objj_msgSend(_verticalScroller, "setHidden:", YES);
  195. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  196. }
  197. }
  198. }), new objj_method(sel_getUid("hasVerticalScroller"), function $CPScrollView__hasVerticalScroller(self, _cmd)
  199. { with(self)
  200. {
  201. return _hasVerticalScroller;
  202. }
  203. }), new objj_method(sel_getUid("setAutohidesScrollers:"), function $CPScrollView__setAutohidesScrollers_(self, _cmd, autohidesScrollers)
  204. { with(self)
  205. {
  206. if (_autohidesScrollers == autohidesScrollers)
  207. return;
  208. _autohidesScrollers = autohidesScrollers;
  209. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  210. }
  211. }), new objj_method(sel_getUid("autohidesScrollers"), function $CPScrollView__autohidesScrollers(self, _cmd)
  212. { with(self)
  213. {
  214. return _autohidesScrollers;
  215. }
  216. }), new objj_method(sel_getUid("_verticalScrollerDidScroll:"), function $CPScrollView___verticalScrollerDidScroll_(self, _cmd, aScroller)
  217. { with(self)
  218. {
  219. var value = objj_msgSend(aScroller, "floatValue"),
  220. documentFrame = objj_msgSend(objj_msgSend(_contentView, "documentView"), "frame");
  221. contentBounds = objj_msgSend(_contentView, "bounds");
  222. switch (objj_msgSend(_verticalScroller, "hitPart"))
  223. {
  224. case CPScrollerDecrementLine: contentBounds.origin.y -= _verticalLineScroll;
  225. break;
  226. case CPScrollerIncrementLine: contentBounds.origin.y += _verticalLineScroll;
  227. break;
  228. case CPScrollerDecrementPage: contentBounds.origin.y -= (contentBounds.size.height) - _verticalPageScroll;
  229. break;
  230. case CPScrollerIncrementPage: contentBounds.origin.y += (contentBounds.size.height) - _verticalPageScroll;
  231. break;
  232. case CPScrollerKnobSlot:
  233. case CPScrollerKnob:
  234. default: contentBounds.origin.y = value * ((documentFrame.size.height) - (contentBounds.size.height));
  235. }
  236. objj_msgSend(_contentView, "scrollToPoint:", contentBounds.origin);
  237. }
  238. }), new objj_method(sel_getUid("_horizontalScrollerDidScroll:"), function $CPScrollView___horizontalScrollerDidScroll_(self, _cmd, aScroller)
  239. { with(self)
  240. {
  241. var value = objj_msgSend(aScroller, "floatValue"),
  242. documentFrame = objj_msgSend(objj_msgSend(self, "documentView"), "frame"),
  243. contentBounds = objj_msgSend(_contentView, "bounds");
  244. switch (objj_msgSend(_horizontalScroller, "hitPart"))
  245. {
  246. case CPScrollerDecrementLine: contentBounds.origin.x -= _horizontalLineScroll;
  247. break;
  248. case CPScrollerIncrementLine: contentBounds.origin.x += _horizontalLineScroll;
  249. break;
  250. case CPScrollerDecrementPage: contentBounds.origin.x -= (contentBounds.size.width) - _horizontalPageScroll;
  251. break;
  252. case CPScrollerIncrementPage: contentBounds.origin.x += (contentBounds.size.width) - _horizontalPageScroll;
  253. break;
  254. case CPScrollerKnobSlot:
  255. case CPScrollerKnob:
  256. default: contentBounds.origin.x = value * ((documentFrame.size.width) - (contentBounds.size.width));
  257. }
  258. objj_msgSend(_contentView, "scrollToPoint:", contentBounds.origin);
  259. }
  260. }), new objj_method(sel_getUid("tile"), function $CPScrollView__tile(self, _cmd)
  261. { with(self)
  262. {
  263. }
  264. }), new objj_method(sel_getUid("resizeSubviewsWithOldSize:"), function $CPScrollView__resizeSubviewsWithOldSize_(self, _cmd, aSize)
  265. { with(self)
  266. {
  267. objj_msgSend(self, "reflectScrolledClipView:", _contentView);
  268. }
  269. }), new objj_method(sel_getUid("setLineScroll:"), function $CPScrollView__setLineScroll_(self, _cmd, aLineScroll)
  270. { with(self)
  271. {
  272. objj_msgSend(self, "setHorizonalLineScroll:", aLineScroll);
  273. objj_msgSend(self, "setVerticalLineScroll:", aLineScroll);
  274. }
  275. }), new objj_method(sel_getUid("lineScroll"), function $CPScrollView__lineScroll(self, _cmd)
  276. { with(self)
  277. {
  278. return objj_msgSend(self, "horizontalLineScroll");
  279. }
  280. }), new objj_method(sel_getUid("setHorizontalLineScroll:"), function $CPScrollView__setHorizontalLineScroll_(self, _cmd, aLineScroll)
  281. { with(self)
  282. {
  283. _horizontalLineScroll = aLineScroll;
  284. }
  285. }), new objj_method(sel_getUid("horizontalLineScroll"), function $CPScrollView__horizontalLineScroll(self, _cmd)
  286. { with(self)
  287. {
  288. return _horizontalLineScroll;
  289. }
  290. }), new objj_method(sel_getUid("setVerticalLineScroll:"), function $CPScrollView__setVerticalLineScroll_(self, _cmd, aLineScroll)
  291. { with(self)
  292. {
  293. _verticalLineScroll = aLineScroll;
  294. }
  295. }), new objj_method(sel_getUid("verticalLineScroll"), function $CPScrollView__verticalLineScroll(self, _cmd)
  296. { with(self)
  297. {
  298. return _verticalLineScroll;
  299. }
  300. }), new objj_method(sel_getUid("setPageScroll:"), function $CPScrollView__setPageScroll_(self, _cmd, aPageScroll)
  301. { with(self)
  302. {
  303. objj_msgSend(self, "setHorizontalPageScroll:", aPageScroll);
  304. objj_msgSend(self, "setVerticalPageScroll:", aPageScroll);
  305. }
  306. }), new objj_method(sel_getUid("pageScroll"), function $CPScrollView__pageScroll(self, _cmd)
  307. { with(self)
  308. {
  309. return objj_msgSend(self, "horizontalPageScroll");
  310. }
  311. }), new objj_method(sel_getUid("setHorizontalPageScroll:"), function $CPScrollView__setHorizontalPageScroll_(self, _cmd, aPageScroll)
  312. { with(self)
  313. {
  314. _horizontalPageScroll = aPageScroll;
  315. }
  316. }), new objj_method(sel_getUid("horizontalPageScroll"), function $CPScrollView__horizontalPageScroll(self, _cmd)
  317. { with(self)
  318. {
  319. return _horizontalPageScroll;
  320. }
  321. }), new objj_method(sel_getUid("setVerticalPageScroll:"), function $CPScrollView__setVerticalPageScroll_(self, _cmd, aPageScroll)
  322. { with(self)
  323. {
  324. _verticalPageScroll = aPageScroll;
  325. }
  326. }), new objj_method(sel_getUid("verticalPageScroll"), function $CPScrollView__verticalPageScroll(self, _cmd)
  327. { with(self)
  328. {
  329. return _verticalPageScroll;
  330. }
  331. }), new objj_method(sel_getUid("scrollWheel:"), function $CPScrollView__scrollWheel_(self, _cmd, anEvent)
  332. { with(self)
  333. {
  334. var value = objj_msgSend(_verticalScroller, "floatValue"),
  335. documentFrame = objj_msgSend(objj_msgSend(self, "documentView"), "frame"),
  336. contentBounds = objj_msgSend(_contentView, "bounds");
  337. contentBounds.origin.x += objj_msgSend(anEvent, "deltaX") * _horizontalLineScroll;
  338. contentBounds.origin.y += objj_msgSend(anEvent, "deltaY") * _verticalLineScroll;
  339. objj_msgSend(_contentView, "scrollToPoint:", contentBounds.origin);
  340. }
  341. }), new objj_method(sel_getUid("keyDown:"), function $CPScrollView__keyDown_(self, _cmd, anEvent)
  342. { with(self)
  343. {
  344. var keyCode = objj_msgSend(anEvent, "keyCode"),
  345. value = objj_msgSend(_verticalScroller, "floatValue"),
  346. documentFrame = objj_msgSend(objj_msgSend(self, "documentView"), "frame"),
  347. contentBounds = objj_msgSend(_contentView, "bounds");
  348. switch (keyCode)
  349. {
  350. case 33:
  351. contentBounds.origin.y -= (contentBounds.size.height) - _verticalPageScroll;
  352. break;
  353. case 34:
  354. contentBounds.origin.y += (contentBounds.size.height) - _verticalPageScroll;
  355. break;
  356. case 38:
  357. contentBounds.origin.y -= _verticalLineScroll;
  358. break;
  359. case 40:
  360. contentBounds.origin.y += _verticalLineScroll;
  361. break;
  362. case 37:
  363. contentBounds.origin.x -= _horizontalLineScroll;
  364. break;
  365. case 49:
  366. contentBounds.origin.x += _horizontalLineScroll;
  367. break;
  368. default: return objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPView") }, "keyDown:", anEvent);
  369. }
  370. objj_msgSend(_contentView, "scrollToPoint:", contentBounds.origin);
  371. }
  372. })]);
  373. }
  374. var CPScrollViewContentViewKey = "CPScrollViewContentView",
  375. CPScrollViewVLineScrollKey = "CPScrollViewVLineScroll",
  376. CPScrollViewHLineScrollKey = "CPScrollViewHLineScroll",
  377. CPScrollViewVPageScrollKey = "CPScrollViewVPageScroll",
  378. CPScrollViewHPageScrollKey = "CPScrollViewHPageScroll",
  379. CPScrollViewHasVScrollerKey = "CPScrollViewHasVScroller",
  380. CPScrollViewHasHScrollerKey = "CPScrollViewHasHScroller",
  381. CPScrollViewVScrollerKey = "CPScrollViewVScroller",
  382. CPScrollViewHScrollerKey = "CPScrollViewHScroller",
  383. CPScrollViewAutohidesScrollerKey = "CPScrollViewAutohidesScroller";
  384. {
  385. var the_class = objj_getClass("CPScrollView")
  386. if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPScrollView\""));
  387. var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("initWithCoder:"), function $CPScrollView__initWithCoder_(self, _cmd, aCoder)
  388. { with(self)
  389. {
  390. if (self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPView") }, "initWithCoder:", aCoder))
  391. {
  392. _verticalLineScroll = objj_msgSend(aCoder, "decodeFloatForKey:", CPScrollViewVLineScrollKey);
  393. _verticalPageScroll = objj_msgSend(aCoder, "decodeFloatForKey:", CPScrollViewVPageScrollKey);
  394. _horizontalLineScroll = objj_msgSend(aCoder, "decodeFloatForKey:", CPScrollViewHLineScrollKey);
  395. _horizontalPageScroll = objj_msgSend(aCoder, "decodeFloatForKey:", CPScrollViewHPageScrollKey);
  396. _contentView = objj_msgSend(aCoder, "decodeObjectForKey:", CPScrollViewContentViewKey);
  397. _verticalScroller = objj_msgSend(aCoder, "decodeObjectForKey:", CPScrollViewVScrollerKey);
  398. _horizontalScroller = objj_msgSend(aCoder, "decodeObjectForKey:", CPScrollViewHScrollerKey);
  399. _hasVerticalScroller = objj_msgSend(aCoder, "decodeBoolForKey:", CPScrollViewHasVScrollerKey);
  400. _hasHorizontalScroller = objj_msgSend(aCoder, "decodeBoolForKey:", CPScrollViewHasHScrollerKey);
  401. _autohidesScrollers = objj_msgSend(aCoder, "decodeBoolForKey:", CPScrollViewAutohidesScrollerKey);
  402. objj_msgSend(objj_msgSend(CPRunLoop, "currentRunLoop"), "performSelector:target:argument:order:modes:", sel_getUid("reflectScrolledClipView:"), self, _contentView, 0, [CPDefaultRunLoopMode]);
  403. }
  404. return self;
  405. }
  406. }), new objj_method(sel_getUid("encodeWithCoder:"), function $CPScrollView__encodeWithCoder_(self, _cmd, aCoder)
  407. { with(self)
  408. {
  409. objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPView") }, "encodeWithCoder:", aCoder);
  410. objj_msgSend(aCoder, "encodeObject:forKey:", _contentView, CPScrollViewContentViewKey);
  411. objj_msgSend(aCoder, "encodeObject:forKey:", _verticalScroller, CPScrollViewVScrollerKey);
  412. objj_msgSend(aCoder, "encodeObject:forKey:", _horizontalScroller, CPScrollViewHScrollerKey);
  413. objj_msgSend(aCoder, "encodeFloat:forKey:", _verticalLineScroll, CPScrollViewVLineScrollKey);
  414. objj_msgSend(aCoder, "encodeFloat:forKey:", _verticalPageScroll, CPScrollViewVPageScrollKey);
  415. objj_msgSend(aCoder, "encodeFloat:forKey:", _horizontalLineScroll, CPScrollViewHLineScrollKey);
  416. objj_msgSend(aCoder, "encodeFloat:forKey:", _horizontalPageScroll, CPScrollViewHPageScrollKey);
  417. objj_msgSend(aCoder, "encodeBool:forKey:", _hasVerticalScroller, CPScrollViewHasVScrollerKey);
  418. objj_msgSend(aCoder, "encodeBool:forKey:", _hasHorizontalScroller, CPScrollViewHasHScrollerKey);
  419. objj_msgSend(aCoder, "encodeBool:forKey:", _autohidesScrollers, CPScrollViewAutohidesScrollerKey);
  420. }
  421. })]);
  422. }