mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-29 22:37:39 +00:00
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:
parent
bed9ea8c64
commit
4e3817c049
3 changed files with 68 additions and 0 deletions
|
@ -1,5 +1,13 @@
|
|||
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:):
|
||||
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.
|
||||
|
|
|
@ -730,6 +730,56 @@ static float scrollerWidth;
|
|||
[_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
|
||||
// connected to by NSScrollers in IB when building a scrollview.
|
||||
|
|
|
@ -1368,6 +1368,16 @@ and layout is left-to-right */
|
|||
[[self enclosingScrollView] scrollPageUp: sender];
|
||||
}
|
||||
|
||||
- (void) scrollToBeginningOfDocument: (id)sender
|
||||
{
|
||||
[[self enclosingScrollView] scrollToBeginningOfDocument: sender];
|
||||
}
|
||||
|
||||
- (void) scrollToEndOfDocument: (id)sender
|
||||
{
|
||||
[[self enclosingScrollView] scrollToEndOfDocument: sender];
|
||||
}
|
||||
|
||||
- (void) centerSelectionInVisibleArea: (id)sender
|
||||
{
|
||||
NSRange range;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue