context: using System.Collections.Generic;
  using System.Linq;
  
  using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Graphics;
  
  using NuciXNA.Gui.Controls;
  using NuciXNA.Input;
  using NuciXNA.Primitives;
  
  using Narivia.GameLogic.GameManagers;
  using Narivia.Gui.Helpers;
  
  namespace Narivia.Gui.Controls
  {
      /// <summary>
      /// Info bar GUI element.
      /// </summary>
      public class GuiInfoBar : GuiControl, IGuiControl
      {
          IGameManager gameManager;
          IWorldManager worldManager;
          IHoldingManager holdingManager;
          IMilitaryManager militaryManager;
  
          GuiImage background;
  
          GuiImage provincesIcon;
          GuiImage holdingsIcon;
          GuiImage troopsIcon;
          GuiImage wealthIcon;
  
          GuiText provincesText;
          GuiText holdingsText;
          GuiText troopsText;
          GuiText wealthText;
  
          GuiTooltip provincesTooltip;
          GuiTooltip holdingsTooltip;
          GuiTooltip troopsTooltip;
          GuiTooltip wealthTooltip;
  
          GuiButton turnButton;
          GuiText turnText;
  
          /// <summary>
          /// Occurs when clicked.
          /// </summary>
          public event MouseButtonEventHandler TurnButtonClicked;
  
          public GuiInfoBar(
              IGameManager gameManager,
              IWorldManager worldManager,
              IHoldingManager holdingManager,
              IMilitaryManager militaryManager)
          {
              ForegroundColour = Colour.Gold;
              FontName = "InfoBarFont";
  
              this.gameManager = gameManager;
              this.worldManager = worldManager;
              this.holdingManager = holdingManager;
              this.militaryManager = militaryManager;
          }
  
          /// <summary>
          /// Loads the content.
          /// </summary>
          protected override void DoLoadContent()
          {
              background = new GuiImage
              {
                  ContentFile = "Interface/InfoBar/bar"
              };
  
              provincesIcon = new GuiImage
              {
                  ContentFile = "Interface/InfoBar/icons",
                  SourceRectangle = new Rectangle2D(0, 0, 26, 26),
                  Location = new Point2D(16, 10),
                  Size = new Size2D(26, 26)
              };
              holdingsIcon = new GuiImage
              {
                  ContentFile = "Interface/InfoBar/icons",
                  SourceRectangle = new Rectangle2D(26, 0, 26, 26),
                  Location = new Point2D(52, 10),
                  Size = new Size2D(26, 26)
              };
              troopsIcon = new GuiImage
              {
                  ContentFile = "Interface/InfoBar/icons",
                  SourceRectangle = new Rectangle2D(52, 0, 26, 26),
                  Location = new Point2D(89, 10),
                  Size = new Size2D(26, 26)
              };
              wealthIcon = new GuiImage
              {
                  ContentFile = "Interface/InfoBar/icons",
                  SourceRectangle = new Rectangle2D(78, 0, 26, 26),
                  Location = new Point2D(124, 10),
                  Size = new Size2D(26, 26)
              };
  
              provincesText = new GuiText
              {
                  Location = new Point2D(13, 36),
                  Size = new Size2D(32, 15)
              };
              holdingsText = new GuiText
              {
                  Location = new Point2D(49, 36),
                  Size = new Size2D(32, 15)
              };
              troopsText = new GuiText
              {
                  Location = new Point2D(85, 36),
                  Size = new Size2D(32, 15)
              };
              wealthText = new GuiText
              {
                  Location = new Point2D(121, 36),
                  Size = new Size2D(32, 15)
              };
  
              provincesTooltip = new GuiTooltip
              {
                  FontName = "DefaultFont",
                  Text = "Provinces",
                  Size = new Size2D(100, 20),
                  BackgroundColour = Colour.Black
              };
              holdingsTooltip = new GuiTooltip
              {
                  FontName = "DefaultFont",
                  Text = "Holdings",
                  Size = new Size2D(100, 20),
                  BackgroundColour = Colour.Black
              };
              troopsTooltip = new GuiTooltip
              {
                  FontName = "DefaultFont",
                  Text = "Troops",
                  Size = new Size2D(128, 128),
                  BackgroundColour = Colour.Black
              };
              wealthTooltip = new GuiTooltip
              {
                  FontName = "DefaultFont",
                  Text = "Wealth",
                  Size = new Size2D(100, 20),
                  BackgroundColour = Colour.Black
              };
  
              turnButton = new GuiButton
              {
                  ContentFile = "Interface/Buttons/button-plus",
                  Location = new Point2D(142, 59),
                  Size = new Size2D(24, 24)
              };
              turnText = new GuiText
              {
                  Location = new Point2D(15, 62),
                  Size = new Size2D(138, 15)
              };
  
              RegisterChild(background);
              RegisterChildren(provincesIcon, holdingsIcon, troopsIcon, wealthIcon);
              RegisterChildren(provincesText, holdingsText, troopsText, wealthText);
              RegisterChildren(turnButton, turnText);
              RegisterChildren(provincesTooltip, holdingsTooltip, wealthTooltip);
  
              RegisterEvents();
              SetChildrenProperties();
          }
  
          /// <summary>
          /// Unloads the content.
          /// </summary>
          protected override void DoUnloadContent()
          {
              UnregisterEvents();
          }
  
          /// <summary>
          /// Update the content.
          /// </summary>
          /// <param name="gameTime">Game time.</param>
          protected override void DoUpdate(GameTime gameTime)
          {
              SetChildrenProperties();
          }
  
          /// <summary>
          /// Draw the content on the specified <see cref="SpriteBatch"/>.
          /// </summary>
          /// <param name="spriteBatch">Sprite batch.</param>
          protected override void DoDraw(SpriteBatch spriteBatch)
          {
  
          }
  
          void RegisterEvents()
          {
              provincesIcon.MouseEntered += OnProvincesMouseEntered;
              provincesIcon.MouseLeft += OnProvincesMouseLeft;
  
  
gt:             holdingsIcon.MouseEntered += OnHoldingsMouseEntered;