Add faction suffix support to text fields and scroll panels
This commit is contained in:
committed by
abcdefg30
parent
9687988976
commit
cbdf6c3747
@@ -29,13 +29,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
iw.ImageCollection += suffix;
|
iw.ImageCollection += suffix;
|
||||||
else if (widget is BackgroundWidget bgw)
|
else if (widget is BackgroundWidget bgw)
|
||||||
bgw.Background += suffix;
|
bgw.Background += suffix;
|
||||||
|
else if (widget is TextFieldWidget tfw)
|
||||||
|
tfw.Background += suffix;
|
||||||
|
else if (widget is ScrollPanelWidget spw)
|
||||||
|
{
|
||||||
|
spw.Button += suffix;
|
||||||
|
spw.Background += suffix;
|
||||||
|
spw.ScrollBarBackground += suffix;
|
||||||
|
spw.Decorations += suffix;
|
||||||
|
}
|
||||||
else if (widget is ProductionTabsWidget ptw)
|
else if (widget is ProductionTabsWidget ptw)
|
||||||
{
|
{
|
||||||
ptw.Button += suffix;
|
ptw.Button += suffix;
|
||||||
ptw.Background += suffix;
|
ptw.Background += suffix;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new InvalidOperationException("AddFactionSuffixLogic only supports ButtonWidget, ImageWidget, BackgroundWidget and ProductionTabsWidget");
|
throw new InvalidOperationException("AddFactionSuffixLogic only supports ButtonWidget, ImageWidget, BackgroundWidget, TextFieldWidget, ScrollPanelWidget and ProductionTabsWidget");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public string Background = "scrollpanel-bg";
|
public string Background = "scrollpanel-bg";
|
||||||
public string ScrollBarBackground = "scrollpanel-bg";
|
public string ScrollBarBackground = "scrollpanel-bg";
|
||||||
public string Button = "scrollpanel-button";
|
public string Button = "scrollpanel-button";
|
||||||
public readonly string Decorations = "scrollpanel-decorations";
|
public string Decorations = "scrollpanel-decorations";
|
||||||
public readonly string DecorationScrollUp = "up";
|
public readonly string DecorationScrollUp = "up";
|
||||||
public readonly string DecorationScrollDown = "down";
|
public readonly string DecorationScrollDown = "down";
|
||||||
readonly CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused), Sprite> getUpArrowImage;
|
readonly CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused), Sprite> getUpArrowImage;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public int VisualHeight = 1;
|
public int VisualHeight = 1;
|
||||||
public int LeftMargin = 5;
|
public int LeftMargin = 5;
|
||||||
public int RightMargin = 5;
|
public int RightMargin = 5;
|
||||||
|
public string Background = "textfield";
|
||||||
|
|
||||||
public bool Disabled = false;
|
public bool Disabled = false;
|
||||||
|
|
||||||
@@ -561,7 +562,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
var disabled = IsDisabled();
|
var disabled = IsDisabled();
|
||||||
var hover = Ui.MouseOverWidget == this || Children.Any(c => c == Ui.MouseOverWidget);
|
var hover = Ui.MouseOverWidget == this || Children.Any(c => c == Ui.MouseOverWidget);
|
||||||
var state = WidgetUtils.GetStatefulImageName("textfield", disabled, false, hover, HasKeyboardFocus);
|
var state = WidgetUtils.GetStatefulImageName(Background, disabled, false, hover, HasKeyboardFocus);
|
||||||
|
|
||||||
WidgetUtils.DrawPanel(state,
|
WidgetUtils.DrawPanel(state,
|
||||||
new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height));
|
new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height));
|
||||||
|
|||||||
@@ -120,6 +120,30 @@ textfield-disabled:
|
|||||||
textfield-focused:
|
textfield-focused:
|
||||||
Inherits: button-pressed
|
Inherits: button-pressed
|
||||||
|
|
||||||
|
textfield-nod:
|
||||||
|
Inherits: button-nod
|
||||||
|
|
||||||
|
textfield-nod-hover:
|
||||||
|
Inherits: button-nod-hover
|
||||||
|
|
||||||
|
textfield-nod-disabled:
|
||||||
|
Inherits: button-nod-disabled
|
||||||
|
|
||||||
|
textfield-nod-focused:
|
||||||
|
Inherits: button-nod-pressed
|
||||||
|
|
||||||
|
textfield-gdi:
|
||||||
|
Inherits: button-gdi
|
||||||
|
|
||||||
|
textfield-gdi-hover:
|
||||||
|
Inherits: button-gdi-hover
|
||||||
|
|
||||||
|
textfield-gdi-disabled:
|
||||||
|
Inherits: button-gdi-disabled
|
||||||
|
|
||||||
|
textfield-gdi-focused:
|
||||||
|
Inherits: button-gdi-pressed
|
||||||
|
|
||||||
#
|
#
|
||||||
# Progress bar
|
# Progress bar
|
||||||
# ===
|
# ===
|
||||||
@@ -151,6 +175,36 @@ scrollpanel-button-disabled:
|
|||||||
scrollpanel-button-pressed:
|
scrollpanel-button-pressed:
|
||||||
Inherits: button-pressed
|
Inherits: button-pressed
|
||||||
|
|
||||||
|
scrollpanel-bg-nod:
|
||||||
|
Inherits: panel-gray-nod
|
||||||
|
|
||||||
|
scrollpanel-button-nod:
|
||||||
|
Inherits: button-nod
|
||||||
|
|
||||||
|
scrollpanel-button-nod-hover:
|
||||||
|
Inherits: button-nod-hover
|
||||||
|
|
||||||
|
scrollpanel-button-nod-disabled:
|
||||||
|
Inherits: button-nod-disabled
|
||||||
|
|
||||||
|
scrollpanel-button-nod-pressed:
|
||||||
|
Inherits: button-nod-pressed
|
||||||
|
|
||||||
|
scrollpanel-bg-gdi:
|
||||||
|
Inherits: panel-gray-gdi
|
||||||
|
|
||||||
|
scrollpanel-button-gdi:
|
||||||
|
Inherits: button-gdi
|
||||||
|
|
||||||
|
scrollpanel-button-gdi-hover:
|
||||||
|
Inherits: button-gdi-hover
|
||||||
|
|
||||||
|
scrollpanel-button-gdi-disabled:
|
||||||
|
Inherits: button-gdi-disabled
|
||||||
|
|
||||||
|
scrollpanel-button-gdi-pressed:
|
||||||
|
Inherits: button-gdi-pressed
|
||||||
|
|
||||||
scrollitem-hover:
|
scrollitem-hover:
|
||||||
Inherits: button
|
Inherits: button
|
||||||
|
|
||||||
@@ -374,6 +428,12 @@ scrollpanel-decorations:
|
|||||||
left: 938, 17, 16, 16
|
left: 938, 17, 16, 16
|
||||||
left-disabled: 955, 17, 16, 16
|
left-disabled: 955, 17, 16, 16
|
||||||
|
|
||||||
|
scrollpanel-decorations-nod:
|
||||||
|
Inherits: scrollpanel-decorations
|
||||||
|
|
||||||
|
scrollpanel-decorations-gdi:
|
||||||
|
Inherits: scrollpanel-decorations
|
||||||
|
|
||||||
dropdown-decorations:
|
dropdown-decorations:
|
||||||
Inherits: ^Chrome
|
Inherits: ^Chrome
|
||||||
Regions:
|
Regions:
|
||||||
|
|||||||
Reference in New Issue
Block a user