wxMainFrame

The top-level frame window.  Houses the main screen window when a game is not being played, and a SettlersView when a game is being played.  Handles all of the menu event messages.

Derived From

wxFrame (see http://www.wxwidgets.org/manuals/2.4.2/wx163.htm)

Project

Cities3D

Include

wxMainFrame.h

Summary
The top-level frame window.
The wxMainFrame constructor.
The wxMainFrame destructor.
Does nothing right now.
Launches a hotseat game.
Does nothing right now.
Opens a saved game.
Saves the open game.
Closes down an open game.
Runs the wxSettingsDialog window.
Exits the application.
The wxWidgets event table declaration.
Loads the RuleSets required by the current map.
Callback for when games are loaded from disk or network.
Creates the child SettlersView window.
Handles main window resizes.

Public

Summary
The wxMainFrame constructor.
The wxMainFrame destructor.
Does nothing right now.
Launches a hotseat game.
Does nothing right now.
Opens a saved game.
Saves the open game.
Closes down an open game.
Runs the wxSettingsDialog window.
Exits the application.
The wxWidgets event table declaration.

Constructors

wxMainFrame

wxMainFrame(wxWindow *parent,
const wxString &title,
const wxPoint &pos,
const wxSize &size)

The wxMainFrame constructor.  Initializes the base class.  Sets the window size based on the values in the ConfigDatabase.

Parameters

parentThe parent window.  May be NULL.
titleThe window caption.  Displayed in the frame’s title bar.
posThe window position.
sizeThe window size.

Destructor

~wxMainFrame

~wxMainFrame()

The wxMainFrame destructor.  Saves the window size to the ConfigDatabase.

Event Message Handling

OnNewSingle

void OnNewSingle(wxCommandEvent &event)

Does nothing right now.

Parameters

eventThe menu command event.

OnNewHotseat

void OnNewHotseat(wxCommandEvent &event)

Launches a hotseat game.  Runs the wxGameSetupDialog window.  If successful, loads all the needed rulesets for the selected map and variants.  Then calls CreateSettlersView to create the child window that actually displays the game.  Calls the RuleEngine to randomize the players and then starts the game by executing the Rule0 Rule.

Parameters

eventThe menu command event.

OnNewNetwork

void OnNewNetwork(wxCommandEvent &event)

Does nothing right now.

Parameters

eventThe menu command event.

OnOpen

void OnOpen(wxCommandEvent &event)

Opens a saved game.

Parameters

eventThe menu command event.

OnSave

void OnSave(wxCommandEvent &event)

Saves the open game.  If the game is incomplete, it is saved in the incomplete database.  Otherwise, it is saved to complete database.

Parameters

eventThe menu command event.

OnClose

void OnClose(wxCommandEvent &event)

Closes down an open game.  Destroys the SettlersView child window.  Clears the loaded map.  Restarts the GameEngine, and calls ShowAppMenu on the wxCities3DApp.

Parameters

eventThe menu command event.

OnSettings

void OnSettings(wxCommandEvent &event)

Runs the wxSettingsDialog window.

Parameters

eventThe menu command event.

OnExit

void OnExit(wxCommandEvent &event)

Exits the application.  Calls wxFrame::Close().

Parameters

eventThe menu command event.

Variables

DECLARE_EVENT_TABLE

The wxWidgets event table declaration.

Private

Summary
Loads the RuleSets required by the current map.
Callback for when games are loaded from disk or network.
Creates the child SettlersView window.
Handles main window resizes.

Functions

StartGame

void StartGame(bool ck)

Loads the RuleSets required by the current map.  Calls CreateSettlersView to initialize the display window.  Calls RuleRandomizePlayers and Rule0 to start the game.

Parameters

ckFlag indicating whether Cities & Knights rules are being used.

LoadCallback

void LoadCallback(const StringPairArray array)

Callback for when games are loaded from disk or network.  Loads all of the <Rulesets> in the given array and calls CreateSettlersView to create the child display window.

Parameters

arrayThe container of module/RuleSet names to load for the game being opened.

CreateSettlersView

void CreateSettlersView()

Creates the child SettlersView window.

Event Message Handling

OnSize

void OnSize(wxSizeEvent &event)

Handles main window resizes.

Parameters

eventThe size event.
wxMainFrame(wxWindow *parent,
const wxString &title,
const wxPoint &pos,
const wxSize &size)
The wxMainFrame constructor.
~wxMainFrame()
The wxMainFrame destructor.
void OnNewSingle(wxCommandEvent &event)
Does nothing right now.
void OnNewHotseat(wxCommandEvent &event)
Launches a hotseat game.
void OnNewNetwork(wxCommandEvent &event)
Does nothing right now.
void OnOpen(wxCommandEvent &event)
Opens a saved game.
void OnSave(wxCommandEvent &event)
Saves the open game.
void OnClose(wxCommandEvent &event)
Closes down an open game.
void OnSettings(wxCommandEvent &event)
Runs the wxSettingsDialog window.
Still volatile.
void OnExit(wxCommandEvent &event)
Exits the application.
void StartGame(bool ck)
Loads the RuleSets required by the current map.
A repository of all things rules-related.
void LoadCallback(const StringPairArray array)
Callback for when games are loaded from disk or network.
void CreateSettlersView()
Creates the child SettlersView window.
The main game window.
void OnSize(wxSizeEvent &event)
Handles main window resizes.
Cities3D is a cross-platform implementation of the board game Settlers of Catan with all expansions, including Seafarers, and Cities & Knights.
A Singleton class that handles configuration options for the application.
Dialog that sets up a hotseat game.
The default implementation of the IRuleEngine interface.
The starting point of a game.
The default implementation of IRule for normal Game actions.
The engine that drives the game.
The main application class.
Randomizes the order of the players in the Game data.