This class is responsible for any and all user interactions with the User interface/HUD. More...
#include <uimanager.h>
Public Types | |
typedef InputContainer::const_iterator | ConstInputIterator |
Const Iterator type for Input::MetaCode instances stored by this class. | |
typedef MarkupParserContainer::const_iterator | ConstMarkupParserIterator |
Const Iterator type for MarkupParser instances stored by this class. | |
typedef ScreenContainer::const_iterator | ConstScreenIterator |
Const Iterator type for Screen instances stored by this class. | |
typedef std::pair< String, Real > | FontResult |
An std::pair type for returning the result of a font suggestion. | |
typedef std::vector < Input::MetaCode > | InputContainer |
Basic container type for Input::MetaCode storage by this class. | |
typedef InputContainer::iterator | InputIterator |
Iterator type for Input::MetaCode instances stored by this class. | |
typedef std::map< String, MarkupParser * > | MarkupParserContainer |
Basic container type for MarkupParser storage by this class. | |
typedef MarkupParserContainer::iterator | MarkupParserIterator |
Iterator type for MarkupParser instances stored by this class. | |
typedef std::vector< UI::Screen * > | ScreenContainer |
Basic container type for Screen storage by this class. | |
typedef ScreenContainer::iterator | ScreenIterator |
Iterator type for Screen instances stored by this class. | |
Public Types inherited from Mezzanine::ManagerBase | |
enum | ManagerType { MT_AudioManager = 1, MT_AnimationManager, MT_CollisionShapeManager, MT_CompositorManager, MT_GraphicsManager, MT_EventManager, MT_InputManager, MT_LogManager, MT_MaterialManager, MT_MeshManager, MT_NetworkManager, MT_ResourceManager, MT_ScriptingManager, MT_UIManager, MT_ActorManager = 100, MT_AreaEffectManager, MT_CameraManager, MT_DebrisManager, MT_PagingManager, MT_PhysicsManager, MT_SceneManager, MT_SoundScapeManager, MT_TerrainManager, MT_VehicleManager, MT_UserCreated = 512 } |
Public Member Functions | |||
UIManager () | |||
Class Constructor. | |||
UIManager (XML::Node &XMLNode) | |||
XML constructor. More... | |||
virtual | ~UIManager () | ||
Class Destructor. | |||
void | AddAutoRegisterCode (const Input::MetaCode &Code) | ||
Adds a key or button that will be auto-registered with every created UI button. More... | |||
void | BindHotKey (const Input::MetaCode &HotKey, Button *BoundButton) | ||
Binds a key to a button. More... | |||
bool | ButtonAutoRegisterEnabled () | ||
Gets whether or not the ButtonAutoRegister feature is enabled. More... | |||
Widget * | CheckWidgetUnderPoint (Graphics::Viewport *VP, const Vector2 &Point) | ||
Searches all visable screens and layers to see if a Widget is under the given point. More... | |||
Screen * | CreateScreen (const String &ScreenName, const String &Atlas, Graphics::Viewport *WindowViewport) | ||
Creates an internal HUD screen. More... | |||
virtual void | Deinitialize () | ||
Removes this manager from any necessary configuration so it can be safely disposed of. More... | |||
void | DestroyAllMarkupParsers () | ||
Removes and destroys all MarkupParsers from this manager. | |||
void | DestroyAllScreens () | ||
Deletes all screens stored in this manager. | |||
void | DestroyMarkupParser (const String &ParserName) | ||
Removes and destroys a MarkupParser from this manager. More... | |||
void | DestroyScreen (Screen *Screen) | ||
Deletes a screen and removes all trace of it from the manager. More... | |||
void | EnableButtonAutoRegister (bool Enable) | ||
Enables whether or not to automatically set the activation key or button for UI buttons. More... | |||
TextureAtlas * | GetAtlas (const String &AtlasName) | ||
Gets a loaded Atlas being stored in this manager. More... | |||
TextureAtlasHandler * | GetAtlasHandler () const | ||
Gets this managers Atlas Handler. More... | |||
InputContainer * | GetAutoRegisteredCodes () | ||
Gets the list of codes that will be auto-registered with each UI button. More... | |||
Widget * | GetHoveredWidget () const | ||
Gets the Widget the mouse is hovering over. More... | |||
virtual String | GetImplementationTypeName () const | ||
This Allows any manager name to be sent to a stream. Primarily used for logging. More... | |||
virtual ManagerType | GetInterfaceType () const | ||
This returns the type of this manager. More... | |||
MarkupParser * | GetMarkupParser (const String &ParserName) const | ||
Gets a MarkupParser by it's registered name. More... | |||
Whole | GetNumScreens () | ||
Gets the number of screens created and stored in this manager. More... | |||
Screen * | GetScreen (const String &Name) | ||
Gets an already created screen by name. More... | |||
Screen * | GetScreen (const Whole &Index) | ||
Gets an already created screen by index. More... | |||
Screen * | GetVisibleScreenOnViewport (Graphics::Viewport *WindowViewport) | ||
Gets the currently visible screen on the provided viewport. More... | |||
Widget * | GetWidgetFocus () const | ||
Gets the current widget being controlled. More... | |||
WidgetUpdateWorkUnit * | GetWidgetUpdateWork () | ||
Gets the work unit responsible for updating the widgets in this manager. More... | |||
void | HideAllScreens () | ||
Hides all screens owned by this manager. | |||
void | HideScreensOnViewport (Graphics::Viewport *WindowViewport, Screen *Exclude=NULL) | ||
Hides all screens bound to a specific viewport. More... | |||
virtual void | Initialize () | ||
Configures this manager for use prior to entering the main loop. More... | |||
void | InjectInput (const Input::MetaCode &Code) | ||
Injects a metacode into this manager, allowing the UI system to be aware of it. More... | |||
bool | IsMarkupParserRegistered (const String &ParserName) const | ||
Checks to see if a MarkupParser has already been registsered under a specific name. More... | |||
void | LoadMTA (const String &Name, const String &Group="UI") | ||
Loads a Mezzanine Texture Atlas file for use with Screens. More... | |||
Boolean | MouseIsInUISystem () const | ||
Checks to see if the mouse is over a UI element. More... | |||
void | RegisterMarkupParser (const String &ParserName, MarkupParser *ToAdd) | ||
Registers a new MarkupParser with this Manager.
| |||
void | RemoveAllAutoRegisterCodes () | ||
Removes all auto-registering input codes. | |||
void | RemoveAutoRegisterCode (const Input::MetaCode &Code) | ||
Removes a previously set auto-registering input code. More... | |||
void | ShowAllScreens () | ||
Shows all screens owned by this manager. | |||
void | ShowScreensOnViewport (Graphics::Viewport *WindowViewport) | ||
Shows all screens bound to a specific viewport. More... | |||
FontResult | SuggestGlyphIndex (const Whole &Height, const String &Atlas) | ||
Suggests a glyph index based on the desired actual height. More... | |||
void | UnbindHotKey (const Input::MetaCode &HotKey, Button *BoundButton) | ||
Removes a previously set hotkey binding. More... | |||
void | UnregisterAllMarkupParsers () | ||
Removes all MarkupParsers from this manager. | |||
void | UnregisterMarkupParser (const String &ParserName) | ||
Removes a MarkupParser from this manager. More... | |||
virtual void | UpdateScreens () | ||
Updates the UI system based on the most recent inputs. | |||
Public Member Functions inherited from Mezzanine::ManagerBase | |||
ManagerBase () | |||
Class constructor. | |||
virtual | ~ManagerBase () | ||
Class destructor. | |||
virtual String | GetInterfaceTypeAsString () const | ||
Gets a string of the interface type of this manager. More... | |||
bool | IsInitialized () const | ||
Gets whether or not this manager has been initialized. More... | |||
Public Member Functions inherited from Mezzanine::Singleton< UIManager > | |||
Singleton () | |||
Class constructor. | |||
~Singleton () | |||
Class destructor. | |||
Protected Member Functions | |
bool | FocusIsLocked () const |
Gets whether or not the systems current focus is locked. More... | |
void | HandlePostFocusControllerInput (const Input::MetaCode &Code) |
Handles controller processes after the update of the main focus. More... | |
void | HandlePostFocusInput (const Input::MetaCode &Code) |
Handles UI processing after the update of the main focus. More... | |
void | HandlePostFocusKeyboardInput (const Input::MetaCode &Code) |
Handles keyboard processes after the update of the main focus. More... | |
void | HandlePostFocusMouseInput (const Input::MetaCode &Code) |
Handles mouse processes after the update of the main focus. More... | |
void | HandlePreFocusControllerInput (const Input::MetaCode &Code) |
Handles controller processes prior to the update of the main focus. More... | |
void | HandlePreFocusInput (const Input::MetaCode &Code) |
Handles UI processing prior to the update of the main focus. More... | |
void | HandlePreFocusKeyboardInput (const Input::MetaCode &Code) |
Handles keyboard processes prior to the update of the main focus. More... | |
void | HandlePreFocusMouseInput (const Input::MetaCode &Code) |
Handles mouse processes prior to the update of the main focus. More... | |
bool | SwitchFocus (Widget *NewFocus) |
Updates the current focus to a new target. More... | |
Protected Attributes | |
TextureAtlasHandler * | AtlasHandler |
A pointer to the class responsible for Atlas tasks in the UI system. More... | |
InputContainer | AutoRegisterCodes |
A container storing all of the Inputs buttons will be set to activate in response to. More... | |
bool | ButtonAutoRegister |
Stores whether or not newly created buttons will have activation codes binded to them automatically. More... | |
Input::MetaCode | FocusLockCode |
Stores the Input that locked the current focus. More... | |
HotKeyHandler * | HKHandler |
A pointer to the class responsible for HotKey tasks in the UI system. More... | |
Widget * | HoveredWidget |
A pointer to the current widget in the UI system the mouse is hovered over. More... | |
InputContainer | InjectedInputs |
A container storing all of the Inputs generated/tracked during the last UI update. More... | |
MarkupParserContainer | MarkupParsers |
A container storing all the registered/known markup parsers. More... | |
bool | MouseMoved |
Stores whether or not the mouse moved since the last time the UI was updated. More... | |
ScreenContainer | Screens |
A container storing all the Screens created in the UI system. More... | |
Threading::DefaultThreadSpecificStorage::Type * | ThreadResources |
Can be used for thread safe logging and other thread specific resources. More... | |
Widget * | WidgetFocus |
A pointer to the widget that is currently holding the focus. More... | |
WidgetUpdateWorkUnit * | WidgetUpdateWork |
The work unit that updates all of the widgets in the UI system. More... | |
Protected Attributes inherited from Mezzanine::ManagerBase | |
bool | Initialized |
Simple bool indicating whether or not this manager has been initialized. More... | |
Entresol * | TheEntresol |
The actual pointer to the Entresol core class. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Mezzanine::ManagerBase | |
static String | GetTypeAsString (const ManagerType &ManagerType) |
Gets the string form of the type of manager. More... | |
static ManagerType | GetTypeFromString (const String &ManagerName) |
Gets the type of manager requested from a string. More... | |
Static Public Member Functions inherited from Mezzanine::Singleton< UIManager > | |
static UIManager * | GetSingletonPtr () |
Fetches a pointer to the singleton. More... | |
static bool | SingletonValid () |
Checks to see if the singleton pointer is valid. More... | |
Static Protected Attributes inherited from Mezzanine::Singleton< UIManager > | |
static UIManager * | SingletonPtr |
This class is responsible for any and all user interactions with the User interface/HUD.
Currently, you have to create the UI/HUD in code. Font and sprite data is loaded through a premade mta file(*.mta).
Definition at line 113 of file uimanager.h.
Mezzanine::UI::UIManager::UIManager | ( | XML::Node & | XMLNode) |
XML constructor.
XMLNode | The node of the xml document to construct from. |
Definition at line 123 of file uimanager.cpp.
void Mezzanine::UI::UIManager::AddAutoRegisterCode | ( | const Input::MetaCode & | Code) |
Adds a key or button that will be auto-registered with every created UI button.
Code | The input code for the keyboard key or mouse button to be added to the list of codes to be auto-registered. |
Definition at line 411 of file uimanager.cpp.
void Mezzanine::UI::UIManager::BindHotKey | ( | const Input::MetaCode & | HotKey, |
Button * | BoundButton | ||
) |
Binds a key to a button.
This function allows buttons to behave like they are pressed without mouse input.
HotKey | The key or button (on the input device) to activate the button. |
BoundButton | The button being bound to the hotkey. |
Definition at line 388 of file uimanager.cpp.
bool Mezzanine::UI::UIManager::ButtonAutoRegisterEnabled | ( | ) |
Gets whether or not the ButtonAutoRegister feature is enabled.
Definition at line 406 of file uimanager.cpp.
Widget * Mezzanine::UI::UIManager::CheckWidgetUnderPoint | ( | Graphics::Viewport * | VP, |
const Vector2 & | Point | ||
) |
Searches all visable screens and layers to see if a Widget is under the given point.
This is called automatically once every frame. Should only be called on manually if you need more then one check per frame.
VP | A pointer to the viewport to check. |
Point | The point on screen(in viewport space) to use when checking Widgets. |
Definition at line 529 of file uimanager.cpp.
Screen * Mezzanine::UI::UIManager::CreateScreen | ( | const String & | ScreenName, |
const String & | Atlas, | ||
Graphics::Viewport * | WindowViewport | ||
) |
Creates an internal HUD screen.
Screens are the base set of renderable UI you can use, allowing you to switch entire sets of UI's on the fly if needed. For performance reasons you should always keep the number of screens you create to a minimum.
ScreenName | The name to be given to the screen. |
Atlas | The name of a previously loaded mta file to be used with this screen. |
WindowViewport | The viewport to create this screen in. |
Definition at line 288 of file uimanager.cpp.
|
virtual |
Removes this manager from any necessary configuration so it can be safely disposed of.
Implements Mezzanine::ManagerBase.
Definition at line 669 of file uimanager.cpp.
void Mezzanine::UI::UIManager::DestroyMarkupParser | ( | const String & | ParserName) |
Removes and destroys a MarkupParser from this manager.
ParserName | The name of the MarkupParser to be destroyed. |
Definition at line 480 of file uimanager.cpp.
void Mezzanine::UI::UIManager::DestroyScreen | ( | Screen * | Screen) |
Deletes a screen and removes all trace of it from the manager.
Destroying a screen will also destroy all of it's layers, and everything contained in those layers.
Screen | The screen to be destroyed. |
Definition at line 317 of file uimanager.cpp.
void Mezzanine::UI::UIManager::EnableButtonAutoRegister | ( | bool | Enable) |
Enables whether or not to automatically set the activation key or button for UI buttons.
If true, this will cause every UI button to have keyboard keys or mouse buttons added with AddButtonAutoRegister() to be added as activation keys or buttons immediately after they are created.
Default: False.
Enable | Whether or not to enable this feature. |
Definition at line 401 of file uimanager.cpp.
|
protected |
Gets whether or not the systems current focus is locked.
Definition at line 267 of file uimanager.cpp.
TextureAtlas * Mezzanine::UI::UIManager::GetAtlas | ( | const String & | AtlasName) |
Gets a loaded Atlas being stored in this manager.
AtlasName | The name of the Atlas, which is usually the name of the file without the extension. |
Definition at line 280 of file uimanager.cpp.
TextureAtlasHandler * Mezzanine::UI::UIManager::GetAtlasHandler | ( | ) | const |
Gets this managers Atlas Handler.
Definition at line 507 of file uimanager.cpp.
UIManager::InputContainer * Mezzanine::UI::UIManager::GetAutoRegisteredCodes | ( | ) |
Gets the list of codes that will be auto-registered with each UI button.
Definition at line 437 of file uimanager.cpp.
Widget * Mezzanine::UI::UIManager::GetHoveredWidget | ( | ) | const |
Gets the Widget the mouse is hovering over.
Definition at line 501 of file uimanager.cpp.
|
virtual |
This Allows any manager name to be sent to a stream. Primarily used for logging.
Implements Mezzanine::ManagerBase.
Definition at line 690 of file uimanager.cpp.
|
virtual |
This returns the type of this manager.
This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.
Implements Mezzanine::ManagerBase.
Definition at line 687 of file uimanager.cpp.
MarkupParser * Mezzanine::UI::UIManager::GetMarkupParser | ( | const String & | ParserName) | const |
Gets a MarkupParser by it's registered name.
ParserName | The name of the MarkupParser to retrieve. |
Definition at line 461 of file uimanager.cpp.
Whole Mezzanine::UI::UIManager::GetNumScreens | ( | ) |
Gets the number of screens created and stored in this manager.
Definition at line 312 of file uimanager.cpp.
Gets an already created screen by name.
Definition at line 295 of file uimanager.cpp.
Gets an already created screen by index.
Definition at line 307 of file uimanager.cpp.
Screen * Mezzanine::UI::UIManager::GetVisibleScreenOnViewport | ( | Graphics::Viewport * | WindowViewport) |
Gets the currently visible screen on the provided viewport.
WindowViewport | The viewport to check for a visible screen. |
Definition at line 374 of file uimanager.cpp.
Widget * Mezzanine::UI::UIManager::GetWidgetFocus | ( | ) | const |
Gets the current widget being controlled.
The widget control is used mostly for manipulating widgets while the mouse is not currently hovering over them, such as the click and drag action of scrollbars and resizing windows.
Definition at line 504 of file uimanager.cpp.
WidgetUpdateWorkUnit * Mezzanine::UI::UIManager::GetWidgetUpdateWork | ( | ) |
Gets the work unit responsible for updating the widgets in this manager.
Definition at line 679 of file uimanager.cpp.
|
protected |
Handles controller processes after the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 238 of file uimanager.cpp.
|
protected |
Handles UI processing after the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 166 of file uimanager.cpp.
|
protected |
Handles keyboard processes after the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 225 of file uimanager.cpp.
|
protected |
Handles mouse processes after the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 230 of file uimanager.cpp.
|
protected |
Handles controller processes prior to the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 219 of file uimanager.cpp.
|
protected |
Handles UI processing prior to the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 155 of file uimanager.cpp.
|
protected |
Handles keyboard processes prior to the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 177 of file uimanager.cpp.
|
protected |
Handles mouse processes prior to the update of the main focus.
Code | The MetaCode containing the input to be processed. |
Definition at line 182 of file uimanager.cpp.
void Mezzanine::UI::UIManager::HideScreensOnViewport | ( | Graphics::Viewport * | WindowViewport, |
Screen * | Exclude = NULL |
||
) |
Hides all screens bound to a specific viewport.
WindowViewport | The viewport bound to all screens to be hidden. |
Exclude | Optional parameter that will make a single screen be excluded from this operation. |
Definition at line 356 of file uimanager.cpp.
|
virtual |
Configures this manager for use prior to entering the main loop.
Implements Mezzanine::ManagerBase.
Definition at line 657 of file uimanager.cpp.
void Mezzanine::UI::UIManager::InjectInput | ( | const Input::MetaCode & | Code) |
Injects a metacode into this manager, allowing the UI system to be aware of it.
Code | The MetaCode to be injected and later processed. |
Definition at line 513 of file uimanager.cpp.
bool Mezzanine::UI::UIManager::IsMarkupParserRegistered | ( | const String & | ParserName) | const |
Checks to see if a MarkupParser has already been registsered under a specific name.
ParserName | The name of the MarkupParser to check for. |
Definition at line 455 of file uimanager.cpp.
Loads a Mezzanine Texture Atlas file for use with Screens.
Name | The name of the file to be loaded. |
Group | The resource group where the MTA file can be found. |
Definition at line 275 of file uimanager.cpp.
Boolean Mezzanine::UI::UIManager::MouseIsInUISystem | ( | ) | const |
Checks to see if the mouse is over a UI element.
This should only be called on after this manager does it's main loop items for best results.
Definition at line 539 of file uimanager.cpp.
void Mezzanine::UI::UIManager::RegisterMarkupParser | ( | const String & | ParserName, |
MarkupParser * | ToAdd | ||
) |
Registers a new MarkupParser with this Manager.
This | method will thrown a "II_DUPLICATE_IDENTITY_EXCEPTION" if the provided name is already registered. |
ParserName | The name to be given to the registered MarkupParser. |
ToAdd | A pointer to the MarkupParser to be registered with the given name. |
Definition at line 445 of file uimanager.cpp.
void Mezzanine::UI::UIManager::RemoveAutoRegisterCode | ( | const Input::MetaCode & | Code) |
Removes a previously set auto-registering input code.
Code | The input code to be removed from the list of auto-registering codes. |
Definition at line 421 of file uimanager.cpp.
void Mezzanine::UI::UIManager::ShowScreensOnViewport | ( | Graphics::Viewport * | WindowViewport) |
Shows all screens bound to a specific viewport.
WindowViewport | The viewport bound to all screens to be shown. |
Definition at line 338 of file uimanager.cpp.
UIManager::FontResult Mezzanine::UI::UIManager::SuggestGlyphIndex | ( | const Whole & | Height, |
const String & | Atlas | ||
) |
Suggests a glyph index based on the desired actual height.
Height | The desired Height of the glyph wanted in pixels. |
Atlas | The altas to search. |
Definition at line 544 of file uimanager.cpp.
|
protected |
Updates the current focus to a new target.
NewFocus | The new widget obtaining the UI focus. |
Definition at line 244 of file uimanager.cpp.
void Mezzanine::UI::UIManager::UnbindHotKey | ( | const Input::MetaCode & | HotKey, |
Button * | BoundButton | ||
) |
Removes a previously set hotkey binding.
HotKey | The key or button (on the input device) to activate the button. |
BoundButton | The button currently bound to the hotkey. |
Definition at line 393 of file uimanager.cpp.
void Mezzanine::UI::UIManager::UnregisterMarkupParser | ( | const String & | ParserName) |
Removes a MarkupParser from this manager.
ParserName | The name of the MarkupParser to be removed. |
Definition at line 468 of file uimanager.cpp.
|
protected |
A pointer to the class responsible for Atlas tasks in the UI system.
Definition at line 161 of file uimanager.h.
|
protected |
A container storing all of the Inputs buttons will be set to activate in response to.
Definition at line 145 of file uimanager.h.
|
protected |
Stores whether or not newly created buttons will have activation codes binded to them automatically.
Definition at line 173 of file uimanager.h.
|
protected |
Stores the Input that locked the current focus.
Definition at line 152 of file uimanager.h.
|
protected |
A pointer to the class responsible for HotKey tasks in the UI system.
Definition at line 164 of file uimanager.h.
|
protected |
A pointer to the current widget in the UI system the mouse is hovered over.
Definition at line 155 of file uimanager.h.
|
protected |
A container storing all of the Inputs generated/tracked during the last UI update.
Definition at line 148 of file uimanager.h.
|
protected |
A container storing all the registered/known markup parsers.
Definition at line 139 of file uimanager.h.
|
protected |
Stores whether or not the mouse moved since the last time the UI was updated.
Definition at line 176 of file uimanager.h.
|
protected |
A container storing all the Screens created in the UI system.
Definition at line 142 of file uimanager.h.
|
protected |
Can be used for thread safe logging and other thread specific resources.
Definition at line 170 of file uimanager.h.
|
protected |
A pointer to the widget that is currently holding the focus.
Definition at line 158 of file uimanager.h.
|
protected |
The work unit that updates all of the widgets in the UI system.
Definition at line 167 of file uimanager.h.