wxGameSetupDialog

Dialog that sets up a hotseat game.  Allows the user to select players and assign them to colors, select a map, and apply any available variants to the rules.

Derived From

wxBaseDialog

Project

Cities3D

Include

GameSetupDialog.h

Summary
Dialog that sets up a hotseat game.
The wxGameSetupDialog constructor.
The wxGameSetupDialog destructor.
Returns whether the user has turned on Cities & Knights rules.
The wxWidgets event table declaration.
Updates the dialog.
Runs the wxAddPlayerDialog window.
Runs the wxAddPlayerDialog window with the PlayerDatabase index of the selected player.
Runs the wxSelectMapDialog window.
Does nothing right now.
Handles a player selection in the wxPlayerDropListCtrl.
Whether the user has turned on Cities & Knights rules.

Public

Summary
The wxGameSetupDialog constructor.
The wxGameSetupDialog destructor.
Returns whether the user has turned on Cities & Knights rules.
The wxWidgets event table declaration.

Constructors

wxGameSetupDialog

wxGameSetupDialog(wxWindow *parent)

The wxGameSetupDialog constructor.  Disables the OK button, and adds OnUpdateDialog as a receiver of the eventPreGame Event via the Controller.

Parameters

parentThe parent window.

Destructor

~wxGameSetupDialog

~wxGameSetupDialog()

The wxGameSetupDialog destructor.  Removes the OnUpdateDialog as a receiver of the eventPreGame Event.

Functions

GetCK

bool GetCK() const

Returns whether the user has turned on Cities & Knights rules.

Returns

A bool value that is true if the user has turned on Cities & Knights rules and false if they have not.

Variables

DECLARE_EVENT_TABLE

The wxWidgets event table declaration.

Private

Summary
Updates the dialog.
Runs the wxAddPlayerDialog window.
Runs the wxAddPlayerDialog window with the PlayerDatabase index of the selected player.
Runs the wxSelectMapDialog window.
Does nothing right now.
Handles a player selection in the wxPlayerDropListCtrl.
Whether the user has turned on Cities & Knights rules.

Game Event Functions

OnUpdateDialog

void OnUpdateDialog(GamePtr game)

Updates the dialog.  Triggered by the eventPreGame Event.  Enables the OK button if there is at least one player in the game and if a map has been selected.  Calls OnPlayerSelected to refresh the current player selection.

Parameters

gameThe current Game object.

Event Message Handling

OnAddPlayer

void OnAddPlayer(wxCommandEvent &event)

Runs the wxAddPlayerDialog window.  If the user adds a new player, adds that player to the wxPlayerDropListCtrl.

Parameters

eventThe button click event.

OnEditPlayer

void OnEditPlayer(wxCommandEvent &event)

Runs the wxAddPlayerDialog window with the PlayerDatabase index of the selected player.  If the user edits the player, changes the name of that player in the wxPlayerDropListCtrl.

Parameters

eventThe button click event.

OnSelectMap

void OnSelectMap(wxCommandEvent &event)

Runs the wxSelectMapDialog window.  If a map is selected, sets the mCK flag based on the setting in the wxSelectMapDialog and calls the RuleEngine to load the selected map.

Parameters

eventThe button click event.

OnGameOptions

void OnGameOptions(wxCommandEvent &event)

Does nothing right now.

Parameters

eventThe button click event.

OnPlayerSelected

void OnPlayerSelected(wxListEvent &event)

Handles a player selection in the wxPlayerDropListCtrl.  Enables the Edit button if a player is selected, disables it if not.

Parameters

eventThe list selection event.

Variables

mCK

bool mCK

Whether the user has turned on Cities & Knights rules.  True if they have, false if not.

wxGameSetupDialog(wxWindow *parent)
The wxGameSetupDialog constructor.
~wxGameSetupDialog()
The wxGameSetupDialog destructor.
bool GetCK() const
Returns whether the user has turned on Cities & Knights rules.
void OnUpdateDialog(GamePtr game)
Updates the dialog.
void OnAddPlayer(wxCommandEvent &event)
Runs the wxAddPlayerDialog window.
Dialog that allows users to add or edit players.
void OnEditPlayer(wxCommandEvent &event)
Runs the wxAddPlayerDialog window with the PlayerDatabase index of the selected player.
Still volatile.
void OnSelectMap(wxCommandEvent &event)
Runs the wxSelectMapDialog window.
The wxOpenGameDialog constructor.
void OnGameOptions(wxCommandEvent &event)
Does nothing right now.
void OnPlayerSelected(wxListEvent &event)
Handles a player selection in the wxPlayerDropListCtrl.
Displays all of the players in the PlayerDatabase in a list control, with drag and drop initiation.
bool mCK
Whether the user has turned on Cities & Knights rules.
A common base class for dialog boxes.
Cities3D is a cross-platform implementation of the board game Settlers of Catan with all expansions, including Seafarers, and Cities & Knights.
A generic implementation of the Observer design pattern.
The communication mechanism between the View and the Model.
Still volatile.
The default implementation of the IRuleEngine interface.