summaryrefslogtreecommitdiffstats
path: root/Examples/WhisperDesktop/Utils/TranslateCheckbox.cpp
blob: c5e6ac04f17c8304a6efa381b3fd7ef5106a8e9b (plain)
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
#include "stdafx.h"
#include "TranslateCheckbox.h"

static const LPCTSTR regValTranslate = L"translate";

void TranslateCheckbox::initialize( HWND owner, int idc, AppState& state )
{
	m_hWnd = GetDlgItem( owner, idc );
	assert( nullptr != m_hWnd );

	if( state.dwordLoad( regValTranslate, 0 ) != 0 )
		::SendMessage( m_hWnd, BM_SETCHECK, BST_CHECKED, 0L );
}

bool TranslateCheckbox::checked()
{
	assert( nullptr != m_hWnd );
	const int state = ( int )::SendMessage( m_hWnd, BM_GETCHECK, 0, 0 );
	return state == BST_CHECKED;
}

void TranslateCheckbox::saveSelection( AppState& state )
{
	state.dwordStore( regValTranslate, checked() ? TRUE : FALSE );
}