diff src/win32/LangSelect.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/LangSelect.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,75 @@
     1.4 +// LangSelect.cpp : implementation file
     1.5 +//
     1.6 +
     1.7 +#include "stdafx.h"
     1.8 +#include "resource.h"
     1.9 +#include "LangSelect.h"
    1.10 +#include "VBA.h"
    1.11 +
    1.12 +/////////////////////////////////////////////////////////////////////////////
    1.13 +// LangSelect dialog
    1.14 +
    1.15 +LangSelect::LangSelect(CWnd*pParent /*=NULL*/)
    1.16 +	: CDialog(LangSelect::IDD, pParent)
    1.17 +{
    1.18 +	//{{AFX_DATA_INIT(LangSelect)
    1.19 +	// NOTE: the ClassWizard will add member initialization here
    1.20 +	//}}AFX_DATA_INIT
    1.21 +}
    1.22 +
    1.23 +void LangSelect::DoDataExchange(CDataExchange*pDX)
    1.24 +{
    1.25 +	CDialog::DoDataExchange(pDX);
    1.26 +	//{{AFX_DATA_MAP(LangSelect)
    1.27 +	DDX_Control(pDX, IDC_LANG_STRING, m_langString);
    1.28 +	DDX_Control(pDX, IDC_LANG_NAME, m_langName);
    1.29 +	//}}AFX_DATA_MAP
    1.30 +}
    1.31 +
    1.32 +BEGIN_MESSAGE_MAP(LangSelect, CDialog)
    1.33 +//{{AFX_MSG_MAP(LangSelect)
    1.34 +ON_BN_CLICKED(ID_CANCEL, OnCancel)
    1.35 +ON_BN_CLICKED(ID_OK, OnOk)
    1.36 +//}}AFX_MSG_MAP
    1.37 +END_MESSAGE_MAP()
    1.38 +
    1.39 +/////////////////////////////////////////////////////////////////////////////
    1.40 +// LangSelect message handlers
    1.41 +
    1.42 +void LangSelect::OnCancel()
    1.43 +{
    1.44 +	EndDialog(FALSE);
    1.45 +}
    1.46 +
    1.47 +void LangSelect::OnOk()
    1.48 +{
    1.49 +	m_langString.GetWindowText(theApp.languageName);
    1.50 +	EndDialog(TRUE);
    1.51 +}
    1.52 +
    1.53 +BOOL LangSelect::OnInitDialog()
    1.54 +{
    1.55 +	CDialog::OnInitDialog();
    1.56 +
    1.57 +	char lbuffer[10];
    1.58 +	if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME,
    1.59 +	                  lbuffer, 10))
    1.60 +	{
    1.61 +		m_langName.SetWindowText(lbuffer);
    1.62 +	}
    1.63 +	else
    1.64 +	{
    1.65 +		m_langName.SetWindowText("???");
    1.66 +	}
    1.67 +
    1.68 +	if (!theApp.languageName.IsEmpty())
    1.69 +		m_langString.SetWindowText(theApp.languageName);
    1.70 +
    1.71 +	m_langString.LimitText(3);
    1.72 +
    1.73 +	CenterWindow();
    1.74 +
    1.75 +	return TRUE; // return TRUE unless you set the focus to a control
    1.76 +	             // EXCEPTION: OCX Property Pages should return FALSE
    1.77 +}
    1.78 +