void ide::Window::hide() { //get orig background for restoring when hiding or deleting the window if(_owner==FULLSCREEN) { _origbg=getbkgd(stdscr); } else { _origbg=getbkgd(_owner->_win); } _hidden=true; if(_bwin!=NULL) { wclear(_bwin); wbkgd(_bwin,_origbg); wbkgd(_win,_origbg); wrefresh(_bwin); } else { wclear(_win); wbkgd(_win,_origbg); wrefresh(_win); } }
_nc_Draw_Menu(const MENU * menu) { ITEM *item = menu->items[0]; ITEM *lasthor, *lastvert; ITEM *hitem; int y = 0; chtype s_bkgd; assert(item && menu->win); s_bkgd = getbkgd(menu->win); wbkgdset(menu->win, menu->back); werase(menu->win); wbkgdset(menu->win, s_bkgd); lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *) 0 : item; do { wmove(menu->win, y, 0); hitem = item; lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *) 0 : hitem; do { _nc_Post_Item(menu, hitem); wattron(menu->win, menu->back); if (((hitem = hitem->right) != lasthor) && hitem) { int i, j, cy, cx; chtype ch = ' '; getyx(menu->win, cy, cx); for (j = 0; j < menu->spc_rows; j++) { wmove(menu->win, cy + j, cx); for (i = 0; i < menu->spc_cols; i++) { waddch(menu->win, ch); } } wmove(menu->win, cy, cx + menu->spc_cols); } } while (hitem && (hitem != lasthor)); wattroff(menu->win, menu->back); item = item->down; y += menu->spc_rows; } while (item && (item != lastvert)); }
/* window:refresh() refresh the window (update physical window to match virtual window). */ int lui_refresh_window(lua_State *L) { WINDOW *w = panel_window(check_window(L, 1)); /* FIXME: set the bkgd each time we refresh is absolutely not necessary, but when we clear the screen it's useful... */ wbkgd(w, getbkgd(w)); update_panels(); doupdate(); return 0; }
int main(void) { chtype ch,a; char bgchar; int bgcolor,x; short fore,back; char colors[8][8] = { "Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White" }; char attribs[15][11] = { "Standout", "Underline", "Reverse", "Blink", "Dim", "Bold", "AltChar", "Invis", "Protect", "Horizontal", "Left", "Low", "Right", "Top", "Vertical" }; a = 0x10000; initscr(); start_color(); init_pair(1,COLOR_WHITE,COLOR_BLUE); bkgd(COLOR_PAIR(1) | A_BOLD); ch = getbkgd(stdscr); bgchar = (ch & A_CHARTEXT); /* Read character */ bgcolor = (ch & A_COLOR) >> 8; /* Read color pair */ pair_content(bgcolor,&fore,&back); /* Read colors */ printw("Background chtype is 0x%04x\n",ch); printw("Background character is 0x%02x or '%c'\n",\ bgchar,bgchar); printw("Background color pair is %d\n",bgcolor); printw("\tForeground color is %s\n",colors[fore]); printw("\tBackground color is %s\n",colors[back]); addstr("Other attributes found:\n"); for(x=0; x<15; x++) { if(a & ch) printw("%s\n",attribs[x]); a <<= 1; } refresh(); getch(); endwin(); return 0; }
static WINDOW * show_cmd(const char *scmd, struct winsize *win) { int n, m; WINDOW *actionwin; int nrow; wclear(stdscr); clearok(stdscr, 1); touchwin(stdscr); refresh(); mvaddstr(0, 4, msg_string(MSG_Status)); standout(); addstr(msg_string(MSG_Running)); standend(); mvaddstr(1, 4, msg_string(MSG_Command)); standout(); printw("%s", scmd); standend(); addstr("\n\n"); for (n = win->ws_col; (m = min(n, 30)) > 0; n -= m) addstr( "------------------------------" + 30 - m); refresh(); nrow = getcury(stdscr) + 1; actionwin = subwin(stdscr, win->ws_row - nrow, win->ws_col, nrow, 0); if (actionwin == NULL) { fprintf(stderr, "sysinst: failed to allocate output window.\n"); exit(1); } scrollok(actionwin, TRUE); if (has_colors()) { wbkgd(actionwin, getbkgd(stdscr)); wattrset(actionwin, getattrs(stdscr)); } wmove(actionwin, 0, 0); wrefresh(actionwin); return actionwin; }
int wbkgd(WINDOW *win, chtype ch) { uint16_t y, x; chtype old_ch; assert(win != NULL); old_ch = getbkgd(win); wbkgdset(win, ch); for (y = win->begy; y < win->endy; ++y) { for (x = win->begx; x < win->endx; ++x) { if (window_getch(win, y, x) == old_ch) { window_setch(win, ch, y, x); } } } return OK; }
EIF_INTEGER c_ecurses_getbkgd (EIF_POINTER w) { return getbkgd ((WINDOW*)w) ; };