TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
TurtleBrains::Application::ApplicationStatus Class Reference

Create a customized status bar area to feed the user status information. More...

#include <tb_application_status.h>

Public Member Functions

 ApplicationStatus (const StatusIdentifier &statusIdentifier)
 
 ~ApplicationStatus (void)
 
const StatusIdentifierGetIdentifier (void) const
 
void ClearStatus (void)
 
void AddStatusItem (const StatusItemIdentifier &itemIdentifier, const tbCore::tbString &statusMessage, const char partitionPlacement)
 
void SetStatusItem (const StatusItemIdentifier &itemIdentifier, const tbCore::tbString &statusMessage)
 

Detailed Description

The ApplicationStatus object represents a reusuable status bar object that can be partitioned to hold up to 16 partitioned items that can be updated/modified individually.

Warning
Most classes in the Application area are up for a complete redesign of the public facing interface.

TODO: TurtleBrains: Documentation: Create an example of creating / using an ApplicaitonStatus.

Constructor & Destructor Documentation

TurtleBrains::Application::ApplicationStatus::ApplicationStatus ( const StatusIdentifier statusIdentifier)
explicit

When you create an ApplicationStatus object with a StatusIdentifier, you can later create another ApplicationStatus object with that same StatusIdentifier value and BOTH of those status objects will refer to and edit the same status bar settings.

TurtleBrains::Application::ApplicationStatus::~ApplicationStatus ( void  )

This will destruct the ApplicationStatus object, but will not destroy resources or remove the status settings from memory or remove the status if it were visible. Creating another ApplicationStatus object with the same StatusIdentifier value will give access to these settings once again.

Note
this does not cause the status to be destroyed, or even cause any settings to be removed from memory, as creating another ApplicationStatus object with the same StatusIdentifier will provide access again.

Member Function Documentation

void TurtleBrains::Application::ApplicationStatus::AddStatusItem ( const StatusItemIdentifier itemIdentifier,
const tbCore::tbString statusMessage,
const char  partitionPlacement 
)

Partition the status bar and add an item with a message that can later be modified using the SetStatusItem methdod with the same itemIdentifier. The new item will not be displayed to the user until the next SetWindowStatus call.

Parameters
itemIdentifierA unique identifier to represent the status item / partition so it can be modified or accessed later. No two items can have the same identifier, so an error will be triggered if attempted.
statusMessageThe message to display for this item/partition. Messages wider than the partition width may, or may not, flow into the next partition or remain partially hidden.
partitionPlacementA percentage based placement of the left edge the partition. A value of 0 is the far left edge of the window, and 100 being the right most edge. Values out of that range will trigger an error.
Note
Maximum of 16 different status items can be added to a single ApplicationStatus object.
void TurtleBrains::Application::ApplicationStatus::ClearStatus ( void  )

Removes all items and partitions from the status bar area. This will not be displayed to the user until the next SetWindowStatus call.

const StatusIdentifier& TurtleBrains::Application::ApplicationStatus::GetIdentifier ( void  ) const

Retrieves the StatusIdentifier as specified when the object was created, this identifier cannot change for an ApplicationStatus object.

void TurtleBrains::Application::ApplicationStatus::SetStatusItem ( const StatusItemIdentifier itemIdentifier,
const tbCore::tbString statusMessage 
)

Update or modify the message of a specified status item. The item will not be changed until the next SetWindowStatus call.

Parameters
itemIdentifierThe identifier of the status item to be modified as added via AddStatusItem.
statusMessageThe message to display for this item/partition. Messages wider than the partition width may, or may not, flow into the next partition or remain partially hidden.