Improvements at pulldown popups when the theme process events.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37154 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Germán Arias 2013-09-25 05:42:27 +00:00
parent baabe32c27
commit 5559a2dfd1
2 changed files with 34 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2013-09-24 German Arias <germanandre@gmx.es>
* Source/GSThemeMenu.m (-displayPopUpMenu:withCellFrame:...): If the
PopUp (pulldown) is currently displayed and the theme process events,
allow user close it by clicking over the PopUp button.
2013-09-23 Ivan Vucica <ivan@vucica.net>
* Source/NSImage.m: Missing -retain inside the method

View file

@ -30,6 +30,7 @@
#import <Foundation/NSArchiver.h>
#import "AppKit/NSMenu.h"
#import "AppKit/NSPanel.h"
#import "AppKit/NSPopUpButtonCell.h"
#import "AppKit/NSWindow.h"
#import "AppKit/NSMenuView.h"
#import "AppKit/NSApplication.h"
@ -40,11 +41,22 @@
#import "NSToolbarFrameworkPrivate.h"
#import "GSGuiPrivate.h"
@interface NSMenu (PopUp)
- (NSPopUpButtonCell *)owningPopUp;
@end
@interface NSWindow (Private)
- (GSWindowDecorationView *) windowView;
- (void) _setMenu: (NSMenu *)menu;
@end
@implementation NSMenu (PopUp)
- (NSPopUpButtonCell *)owningPopUp
{
return _popUpButtonCell;
}
@end
@implementation NSWindow (Private)
- (GSWindowDecorationView *) windowView
{
@ -104,22 +116,33 @@
controlViewWindow: (NSWindow *)cvWin
preferredEdge: (NSRectEdge)edge
selectedItem: (int)selectedItem
{
{
BOOL pe = [[GSTheme theme] doesProcessEventsForPopUpMenu];
/* Ensure the window responds when run in modal and should
* process events. Or revert this if theme has changed.
*/
if ([[GSTheme theme] doesProcessEventsForPopUpMenu] &&
![[mr window] worksWhenModal])
if (pe && ![[mr window] worksWhenModal])
{
[(NSPanel *)[mr window] setWorksWhenModal: YES];
}
if (![[GSTheme theme] doesProcessEventsForPopUpMenu] &&
[[mr window] worksWhenModal])
if (!pe && [[mr window] worksWhenModal])
{
[(NSPanel *)[mr window] setWorksWhenModal: NO];
}
/* This is for pulldown PopUp when the theme process events.
* If the popup is currently displayed, close it. If not, the
* user only can close it choosing one option at menu.
*/
if (pe && [[mr window] isVisible] &&
[[mr menu] owningPopUp] != nil)
{
[[[mr menu] owningPopUp] dismissPopUp];
return;
}
// Ask the MenuView to attach the menu to this rect
[mr setWindowFrameForAttachingToRect: cellFrame
onScreen: [cvWin screen]