FlatRedBall.Gui.GuiManager

Introduction

The GuiManager is a static object responsible for common UI element management as well as some UI creation.

There are two categories of UI elements:

  1. Default FlatRedBall GUI objects which are usually used for debugging and tools (these are used in all FRB graphical tools like the SpriteEditor, PolygonEditor, etc)
  2. Glue Entities inheriting from IWindow

For a Default FlatRedBall UI element to be visible and functional it must either belong to the GuiManager or another UI element. Glue Entities are drawn by the engine like normal Entities – the GuiManager simply handles the cursor-based activity (like clicks).

Window Categories

When a Window is created and added to the GuiManager, it can be added to one of three internal lists. These lists define the three categories. These categories are:

  • Regular
  • Dominant
  • Perishable

The following sections define the characteristics of each category.

Regular

Adding a Window by calling its constructor then passing it to the GuiManager’s AddWindow method will add the Window as a regular Window. Regular Windows remain in memory until they are removed using the GuiManager’s RemoveWindow method. Making a regular Window invisible will not remove it from the GuiManager.

Dominant

Dominant Windows are Windows which consume Cursor interaction while they are visible. In other words, if a dominant Window is present, no other Windows will receive input. Any Window can be made dominant through the AddDominantWindow method.

Dominant Windows are often used when the users attention is required on a particular Window. Examples include a OkCancelWindow asking if the program should really exit after clicking the close button or a FileWindow for selecting a file to load in an application.

Dominant Windows can be removed by either calling the GuiManager’s RemoveWindow method or by setting the dominant Window’s Visible property to false. Setting the Visible property to false will result in the GuiManager automatically removing the Window if RemoveInvisibleDominantWindows is set to true.

Perishable

Perishable Windows are Windows which will automatically be removed by the GuiManager when the user clicks and the Cursor is not over the perishable Window. Perishable Windows are most commonly used for Windows which have a short life span. Examples include the drop-down ListBoxes that appear when clicking the Button on ComboBoxes or menus appearing when right-clicking on an object.

If the user clicks on a perishable Window, the Window will not automatically remove itself. The removal is usually handled in one of the Window’s events in this case.

GuiManager Members

Did this article leave any questions unanswered? Post any question in our forums for a rapid response.