mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
(drawKeyEquivalentWithFrame:inView:): check if item is disabled/enabled and set
color attribute for attributed key equivalent string.
This commit is contained in:
parent
9295b2311b
commit
1b0e90686a
2 changed files with 20 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2019-04-10 Sergii Stoian <stoyan255@ukr.net>
|
||||
|
||||
* Source/NSMenuItemCell.m (drawKeyEquivalentWithFrame:inView:):
|
||||
check if item is disabled/enabled and set color attribute for attributed
|
||||
key equivalent string.
|
||||
|
||||
2019-04-09 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSMenuItemCell.m (_keyEquivalentString): if modifier key string
|
||||
|
|
|
@ -787,10 +787,21 @@ static NSString *commandKeyString = @"#";
|
|||
if (_keyEquivalentFont != nil)
|
||||
{
|
||||
NSDictionary *attrs;
|
||||
NSArray *attrObjects, *attrKeys;
|
||||
NSAttributedString *aString;
|
||||
|
||||
attrs = [NSDictionary dictionaryWithObject: _keyEquivalentFont
|
||||
forKey: NSFontAttributeName];
|
||||
NSColor *aColor;
|
||||
|
||||
if (_cell.is_disabled)
|
||||
aColor = [NSColor disabledControlTextColor];
|
||||
else
|
||||
aColor = [NSColor controlTextColor];
|
||||
|
||||
attrObjects = [NSArray arrayWithObjects: _keyEquivalentFont,
|
||||
aColor, nil];
|
||||
attrKeys = [NSArray arrayWithObjects: NSFontAttributeName,
|
||||
NSForegroundColorAttributeName, nil];
|
||||
attrs = [NSDictionary dictionaryWithObjects: attrObjects
|
||||
forKeys: attrKeys];
|
||||
aString = [[NSAttributedString alloc]
|
||||
initWithString: [self _keyEquivalentString]
|
||||
attributes: attrs];
|
||||
|
|
Loading…
Reference in a new issue