dolphin/Source/Core/DolphinWX/Src/NetWindow.h
Glenn Rice 217ee43063 Fix a memory leak in the breakpoint window.
Parent message alerts by the active window.  This way if another window is open it isn't pushed behind the main window.  We probably should parent the message alerts by the calling window instead, but this may be good enough.
Make sure there is only one instance of some modeless windows (Cheats Manager and Net Play).


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7257 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-02-27 02:27:43 +00:00

144 lines
3.2 KiB
C++

// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _NETWINDOW_H_
#define _NETWINDOW_H_
#include "CommonTypes.h"
#include <queue>
#include <string>
#include <wx/wx.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
#include <wx/notebook.h>
#include <wx/gbsizer.h>
#include <wx/listbox.h>
#include <wx/spinctrl.h>
#include "GameListCtrl.h"
#include "FifoQueue.h"
#include "NetPlay.h"
enum
{
NP_GUI_EVT_CHANGE_GAME = 45,
NP_GUI_EVT_START_GAME,
NP_GUI_EVT_STOP_GAME,
};
class NetPlaySetupDiag : public wxFrame
{
public:
NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list);
~NetPlaySetupDiag();
private:
void OnJoin(wxCommandEvent& event);
void OnHost(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
wxTextCtrl *m_nickname_text,
*m_host_port_text,
*m_connect_port_text,
*m_connect_ip_text;
wxListBox* m_game_lbox;
const CGameListCtrl* const m_game_list;
};
class NetPlayDiag : public wxFrame, public NetPlayUI
{
public:
NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list
, const std::string& game, const bool is_hosting = false);
~NetPlayDiag();
Common::FifoQueue<std::string> chat_msgs;
void OnStart(wxCommandEvent& event);
void OnStop(wxCommandEvent& event);
// implementation of NetPlayUI methods
void BootGame(const std::string& filename);
void StopGame();
void Update();
void AppendChat(const std::string& msg);
void OnMsgChangeGame(const std::string& filename);
void OnMsgStartGame();
void OnMsgStopGame();
static NetPlayDiag *&GetInstance() { return npd; };
private:
DECLARE_EVENT_TABLE()
void OnChat(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void OnPadBuffHelp(wxCommandEvent& event);
void OnThread(wxCommandEvent& event);
void OnChangeGame(wxCommandEvent& event);
void OnAdjustBuffer(wxCommandEvent& event);
void OnConfigPads(wxCommandEvent& event);
wxListBox* m_player_lbox;
wxTextCtrl* m_chat_text;
wxTextCtrl* m_chat_msg_text;
std::string m_selected_game;
wxButton* m_game_btn;
std::vector<int> m_playerids;
const CGameListCtrl* const m_game_list;
static NetPlayDiag* npd;
};
DECLARE_EVENT_TYPE(wxEVT_THREAD, -1)
class ChangeGameDiag : public wxDialog
{
public:
ChangeGameDiag(wxWindow* const parent, const CGameListCtrl* const game_list, wxString& game_name);
private:
void OnPick(wxCommandEvent& event);
wxListBox* m_game_lbox;
wxString& m_game_name;
};
class PadMapDiag : public wxDialog
{
public:
PadMapDiag(wxWindow* const parent, int map[]);
private:
void OnAdjust(wxCommandEvent& event);
wxChoice* m_map_cbox[4];
int* const m_mapping;
};
#endif // _NETWINDOW_H_