📄 basewin.c
字号:
#include "basewin.h"int BaseWindow::InitBaseWindow(int Y,int X,int Height,int Width,int Color,int Shadow,int FontStyle,int WinType,char *Title){ basewin=newwin(Height,Width,Y,X); if (basewin==NULL) { return FALSE; } color=Color; fontstyle=FontStyle; SetPosition(Y,X,Height,Width); // set window's position SET_STYLE(basewin,fontstyle); // set window's fontstyle SET_STYLE(basewin,color); // set window's color shadow=Shadow; // set window's shadow wintype=WinType; // set window's type strcpy(title,Title); // set window's title// curs_set(0); return TRUE;}void BaseWindow::DestroyBaseWindow(){ delwin(basewin);// curs_set(1);}void BaseWindow::draw_box (int y, int x, int height, int width, chtype box, chtype border){ int i, j; wattrset (basewin, 0); for (i = 0; i < height; i++) { wmove (basewin, y + i, x); for (j = 0; j < width; j++) waddch (basewin, box); }}void BaseWindow::GetPosition(int &Y,int &X,int &Height,int &Width){ Y=this->y; X=this->x; Width=this->width; Height=this->height;}void BaseWindow::SetPosition(int Y,int X,int Height,int Width){ this->y=Y; this->x=X; this->width=Width; this->height=Height; //refresh windowa}int BaseWindow::GetHeight(){ return height; }int BaseWindow::GetWidth(){ return width;}int BaseWindow::GetY(){ return y;}int BaseWindow::GetX(){ return x;}int BaseWindow::SetColor(int Color){ int oricolor=color; color=Color; //refresh window return oricolor;}int BaseWindow::SetColor(){ if (color>0) { //refresh window } return color;}int BaseWindow::GetColor(){ return color;}int BaseWindow::CloseColor(){ CLOSE_STYLE(basewin,color); //refresh window return color;}int BaseWindow::SetTitle(char *Title){ strcpy(title,Title); return strlen(title);}char* BaseWindow::GetTitle(){ return title;}int BaseWindow::SetShadow(int Show){ shadow=Show; return shadow;}int BaseWindow::GetShadow(){ return shadow;}int BaseWindow::SetFontStyle(int FontStyle){ fontstyle=FontStyle; //refresh window return SET_STYLE(basewin,fontstyle);}int BaseWindow::GetFontStyle(){ return fontstyle;}int BaseWindow::SetWinType(int WinType){ wintype=WinType; return wintype;}int BaseWindow::GetWinType(){ return wintype;}int BaseWindow::Getach(){ return wgetch(basewin);}void BaseWindow::Refresh(){ curs_set(0); wrefresh(basewin);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -