mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-25 07:55:52 +00:00
large-control-size
This commit adds compatibility with the new control size "Large" introduced in MacOS 11.
This commit is contained in:
1 parent
6f44fe9f93
commit
e0735a1d82
3 files changed
+14
-3
No files matched your search
+5
-1
@@ -48,9 +48,10 @@
|
||||
CPRegularControlSize = 0;
|
||||
CPSmallControlSize = 1;
|
||||
CPMiniControlSize = 2;
|
||||
CPLargeControlSize = 3; // Since MacOS 11, there's a new control size "Large"
|
||||
|
||||
// To get the theme state corresponding to a control size, use CPControlSizeThemeStates[controlSize]
|
||||
CPControlSizeThemeStates = @[CPThemeStateControlSizeRegular, CPThemeStateControlSizeSmall, CPThemeStateControlSizeMini];
|
||||
CPControlSizeThemeStates = @[CPThemeStateControlSizeRegular, CPThemeStateControlSizeSmall, CPThemeStateControlSizeMini, CPThemeStateControlSizeLarge];
|
||||
|
||||
@typedef CPLineBreakMode
|
||||
CPLineBreakByWordWrapping = 0;
|
||||
@@ -248,6 +249,9 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
case CPMiniControlSize:
|
||||
return CPThemeStateControlSizeMini;
|
||||
|
||||
case CPLargeControlSize:
|
||||
return CPThemeStateControlSizeLarge;
|
||||
|
||||
case CPRegularControlSize:
|
||||
default:
|
||||
|
||||
@@ -814,6 +814,7 @@ CPThemeStateKeyWindow = CPThemeState("keyWindow");
|
||||
CPThemeStateControlSizeRegular = CPThemeState("controlSizeRegular");
|
||||
CPThemeStateControlSizeSmall = CPThemeState("controlSizeSmall");
|
||||
CPThemeStateControlSizeMini = CPThemeState("controlSizeMini");
|
||||
CPThemeStateControlSizeLarge = CPThemeState("controlSizeLarge");
|
||||
CPThemeStateAlternateState = CPThemeState("alternate");
|
||||
CPThemeStateComposedControl = CPThemeState("composed");
|
||||
CPThemeStateWindowsPlatform = CPThemeState("windowsPlatform");
|
||||
|
||||
@@ -61,8 +61,9 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
var flags = [aCoder decodeIntForKey:@"NSCellFlags"],
|
||||
flags2 = [aCoder decodeIntForKey:@"NSCellFlags2"];
|
||||
var flags = [aCoder decodeIntForKey:@"NSCellFlags"],
|
||||
flags2 = [aCoder decodeIntForKey:@"NSCellFlags2"],
|
||||
newControlSize = [aCoder decodeIntForKey:@"NSControlSize2"];
|
||||
|
||||
_state = (flags & 0x80000000) ? CPOnState : CPOffState;
|
||||
_isHighlighted = (flags & 0x40000000) ? YES : NO;
|
||||
@@ -84,6 +85,11 @@
|
||||
_usesSingleLineMode = (flags2 & 0xF4240) ? YES : NO;
|
||||
|
||||
_tag = [aCoder decodeIntForKey:@"NSTag"];
|
||||
|
||||
// Since MacOS 11, there's a new control size "Large" and a new key "NSControlSize2"
|
||||
// For compatibility reasons, we compute the control size based on the old and the new methods
|
||||
if (newControlSize > 2)
|
||||
_controlSize = newControlSize;
|
||||
|
||||
_objectValue = [aCoder decodeObjectForKey:@"NSContents"];
|
||||
_font = [aCoder decodeObjectForKey:@"NSSupport"];
|
||||
|
||||
Reference in new issue
Block a user