mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-04 03:44:58 +00:00
Take into account highlightsBy and showsStateBy when decoding cib.
nib2cib was modified to take into account these variables during conversion nib->cib.
This commit is contained in:
1 parent
c80417c433
commit
66f5e1fb64
2 files changed
+48
-2
No files matched your search
+12
-1
@@ -376,6 +376,9 @@ CPButtonImageOffset = 3.0;
|
||||
|
||||
- (void)setShowsStateBy:(CPInteger)aMask
|
||||
{
|
||||
// CPPushInCellMask cannot be set for showsStateBy.
|
||||
aMask ^= CPPushInCellMask;
|
||||
|
||||
if (_showsStateBy === aMask)
|
||||
return;
|
||||
|
||||
@@ -791,7 +794,9 @@ var CPButtonImageKey = @"CPButtonImageKey",
|
||||
CPButtonKeyEquivalentKey = @"CPButtonKeyEquivalentKey",
|
||||
CPButtonKeyEquivalentMaskKey = @"CPButtonKeyEquivalentMaskKey",
|
||||
CPButtonPeriodicDelayKey = @"CPButtonPeriodicDelayKey",
|
||||
CPButtonPeriodicIntervalKey = @"CPButtonPeriodicIntervalKey";
|
||||
CPButtonPeriodicIntervalKey = @"CPButtonPeriodicIntervalKey",
|
||||
CPButtonHighlightsByKey = @"CPButtonHighlightsByKey",
|
||||
CPButtonShowsStateByKey = @"CPButtonShowsStateByKey";
|
||||
|
||||
@implementation CPButton (CPCoding)
|
||||
|
||||
@@ -811,6 +816,9 @@ var CPButtonImageKey = @"CPButtonImageKey",
|
||||
_alternateTitle = [aCoder decodeObjectForKey:CPButtonAlternateTitleKey];
|
||||
_allowsMixedState = [aCoder decodeBoolForKey:CPButtonAllowsMixedStateKey];
|
||||
|
||||
_highlightsBy = [aCoder decodeIntForKey:CPButtonHighlightsByKey];
|
||||
_showsStateBy = [aCoder decodeIntForKey:CPButtonShowsStateByKey];
|
||||
|
||||
[self setImageDimsWhenDisabled:[aCoder decodeObjectForKey:CPButtonImageDimsWhenDisabledKey]];
|
||||
|
||||
if ([aCoder containsValueForKey:CPButtonImagePositionKey])
|
||||
@@ -848,6 +856,9 @@ var CPButtonImageKey = @"CPButtonImageKey",
|
||||
|
||||
[aCoder encodeBool:_allowsMixedState forKey:CPButtonAllowsMixedStateKey];
|
||||
|
||||
[aCoder encodeInt:_highlightsBy forKey:CPButtonHighlightsByKey];
|
||||
[aCoder encodeInt:_showsStateBy forKey:CPButtonShowsStateByKey];
|
||||
|
||||
[aCoder encodeBool:[self imageDimsWhenDisabled] forKey:CPButtonImageDimsWhenDisabledKey];
|
||||
[aCoder encodeInt:[self imagePosition] forKey:CPButtonImagePositionKey];
|
||||
|
||||
|
||||
@@ -50,7 +50,18 @@ var NSButtonIsBorderedMask = 0x00800000,
|
||||
NSButtonImageRightPositionMask = 0x2C,
|
||||
NSButtonImageLeftPositionMask = 0x3C,
|
||||
NSButtonImageOnlyPositionMask = 0x44,
|
||||
NSButtonImageOverlapsPositionMask = 0x6C;
|
||||
NSButtonImageOverlapsPositionMask = 0x6C,
|
||||
|
||||
// You cannot set neither highlightsBy nor showsStateBy in IB,
|
||||
// buy you can set button type which implicitly sets the masks.
|
||||
// Note, that you cannot set NSPushInCellMask for showsStateBy.
|
||||
NSHighlightsByPushInCellMask = 0x80000000,
|
||||
NSHighlightsByContentsCellMask = 0x08000000,
|
||||
NSHighlightsByChangeGrayCellMask = 0x04000000,
|
||||
NSHighlightsByChangeBackgroundCellMask = 0x02000000,
|
||||
NSShowsStateByContentsCellMask = 0x40000000,
|
||||
NSShowsStateByChangeGrayCellMask = 0x20000000,
|
||||
NSShowsStateByChangeBackgroundCellMask = 0x10000000;
|
||||
|
||||
|
||||
@implementation CPButton (NSCoding)
|
||||
@@ -204,6 +215,9 @@ var NSButtonIsBorderedMask = 0x00800000,
|
||||
|
||||
[self setEnabled:[cell isEnabled]];
|
||||
|
||||
_highlightsBy = [cell highlightsBy];
|
||||
_showsStateBy = [cell showsStateBy];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -235,6 +249,9 @@ var NSButtonIsBorderedMask = 0x00800000,
|
||||
BOOL _allowsMixedState @accessors(readonly, getter=allowsMixedState);
|
||||
BOOL _imagePosition @accessors(readonly, getter=imagePosition);
|
||||
|
||||
int _highlightsBy @accessors(readonly, getter=highlightsBy);
|
||||
int _showsStateBy @accessors(readonly, getter=showsStateBy);
|
||||
|
||||
CPString _keyEquivalent @accessors(readonly, getter=keyEquivalent);
|
||||
unsigned _keyEquivalentModifierMask @accessors(readonly, getter=keyEquivalentModifierMask);
|
||||
}
|
||||
@@ -280,6 +297,24 @@ var NSButtonIsBorderedMask = 0x00800000,
|
||||
else if ((position & NSButtonNoImagePositionMask) == NSButtonNoImagePositionMask)
|
||||
_imagePosition = CPNoImage;
|
||||
|
||||
_highlightsBy = CPNoCellMask;
|
||||
if (buttonFlags & NSHighlightsByPushInCellMask)
|
||||
_highlightsBy |= CPPushInCellMask;
|
||||
if (buttonFlags & NSHighlightsByContentsCellMask)
|
||||
_highlightsBy |= CPContentsCellMask;
|
||||
if (buttonFlags & NSHighlightsByChangeGrayCellMask)
|
||||
_highlightsBy |= CPChangeGrayCellMask;
|
||||
if (buttonFlags & NSHighlightsByChangeBackgroundCellMask)
|
||||
_highlightsBy |= CPChangeBackgroundCellMask;
|
||||
|
||||
_showsStateBy = CPNoCellMask;
|
||||
if (buttonFlags & NSShowsStateByContentsCellMask)
|
||||
_showsStateBy |= CPContentsCellMask;
|
||||
if (buttonFlags & NSShowsStateByChangeGrayCellMask)
|
||||
_showsStateBy |= CPChangeGrayCellMask;
|
||||
if (buttonFlags & NSShowsStateByChangeBackgroundCellMask)
|
||||
_showsStateBy |= CPChangeBackgroundCellMask;
|
||||
|
||||
_keyEquivalent = [aCoder decodeObjectForKey:@"NSKeyEquivalent"];
|
||||
_keyEquivalentModifierMask = buttonFlags2 >> 8;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user