diff --git a/ChangeLog b/ChangeLog index a85c9e65f..392cc9e47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-05-20 04:14-EDT Gregory John Casamento + + * Headers/Additions/GNUstepGUI/GSTheme.h: Added method + displayPopUpMenu:... to handle the display of the popup menus for + themes. + * Source/GSThemeMenu.m: Added default implementation. + * Source/NSPopUpButtonCell.m: Call the displayPopUpMenu:... method + in the method attachPopUpWithFrame:inView:. + 2010-05-19 Quentin Mathe * Headers/AppKit/NSColorPicking.h: Removed Protocol.h import to diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h index c2989c812..8a6c16568 100644 --- a/Headers/Additions/GNUstepGUI/GSTheme.h +++ b/Headers/Additions/GNUstepGUI/GSTheme.h @@ -1061,6 +1061,15 @@ withRepeatedImage: (NSImage*)image - (void) rightMouseDisplay: (NSMenu *)menu forEvent: (NSEvent *)theEvent; +/** + * Display popup menu item. + */ +- (void) displayPopUpMenu: (NSMenuView *)mr + withCellFrame: (NSRect)cellFrame + controlViewWindow: (NSWindow *)cvWin + preferredEdge: (NSRectEdge)edge + selectedItem: (int)selectedItem; + /** * Processes menu events for the theme. The default implementation * does nothing. diff --git a/Source/GSThemeMenu.m b/Source/GSThemeMenu.m index 2524a71e3..4358eda21 100644 --- a/Source/GSThemeMenu.m +++ b/Source/GSThemeMenu.m @@ -91,6 +91,25 @@ } } +- (void) displayPopUpMenu: (NSMenuView *)mr + withCellFrame: (NSRect)cellFrame + controlViewWindow: (NSWindow *)cvWin + preferredEdge: (NSRectEdge)edge + selectedItem: (int)selectedItem +{ + // Ask the MenuView to attach the menu to this rect + [mr setWindowFrameForAttachingToRect: cellFrame + onScreen: [cvWin screen] + preferredEdge: edge + popUpSelectedItem: selectedItem]; + + // Set to be above the main window + [cvWin addChildWindow: [mr window] ordered: NSWindowAbove]; + + // Last, display the window + [[mr window] orderFrontRegardless]; +} + - (void) processCommand: (void *)context { // this is only implemented when we handle native menus. diff --git a/Source/NSPopUpButtonCell.m b/Source/NSPopUpButtonCell.m index c0c522adc..36665c61a 100644 --- a/Source/NSPopUpButtonCell.m +++ b/Source/NSPopUpButtonCell.m @@ -838,17 +838,12 @@ static NSImage *_pbc_image[5]; [mr setHighlightedItemIndex: selectedItem]; } - // Ask the MenuView to attach the menu to this rect - [mr setWindowFrameForAttachingToRect: cellFrame - onScreen: [cvWin screen] - preferredEdge: _pbcFlags.preferredEdge - popUpSelectedItem: selectedItem]; - - // Set to be above the main window - [cvWin addChildWindow: [mr window] ordered: NSWindowAbove]; - - // Last, display the window - [[mr window] orderFrontRegardless]; + // display the menu item... + [[GSTheme theme] displayPopUpMenu: mr + withCellFrame: cellFrame + controlViewWindow: cvWin + preferredEdge: _pbcFlags.preferredEdge + selectedItem: selectedItem]; [nc addObserver: self selector: @selector(_handleNotification:)