split scrollthumb/button in chrome data; fixes screwed up RA scrollthumbs
This commit is contained in:
@@ -99,22 +99,22 @@ namespace OpenRA.Widgets
|
||||
var s = font.Measure(text);
|
||||
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
|
||||
|
||||
DrawBackground(rb, disabled, Depressed, rb.Contains(Viewport.LastMousePos));
|
||||
DrawBackground("button", rb, disabled, Depressed, rb.Contains(Viewport.LastMousePos));
|
||||
font.DrawText(text, new int2(rb.X + (UsableWidth - s.X)/ 2, rb.Y + (Bounds.Height - s.Y) / 2) + stateOffset,
|
||||
disabled ? Color.Gray : Color.White);
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new ButtonWidget(this); }
|
||||
public virtual int UsableWidth { get { return Bounds.Width; } }
|
||||
|
||||
public static void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover)
|
||||
|
||||
public static void DrawBackground(string baseName, Rectangle rect, bool disabled, bool pressed, bool hover)
|
||||
{
|
||||
var state = disabled ? "button-disabled" :
|
||||
pressed ? "button-pressed" :
|
||||
hover ? "button-hover" :
|
||||
"button";
|
||||
var state = disabled ? "-disabled" :
|
||||
pressed ? "-pressed" :
|
||||
hover ? "-hover" :
|
||||
"";
|
||||
|
||||
WidgetUtils.DrawPanel(state, rect);
|
||||
WidgetUtils.DrawPanel(baseName + state, rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,13 +79,13 @@ namespace OpenRA.Widgets
|
||||
|
||||
WidgetUtils.DrawPanel(Background, backgroundRect);
|
||||
WidgetUtils.DrawPanel("scrollpanel-bg", scrollbarRect);
|
||||
ButtonWidget.DrawBackground(upButtonRect, (thumbHeight == 0 || ListOffset >= 0),
|
||||
ButtonWidget.DrawBackground("button", upButtonRect, (thumbHeight == 0 || ListOffset >= 0),
|
||||
UpPressed, upButtonRect.Contains(Viewport.LastMousePos));
|
||||
ButtonWidget.DrawBackground(downButtonRect, (thumbHeight == 0 || ListOffset <= Bounds.Height - ContentHeight),
|
||||
ButtonWidget.DrawBackground("button", downButtonRect, (thumbHeight == 0 || ListOffset <= Bounds.Height - ContentHeight),
|
||||
DownPressed, downButtonRect.Contains(Viewport.LastMousePos));
|
||||
|
||||
if (thumbHeight > 0)
|
||||
ButtonWidget.DrawBackground(thumbRect, false, (Focused && thumbRect.Contains(Viewport.LastMousePos)),
|
||||
ButtonWidget.DrawBackground("scrollthumb", thumbRect, false, (Focused && thumbRect.Contains(Viewport.LastMousePos)),
|
||||
thumbRect.Contains(Viewport.LastMousePos));
|
||||
|
||||
var upDisabled = thumbHeight == 0 || ListOffset >= 0;
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace OpenRA.Widgets
|
||||
WidgetUtils.DrawPanel("slider-track", trackRect);
|
||||
|
||||
// Thumb
|
||||
ButtonWidget.DrawBackground(tr, IsDisabled(), isMoving, tr.Contains(Viewport.LastMousePos));
|
||||
ButtonWidget.DrawBackground("scrollthumb", tr, IsDisabled(), isMoving, tr.Contains(Viewport.LastMousePos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user