Make CPPanel -becomesKeyOnlyIfNeeded and CPView -needsPanelToBecomeKey work.

This commit is contained in:
Nicholas Small
2010-01-15 17:23:56 -05:00
parent 6040ee4ffc
commit 204df99375
3 changed files with 19 additions and 1 deletions
+10
View File
@@ -569,6 +569,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
return YES;
}
/*!
Text fields require panels to become key window, so this returns \c YES.
*/
- (BOOL)needsPanelToBecomeKey
{
return YES;
}
- (void)mouseDown:(CPEvent)anEvent
{
// Don't track! (ever?)
@@ -1028,6 +1036,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
var view = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()];
//[view setImagePosition:CPNoImage];
[view setHitTests:NO];
return view;
}
+8
View File
@@ -1284,6 +1284,14 @@ var CPViewFlags = { },
return self;
}
/*!
Returns \c YES if this view requires a panel to become key. Normally only text fields, so this returns \c NO.
*/
- (BOOL)needsPanelToBecomeKey
{
return NO;
}
/*!
Returns \c YES if mouse events aren't needed by the receiver and can be sent to the superview. The
default implementation returns \c NO if the view is opaque.
+1 -1
View File
@@ -1321,7 +1321,7 @@ CPTexturedBackgroundWindowMask
var theWindow = [anEvent window];
if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded])
if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey])
return [_leftMouseDownView mouseDown:anEvent];
else
{