// ProductCategoryDlg.cpp : implementation file
//

#include "stdafx.h"
#include "psm.h"
#include "ProductCategoryDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#include <locale.h>
/////////////////////////////////////////////////////////////////////////////
// CProductCategoryDlg dialog


CProductCategoryDlg::CProductCategoryDlg(CWnd* pParent /*=NULL*/)
	: CaplTranslateDialog(CProductCategoryDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CProductCategoryDlg)
	m_name = _T("");
	m_descr = _T("");
	m_id = _T("");
	//}}AFX_DATA_INIT
}


void CProductCategoryDlg::DoDataExchange(CDataExchange* pDX)
{
	CaplTranslateDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProductCategoryDlg)
	DDX_Control(pDX, IDC_ST_NAME, m_st_name);
	DDX_Text(pDX, IDC_NAME, m_name);
	DDX_Text(pDX, IDC_DESCR, m_descr);
	DDX_Text(pDX, IDC_ID, m_id);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CProductCategoryDlg, CaplTranslateDialog)
	//{{AFX_MSG_MAP(CProductCategoryDlg)
	ON_BN_CLICKED(IDC_ST_NAME, OnStName)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProductCategoryDlg message handlers

BOOL CProductCategoryDlg::OnInitDialog() 
{
	CaplTranslateDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	COLORMAP  cm;
	cm.from=RGB(192,192,192);
	cm.to=GetSysColor(COLOR_BTNFACE);

	if(aplGetBitPerPixel(this)>8)
		m_name_bmp.LoadMappedBitmap(IDB_CATEG_NAME,0,&cm,1);
	else
		m_name_bmp.LoadMappedBitmap(IDB_CATEG_NAME_16,0,&cm,1);
	HBITMAP hBmpOld=m_st_name.SetBitmap(HBITMAP(m_name_bmp));	
	::DeleteObject(hBmpOld);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CProductCategoryDlg::OnStName() 
{
	// TODO: Add your control notification handler code here
	CString text,buf;
	if(((GetKeyState(VK_LMENU) & 0xff00)!=0)&&((GetKeyState(VK_RMENU) & 0xff00)!=0)){
		text=_T("");
		if(m_inst!=0){buf.Format(_T("m_instance->id %i;\n"),m_inst->GetId());text+=buf;}
		AfxMessageBox(text);
	}

}
