// BtnSwitchBar.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "dynamicdraw.h"
#include "BtnSwitchBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFCBtnSwitchBar

CFCBtnSwitchBar::CFCBtnSwitchBar()
{
}

CFCBtnSwitchBar::~CFCBtnSwitchBar()
{
}


BEGIN_MESSAGE_MAP(CFCBtnSwitchBar, BASE_CLASS)
	//{{AFX_MSG_MAP(CFCBtnSwitchBar)
		// _xZkqqHx_iDiBiDiC_xHqqkZx_ - ClassWizard _xZkqqHx_iCmNiClBiCmMiImKjChFiCmJiDhNiDgCiDhDiDjDiDePjHhAiCmMiDhNiDeOiDiNiCpAjCmHiJmBiCnMiClNiCmNiNoNiPjMiClFiCnMiClHiBeC_xHqqkZx_
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFCBtnSwitchBar _xZkqqHx_iDiBiDgCiDfKiBfLiDfH_xHqqkZx_ _xZkqqHx_iDgOiDjDiDgIiDiJ_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCBtnSwitchBar::DrawItem
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhLiDfOiDjDiCmMjFfMiOkGiCpAjFgAiJoGiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.01.20 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCBtnSwitchBar::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	COLORREF colShadow;
	COLORREF colLight;
	if (lpDrawItemStruct->itemState & ODS_SELECTED)
	//----- _xZkqqHx_iDhLiDfOiDjDiCpAiJjPiClFiClNiPpDjBnEiCmMiPoKiNiH_xHqqkZx_ -----
	{
		colShadow = ::GetSysColor(COLOR_3DHILIGHT);
		colLight = ::GetSysColor(COLOR_3DSHADOW);
	} else
	//----- _xZkqqHx_iDhLiDfOiDjDiCpAjHkDiClFiClNiPpDjBnEiCmMiPoKiNiH_xHqqkZx_ -----
	{
		colShadow = ::GetSysColor(COLOR_3DSHADOW);
		colLight = ::GetSysColor(COLOR_3DHILIGHT);
	}
	CPen penShadow(PS_SOLID, 1, colShadow);
	CPen penLight(PS_SOLID, 1, colLight);

	CRect rtClient;
	GetClientRect(rtClient);

	long lCenterY = (rtClient.top + rtClient.bottom) / 2;
	CRect rtBox0(rtClient.left + 5, lCenterY - 4, rtClient.right - 5, lCenterY - 1);
	CRect rtBox1(rtClient.left + 5, lCenterY + 1, rtClient.right - 5, lCenterY + 4);

 	CDC dc;
 	dc.Attach(lpDrawItemStruct->hDC);

	CPen* penOld = dc.SelectObject(&penShadow);
	dc.MoveTo(rtBox0.right, rtBox0.top);
	dc.LineTo(rtBox0.right, rtBox0.bottom);
	dc.LineTo(rtBox0.left, rtBox0.bottom);

	dc.MoveTo(rtBox1.right, rtBox1.top);
	dc.LineTo(rtBox1.right, rtBox1.bottom);
	dc.LineTo(rtBox1.left, rtBox1.bottom);

	dc.SelectObject(&penLight);
	dc.MoveTo(rtBox0.left, rtBox0.bottom);
	dc.LineTo(rtBox0.left, rtBox0.top);
	dc.LineTo(rtBox0.right, rtBox0.top);

	dc.MoveTo(rtBox1.left, rtBox1.bottom);
	dc.LineTo(rtBox1.left, rtBox1.top);
	dc.LineTo(rtBox1.right, rtBox1.top);

	dc.SelectObject(penOld);
	// _xZkqqHx_jFeLiClIiNmFiMoDiCmJ_xHqqkZx_Detach_xZkqqHx_iCpAiMmEiCpBiCmF_xHqqkZx_HDC_xZkqqHx_iCpAiJpAjFpKiClHiCoJiClBiCmGiBeC_xHqqkZx_
	// _xZkqqHx_iClBiCoKiCpAiClFiCmIiCkCiCmGiBeB_xHqqkZx_dc_xZkqqHx_iCmGiIoKiPiPiCmJ_xHqqkZx_HDC_xZkqqHx_iCkKiNoNiPjMiClDiCoKiCmEiClFiCnMiCkEiBeC_xHqqkZx_
 	dc.Detach();
} // CFCBtnSwitchBar::DrawItem.
