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

📄 cwind.hpp

📁 一个在unix下用curses实现的菜单程序
💻 HPP
字号:
#ifndef CWIND
#include <curses.h>
#include <vector>
using namespace std;
using std::vector;

#define CWIND
#define ESC 27   
#define ENT 13   
#define REFRESH 12   
#define MAX_M 10 /* 菜单最大层数 */  
typedef struct _MENUID
{
	char 	MenuName[24];	/*菜单名*/
	short 	Type;			/*菜单风格*/
	short 	Color;		/*菜单字体颜色*/
	int 	item;
	class CMenu *lpMenu;
}*PMENUID,MENUID;
typedef struct _MAINMENU
{
	char MenuName[24];
	short Color;
	class CMenu *lpMenu;
	int x;
	int y;
	int 	item;
	int Witch;
}*PMAINMENU,MAINMENU;
#define TYPE_KEY  0x00000000
#define TYPE_MENU 0x00000001
class CWind
{
public:
	CWind();
	virtual ~CWind();
	int CreateWindow(char x=0,char y=0,char High=0,char Witch=0);
	int Print(char x,char y,char *Farmat,...);
	int ScrollYOut(char *Farmat,...);
	virtual int OnInitialize(){return 0;};
	virtual int OnCreate(){return 0;};
	virtual int Run();
	virtual int OnWindow(void *lp,int type);
	int SetColor(int CurrColor,int BackColor);
	int EndColor(int CurrColor);
	int GetMaxX();
	int GetMaxY();
	int ClearWindows();
	int Printf(int x,int y,char *Farmat,...);
private:
protected:
	int Color;
	WINDOW *win;
	char y;
};
class CMenu :public CWind
{
public: 
	CMenu();
	int ShowMenu();
	int CreateMenu(int x=0,int y=0,int Witch=0,int Height=0);
	int CreateItem(int type,char MenuName[20],int ID,CMenu *pSubMenu);
	int ScrollY(int y);
	int ShowWindow(int x,int y);
	int UpDateMenu();
private:
	vector<MENUID> Menu;
};
class MainMenu:public CWind
{
public:
	MainMenu();
	int CreateMenu(char *MenuName,int ID,CMenu *pSubMenu);
	int ShowWindow();
private:
	int CurrXY;
	vector<MAINMENU> Menu;
};
#endif

⌨️ 快捷键说明

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