From: Richard K. <ric...@us...> - 2005-05-26 20:36:18
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20456 Modified Files: NSScrollView.as NSScroller.as Log Message: last methods in place for NSScrollView...testing and debugging Index: NSScrollView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScrollView.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NSScrollView.as 26 May 2005 04:03:19 -0000 1.3 --- NSScrollView.as 26 May 2005 20:35:50 -0000 1.4 *************** *** 40,43 **** --- 40,45 ---- import org.actionstep.constants.NSBorderType; import org.actionstep.constants.NSScrollerPart; + + import org.actionstep.ASDraw; import org.actionstep.NSView; *************** *** 74,78 **** public function initWithFrame(rect:NSRect):NSScrollView { super.initWithFrame(rect); ! setContentView(new NSClipView()); m_borderType = NSBorderType.NSNoBorder; m_autohidesScrollers = false; --- 76,80 ---- public function initWithFrame(rect:NSRect):NSScrollView { super.initWithFrame(rect); ! setContentView((new NSClipView()).init()); m_borderType = NSBorderType.NSNoBorder; m_autohidesScrollers = false; *************** *** 180,184 **** if (m_hasHorizontalScroller) { if (m_horizontalScroller == null) { ! setHorizontalScroller(new NSScroller()); } addSubview(m_horizontalScroller); --- 182,186 ---- if (m_hasHorizontalScroller) { if (m_horizontalScroller == null) { ! setHorizontalScroller((new NSScroller()).init()); } addSubview(m_horizontalScroller); *************** *** 216,220 **** if (m_hasVerticalScroller) { if (m_verticalScroller == null) { ! setVerticalScroller(new NSScroller()); } addSubview(m_verticalScroller); --- 218,222 ---- if (m_hasVerticalScroller) { if (m_verticalScroller == null) { ! setVerticalScroller((new NSScroller()).init()); } addSubview(m_verticalScroller); *************** *** 339,343 **** if (scroller != m_verticalScroller && scroller != m_horizontalScroller) { ! return; //Unknown scroller } --- 341,346 ---- if (scroller != m_verticalScroller && scroller != m_horizontalScroller) { ! //Unknown scroller ! return; } *************** *** 400,404 **** public function reflectScrolledClipView(view:NSView) { ! //! implement } --- 403,443 ---- public function reflectScrolledClipView(view:NSView) { ! var documentFrame:NSRect = NSRect.ZeroRect; ! var clipViewBounds:NSRect = NSRect.ZeroRect; ! var floatValue:Number = 0; ! var knobProportion:Number = 0; ! var documentView:NSView; ! if (view != m_contentView) { ! return; ! } ! if (m_contentView != null) { ! clipViewBounds = m_contentView.bounds(); ! documentView = m_contentView.documentView(); ! } ! if (documentView != null) { ! documentFrame = documentView.frame(); ! } ! if (m_hasVerticalScroller) { ! if (documentFrame.size.height <= clipViewBounds.size.height) { ! m_verticalScroller.setEnabled(false); ! } else { ! m_verticalScroller.setEnabled(true); ! knobProportion = clipViewBounds.size.height / documentFrame.size.height; ! floatValue = (clipViewBounds.origin.y - documentFrame.origin.y) / ! (documentFrame.size.height - clipViewBounds.size.height); ! m_verticalScroller.setFloatValueKnobProportion(floatValue, knobProportion); ! } ! } ! if (m_hasHorizontalScroller) { ! if (documentFrame.size.width <= clipViewBounds.size.width) { ! m_horizontalScroller.setEnabled(false); ! } else { ! m_horizontalScroller.setEnabled(true); ! knobProportion = clipViewBounds.size.width / documentFrame.size.width; ! floatValue = (clipViewBounds.origin.x - documentFrame.origin.x) / ! (documentFrame.size.width - clipViewBounds.size.width); ! m_horizontalScroller.setFloatValueKnobProportion(floatValue, knobProportion); ! } ! } } *************** *** 414,422 **** vScrollerRect = new NSRect(contentRect.maxX() - scrollerWidth, contentRect.minY(), scrollerWidth, contentRect.size.height - scrollerWidth); m_verticalScroller.setFrame(vScrollerRect); - contentRect.size.width -= (vScrollerRect.size.width); } if (m_hasHorizontalScroller) { hScrollerRect = new NSRect(contentRect.minX(), contentRect.maxY() - scrollerWidth, contentRect.size.width - scrollerWidth, scrollerWidth); m_horizontalScroller.setFrame(hScrollerRect); contentRect.size.height -= (hScrollerRect.size.height); } --- 453,465 ---- vScrollerRect = new NSRect(contentRect.maxX() - scrollerWidth, contentRect.minY(), scrollerWidth, contentRect.size.height - scrollerWidth); m_verticalScroller.setFrame(vScrollerRect); } if (m_hasHorizontalScroller) { hScrollerRect = new NSRect(contentRect.minX(), contentRect.maxY() - scrollerWidth, contentRect.size.width - scrollerWidth, scrollerWidth); m_horizontalScroller.setFrame(hScrollerRect); + } + if (m_hasVerticalScroller) { + contentRect.size.width -= (vScrollerRect.size.width); + } + if (m_hasHorizontalScroller) { contentRect.size.height -= (hScrollerRect.size.height); } *************** *** 428,432 **** public function drawRect(rect:NSRect) { ! //! draw borders } --- 471,487 ---- public function drawRect(rect:NSRect) { ! switch(m_borderType) { ! case NSBorderType.NSNoBorder: ! break; ! case NSBorderType.NSLineBorder: ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0]); ! break; ! case NSBorderType.NSBezelBorder: ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0]); ! break; ! case NSBorderType.NSGrooveBorder: ! ASDraw.outlineRectWithRect(m_mcBounds, rect, [0]); ! break; ! } } Index: NSScroller.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSScroller.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSScroller.as 25 May 2005 14:21:52 -0000 1.8 --- NSScroller.as 26 May 2005 20:35:50 -0000 1.9 *************** *** 162,165 **** --- 162,166 ---- } m_hitPart = NSScrollerPart.NSScrollerNoPart; + setNeedsDisplay(true); checkSpaceForParts(); } *************** *** 472,475 **** --- 473,479 ---- public function mouseDown(event:NSEvent) { + if (!m_enabled) { + return; + } var location:NSPoint = event.mouseLocation; m_hitPart = testPart(location); *************** *** 544,555 **** public function drawRect(rect:NSRect) { ASTheme.current().drawScrollerSlotWithRectInView(rect, this); ! var rectIncrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerIncrementLine); ! var rectDecrementLine:NSRect = rectForPart(NSScrollerPart.NSScrollerDecrementLine); ! (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectDecrementLine, this); ! (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectIncrementLine, this); ! drawKnob(); } private function drawKnob() { if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { m_scrollerKnobClip = createBoundsMovieClip(); --- 548,560 ---- public function drawRect(rect:NSRect) { ASTheme.current().drawScrollerSlotWithRectInView(rect, this); ! if (m_enabled) { ! (m_horizontal ? g_leftCell : g_upCell).drawWithFrameInView(rectForPart(NSScrollerPart.NSScrollerDecrementLine), this); ! (m_horizontal ? g_rightCell : g_downCell).drawWithFrameInView(rectForPart(NSScrollerPart.NSScrollerIncrementLine), this); ! drawKnob(); ! } } private function drawKnob() { + if (m_mcBounds == null) return; if (m_scrollerKnobClip == null || m_scrollerKnobClip._parent == undefined) { m_scrollerKnobClip = createBoundsMovieClip(); |