split scrollthumb/button in chrome data; fixes screwed up RA scrollthumbs
This commit is contained in:
@@ -99,7 +99,7 @@ namespace OpenRA.Widgets
|
|||||||
var s = font.Measure(text);
|
var s = font.Measure(text);
|
||||||
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
|
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,
|
font.DrawText(text, new int2(rb.X + (UsableWidth - s.X)/ 2, rb.Y + (Bounds.Height - s.Y) / 2) + stateOffset,
|
||||||
disabled ? Color.Gray : Color.White);
|
disabled ? Color.Gray : Color.White);
|
||||||
}
|
}
|
||||||
@@ -107,14 +107,14 @@ namespace OpenRA.Widgets
|
|||||||
public override Widget Clone() { return new ButtonWidget(this); }
|
public override Widget Clone() { return new ButtonWidget(this); }
|
||||||
public virtual int UsableWidth { get { return Bounds.Width; } }
|
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" :
|
var state = disabled ? "-disabled" :
|
||||||
pressed ? "button-pressed" :
|
pressed ? "-pressed" :
|
||||||
hover ? "button-hover" :
|
hover ? "-hover" :
|
||||||
"button";
|
"";
|
||||||
|
|
||||||
WidgetUtils.DrawPanel(state, rect);
|
WidgetUtils.DrawPanel(baseName + state, rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,13 +79,13 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
WidgetUtils.DrawPanel(Background, backgroundRect);
|
WidgetUtils.DrawPanel(Background, backgroundRect);
|
||||||
WidgetUtils.DrawPanel("scrollpanel-bg", scrollbarRect);
|
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));
|
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));
|
DownPressed, downButtonRect.Contains(Viewport.LastMousePos));
|
||||||
|
|
||||||
if (thumbHeight > 0)
|
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));
|
thumbRect.Contains(Viewport.LastMousePos));
|
||||||
|
|
||||||
var upDisabled = thumbHeight == 0 || ListOffset >= 0;
|
var upDisabled = thumbHeight == 0 || ListOffset >= 0;
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ namespace OpenRA.Widgets
|
|||||||
WidgetUtils.DrawPanel("slider-track", trackRect);
|
WidgetUtils.DrawPanel("slider-track", trackRect);
|
||||||
|
|
||||||
// Thumb
|
// Thumb
|
||||||
ButtonWidget.DrawBackground(tr, IsDisabled(), isMoving, tr.Contains(Viewport.LastMousePos));
|
ButtonWidget.DrawBackground("scrollthumb", tr, IsDisabled(), isMoving, tr.Contains(Viewport.LastMousePos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,50 @@ button-pressed: chrome.png
|
|||||||
corner-bl: 64,254,2,2
|
corner-bl: 64,254,2,2
|
||||||
corner-br: 126,254,2,2
|
corner-br: 126,254,2,2
|
||||||
|
|
||||||
|
scrollthumb: chrome.png
|
||||||
|
background: 2,194,60,60
|
||||||
|
border-r: 62,194,2,60
|
||||||
|
border-l: 0,194,2,60
|
||||||
|
border-b: 2,254,60,2
|
||||||
|
border-t: 2,192,60,2
|
||||||
|
corner-tl: 0,192,2,2
|
||||||
|
corner-tr: 62,192,2,2
|
||||||
|
corner-bl: 0,254,2,2
|
||||||
|
corner-br: 62,254,2,2
|
||||||
|
|
||||||
|
scrollthumb-hover: chrome.png
|
||||||
|
background: 2,130,60,60
|
||||||
|
border-r: 62,132,2,60
|
||||||
|
border-l: 0,130,2,60
|
||||||
|
border-b: 2,190,60,2
|
||||||
|
border-t: 2,128,60,2
|
||||||
|
corner-tl: 0,128,2,2
|
||||||
|
corner-tr: 62,128,2,2
|
||||||
|
corner-bl: 0,190,2,2
|
||||||
|
corner-br: 62,190,2,2
|
||||||
|
|
||||||
|
scrollthumb-disabled: chrome.png
|
||||||
|
background: 66,130,60,60
|
||||||
|
border-r: 126,130,2,60
|
||||||
|
border-l: 64,130,2,60
|
||||||
|
border-b: 66,190,60,2
|
||||||
|
border-t: 66,128,60,2
|
||||||
|
corner-tl: 64,128,2,2
|
||||||
|
corner-tr: 126,128,2,2
|
||||||
|
corner-bl: 64,190,2,2
|
||||||
|
corner-br: 126,190,2,2
|
||||||
|
|
||||||
|
scrollthumb-pressed: chrome.png
|
||||||
|
background: 66,194,60,60
|
||||||
|
border-r: 126,194,2,60
|
||||||
|
border-l: 64,194,2,60
|
||||||
|
border-b: 66,254,60,2
|
||||||
|
border-t: 66,192,60,2
|
||||||
|
corner-tl: 64,192,2,2
|
||||||
|
corner-tr: 126,192,2,2
|
||||||
|
corner-bl: 64,254,2,2
|
||||||
|
corner-br: 126,254,2,2
|
||||||
|
|
||||||
# A copy of button
|
# A copy of button
|
||||||
textfield: chrome.png
|
textfield: chrome.png
|
||||||
background: 2,194,60,60
|
background: 2,194,60,60
|
||||||
|
|||||||
@@ -285,6 +285,53 @@ button-pressed: dialog.png
|
|||||||
corner-bl: 640,82,1,1
|
corner-bl: 640,82,1,1
|
||||||
corner-br: 722,82,1,1
|
corner-br: 722,82,1,1
|
||||||
|
|
||||||
|
scrollthumb: dialog.png
|
||||||
|
background: 513,1,126,126
|
||||||
|
border-r: 639,1,1,126
|
||||||
|
border-l: 512,1,1,126
|
||||||
|
border-b: 513,127,126,1
|
||||||
|
border-t: 513,0,126,1
|
||||||
|
corner-tl: 512,0,1,1
|
||||||
|
corner-tr: 594,0,1,1
|
||||||
|
corner-bl: 512,82,1,1
|
||||||
|
corner-br: 594,82,1,1
|
||||||
|
|
||||||
|
# A copy of dialog2
|
||||||
|
scrollthumb-hover: dialog.png
|
||||||
|
background: 513,1,126,126
|
||||||
|
border-r: 639,1,1,126
|
||||||
|
border-l: 512,1,1,126
|
||||||
|
border-b: 513,127,126,1
|
||||||
|
border-t: 513,0,126,1
|
||||||
|
corner-tl: 512,0,1,1
|
||||||
|
corner-tr: 594,0,1,1
|
||||||
|
corner-bl: 512,82,1,1
|
||||||
|
corner-br: 594,82,1,1
|
||||||
|
|
||||||
|
# A copy of dialog2
|
||||||
|
scrollthumb-disabled: dialog.png
|
||||||
|
background: 513,1,126,126
|
||||||
|
border-r: 639,1,1,126
|
||||||
|
border-l: 512,1,1,126
|
||||||
|
border-b: 513,127,126,1
|
||||||
|
border-t: 513,0,126,1
|
||||||
|
corner-tl: 512,0,1,1
|
||||||
|
corner-tr: 594,0,1,1
|
||||||
|
corner-bl: 512,82,1,1
|
||||||
|
corner-br: 594,82,1,1
|
||||||
|
|
||||||
|
# A copy of dialog3
|
||||||
|
scrollthumb-pressed: dialog.png
|
||||||
|
background: 513,1,126,126
|
||||||
|
border-r: 639,1,1,126
|
||||||
|
border-l: 512,1,1,126
|
||||||
|
border-b: 513,127,126,1
|
||||||
|
border-t: 513,0,126,1
|
||||||
|
corner-tl: 512,0,1,1
|
||||||
|
corner-tr: 594,0,1,1
|
||||||
|
corner-bl: 512,82,1,1
|
||||||
|
corner-br: 594,82,1,1
|
||||||
|
|
||||||
# A copy of dialog3
|
# A copy of dialog3
|
||||||
textfield: dialog.png
|
textfield: dialog.png
|
||||||
background: 641,1,126,126
|
background: 641,1,126,126
|
||||||
|
|||||||
Reference in New Issue
Block a user