Implement additional NSResponder action methods to scroll to the

beginning and end of a document, respectively.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30057 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-03-27 22:03:34 +00:00
parent bed9ea8c64
commit 4e3817c049
3 changed files with 68 additions and 0 deletions

View file

@ -1,5 +1,13 @@
2010-03-27 Wolfgang Lux <wolfgang.lux@gmail.com> 2010-03-27 Wolfgang Lux <wolfgang.lux@gmail.com>
* Headers/AppKit/NSResponder.h (-scrollToBeginningOfDocument:,
-scrollToEndOfDocument:):
* Source/NSScrollView.m (-scrollToBeginningOfDocument:,
-scrollToEndOfDocument:):
* Source/NSTextView_actions.m (-scrollToBeginningOfDocument:,
-scrollToEndOfDocument:):
Implement additional NSResponder action methods.
* Source/NSAttributedString.m (-nextWordFromIndex:forward:): * Source/NSAttributedString.m (-nextWordFromIndex:forward:):
Move to the next end of a word rather than the beginning of the Move to the next end of a word rather than the beginning of the
next word so users can quickly navigate to either end of words. next word so users can quickly navigate to either end of words.

View file

@ -730,6 +730,56 @@ static float scrollerWidth;
[_contentView _scrollToPoint: point]; [_contentView _scrollToPoint: point];
} }
- (void) scrollToBeginningOfDocument: (id)sender
{
NSRect clipViewBounds, documentRect;
NSPoint point;
if (_contentView == nil)
{
clipViewBounds = NSZeroRect;
documentRect = NSZeroRect;
}
else
{
clipViewBounds = [_contentView bounds];
documentRect = [_contentView documentRect];
}
point = documentRect.origin;
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
{
point.y = NSMaxY(documentRect) - NSHeight(clipViewBounds);
if (point.y < 0)
point.y = 0;
}
[_contentView _scrollToPoint: point];
}
- (void) scrollToEndOfDocument: (id)sender
{
NSRect clipViewBounds, documentRect;
NSPoint point;
if (_contentView == nil)
{
clipViewBounds = NSZeroRect;
documentRect = NSZeroRect;
}
else
{
clipViewBounds = [_contentView bounds];
documentRect = [_contentView documentRect];
}
point = documentRect.origin;
if (_contentView == nil || _contentView->_rFlags.flipped_view)
{
point.y = NSMaxY(documentRect) - NSHeight(clipViewBounds);
if (point.y < 0)
point.y = 0;
}
[_contentView _scrollToPoint: point];
}
// //
// This method is here purely for nib compatibility. This is the action // This method is here purely for nib compatibility. This is the action
// connected to by NSScrollers in IB when building a scrollview. // connected to by NSScrollers in IB when building a scrollview.

View file

@ -1368,6 +1368,16 @@ and layout is left-to-right */
[[self enclosingScrollView] scrollPageUp: sender]; [[self enclosingScrollView] scrollPageUp: sender];
} }
- (void) scrollToBeginningOfDocument: (id)sender
{
[[self enclosingScrollView] scrollToBeginningOfDocument: sender];
}
- (void) scrollToEndOfDocument: (id)sender
{
[[self enclosingScrollView] scrollToEndOfDocument: sender];
}
- (void) centerSelectionInVisibleArea: (id)sender - (void) centerSelectionInVisibleArea: (id)sender
{ {
NSRange range; NSRange range;