mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-06 00:52:58 +00:00
Fixed: CPSegmentedControl doesn't support small and mini control
Previously, when changing the controlSize of a CPSegmentedControl, Cappuccino didn't have the theme to do that. Now, Cappuccino supports the controlSize small and mini. Aristo and Aristo2 have new attributes for that. The attribute theme "default-height" has been replaced by "min-size" and "max-size" (used everywhere else in Cappuccino). The CPSegmentedControl has now the theme attribute "nib2cib-adjustment-frame". This pull request fixed alignment issue when adding a CPSegmentedControl from xCode. In the method initWithCode, we didn't care about the divider thickness, now we do. This same method will also add leftovers pixel to have exactly the same size as in xCode. Leftovers pixels are here because FLOOR operation and size of the font. Manual test in Tests/Manual/CPSegmentedControlTest Manual test in Tests/Manual/Nib2CibAlignment
This commit is contained in:
1 parent
608480c1d2
commit
e4516c19d3
7 files changed
+575
-338
No files matched your search
@@ -41,14 +41,6 @@
|
||||
{
|
||||
[super NS_initWithCell:cell];
|
||||
|
||||
var frame = [self frame],
|
||||
originalWidth = frame.size.width;
|
||||
|
||||
frame.size.width = 0;
|
||||
frame.origin.x = MAX(frame.origin.x - 4.0, 0.0);
|
||||
|
||||
[self setFrame:frame];
|
||||
|
||||
_segments = [cell segments];
|
||||
_selectedSegment = [cell selectedSegment];
|
||||
_segmentStyle = [cell segmentStyle];
|
||||
@@ -57,23 +49,13 @@
|
||||
[self setValue:CPCenterTextAlignment forThemeAttribute:@"alignment"];
|
||||
|
||||
// HACK
|
||||
|
||||
for (var i = 0; i < _segments.length; i++)
|
||||
{
|
||||
_themeStates[i] = _segments[i].selected ? CPThemeStateSelected : CPThemeStateNormal;
|
||||
|
||||
[self tileWithChangedSegment:i];
|
||||
}
|
||||
|
||||
// Adjust for differences between Cocoa and Cappuccino widget framing.
|
||||
frame.origin.x += 6;
|
||||
|
||||
if ([[Nib2Cib defaultTheme] name] == @"Aristo2")
|
||||
frame.size.height += 1;
|
||||
|
||||
frame.size.width = originalWidth;
|
||||
[self setEnabled:[cell isEnabled]];
|
||||
[self setFrame:frame];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -90,6 +72,7 @@
|
||||
{
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
||||
[self NS_initWithCell:cell];
|
||||
[self _adjustNib2CibSize];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
Reference in new issue
Block a user