Add a hover state for scrollpanel entries

This commit is contained in:
Paul Chote
2011-05-08 17:10:12 +12:00
parent fdf9927854
commit 7db1b5a1a0
3 changed files with 6 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ using OpenRA.FileFormats;
using OpenRA.Server;
using OpenRA.Widgets;
using OpenRA.Mods.RA.Widgets.Delegates;
using OpenRA.Graphics;
namespace OpenRA.Mods.Cnc.Widgets
{
@@ -164,7 +165,7 @@ namespace OpenRA.Mods.Cnc.Widgets
var game = loop;
var template = serverTemplate.Clone() as ContainerWidget;
template.GetBackground = () => (currentServer == game) ? "panel-darkred" : null;
template.GetBackground = () => (template.RenderBounds.Contains(Viewport.LastMousePos) ? "button-hover" : (currentServer == game) ? "button-pressed" : null);
template.OnMouseDown = mi => { if (mi.Button != MouseButton.Left) return false; currentServer = game; return true; };
template.IsVisible = () => true;
template.GetWidget<LabelWidget>("TITLE").GetText = () => game.Name;