// EDACGrBt.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"

#include "EDACGrBt.hpp"

#include "_AInterf.hpp"

//External Modules
#include "CTL.h"
#include "IncTUT.h"
//End of External Modules

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

#define C_ED_ACTORS_GROUP_BUTTON_HEIGHT	23

/////////////////////////////////////////////////////////////////////////////
// EdActors_MSGroupButton

BEGIN_MESSAGE_MAP(EdActors_MSGroupButton, CButton)
	//{{AFX_MSG_MAP(EdActors_MSGroupButton)
	ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

//****************************************************************************
EdActors_MSGroupButton::EdActors_MSGroupButton(	unsigned char ucListIndex,
																								CString csText,
																								short wXPos,
																								short wYPos,
																								short wWidth,
																								CWnd *pclParentWnd)
{
	m_ucListIndex = ucListIndex;

	CRect crGroupButtonRect;
	crGroupButtonRect.left = wXPos;
	crGroupButtonRect.right = wXPos + wWidth;
	crGroupButtonRect.top = wYPos;
	crGroupButtonRect.bottom = wYPos + C_ED_ACTORS_GROUP_BUTTON_HEIGHT;

	//Creates Button
	Create(	csText,
					WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | BS_PUSHLIKE,
					crGroupButtonRect,
					pclParentWnd,
					CTL_fn_lGetNextAvailableIDForControl());

	SetFont(pclParentWnd->GetFont());

	//Registers in TUT Module
	TUT_M_vGetTutDll();
	
	TUT_M_vRegisterControl(m_hWnd, "OAc - Group Button - " + csText, TUT_e_Button);
	//End of Registers in TUT Module
}

//****************************************************************************
EdActors_MSGroupButton::~EdActors_MSGroupButton()
{
	//Un-Registers in TUT Module
	TUT_M_vGetTutDll();
	
	TUT_M_vUnregisterControl(m_hWnd);
	//End of Un-Registers in TUT Module
}

/////////////////////////////////////////////////////////////////////////////
// EdActors_MSGroupButton message handlers

//****************************************************************************
unsigned char EdActors_MSGroupButton::m_fn_ucGetListIndex()
{
	return m_ucListIndex;
}

//****************************************************************************
void EdActors_MSGroupButton::OnClicked() 
{
	g_pclInterface->m_clDocument.m_fn_vSetCurrentList(m_ucListIndex);
}
