Displays a set of buttons for user turn actions. ControlsUI sits at the top of the screen just to the left of the MessageUI. It holds action buttons that players can use on their turn to undo an action (if possible), trade with each other, trade with the bank, play a card, or end their turn. ControlsUI can be updated by transmitting a DataObject to the eventControlsUI Event via the Controller. The transmitted DataObject must have a bool as its first parameter. If the bool value is false, the ControlsUI hides itself; if the bool value is true, the ControlsUI shows itself and updates each of its buttons via ILogic rules. The buttons are enabled or disabled depending on the result of the ILogic. If a user clicks an enabled button, ControlsUI calls the RuleEngine with an IRule to execute.
ControlsUI.h
Displays a set of buttons for user turn actions. | |
The ControlsUI constructor. | |
The ControlsUI destructor. | |
Initializes the ControlsUI. | |
The wxWidgets event table declaration. | |
Updates the clickability outline of the ControlsUI. | |
Paints the ControlsUI. | |
Provides the TraitsUI object for the ControlsUI. | |
Resizes the ControlsUI. | |
Updates the ControlsUI. | |
Updates the Undo button by checking the IRuleEngine. | |
Handles any action button click. | |
The action buttons. | |
Whether the ControlsUI has a clickable item in it or not. | |
Pointer to the window the ControlsUI is offset from. |
|
The ControlsUI constructor. Sets the resize window that the ControlsUI depends on to calculate its offset (should be the MessageUI window), and adds OnUpdate as a receiver of the eventControlsUI Event.
| parent | The parent window. Must not be NULL. |
| resizeLink | The window used to calculate offset properly. Must not be NULL. Since ControlsUI is to the left of MessageUI, it must take that into account when locating itself. |
| ~ControlsUI() |
The ControlsUI destructor. Removes OnUpdate as a receiver of the eventMessageUI Event.
|
Initializes the ControlsUI. Creates all of the action buttons and sets them to disabled. Then creates the internal TraitsUI object and calls ResizeUI to set the size of the UI properly.
Updates the clickability outline of the ControlsUI. | |
Paints the ControlsUI. | |
Provides the TraitsUI object for the ControlsUI. | |
Resizes the ControlsUI. | |
Updates the ControlsUI. | |
Updates the Undo button by checking the IRuleEngine. | |
Handles any action button click. | |
The action buttons. | |
Whether the ControlsUI has a clickable item in it or not. | |
Pointer to the window the ControlsUI is offset from. |
|
Updates the ControlsUI. Triggered by the eventControlsUI Event. The given DataObject must have a bool as its first parameter. If the bool is true, the ControlsUI is shown on the screen, if false, the ControlsUI is hidden. Calls hard-coded Logic for each of the buttons, to determine if the button should be enabled. Enables or disables the buttons appropriately. If any of the buttons are enabled, the entire ControlsUI is set to clickable state (and drawn with a white outline), otherwise, it is set to not clickable and drawn with the standard outline.
| object | The DataObject containing the update information. Must have a bool as its first parameter. |
|
Updates the Undo button by checking the IRuleEngine.
| dummy | A dummy parameter to satisfy the one parameter requirement for Events. Unused. |
|
Handles any action button click. Calls the RuleEngine with a hard-coded Rule for each of the buttons.
| event | The button click event. |
| ClearButtonArray mButtons |
The action buttons. Created as wxClearButtons for a common UI look and feel.
|
| ~ControlsUI() |
|
| void UpdateClickable() |
|
| virtual const TraitsUIPtr &GetTraitsUI() |
| virtual void ResizeUI() |
|
|
|
| ClearButtonArray mButtons |
| bool mClickable |
| const wxWindow *mResizeLink |