mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 02:11:01 +00:00
Updated key view loop code, to generalize automatic selection of text.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5230 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e2a2a1a7ce
commit
d6cf6096dd
1 changed files with 36 additions and 12 deletions
|
@ -133,7 +133,6 @@ static IMP ccImp;
|
||||||
static IMP ctImp;
|
static IMP ctImp;
|
||||||
static Class responderClass;
|
static Class responderClass;
|
||||||
static Class viewClass;
|
static Class viewClass;
|
||||||
static Class textFieldClass;
|
|
||||||
static NSMutableSet *autosaveNames;
|
static NSMutableSet *autosaveNames;
|
||||||
static NSRecursiveLock *windowsLock;
|
static NSRecursiveLock *windowsLock;
|
||||||
static NSMapTable* windowmaps = NULL;
|
static NSMapTable* windowmaps = NULL;
|
||||||
|
@ -151,7 +150,6 @@ static NSMapTable* windowmaps = NULL;
|
||||||
ctImp = [self instanceMethodForSelector: ctSel];
|
ctImp = [self instanceMethodForSelector: ctSel];
|
||||||
responderClass = [NSResponder class];
|
responderClass = [NSResponder class];
|
||||||
viewClass = [NSView class];
|
viewClass = [NSView class];
|
||||||
textFieldClass = [NSTextField class];
|
|
||||||
autosaveNames = [NSMutableSet new];
|
autosaveNames = [NSMutableSet new];
|
||||||
windowsLock = [NSRecursiveLock new];
|
windowsLock = [NSRecursiveLock new];
|
||||||
}
|
}
|
||||||
|
@ -2058,8 +2056,12 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if (theView)
|
if (theView)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: theView];
|
[self makeFirstResponder: theView];
|
||||||
if ([theView isKindOfClass: textFieldClass])
|
if ([theView respondsToSelector:@selector(selectText:)])
|
||||||
[(NSTextField *)theView selectText: self];
|
{
|
||||||
|
_selection_direction = NSSelectingNext;
|
||||||
|
[(id)theView selectText: self];
|
||||||
|
_selection_direction = NSDirectSelection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2072,8 +2074,12 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if (theView)
|
if (theView)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: theView];
|
[self makeFirstResponder: theView];
|
||||||
if ([theView isKindOfClass: textFieldClass])
|
if ([theView respondsToSelector:@selector(selectText:)])
|
||||||
[(NSTextField *)theView selectText: self];
|
{
|
||||||
|
_selection_direction = NSSelectingPrevious;
|
||||||
|
[(id)theView selectText: self];
|
||||||
|
_selection_direction = NSDirectSelection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2084,7 +2090,7 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if ([first_responder isKindOfClass: viewClass])
|
if ([first_responder isKindOfClass: viewClass])
|
||||||
theView = [first_responder nextValidKeyView];
|
theView = [first_responder nextValidKeyView];
|
||||||
|
|
||||||
if (!theView)
|
if ((theView == nil) && (_initial_first_responder))
|
||||||
{
|
{
|
||||||
if ([_initial_first_responder acceptsFirstResponder])
|
if ([_initial_first_responder acceptsFirstResponder])
|
||||||
theView = _initial_first_responder;
|
theView = _initial_first_responder;
|
||||||
|
@ -2095,8 +2101,12 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if (theView)
|
if (theView)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: theView];
|
[self makeFirstResponder: theView];
|
||||||
if ([theView isKindOfClass: textFieldClass])
|
if ([theView respondsToSelector:@selector(selectText:)])
|
||||||
[(NSTextField *)theView selectText: self];
|
{
|
||||||
|
_selection_direction = NSSelectingNext;
|
||||||
|
[(id)theView selectText: self];
|
||||||
|
_selection_direction = NSDirectSelection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2107,7 +2117,7 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if ([first_responder isKindOfClass: viewClass])
|
if ([first_responder isKindOfClass: viewClass])
|
||||||
theView = [first_responder previousValidKeyView];
|
theView = [first_responder previousValidKeyView];
|
||||||
|
|
||||||
if (!theView)
|
if ((theView == nil) && (_initial_first_responder))
|
||||||
{
|
{
|
||||||
if ([_initial_first_responder acceptsFirstResponder])
|
if ([_initial_first_responder acceptsFirstResponder])
|
||||||
theView = _initial_first_responder;
|
theView = _initial_first_responder;
|
||||||
|
@ -2118,11 +2128,24 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if (theView)
|
if (theView)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: theView];
|
[self makeFirstResponder: theView];
|
||||||
if ([theView isKindOfClass: textFieldClass])
|
if ([theView respondsToSelector:@selector(selectText:)])
|
||||||
[(NSTextField *)theView selectText: self];
|
{
|
||||||
|
_selection_direction = NSSelectingPrevious;
|
||||||
|
[(id)theView selectText: self];
|
||||||
|
_selection_direction = NSDirectSelection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is invoked by selectText: of some views (eg matrixes),
|
||||||
|
// to know whether they have received it from the window, and
|
||||||
|
// if so, in which direction is the selection moving (so that they know
|
||||||
|
// if they should select the last or the first editable cell).
|
||||||
|
- (NSSelectionDirection)keyViewSelectionDirection
|
||||||
|
{
|
||||||
|
return _selection_direction;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dragging
|
* Dragging
|
||||||
*/
|
*/
|
||||||
|
@ -2801,6 +2824,7 @@ resetCursorRectsForView(NSView *theView)
|
||||||
first_responder = self;
|
first_responder = self;
|
||||||
original_responder = nil;
|
original_responder = nil;
|
||||||
_initial_first_responder = nil;
|
_initial_first_responder = nil;
|
||||||
|
_selection_direction = NSDirectSelection;
|
||||||
delegate = nil;
|
delegate = nil;
|
||||||
window_num = 0;
|
window_num = 0;
|
||||||
gstate = 0;
|
gstate = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue