IWindow serves as an interface for creating button-like Entities in Glue. Using the IWindow enables you to do the following:
- Respond to clicks (release of mouse-button or touch screen)
- Respond to pushes (initial press of a mouse-button or touch screen)
- Respond to dragging
- Prevent click-throughs on overlapping IWindows
The most commonly-used event when using IWindows in Glue is the Click event. The Click event is an event that is raised whenever the user “clicks” on an IWindow. FlatRedBall considers a Click as occurring if:
- The user pushes on a button
- The user clicks (releases) while still on the button
When these two events occur, then a button’s Click event is raised.
Entities that implement IWindow automatically receive an Enabled property. The Enabled property controls whether the GuiManager’s Cursor can interact with the Entity. Disabled Entities will not have their GUI events fired.
This Enabled property uses explicit implementation which means you can only access this property by casting an instance of your Entity to IWindow. In other words:
// Inside the Entity
((IWindow)this).Enabled = false;
// Outside of the Entity, assuming mEntityInstance is an instance:
((IWindow)mEntityInstance).Enabled = false;