-
Notifications
You must be signed in to change notification settings - Fork 12
/
LanguageDlg.cpp
77 lines (63 loc) · 1.75 KB
/
LanguageDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// ランゲージダイアログクラス
//
//
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <string>
using namespace std;
#include "VirtuaNESres.h"
#include "DebugOut.h"
#include "App.h"
#include "Pathlib.h"
#include "Plugin.h"
#include "Wnd.h"
#include "LanguageDlg.h"
DLG_MESSAGE_BEGIN(CLanguageDlg)
// メッセージ
DLG_ON_MESSAGE( WM_INITDIALOG, OnInitDialog )
// コマンド
DLG_COMMAND_BEGIN()
DLG_ON_COMMAND( IDOK, OnOK )
DLG_ON_COMMAND( IDCANCEL, OnCancel )
DLG_ON_COMMAND( IDDEFAULT, OnDefault )
DLG_COMMAND_END()
DLG_MESSAGE_END()
INT CLanguageDlg::DoModal( HWND hWndParent )
{
return ::DialogBoxParam( CApp::GetPlugin(), MAKEINTRESOURCE(IDD_CFG_LANGUAGE),
hWndParent, g_DlgProc, (LPARAM)this );
}
DLGMSG CLanguageDlg::OnInitDialog( DLGMSGPARAM )
{
// DEBUGOUT( "CLanguageDlg::OnInitDialog\n" );
m_nPluginID = CPlugin::GetPluginID();
for( INT i = 0; i < CPlugin::GetPluginNum(); i++ ) {
::SendDlgItemMessage( m_hWnd, IDC_LNG_LIST, LB_INSERTSTRING, (WPARAM)i, (LPARAM)CPlugin::GetPluginLanguage(i) );
}
// デフォルト選択
::SendDlgItemMessage( m_hWnd, IDC_LNG_LIST, LB_SETCURSEL, (WPARAM)m_nPluginID, 0 );
return TRUE;
}
DLGCMD CLanguageDlg::OnOK( DLGCMDPARAM )
{
// DEBUGOUT( "CLanguageDlg::OnOK\n" );
INT nID = ::SendDlgItemMessage( m_hWnd, IDC_LNG_LIST, LB_GETCURSEL, 0, 0 );
if( m_nPluginID != nID ) {
CPlugin::SetPluginID( nID );
::EndDialog( m_hWnd, IDOK );
} else {
::EndDialog( m_hWnd, IDCANCEL );
}
}
DLGCMD CLanguageDlg::OnCancel( DLGCMDPARAM )
{
// DEBUGOUT( "CLanguageDlg::OnCancel\n" );
::EndDialog( m_hWnd, IDCANCEL );
}
DLGCMD CLanguageDlg::OnDefault( DLGCMDPARAM )
{
// DEBUGOUT( "CLanguageDlg::OnDefault\n" );
// デフォルト選択
SendDlgItemMessage( m_hWnd, IDC_LNG_LIST, LB_SETCURSEL, (WPARAM)CPlugin::GetPluginID(), 0 );
}