///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#include "gui.h"

///////////////////////////////////////////////////////////////////////////

LoginDialogBase::LoginDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* sizer;
	sizer = new wxBoxSizer( wxVERTICAL );
	
	logoBitmap = new wxStaticBitmap( this, wxID_ANY, wxBitmap( wxT("logo.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxSize( -1,-1 ), 0 );
	sizer->Add( logoBitmap, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
	
	wxFlexGridSizer* sizer2;
	sizer2 = new wxFlexGridSizer( 2, 2, 0, 0 );
	sizer2->AddGrowableCol( 1 );
	sizer2->AddGrowableRow( 2 );
	sizer2->SetFlexibleDirection( wxBOTH );
	sizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	nameText = new wxStaticText( this, wxID_ANY, wxT("名前"), wxDefaultPosition, wxDefaultSize, 0 );
	nameText->Wrap( -1 );
	sizer2->Add( nameText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	nameEdit = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	sizer2->Add( nameEdit, 0, wxALL|wxEXPAND, 5 );
	
	portText = new wxStaticText( this, wxID_ANY, wxT("ポート"), wxDefaultPosition, wxDefaultSize, 0 );
	portText->Wrap( -1 );
	sizer2->Add( portText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	portEdit = new wxTextCtrl( this, wxID_ANY, wxT("65000"), wxDefaultPosition, wxSize( 50,-1 ), 0 );
	portEdit->SetMaxLength( 5 ); 
	sizer2->Add( portEdit, 0, wxALL, 5 );
	
	networkText = new wxStaticText( this, wxID_ANY, wxT("ネットワーク"), wxDefaultPosition, wxDefaultSize, 0 );
	networkText->Wrap( -1 );
	sizer2->Add( networkText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	networkList = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxSize( -1,100 ), 0, NULL, wxLB_SINGLE ); 
	sizer2->Add( networkList, 1, wxALL|wxEXPAND, 5 );
	
	sizer->Add( sizer2, 1, wxEXPAND, 5 );
	
	statusText = new wxStaticText( this, wxID_ANY, wxT("ログインボタンをクリックするとログインします"), wxDefaultPosition, wxDefaultSize, 0 );
	statusText->Wrap( -1 );
	sizer->Add( statusText, 0, wxALL, 5 );
	
	wxBoxSizer* sizer3;
	sizer3 = new wxBoxSizer( wxHORIZONTAL );
	
	loginButton = new wxButton( this, wxID_ANY, wxT("ログイン(&L)"), wxDefaultPosition, wxSize( 80,25 ), 0 );
	loginButton->SetDefault(); 
	sizer3->Add( loginButton, 0, wxALL, 5 );
	
	exitButton = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxSize( 80,25 ), 0 );
	sizer3->Add( exitButton, 0, wxALL, 5 );
	
	sizer->Add( sizer3, 0, wxALIGN_RIGHT, 5 );
	
	this->SetSizer( sizer );
	this->Layout();
	
	// Connect Events
	loginButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LoginDialogBase::onClickLoginButton ), NULL, this );
}

LoginDialogBase::~LoginDialogBase()
{
	// Disconnect Events
	loginButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LoginDialogBase::onClickLoginButton ), NULL, this );
}

MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* sizer;
	sizer = new wxBoxSizer( wxVERTICAL );
	
	canvas=new Canvas(this);
	sizer->Add( canvas, 1, wxEXPAND, 5 );
	
	wxBoxSizer* sizer3;
	sizer3 = new wxBoxSizer( wxHORIZONTAL );
	
	messageEdit = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,35 ), wxTE_MULTILINE );
	sizer3->Add( messageEdit, 1, wxEXPAND, 5 );
	
	sendButton = new wxButton( this, wxID_ANY, wxT("発言 (Shift+Enter)"), wxDefaultPosition, wxSize( 120,-1 ), 0 );
	sizer3->Add( sendButton, 0, wxEXPAND, 5 );
	
	sizer->Add( sizer3, 0, wxEXPAND, 5 );
	
	logText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,80 ), wxTE_MULTILINE|wxTE_READONLY );
	sizer->Add( logText, 0, wxEXPAND, 5 );
	
	this->SetSizer( sizer );
	this->Layout();
	statusbar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
	menuBar = new wxMenuBar( 0 );
	networkMenu = new wxMenu();
	loginMenuItem = new wxMenuItem( networkMenu, ID_LOGIN, wxString( wxT("ログイン(&L)") ) + wxT('\t') + wxT("F2"), wxT("ネットワークにログインします。"), wxITEM_NORMAL );
	networkMenu->Append( loginMenuItem );
	
	logoutMenuItem = new wxMenuItem( networkMenu, ID_LOGOUT, wxString( wxT("ログアウト(&D)") ) + wxT('\t') + wxT("F3"), wxT("ネットワークからログアウトします。"), wxITEM_NORMAL );
	networkMenu->Append( logoutMenuItem );
	logoutMenuItem->Enable( false );
	
	wxMenuItem* changeCharacterMenuItem;
	changeCharacterMenuItem = new wxMenuItem( networkMenu, ID_CHANGE_CHARACTER, wxString( wxT("キャラクター変更(&C)") ) + wxT('\t') + wxT("F4"), wxT("キャラクターを変更します。"), wxITEM_NORMAL );
	networkMenu->Append( changeCharacterMenuItem );
	changeCharacterMenuItem->Enable( false );
	
	wxMenuItem* ignoreMenuItem;
	ignoreMenuItem = new wxMenuItem( networkMenu, ID_IGNORE, wxString( wxT("無視(&I)") ) + wxT('\t') + wxT("F5"), wxT("選択したユーザーを非表示にします。"), wxITEM_NORMAL );
	networkMenu->Append( ignoreMenuItem );
	ignoreMenuItem->Enable( false );
	
	networkMenu->AppendSeparator();
	
	wxMenuItem* exitMenuItem;
	exitMenuItem = new wxMenuItem( networkMenu, ID_EXIT, wxString( wxT("終了(&X)") ) , wxT("荒巻オンラインを終了します。"), wxITEM_NORMAL );
	networkMenu->Append( exitMenuItem );
	
	menuBar->Append( networkMenu, wxT("ネットワーク(&N)") );
	
	settingMenu = new wxMenu();
	enableSeMenuItem = new wxMenuItem( settingMenu, ID_ENABLE_SE, wxString( wxT("効果音(&S)") ) + wxT('\t') + wxT("F6"), wxT("ログイン・発言・ログアウト時に音を出すようにします。"), wxITEM_CHECK );
	settingMenu->Append( enableSeMenuItem );
	
	topmostMenuItem = new wxMenuItem( settingMenu, ID_TOPMOST, wxString( wxT("最前面表示(&T)") ) + wxT('\t') + wxT("F7"), wxT("ほかのウィンドウに切り替えても常に一番前に表示されるようにします。"), wxITEM_CHECK );
	settingMenu->Append( topmostMenuItem );
	
	menuBar->Append( settingMenu, wxT("設定(&S)") );
	
	helpMenu = new wxMenu();
	wxMenuItem* manualMenuItem;
	manualMenuItem = new wxMenuItem( helpMenu, ID_MANUAL, wxString( wxT("マニュアル(&M)") ) + wxT('\t') + wxT("F1"), wxT("マニュアルを開きます。"), wxITEM_NORMAL );
	helpMenu->Append( manualMenuItem );
	
	menuBar->Append( helpMenu, wxT("ヘルプ(&H)") );
	
	this->SetMenuBar( menuBar );
	
	
	// Connect Events
	messageEdit->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::onKeyDownMessageEdit ), NULL, this );
	sendButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onClickSendButton ), NULL, this );
	this->Connect( loginMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectLoginMenu ) );
	this->Connect( logoutMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectLogoutMenu ) );
	this->Connect( changeCharacterMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectChangeCharacterMenu ) );
	this->Connect( ignoreMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectIgnoreMenu ) );
	this->Connect( exitMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectExitMenu ) );
	this->Connect( enableSeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectEnableSeMenu ) );
	this->Connect( topmostMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectTopmostMenu ) );
	this->Connect( manualMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectManualMenu ) );
}

MainFrameBase::~MainFrameBase()
{
	// Disconnect Events
	messageEdit->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::onKeyDownMessageEdit ), NULL, this );
	sendButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::onClickSendButton ), NULL, this );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectLoginMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectLogoutMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectChangeCharacterMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectIgnoreMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectExitMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectEnableSeMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectTopmostMenu ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::onSelectManualMenu ) );
}
