fix trailing whitespace everywhere
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
Widget panel;
|
||||
MaskWidget fullscreenMask;
|
||||
|
||||
|
||||
public DropDownButtonWidget()
|
||||
: base()
|
||||
{
|
||||
@@ -34,12 +34,12 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
base.Draw();
|
||||
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
|
||||
|
||||
|
||||
var image = ChromeProvider.GetImage("scrollbar", IsDisabled() ? "down_pressed" : "down_arrow");
|
||||
var rb = RenderBounds;
|
||||
|
||||
|
||||
WidgetUtils.DrawRGBA( image,
|
||||
stateOffset + new float2( rb.Right - rb.Height + 4,
|
||||
stateOffset + new float2( rb.Right - rb.Height + 4,
|
||||
rb.Top + (rb.Height - image.bounds.Height) / 2 ));
|
||||
|
||||
WidgetUtils.FillRectWithColor(new Rectangle(stateOffset.X + rb.Right - rb.Height,
|
||||
@@ -48,9 +48,9 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new DropDownButtonWidget(this); }
|
||||
|
||||
|
||||
// This is crap
|
||||
public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */
|
||||
public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */
|
||||
|
||||
public override void Removed()
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Widgets
|
||||
if (panel != null)
|
||||
throw new InvalidOperationException("Attempted to attach a panel to an open dropdown");
|
||||
panel = p;
|
||||
|
||||
|
||||
// Mask to prevent any clicks from being sent to other widgets
|
||||
fullscreenMask = new MaskWidget();
|
||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height);
|
||||
@@ -84,26 +84,26 @@ namespace OpenRA.Widgets
|
||||
panel.Bounds = new Rectangle(RenderOrigin.X, RenderOrigin.Y + Bounds.Height, oldBounds.Width, oldBounds.Height);
|
||||
Widget.RootWidget.AddChild(panel);
|
||||
}
|
||||
|
||||
|
||||
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 panel = (ScrollPanelWidget)Widget.LoadWidget(panelTemplate, null, new WidgetArgs()
|
||||
{{ "substitutions", substitutions }});
|
||||
|
||||
|
||||
var itemTemplate = panel.GetWidget<ScrollItemWidget>("TEMPLATE");
|
||||
panel.RemoveChildren();
|
||||
foreach (var option in options)
|
||||
{
|
||||
var o = option;
|
||||
|
||||
|
||||
ScrollItemWidget item = setupItem(o, itemTemplate);
|
||||
var onClick = item.OnClick;
|
||||
item.OnClick = () => { onClick(); RemovePanel(); };
|
||||
|
||||
|
||||
panel.AddChild(item);
|
||||
}
|
||||
|
||||
|
||||
panel.Bounds.Height = Math.Min(height, panel.ContentHeight);
|
||||
AttachPanel(panel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user