3 curses库窗口(WINDOW)处

2023-01-31 05:01:13 window curses 窗口

3 curses库窗口(WINDOW)处理

~~~~~~~~~~~~~~~~~~~~~~~~~~~


3.1 什么是窗口

===============

* 窗口是屏幕上的一块区域,在其上面可以进行各种输出及其操作.

* 窗口可以位于标准屏幕的任意位置,窗口之间可以相互重叠.

* 窗口可以同时包含与它们相关的子窗口,任何在父窗口与子窗口重叠区域的变化会同时影响到他们中的任何一个


3.2 窗口操作

=============


3.2.1 创建和删除窗口

---------------------


 WINDOW* newwin(int lines,int cols,int begin_x,int begin_y);
 
 int delwin(WINDOW* win);
 
 WINDOW* subwin(WINDOW* win,int lines,int cols,int begin_x,int begin_y);
 
 WINDOW* derwin(WINDOW* win,int lines,int cols,int begin_x,int begin_y);

3.2.2 在窗口进行输入和输出

---------------------------

int wmove(WINDOW* win,int x,int y); 
  int waddch(WINDOW* win,int ch); 
  int mvwaddch(WINDOW* win,x,y,ch); 
  int waddstr(WINDOW* win,char* str); 
  int mvwaddstr(WINDOW* win,int x,int y,char* str); 
  int wprintw(WINDOW* win,char* fmt[,arg...]); 
  int wgetch(WINDOW* win); 
  int mvwgetch(WINDOW* win,int x,int y);
  int wgetstr(WINDOW* win);
  int mvwgetstr(WINDOW* win,int x,int y,char* str);
  int wscanw(WINDOW* win,char* fmt[,args...]);
  int mvwscanw(WINDOW* win,int x,int y,char* fmt[,args...]);
  int winsch(WINDOW* win,int ch); 
  int mvwinsch(WINDOW* win,int x,int y,int ch);
  int winsertln(WINDOW* win,int x,int y); 
  int wdelch(WINDOW* win); 
  int mvwdelch(WINDOW* win,int x,int y);
  int wdeleteln(WINDOW* win);
  int wclear(WINDOW* win);
  int werase(WINDOW* win);
  int wclrtoeol(WINDOW* win);
  int wclrtobot(WINDOW* win);
  int wstandout(WINDOW* win);
  int wstandend(WINDOW* win);
  int wattrset(WINDOW* win,chtype atr);
  int wattroff(WINDOW* win,chtype atr);
  int wattron(WINDOW* win,chtype atr);
  
  int overlay(WINDOW* srcwin,WINDOW* dstwin);
  
  int overwrite(WINDOW* srcwin,WINDOW* dstwin);
  
  int copywin(WINDOW* scrwin,WINDOW* dstwin,int srciminrow,int srcmincol,int dstminrow,int dstmincol,int dstmaxrow,int dstmaxcol,int overlayFlag);


3.2.3 窗口刷新

---------------


 int wnoutrefresh(WINDOW* win);
 
 int doupdate(WINDOW* win);
 
 int wrefresh(WINDOW* win);
 
 int redrawwin(WINDOW* win);
 
 int wredrawln(WINDOW* win,int beg_line,int num_lines);


3.2.4 窗口其他属性操作

-----------------------


  int mvwin(WINDOW* win,int x,inty);
  
  void touchwin(WINDOW* win);
  
  int box(WINDOW* win,chtype vert,chtype hort);
  
  int border(WINDOW* win,chtype ls,chtype,rs,chtype ts,chtype bs,chtype tl,chtype tr,chtype bl,chtype br);
  
  int hline(chtype ch,int n);
  
  int vline(chtype ch,int n);
  
  int whline(WINDOW* win,chtype ch,int n);
  
  int wvline(WINDOW* win,chtype ch,int n);
  
  void leaveok(WINDOW* win,bool state);
  void scrollok(WINDOW* win,bool state);
  void clearok(WINDOW* win,bool state);


3.2.5 屏幕的转存

-----------------


 int putwin(WINDOW* win,FILE* fp);
 
 WINDOW* getwin(FILE* fp);
 
 int scr_dump(const char* filename);
 
 int src_restore(const char* filename);


相关文章