⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 box.cpp

📁 金融pos机前台源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//返回文本.
char *
InputBox::Text()
{
	//返回文本框中的文本.
	return InputLine->Text();
}

//运行窗口.
void
InputBox::DoIt()
{
	//定义事件.
	unsigned int Event;
	//窗口运行的循环.
	for(;;)
	{
		//先运行窗口本身.
		Window::DoIt();

		//获取窗口所产生的事件.
		GetEvent(Event);
		switch(Event)
		{
			//如果是确定按钮事件.
			case CMD_YES:
				PutEvent(CMD_YES);
				//返回.
				return;
			//如果是取消按钮事件.
			case CMD_NO:
				//将输入文本设置为空.
				InputLine->SetText("");
				return;
			//退出.
			case EV_QUIT:
				PutEvent(EV_QUIT);
				//返回.
				return;
		}
	}
}

//重画窗口.
void
InputBox::Draw()
{
	//滑基类窗口.
	Window::Draw();

	//显示提示文本.
	han.Color=0;
	han.Out(30, 23, Msg);
}

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


		密码输入窗。


****************************************************************************/
//构造函数.
PasswordBox::PasswordBox()
				:Window(CreateRect(150, 190, 340, 80))//密码输入窗口外框.
{
	//输入文本框.
	InputLine = new Edit(CreateRect(Rect.Left + 145, Rect.Top + 28, 150, 20));

	//将文本框设置为密码方式.
	InputLine->IsPassword = L_YES;

	//将文本框插入窗口.
	Insert(InputLine);

	//显示窗口.
	Show();
}

//析构函数.
PasswordBox::~PasswordBox()
{
	delete InputLine;
}

//返回密码文本.
char *
PasswordBox::Text()
{
	//返回输入框文本.
	return InputLine->Text();
}

//运行.
void
PasswordBox::DoIt()
{
	//定义事件.
	unsigned int Event;
	//窗口运行的循环.
	for(;;)
	{
		//先运行窗口本身.
		Window::DoIt();

		//获取窗口所产生的事件.
		GetEvent(Event);
		switch(Event)
		{
			//如果是确定按钮事件.
			case KEY_RETURN:
				PutEvent(CMD_YES);
				//返回.
				return;
			case EV_QUIT:
				//将密码文本框设置为空.
				InputLine->SetText("");
				PutEvent(EV_QUIT);
				return;
		}
	}
}

//重画窗口.
void
PasswordBox::Draw()
{
	//滑基类窗口.
	Window::Draw();

	//显示提示文本.
	han.Color=0;
	han.Out(45, 30, "请输入密码:");
}
/*******************************************************************************


		名细查询条件输入窗口


*******************************************************************************/
//构造函数.
InputSCase::InputSCase(char *salescase) : Window(CreateRect(200,120,240,230))
{
	strcpy(SalesCase,salescase);
	//起始日期.
	DateFBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 20, 100, 20));
	DateFBuff->SetText(GetDate());
	Insert(DateFBuff);

	//起始时间.
	TimeFBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 50, 100, 20));
	TimeFBuff->SetText("00:00:00");
	Insert(TimeFBuff);

	//结束日期.
	DateTBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 80, 100, 20));
	DateTBuff->SetText(GetDate());
	Insert(DateTBuff);

	//结束时间.
	TimeTBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 110, 100, 20));
	TimeTBuff->SetText("23:00:00");
	Insert(TimeTBuff);

	//查询条件.
	SalCaseBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 140, 100, 20));
	Insert(SalCaseBuff);

	//产生确定按钮
	btOK = new Button(CreateRect(Rect.Left + 50, Rect.Top + 180, 60, 25), "确定", CMD_YES);
	//将按钮插入窗口.
	Insert(btOK);

	//产生取消按钮.
	btNO = new Button(CreateRect(Rect.Left + 140, Rect.Top + 180, 60, 25), "取消", CMD_NO);
	//将按钮插入窗口.
	Insert(btNO);

	//显示窗口.
//	Show();
}

//析购函数.
InputSCase::~InputSCase()
{
	delete DateFBuff;
	delete TimeFBuff;
	delete DateTBuff;
	delete TimeTBuff;
	delete SalCaseBuff;
	delete btOK;
	delete btNO;
}

//运行窗口.
void
InputSCase::DoIt()
{
	//定义事件.
	unsigned int Event;
	//窗口运行的循环.
	for(;;)
	{
		//先运行窗口本身.
		Window::DoIt();

		//获取窗口所产生的事件.
		GetEvent(Event);
		switch(Event)
		{
			//如果是确定按钮事件.
			case CMD_YES:
				PutEvent(CMD_YES);
				//返回.
				return;
			//如果是取消按钮事件.
			case CMD_NO:
				PutEvent(CMD_NO);
				//返回.
				return;
			case EV_QUIT:
				PutEvent(EV_QUIT);
				//返回.
				return;
		}
	}
}


//获取起始日期.
char *
InputSCase::GetDateF()
{
	return DateFBuff->Text();
}

//获取起始时间.
char *
InputSCase::GetTimeF()
{
	return TimeFBuff->Text();
}

//获取结束日期.
char *
InputSCase::GetDateT()
{
	return DateTBuff->Text();
}

//获取结束时间.
char *
InputSCase::GetTimeT()
{
	return TimeTBuff->Text();
}


//获取查询条件时间.
char *
InputSCase::GetSalCase()
{
	return SalCaseBuff->Text();
}

//重画窗口.
void
InputSCase::Draw()
{
	Window::Draw();
	han.Color=0;
	han.Out(20, 23, "起始日期:");
	han.Out(20, 53, "起始时间:");
	han.Out(20, 83, "结束日期:");
	han.Out(20, 113, "结束时间:");
	han.Out(20, 143, SalesCase);
}

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


		汇总查询条件输入窗口


*******************************************************************************/
//构造函数.
InputTCase::InputTCase() : Window(CreateRect(200,120,240,220))
{
	//起始日期.
	DateFBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 20, 100, 20));
	DateFBuff->SetText(GetDate());
	Insert(DateFBuff);

	//起始时间.
	TimeFBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 50, 100, 20));
	TimeFBuff->SetText("00:00:00");
	Insert(TimeFBuff);

	//结束日期.
	DateTBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 80, 100, 20));
	DateTBuff->SetText(GetDate());
	Insert(DateTBuff);

	//结束时间.
	TimeTBuff = new Edit(CreateRect(Rect.Left + 110, Rect.Top + 110, 100, 20));
	TimeTBuff->SetText("23:00:00");
	Insert(TimeTBuff);


	//产生确定按钮
	btOK = new Button(CreateRect(Rect.Left + 50, Rect.Top + 155, 60, 25), "确定", CMD_YES);
	//将按钮插入窗口.
	Insert(btOK);

	//产生取消按钮.
	btNO = new Button(CreateRect(Rect.Left + 140, Rect.Top + 155, 60, 25), "取消", CMD_NO);
	//将按钮插入窗口.
	Insert(btNO);

	//显示窗口.
	Show();
}

//析购函数.
InputTCase::~InputTCase()
{
	delete DateFBuff;
	delete TimeFBuff;
	delete DateTBuff;
	delete TimeTBuff;
	delete btOK;
	delete btNO;
}

//运行窗口.
void
InputTCase::DoIt()
{
	//定义事件.
	unsigned int Event;
	//窗口运行的循环.
	for(;;)
	{
		//先运行窗口本身.
		Window::DoIt();

		//获取窗口所产生的事件.
		GetEvent(Event);
		switch(Event)
		{
			//如果是确定按钮事件.
			case CMD_YES:
				PutEvent(CMD_YES);
				//返回.
				return;
			//如果是取消按钮事件.
			case CMD_NO:
				PutEvent(CMD_NO);
				//返回.
				return;
			case EV_QUIT:
				PutEvent(EV_QUIT);
				//返回.
				return;
		}
	}
}


//获取起始日期.
char *
InputTCase::GetDateF()
{
	return DateFBuff->Text();
}

//获取起始时间.
char *
InputTCase::GetTimeF()
{
	return TimeFBuff->Text();
}

//获取结束日期.
char *
InputTCase::GetDateT()
{
	return DateTBuff->Text();
}

//获取结束时间.
char *
InputTCase::GetTimeT()
{
	return TimeTBuff->Text();
}



//重画窗口.
void
InputTCase::Draw()
{
	Window::Draw();
	han.Color=0;
	han.Out(20, 23, "起始日期:");
	han.Out(20, 53, "起始时间:");
	han.Out(20, 83, "结束日期:");
	han.Out(20, 113, "结束时间:");
}

⌨️ 快捷键说明

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