// ObjectiveProps.cpp : implementation file
//

#include "stdafx.h"
#include "mw4gameed2.h"
#include "ObjectiveProps.h"
#include "EdObjective.h"


/////////////////////////////////////////////////////////////////////////////
// CObjectiveProps dialog


CObjectiveProps::CObjectiveProps(EdObjective *obj,CWnd* pParent /*=NULL*/)
	: CDialog(CObjectiveProps::IDD, pParent)
{
	MyObj=obj;
	//{{AFX_DATA_INIT(CObjectiveProps)
	m_Description = _T("");
	m_Failed = _T("");
	m_HelpMessage = FALSE;
	m_InComplete = _T("");
	m_Primary = FALSE;
	m_Success = _T("");
	m_Visible = FALSE;
	m_ObjName = _T("");
	m_ComLevel = -1;
	//}}AFX_DATA_INIT
}


void CObjectiveProps::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CObjectiveProps)
	DDX_Text(pDX, IDC_DESCRIPTION, m_Description);
	DDX_Text(pDX, IDC_FAILED, m_Failed);
	DDX_Check(pDX, IDC_HELPMESSAGE, m_HelpMessage);
	DDX_Text(pDX, IDC_INCOMPLETE, m_InComplete);
	DDX_Check(pDX, IDC_PRIMARY, m_Primary);
	DDX_Text(pDX, IDC_SUCCESS, m_Success);
	DDX_Check(pDX, IDC_VISIBLE, m_Visible);
	DDX_Text(pDX, IDC_OBJNAME, m_ObjName);
	DDX_CBIndex(pDX, IDC_COMLEVEL, m_ComLevel);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CObjectiveProps, CDialog)
	//{{AFX_MSG_MAP(CObjectiveProps)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CObjectiveProps message handlers

BOOL CObjectiveProps::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_Description = MyObj->GetDescriptionText();
	m_Failed = MyObj->GetFailText();
	m_Success = MyObj->GetSuccessText();
	m_InComplete = MyObj->GetNeutralText();

	m_Visible = MyObj->GetVisible();
	m_HelpMessage = MyObj->GetHelpMessage();
	m_Primary = MyObj->GetPrimary();

	m_ComLevel = MyObj->GetComLevel();

	m_ObjName = MyObj->GetName();

UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CObjectiveProps::OnOK() 
{
UpdateData(TRUE);
MyObj->SetDescriptionText(m_Description);
MyObj->SetFailText(m_Failed);
MyObj->SetSuccessText(m_Success);
MyObj->SetNeutralText(m_InComplete);

MyObj->SetVisible(m_Visible?true:false);
MyObj->SetHelpMessage(m_HelpMessage?true:false);
MyObj->SetPrimary(m_Primary?true:false);
MyObj->SetComLevel(m_ComLevel);

MyObj->SetName(m_ObjName);

	CDialog::OnOK();
}
