Remove obsoleted dropdown & label code
This commit is contained in:
@@ -84,66 +84,6 @@ namespace OpenRA.Widgets
|
|||||||
Widget.RootWidget.AddChild(panel);
|
Widget.RootWidget.AddChild(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete] public static void ShowDropPanel(Widget w, Widget panel, IEnumerable<Widget> dismissAfter, Func<bool> onDismiss)
|
|
||||||
{
|
|
||||||
// Mask to prevent any clicks from being sent to other widgets
|
|
||||||
var fullscreenMask = new ContainerWidget();
|
|
||||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height);
|
|
||||||
Widget.RootWidget.AddChild(fullscreenMask);
|
|
||||||
|
|
||||||
Action HideDropDown = () =>
|
|
||||||
{
|
|
||||||
Widget.RootWidget.RemoveChild(fullscreenMask);
|
|
||||||
Widget.RootWidget.RemoveChild(panel);
|
|
||||||
};
|
|
||||||
|
|
||||||
HideDropDown += () => Game.BeforeGameStart -= HideDropDown;
|
|
||||||
Game.BeforeGameStart += HideDropDown;
|
|
||||||
|
|
||||||
fullscreenMask.OnMouseDown = mi =>
|
|
||||||
{
|
|
||||||
if (onDismiss()) HideDropDown();
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
fullscreenMask.OnMouseUp = mi => true;
|
|
||||||
|
|
||||||
var oldBounds = panel.Bounds;
|
|
||||||
panel.Bounds = new Rectangle(w.RenderOrigin.X, w.RenderOrigin.Y + w.Bounds.Height, oldBounds.Width, oldBounds.Height);
|
|
||||||
panel.OnMouseUp = mi => true;
|
|
||||||
|
|
||||||
foreach (var ww in dismissAfter)
|
|
||||||
{
|
|
||||||
var origMouseUp = ww.OnMouseUp;
|
|
||||||
ww.OnMouseUp = mi => { var result = origMouseUp(mi); if (onDismiss()) HideDropDown(); return result; };
|
|
||||||
}
|
|
||||||
Widget.RootWidget.AddChild(panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete] public static void ShowDropDown<T>(Widget w, IEnumerable<T> ts, Func<T, int, LabelWidget> ft)
|
|
||||||
{
|
|
||||||
var dropDown = new ScrollPanelWidget();
|
|
||||||
dropDown.Bounds = new Rectangle(w.RenderOrigin.X, w.RenderOrigin.Y + w.Bounds.Height, w.Bounds.Width, 100);
|
|
||||||
dropDown.ItemSpacing = 1;
|
|
||||||
|
|
||||||
List<LabelWidget> items = new List<LabelWidget>();
|
|
||||||
List<Widget> dismissAfter = new List<Widget>();
|
|
||||||
foreach (var t in ts)
|
|
||||||
{
|
|
||||||
var ww = ft(t, dropDown.Bounds.Width - dropDown.ScrollbarWidth);
|
|
||||||
dismissAfter.Add(ww);
|
|
||||||
ww.OnMouseMove = mi => items.Do(lw =>
|
|
||||||
{
|
|
||||||
lw.Background = null; ww.Background = "dialog2";
|
|
||||||
});
|
|
||||||
|
|
||||||
dropDown.AddChild(ww);
|
|
||||||
items.Add(ww);
|
|
||||||
}
|
|
||||||
|
|
||||||
dropDown.Bounds.Height = Math.Min(150, dropDown.ContentHeight);
|
|
||||||
ShowDropPanel(w, dropDown, dismissAfter, () => true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowDropDown<T>(string panelTemplate, int height, List<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
public void ShowDropDown<T>(string panelTemplate, int height, List<T> options, Func<T, ScrollItemWidget, ScrollItemWidget> setupItem)
|
||||||
{
|
{
|
||||||
var substitutions = new Dictionary<string,int>() {{ "DROPDOWN_WIDTH", Bounds.Width }};
|
var substitutions = new Dictionary<string,int>() {{ "DROPDOWN_WIDTH", Bounds.Width }};
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace OpenRA.Widgets
|
|||||||
public enum TextAlign { Left, Center, Right }
|
public enum TextAlign { Left, Center, Right }
|
||||||
public enum TextVAlign { Top, Middle, Bottom }
|
public enum TextVAlign { Top, Middle, Bottom }
|
||||||
public string Text = null;
|
public string Text = null;
|
||||||
[Obsolete] public string Background = null;
|
|
||||||
public TextAlign Align = TextAlign.Left;
|
public TextAlign Align = TextAlign.Left;
|
||||||
public TextVAlign VAlign = TextVAlign.Middle;
|
public TextVAlign VAlign = TextVAlign.Middle;
|
||||||
public string Font = "Regular";
|
public string Font = "Regular";
|
||||||
@@ -28,13 +27,11 @@ namespace OpenRA.Widgets
|
|||||||
public Color ContrastColor = Color.Black;
|
public Color ContrastColor = Color.Black;
|
||||||
public bool WordWrap = false;
|
public bool WordWrap = false;
|
||||||
public Func<string> GetText;
|
public Func<string> GetText;
|
||||||
[Obsolete] public Func<string> GetBackground;
|
|
||||||
|
|
||||||
public LabelWidget()
|
public LabelWidget()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
GetText = () => Text;
|
GetText = () => Text;
|
||||||
GetBackground = () => Background;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LabelWidget(LabelWidget other)
|
protected LabelWidget(LabelWidget other)
|
||||||
@@ -48,16 +45,10 @@ namespace OpenRA.Widgets
|
|||||||
ContrastColor = other.ContrastColor;
|
ContrastColor = other.ContrastColor;
|
||||||
WordWrap = other.WordWrap;
|
WordWrap = other.WordWrap;
|
||||||
GetText = other.GetText;
|
GetText = other.GetText;
|
||||||
GetBackground = other.GetBackground;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawInner()
|
public override void DrawInner()
|
||||||
{
|
{
|
||||||
var bg = GetBackground();
|
|
||||||
|
|
||||||
if (bg != null)
|
|
||||||
WidgetUtils.DrawPanel(bg, RenderBounds );
|
|
||||||
|
|
||||||
SpriteFont font = Game.Renderer.Fonts[Font];
|
SpriteFont font = Game.Renderer.Fonts[Font];
|
||||||
var text = GetText();
|
var text = GetText();
|
||||||
if (text == null)
|
if (text == null)
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ Background@JOINSERVER_BG:
|
|||||||
Y:PARENT_BOTTOM / 2 - HEIGHT
|
Y:PARENT_BOTTOM / 2 - HEIGHT
|
||||||
Width:150
|
Width:150
|
||||||
Height:30
|
Height:30
|
||||||
Background:dialog4
|
|
||||||
Text:Fetching games...
|
Text:Fetching games...
|
||||||
Align:Center
|
Align:Center
|
||||||
Container@SERVER_INFO:
|
Container@SERVER_INFO:
|
||||||
|
|||||||
Reference in New Issue
Block a user