// ActivitySubInfoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "AG_MDA.h"
#include "ActivitySubInfoDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// ActivitySubInfoDlg dialog


ActivitySubInfoDlg::ActivitySubInfoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(ActivitySubInfoDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(ActivitySubInfoDlg)
	m_Name = _T("");
	//}}AFX_DATA_INIT
	pClass = NULL;
	pSubActivity = NULL;
}


void ActivitySubInfoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ActivitySubInfoDlg)
	DDX_Control(pDX, IDC_COMBO_SUB, m_SubCombo);
	DDX_Text(pDX, IDC_EDIT_NAME, m_Name);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// ActivitySubInfoDlg message handlers

void ActivitySubInfoDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if( m_SubCombo.GetCurSel() >= 0 )
	{
		pSubActivity = pClass->m_ActivityGraphs.GetAt( m_SubCombo.GetCurSel() );
	}
	CDialog::OnOK();
}

BOOL ActivitySubInfoDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if( pClass )
	{
		int sel = -1;
		for( int i = 0 ; i <= pClass->m_ActivityGraphs.GetUpperBound() ; i ++ )
		{
			UMLActivityGraph *p = pClass->m_ActivityGraphs.GetAt( i );
			m_SubCombo.InsertString( i  , p->name );
			if( p == pSubActivity ){
				sel = i ;
			}
		}
		m_SubCombo.SetCurSel( sel );
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
