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

📄 q_form.cpp

📁 QCurses全部代码 QCurses全部代码
💻 CPP
字号:
#include  "./qcurses/Q_Form.hpp"/*######################################### 函数功能:构造函数                     ## 返 回 值:NULL                         ## 函数参数:int      vHeight    高度     ##           int      vWidth     宽度     ##           int      vYBegin    起始     ##           int      vXBegin    起始     ##           int      vCFront    文字颜色 ##           int      vCBack     背景色   #########################################*/Q_Form::Q_Form(int  vHeight,int  vWidth,int  vYBegin,int  vXBegin,int  vCFront,int  vCBack):Q_Event(){	_MainWinHandle = newwin(vHeight,vWidth,vYBegin,vXBegin);	_ObjHandle = new Q_Object(_MainWinHandle,  vHeight,  vWidth,  0,  0,   true,  vCFront,  vCBack);	_Caption = new char[80];	ObjNumber = 0;	BreakKey = 0;}//------------------------------------------------------------------------------------------/*######################################### 函数功能:析构函数                     ## 返 回 值:NULL                         ## 函数参数:NULL                         #########################################*/Q_Form::~Q_Form(){	delete [] _Caption;	delete _ObjHandle;	delwin(_MainWinHandle);}//------------------------------------------------------------------------------------------/*######################################### 函数功能:设置标题                     ## 返 回 值:NULL                         ## 函数参数:标题                         #########################################*/void     Q_Form::SetCaption(char  *Caption,int  vCFront,int  vCBack){	if (strlen(Caption)>=80)		Caption[79]='\0';	strcpy(_Caption,Caption);	_ObjHandle->SetCaption(_Caption, vCFront, vCBack);}//------------------------------------------------------------------------------------------/*######################################### 函数功能:激活FORM                     ## 返 回 值:NULL                         ## 函数参数:NULL                         #########################################*/void     Q_Form::Show(){	int i=0,NowKey=0;	while (BreakKey==0)	{		_ObjHandle->Refresh();		if (i>=ObjNumber)			i=0;		if (i<0)			i=ObjNumber-1;		if (!ObjList[i]->TabStop)		{			if (NowKey == KEY_UP || NowKey == KEY_LEFT)				i--;			else				i++;			continue;		}		NowKey = ObjList[i]->Action(this);		if (NowKey == KEY_UP || NowKey == KEY_LEFT)			i--;		else			i++;	}}//------------------------------------------------------------------------------------------/*######################################### 函数功能:隐藏FORM                     ## 返 回 值:NULL                         ## 函数参数:NULL                         #########################################*/void     Q_Form::Hide(){}//------------------------------------------------------------------------------------------/*######################################### 函数功能:关闭FORM                     ## 返 回 值:NULL                         ## 函数参数:NULL                         #########################################*/void     Q_Form::Close(){	BreakKey = 1;}//------------------------------------------------------------------------------------------/*######################################### 函数功能:添加控件                     ## 返 回 值:是否成功                     ## 函数参数:控件指针                     #########################################*/bool     Q_Form::AddObj(Q_Object *vObject){	if (ObjNumber>=MAX_OBJECT)		return false;	ObjList[ObjNumber] = vObject;	ObjNumber++;}//------------------------------------------------------------------------------------------/*######################################### 函数功能:添加一个菜单到FORM           ## 返 回 值:菜单指针                     ## 函数参数:标题                         #########################################*/bool     Q_Form::AddMenu(int  vCFront,int  vCBack){	MainMenu = new Q_Menu(_MainWinHandle,_MainWinHandle->_maxx-2,1,1,false,vCFront,vCBack);	if (!MainMenu)		return false;	for (int i=0;i<ObjNumber;i++)		ObjList[i+1] = ObjList[i];	ObjList[0] = MainMenu;	MainMenu->SetSpace(2);	_ObjHandle->xBorder(1);	_ObjHandle->xBorder(3);	ObjNumber++;	return true;}

⌨️ 快捷键说明

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