Скачиваний:
9
Добавлен:
01.05.2014
Размер:
1.97 Кб
Скачать
// SetDialog.cpp : implementation file
//

#include "stdafx.h"
#include "lab22.h"
#include "SetDialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// SetDialog dialog


SetDialog::SetDialog(CWnd* pParent /*=NULL*/)
	: CDialog(SetDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(SetDialog)
	m_cnt = 0;
	m_name = _T("");
	m_num = 0;
	m_pos = 0;
	m_x = 0;
	m_y = 0;
	//}}AFX_DATA_INIT
	index=0;
}


void SetDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(SetDialog)
	DDX_Text(pDX, IDC_CNT, m_cnt);
	DDX_Text(pDX, IDC_NAME, m_name);
	DDX_Text(pDX, IDC_NUM, m_num);
	DDX_Text(pDX, IDC_POS, m_pos);
	DDX_Text(pDX, IDC_X, m_x);
	DDX_Text(pDX, IDC_Y, m_y);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(SetDialog, CDialog)
	//{{AFX_MSG_MAP(SetDialog)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// SetDialog message handlers

void SetDialog::OnButton1() 
{
	// TODO: Add your control notification handler code here
	if (index>0)
	{
		index--;
		ArSetIterator<Shape*> it(set);

		for (int i=0;i<index;i++)
		{it.next();}

		m_num=index+1;
		m_name=it.currentItem()->getName();
		m_x=it.currentItem()->getX();
		m_y=it.currentItem()->getY();
		m_pos=it.currentPos();

		UpdateData(false);
	}	
}

void SetDialog::OnButton2() 
{
	// TODO: Add your control notification handler code here
	if (index<m_cnt-1)
	{
		index++;
		ArSetIterator<Shape*> it(set);

		for (int i=0;i<index;i++)
		{it.next();}

		m_num=index+1;
		m_name=it.currentItem()->getName();
		m_x=it.currentItem()->getX();
		m_y=it.currentItem()->getY();
		m_pos=it.currentPos();

		UpdateData(false);
	}	
}

Соседние файлы в папке lab22