mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 08:10:50 +00:00
Allow themes to override [NSMenu _isVisible]
(#307)
The default implementation of `[NSMenu]` uses `_aWindow` and `_bWindow` to determine the visibility of the menu. Not all themes use these windows to build a menu. For example, the WinUXTheme will use Win32 APIs to build a menu. Allow themes to override the value of `[NSMenu _isVisible]` by introducing a `[GSTheme proposedVisibility: (BOOL)visible forMenu: (NSMenu *) menu]` method. The default implementation simply eturns the proposed visibility.
This commit is contained in:
parent
9901bbcb4c
commit
acf00ce5d2
3 changed files with 14 additions and 1 deletions
|
@ -1569,6 +1569,12 @@ withRepeatedImage: (NSImage*)image
|
||||||
- (void) organizeMenu: (NSMenu *)menu
|
- (void) organizeMenu: (NSMenu *)menu
|
||||||
isHorizontal: (BOOL)horizontal;
|
isHorizontal: (BOOL)horizontal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by the theme to override the proposed menu visibility. The default
|
||||||
|
* implementation simply returns the proposed visibility unmodified.
|
||||||
|
*/
|
||||||
|
- (BOOL) proposedVisibility: (BOOL)visible
|
||||||
|
forMenu: (NSMenu *) menu;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GSTheme (OpenSavePanels)
|
@interface GSTheme (OpenSavePanels)
|
||||||
|
|
|
@ -418,5 +418,11 @@
|
||||||
[[menu menuRepresentation] update];
|
[[menu menuRepresentation] update];
|
||||||
[menu sizeToFit];
|
[menu sizeToFit];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) proposedVisibility: (BOOL)visible
|
||||||
|
forMenu: (NSMenu *) menu
|
||||||
|
{
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,8 @@ static BOOL menuBarVisible = YES;
|
||||||
|
|
||||||
- (BOOL) _isVisible
|
- (BOOL) _isVisible
|
||||||
{
|
{
|
||||||
return [_aWindow isVisible] || [_bWindow isVisible];
|
BOOL isVisible = [_aWindow isVisible] || [_bWindow isVisible];
|
||||||
|
return [[GSTheme theme] proposedVisibility: isVisible forMenu: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) _isMain
|
- (BOOL) _isMain
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue