mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-20 09:20:41 +00:00
cpstepper HUD fix
This commit is contained in:
+15
-1
@@ -175,7 +175,21 @@
|
||||
[super setFrame:frame];
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (void)setThemeState:(CPThemeState)aState
|
||||
{
|
||||
[super setThemeState:aState];
|
||||
|
||||
// Force a layout update because the internal buttons (_buttonUp and _buttonDown)
|
||||
// rely on layoutSubviews to receive the new theme attributes (like HUD colors).
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)unsetThemeState:(CPThemeState)aState
|
||||
{
|
||||
[super unsetThemeState:aState];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
/*! @ignore */
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
|
||||
@@ -2648,6 +2648,7 @@ var themedButtonValues = nil,
|
||||
[@"text-color", [CPColor whiteColor], CPThemeStateHUD],
|
||||
[@"text-color", [CPColor colorWithWhite:1 alpha:0.5], [CPThemeStateHUD, CPThemeStateDisabled]],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateHUD, CPThemeStateEditing]],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateHUD, CPThemeStateTableDataView, CPThemeStateSelectedDataView, CPThemeStateEditing, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
// Change the background color of selected text in HUD mode to improve contrast
|
||||
// [@"field-selection-color", hudSelectionColor, CPThemeStateHUD],
|
||||
|
||||
@@ -8392,7 +8393,7 @@ var themedButtonValues = nil,
|
||||
[@"border-radius", 2.0],
|
||||
[@"background-color", [CPColor colorWithHexString:@"FFFFCA"]],
|
||||
[@"color", [CPColor blackColor]]
|
||||
];
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:toolTipView];
|
||||
|
||||
|
||||
@@ -111,6 +111,20 @@
|
||||
[contentView addSubview:tabView];
|
||||
}
|
||||
|
||||
// Helper to recursively apply HUD state
|
||||
- (void)_applyHUDStateToView:(CPView)aView
|
||||
{
|
||||
if ([aView respondsToSelector:@selector(setThemeState:)])
|
||||
[aView setThemeState:CPThemeStateHUD];
|
||||
|
||||
var subviews = [aView subviews],
|
||||
count = [subviews count];
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
[self _applyHUDStateToView:subviews[i]];
|
||||
|
||||
}
|
||||
|
||||
- (void)_buildControlsTab:(CPView)containerView isHUD:(BOOL)isHUD
|
||||
{
|
||||
// Layout Constants
|
||||
@@ -337,6 +351,11 @@
|
||||
|
||||
// Resize Right Box to fit
|
||||
[rightBox setFrameSize:CGSizeMake(rightBoxWidth, currentY + 15.0)];
|
||||
|
||||
if (isHUD)
|
||||
{
|
||||
[self _applyHUDStateToView:containerView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_buildTableTab:(CPView)containerView isHUD:(BOOL)isHUD
|
||||
@@ -430,27 +449,11 @@
|
||||
[textView setString:@"Select text here and use the 'Format' or 'Edit' menus.\n\n(This is a Rich Text enabled CPTextView)"];
|
||||
[textView setFont:[CPFont fontWithName:@"Courier" size:13.0]];
|
||||
|
||||
if (isHUD)
|
||||
{
|
||||
[textView setBackgroundColor:[CPColor blackColor]];
|
||||
[textView setTextColor:[CPColor whiteColor]];
|
||||
}
|
||||
[textScroll setDocumentView:textView];
|
||||
|
||||
[splitView addSubview:tableScroll];
|
||||
[splitView addSubview:textScroll];
|
||||
|
||||
if (isHUD)
|
||||
{
|
||||
[splitView setThemeState:CPThemeStateHUD];
|
||||
[tableScroll setThemeState:CPThemeStateHUD];
|
||||
[textScroll setThemeState:CPThemeStateHUD];
|
||||
[tableView setThemeState:CPThemeStateHUD];
|
||||
[ruleContainer setThemeState:CPThemeStateHUD];
|
||||
}
|
||||
|
||||
[containerView addSubview:splitView];
|
||||
|
||||
// Button Bar
|
||||
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(bounds) - bottomBarHeight, CGRectGetWidth(bounds), bottomBarHeight)];
|
||||
[buttonBar setAutoresizingMask:CPViewWidthSizable | CPViewMinYMargin];
|
||||
@@ -473,6 +476,20 @@
|
||||
[buttonBar setButtons:[plusBtn, minusBtn]];
|
||||
|
||||
[containerView addSubview:buttonBar];
|
||||
[containerView addSubview:splitView];
|
||||
|
||||
if (isHUD)
|
||||
{
|
||||
// Apply HUD state to everything in the view hierarchy (Buttons, RuleEditor, Table, ScrollViews)
|
||||
[self _applyHUDStateToView:containerView];
|
||||
|
||||
// Specific overrides
|
||||
[textView setBackgroundColor:[CPColor blackColor]];
|
||||
[textView setTextColor:[CPColor whiteColor]];
|
||||
[_predicateField setTextColor:[CPColor whiteColor]];
|
||||
|
||||
[self _applyHUDStateToView:_ruleEditor];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)ruleEditorRowsDidChange:(CPNotification)note
|
||||
@@ -490,6 +507,11 @@
|
||||
[self _addSizeColumnTo:containerView atX:20.0 controlSize:CPRegularControlSize title:@"Regular size"];
|
||||
[self _addSizeColumnTo:containerView atX:160.0 controlSize:CPSmallControlSize title:@"Small size"];
|
||||
[self _addSizeColumnTo:containerView atX:280.0 controlSize:CPMiniControlSize title:@"Mini size"];
|
||||
|
||||
if (isHUD)
|
||||
{
|
||||
[self _applyHUDStateToView:containerView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_addSizeColumnTo:(CPView)parentView atX:(float)xPos controlSize:(CPControlSize)aSize title:(CPString)title
|
||||
|
||||
Reference in New Issue
Block a user