Add support for dispatching of focus events got/lost focus stuff. NPOB.

This commit is contained in:
hyatt%netscape.com 2002-03-09 22:43:04 +00:00
Родитель a1b8b85b90
Коммит 742fee1d28
1 изменённых файлов: 42 добавлений и 0 удалений

Просмотреть файл

@ -1732,6 +1732,15 @@ nsChildView::GetQuickDrawPort()
@implementation ChildView
-(NSMenu*)menuForEvent:(NSEvent*)theEvent
{
// XXX Fire the context menu event into Gecko.
// XXX If we don't get an ignore status, then we now need to go up our
// view chain and ask for a menu to return.
return nil;
}
//
// initWithGeckoChild:eventSink:
@ -2041,6 +2050,39 @@ const PRInt32 kNumLines = 8;
mGeckoChild->DispatchWindowEvent(geckoEvent);
}
// This method is called when we are about to be focused.
- (BOOL)becomeFirstResponder
{
nsFocusEvent event;
event.eventStructType = NS_FOCUS_EVENT;
event.message = NS_GOTFOCUS;
event.widget = mGeckoChild;
//focus and blur event should go to their base widget loc
event.point.x = 0;
event.point.y = 0;
mGeckoChild->DispatchWindowEvent(event);
return [super becomeFirstResponder];
}
// This method is called when are are about to lose focus.
- (BOOL)resignFirstResponder
{
nsFocusEvent event;
event.eventStructType = NS_FOCUS_EVENT;
event.message = NS_LOSTFOCUS;
event.widget = mGeckoChild;
//focus and blur event should go to their base widget loc
event.point.x = 0;
event.point.y = 0;
mGeckoChild->DispatchWindowEvent(event);
return [super resignFirstResponder];
}
//-------------------------------------------------------------------------
//
// ConvertMacToRaptorKeyCode