Add backend support for the NSWindow child mechanism and use it for

popup buttons.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27719 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2009-01-29 09:37:30 +00:00
parent 0a03a0999e
commit 60af32a0f7
5 changed files with 38 additions and 2 deletions

View file

@ -1,3 +1,14 @@
2009-01-29 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSDisplayServer.h
(-setPartentWindow:forChildWindow:),
* Source/GSDisplayServer.m (-setPartentWindow:forChildWindow:):
New method.
* Source/NSWindow.m (-setParentWindow:, -_initBackendWindow): Use
this new method.
* Source/NSPopUpButtonCell.m (-attachPopUpWithFrame:inView:,
-dismissPopUp): Use child window mechanism for the popup menu.
2009-01-28 Fred Kiefer <FredKiefer@gmx.de> 2009-01-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m (GSWindowWithNumber): Protect agains * Source/NSWindow.m (GSWindowWithNumber): Protect agains

View file

@ -162,6 +162,8 @@ APPKIT_EXPORT NSString * GSScreenNumber;
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors - (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors
: (const unsigned char *) image : (void**)cid; : (const unsigned char *) image : (void**)cid;
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*)cid; - (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*)cid;
- (void) setPartentWindow: (int)partentWin
forChildWindow: (int)childWin;
@end @end

View file

@ -896,6 +896,12 @@ GSCurrentServer(void)
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
} }
- (void) setPartentWindow: (int)partentWin
forChildWindow: (int)childWin
{
[self subclassResponsibility: _cmd];
}
@end @end
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */

View file

@ -828,7 +828,10 @@ static NSImage *_pbc_image[5];
onScreen: [cvWin screen] onScreen: [cvWin screen]
preferredEdge: _pbcFlags.preferredEdge preferredEdge: _pbcFlags.preferredEdge
popUpSelectedItem: selectedItem]; popUpSelectedItem: selectedItem];
// Set to be above the main window
[cvWin addChildWindow: [mr window] ordered: NSWindowAbove];
// Last, display the window // Last, display the window
[[mr window] orderFrontRegardless]; [[mr window] orderFrontRegardless];
@ -844,11 +847,17 @@ static NSImage *_pbc_image[5];
- (void) dismissPopUp - (void) dismissPopUp
{ {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSMenuView *mr = [_menu menuRepresentation];
NSWindow *mWin;
[nc removeObserver: self [nc removeObserver: self
name: NSMenuDidSendActionNotification name: NSMenuDidSendActionNotification
object: _menu]; object: _menu];
[_menu close]; [_menu close];
// remove from main window
mWin = [mr window];
[[mWin parentWindow] removeChildWindow: mWin];
} }
/* Private method handles all cases after doing a selection from /* Private method handles all cases after doing a selection from

View file

@ -856,6 +856,9 @@ many times.
: _styleMask : _styleMask
: [_screen screenNumber]]; : [_screen screenNumber]];
[srv setwindowlevel: [self level] : _windowNum]; [srv setwindowlevel: [self level] : _windowNum];
if (_parent != nil)
[srv setPartentWindow: [_parent windowNumber]
forChildWindow: _windowNum];
// Set up context // Set up context
[self _startBackendWindow]; [self _startBackendWindow];
@ -4741,8 +4744,13 @@ current key view.<br />
- (void) setParentWindow: (NSWindow *)window - (void) setParentWindow: (NSWindow *)window
{ {
// FIXME
_parent = window; _parent = window;
if (_windowNum)
{
[GSServerForWindow(self) setPartentWindow: [_parent windowNumber]
forChildWindow: _windowNum];
}
} }
- (BOOL) allowsToolTipsWhenApplicationIsInactive - (BOOL) allowsToolTipsWhenApplicationIsInactive