newdialog.cpp

来自「EVC4.0开发的国际象棋的元代码」· C++ 代码 · 共 66 行

CPP
66
字号
/****************************************************
Author: S. Senthil kumar
File: NewDialog.cpp
Purpose:    For showing and using New Dialog box

******************************************************/

#include "Global.h"
#include "NewDialog.h"

extern int search_depth;


NewDialog::NewDialog(int n):CDialog(n)
	{
	}
int NewDialog::GetSelectedColor()
	{
		//Return computer color
		return (color==IDC_RADIO3?WHITE:BLACK);
	}
int NewDialog::OnInitDialog()
{
	//Set default parameters
	int buttonid;
	if (search_depth==2) buttonid=IDC_RADIO5;
	else if(search_depth==4) buttonid=IDC_RADIO6;
	else if(search_depth==5) buttonid=IDC_RADIO7;
	else if(search_depth==7) buttonid=IDC_RADIO8;
	
	CButton *defbutton=(CButton *)GetDlgItem(buttonid);
	defbutton->SetCheck(TRUE);
	defbutton=(CButton *)GetDlgItem(IDC_RADIO3);
	defbutton->SetCheck(TRUE);
	
	return CDialog::OnInitDialog();
}

int NewDialog::GetSelectedLevel()
	{
		switch(level)
		{
		case IDC_RADIO5:
			return (2);
		case IDC_RADIO6:
			return (4);
		case IDC_RADIO7:
			return (5);
		case IDC_RADIO8:
			return (7);
		}
		return(0);
	}
void NewDialog::Ok()
	{
		color=GetCheckedRadioButton(IDC_RADIO3,IDC_RADIO4);	
		level=GetCheckedRadioButton(IDC_RADIO5,IDC_RADIO8);	
		CDialog::OnOK();
	}
	

BEGIN_MESSAGE_MAP(NewDialog,CDialog)
ON_COMMAND(IDOK,Ok)
END_MESSAGE_MAP()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?