/* * This sets the background color of the widget. */ void setCDKFScaleBackgroundColor (CDKFSCALE *scale, char *color) { chtype *holder = 0; int junk1, junk2; /* Make sure the color isn't null. */ if (color == 0) { return; } /* Convert the value of the environment variable to a chtype. */ holder = char2Chtype (color, &junk1, &junk2); /* Set the widgets background color. */ wbkgd (scale->win, holder[0]); wbkgd (scale->fieldWin, holder[0]); if (scale->labelWin != 0) { wbkgd (scale->labelWin, holder[0]); } /* Clean up. */ freeChtype (holder); }
int scroll_menu(WINDOW **items,int count,int menu_start_col, int index_num) { int key; int selected=0; while (1) { key=getch(); if (key==KEY_DOWN || key==KEY_UP) { wbkgd(items[selected+1],COLOR_PAIR(2)); wnoutrefresh(items[selected+1]); if (key==KEY_DOWN) { selected=(selected+1) % count; } else { selected=(selected+count-1) % count; } wbkgd(items[selected+1],COLOR_PAIR(1)); wnoutrefresh(items[selected+1]); doupdate(); } else if (key==ESCAPE) { return -1; } else if (key==ENTER) { return selected; } } }
static void colorbox(WINDOW *win, chtype color, int hasbox) { int maxy; #ifndef PDCURSES int maxx; #endif chtype attr = color & A_ATTR; /* extract Bold, Reverse, Blink bits */ setcolor(win, color); #ifdef A_COLOR if (has_colors()) wbkgd(win, COLOR_PAIR(color & A_CHARTEXT) | (attr & ~A_REVERSE)); else #endif wbkgd(win, attr); werase(win); #ifdef PDCURSES maxy = getmaxy(win); #else getmaxyx(win, maxy, maxx); #endif if (hasbox && (maxy > 2)) box(win, 0, 0); touchwin(win); wrefresh(win); }
void init_windows (WINDOW ** header_win, WINDOW ** main_win) { GColors *color = get_color (COLOR_BG); int row = 0, col = 0; /* init standard screen */ getmaxyx (stdscr, row, col); if (row < MIN_HEIGHT || col < MIN_WIDTH) FATAL ("Minimum screen size - 0 columns by 7 lines"); /* init header screen */ *header_win = newwin (6, col, 0, 0); keypad (*header_win, TRUE); if (*header_win == NULL) FATAL ("Unable to allocate memory for header_win."); /* init main screen */ *main_win = newwin (row - 8, col, 7, 0); keypad (*main_win, TRUE); if (*main_win == NULL) FATAL ("Unable to allocate memory for main_win."); /* background colors */ wbkgd (*main_win, COLOR_PAIR (color->pair->idx)); wbkgd (*header_win, COLOR_PAIR (color->pair->idx)); wbkgd (stdscr, COLOR_PAIR (color->pair->idx)); }
int main(void) { WINDOW *subby,*sonny; int row,col; initscr(); start_color(); init_pair(1,COLOR_WHITE,COLOR_BLUE); init_pair(2,COLOR_YELLOW,COLOR_RED); subby = newwin(10,30,10,40); wbkgd(subby,COLOR_PAIR(1)); getparyx(subby,row,col); wprintw(subby,"This subwin's org: %d, %d.",row,col); wrefresh(subby); sonny = subwin(subby,7,30,13,40); wbkgd(sonny,COLOR_PAIR(2)); getparyx(sonny,row,col); wprintw(sonny,"This subwin's org: %d, %d.",row,col); wrefresh(sonny); getch(); endwin(); return 0; }
void plantilla() // plantilla con el menu y titulo del programa { WINDOW *titulo = newwin(3,110, 0,0); box(titulo, '-','-'); init_pair(1,COLOR_WHITE,COLOR_BLUE); wbkgd(titulo, COLOR_PAIR(1)); init_pair(2,COLOR_WHITE,COLOR_RED); attron(COLOR_PAIR(1)); wattron(titulo,A_BOLD); mvwprintw(titulo,1,45,"Directorio Personas"); wrefresh(titulo); wattroff(titulo,A_BOLD); WINDOW *menu = newwin(1,110,4,0); wbkgd(menu, COLOR_PAIR(2)); wattron(menu,A_BOLD); mvwprintw(menu,0,0,"\tIngresar Registro[I] | Eliminar[E] | Buscar[B] | Actualizar[a] | Salir[S]"); wattroff(menu,A_BOLD); wrefresh(menu); }
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); } }
void win_show_subwin(ProfWin *window) { int cols = getmaxx(stdscr); int subwin_cols = 0; switch (window->type) { case WIN_CONSOLE: subwin_cols = win_roster_cols(); window->wins.cons.subwin = newpad(PAD_SIZE, subwin_cols); wbkgd(window->wins.cons.subwin, theme_attrs(THEME_TEXT)); wresize(window->win, PAD_SIZE, cols - subwin_cols); win_redraw(window); break; case WIN_MUC: subwin_cols = win_occpuants_cols(); window->wins.muc.subwin = newpad(PAD_SIZE, subwin_cols); wbkgd(window->wins.muc.subwin, theme_attrs(THEME_TEXT)); wresize(window->win, PAD_SIZE, cols - subwin_cols); win_redraw(window); break; default: break; } }
int main() { CELL file_cpy = {0}; WINDOW *mainwin; mainwin = initscr(); start_color(); setup_colors(); cbreak(); noecho(); keypad(mainwin, TRUE); meta(mainwin, TRUE); raw(); leaveok(mainwin, TRUE); wbkgd(mainwin, COLOR_PAIR(COLOR_MAIN)); wattron(mainwin, COLOR_PAIR(COLOR_MAIN)); werase(mainwin); refresh(); file_cpy.window = mainwin; main_dir(&file_cpy); wbkgd(mainwin, A_NORMAL); werase(mainwin); echo(); nocbreak(); noraw(); refresh(); endwin(); return TRUE; }
int main(void) { WINDOW *pops,*sonny; int x2,y2,x4,y4; initscr(); start_color(); init_pair(1,COLOR_WHITE,COLOR_BLUE); init_pair(2,COLOR_RED,COLOR_YELLOW); x2 = COLS >> 1; y2 = LINES >> 1; x4 = (COLS - x2) >> 1; y4 = (LINES - y2) >> 1; /* create parent and subwindow */ pops = newwin(y2,x2,y4,x4); sonny = derwin(pops,y4,x4,2,2); if(sonny == NULL) { endwin(); puts("Unable to create subwindow\n"); return(1); } /* color windows and splash some text */ wbkgd(pops,COLOR_PAIR(1)); waddstr(pops,"Hello, son."); wbkgd(sonny,COLOR_PAIR(2)); waddstr(sonny,"Hello, Dad."); wrefresh(pops); getch(); endwin(); return 0; }
t_bool catch_key() { int i; int key; keypad(stdscr, TRUE); i = -1; while (i == -1 || (key = getch()) != 'q') { i = 0; if (key == '\t') { g_ctrl.focus = (g_ctrl.focus + 1) % 2; wbkgd(g_ctrl.menu[g_ctrl.focus].win, COLOR_PAIR(P_FONT)); wbkgd(g_ctrl.menu[(g_ctrl.focus + 1) % 2].win, COLOR_PAIR(P_NFOC)); } while (g_movetab[i].c != 0 && g_movetab[i].c != key) i++; if (g_movetab[i].fct != NULL) g_movetab[i].fct(&(g_ctrl.menu[g_ctrl.focus])); else if (g_movetab[i].sh != NULL) exec_sh(g_movetab[i].sh, &(g_ctrl.menu[g_ctrl.focus])); refresh_win(g_ctrl.focus); } return (TRUE); }
/* * called to destroy a window */ static int wdg_dialog_destroy(struct wdg_object *wo) { WDG_WO_EXT(struct wdg_dialog, ww); WDG_DEBUG_MSG("wdg_dialog_destroy"); /* erase the window */ wbkgd(ww->win, COLOR_PAIR(wo->screen_color)); wbkgd(ww->sub, COLOR_PAIR(wo->screen_color)); werase(ww->sub); werase(ww->win); wnoutrefresh(ww->sub); wnoutrefresh(ww->win); /* dealloc the structures */ delwin(ww->sub); delwin(ww->win); /* free the text string */ WDG_SAFE_FREE(ww->text); WDG_BUG_IF(ww->text != NULL); WDG_SAFE_FREE(wo->extend); return WDG_ESUCCESS; }
/*Создание интерфейса чата*/ void new_chat_window (void) { initscr(); curs_set(0); keypad(stdscr,0); noecho(); start_color(); init_pair(1,COLOR_BLUE,COLOR_WHITE); user_list_box = newwin(getmaxy (stdscr),getmaxx(stdscr)/2,0,getmaxx(stdscr)/2); chat = newwin(getmaxy(stdscr),(getmaxx(stdscr)/2)-1,0,0); user_list= newwin((getmaxy (stdscr)-2),(getmaxx(stdscr)/2-2),1,getmaxx(stdscr)/2+1); wbkgd(chat,COLOR_PAIR(1)); wbkgd(user_list,COLOR_PAIR(1)); wbkgd(user_list_box,COLOR_PAIR(1)); wattron(chat,COLOR_PAIR(1)|A_BOLD); wattron(user_list,COLOR_PAIR(1)|A_BOLD); wattron(user_list_box,COLOR_PAIR(1)|A_BOLD); box(chat,0,0); box(user_list_box,0,0); wmove(chat,1,1); wprintw(chat,"Hi,I'm server,WELCOM! Ctrl+C to exit"); wmove(user_list,0,0); wprintw(user_list,"On-line User"); wrefresh(chat); wrefresh(user_list_box); wrefresh(user_list); }
Disp() { initscr(); cbreak(); noecho(); timeout ( 0 ); curs_set ( FALSE ); clear(); int max_x, max_y; getmaxyx ( stdscr, max_y, max_x ); mx = 0; my = 0; vi_w = newwin ( 10+2, max_x, 0, max_x/2 ); net_conect = newwin(10+2,max_x/2,0,0); log_w = newwin ( max_y- ( 10+2 ) - 3, max_x, 10+2, 0 ); log_iw = newwin ( max_y- ( 10+2 ) - 3 -2, max_x-2, 10+2+1, 1 ); shell_w = newwin ( 3, max_x, 10+2+max_y- ( 10+2 ) - 3, 0 ); start_color(); /* init_pair ( 1,COLOR_WHITE, COLOR_BLUE ); init_pair ( 2, COLOR_WHITE, COLOR_YELLOW ); init_pair ( 3, COLOR_YELLOW, COLOR_BLUE ); */ /* init_pair ( 1, COLOR_BLACK, COLOR_WHITE ); init_pair ( 2, COLOR_WHITE, COLOR_YELLOW ); init_pair ( 3, COLOR_WHITE, COLOR_RED ); */ init_pair ( 1, COLOR_BLACK, COLOR_WHITE ); init_pair ( 2, COLOR_WHITE, COLOR_MAGENTA ); init_pair ( 3, COLOR_WHITE, COLOR_RED ); init_pair ( 4, COLOR_BLACK, COLOR_CYAN ); init_pair ( 5, COLOR_BLACK, COLOR_GREEN ); init_pair ( 6, COLOR_BLUE, COLOR_YELLOW ); init_pair ( 7, COLOR_BLACK, COLOR_MAGENTA ); init_pair ( 8, COLOR_CYAN, COLOR_RED ); init_pair ( 9, COLOR_WHITE, COLOR_BLACK ); init_pair ( 10, COLOR_MAGENTA, COLOR_BLACK ); init_pair ( 11, COLOR_GREEN, COLOR_MAGENTA ); wbkgd ( vi_w, COLOR_PAIR ( 3 ) ); wbkgd ( log_w, COLOR_PAIR ( 2 ) ); wbkgd ( log_iw, COLOR_PAIR ( 2 ) ); wbkgd ( shell_w, COLOR_PAIR ( 1 ) ); wbkgd(net_conect,COLOR_PAIR(4)); nodelay ( shell_w, TRUE ); keypad ( shell_w, TRUE ); scrollok ( log_iw, TRUE ); ui( ); }
static int scroller(t_game *game,int i) { wbkgd(game->menulist[i], COLOR_PAIR(2)); wrefresh(game->menulist[i]); i = (i == 1) ? 2 : 1; wbkgd(game->menulist[i], COLOR_PAIR(1)); wrefresh(game->menulist[i]); return (i); }
ProfWin* win_create(const char * const title, win_type_t type) { ProfWin *new_win = malloc(sizeof(ProfWin)); int cols = getmaxx(stdscr); new_win->type = type; switch (new_win->type) { case WIN_CONSOLE: new_win->win = newpad(PAD_SIZE, (cols)); wbkgd(new_win->win, theme_attrs(THEME_TEXT)); new_win->wins.cons.subwin = NULL; new_win->wins.cons.sub_y_pos = 0; break; case WIN_MUC: if (prefs_get_boolean(PREF_OCCUPANTS)) { int subwin_cols = win_occpuants_cols(); new_win->win = newpad(PAD_SIZE, cols - subwin_cols); wbkgd(new_win->win, theme_attrs(THEME_TEXT)); new_win->wins.muc.subwin = newpad(PAD_SIZE, subwin_cols);; wbkgd(new_win->wins.muc.subwin, theme_attrs(THEME_TEXT)); } else { new_win->win = newpad(PAD_SIZE, (cols)); wbkgd(new_win->win, theme_attrs(THEME_TEXT)); new_win->wins.muc.subwin = NULL; } new_win->wins.muc.sub_y_pos = 0; break; default: new_win->win = newpad(PAD_SIZE, (cols)); wbkgd(new_win->win, theme_attrs(THEME_TEXT)); break; } if (new_win->type == WIN_MUC_CONFIG) { new_win->wins.conf.form = NULL; } new_win->from = strdup(title); new_win->buffer = buffer_create(); new_win->y_pos = 0; new_win->paged = 0; new_win->unread = 0; if (new_win->type == WIN_CHAT) { new_win->wins.chat.resource = NULL; new_win->wins.chat.is_otr = FALSE; new_win->wins.chat.is_trusted = FALSE; new_win->wins.chat.history_shown = FALSE; } scrollok(new_win->win, TRUE); return new_win; }
void initgui() { int f, b; initscr(); clear(); cbreak(); start_color(); if (!can_change_color()) { mvprintw(0, 0, "Your terminal does not support 256 colors, the screen " "output will not look like it's supposed to look like!"); } nodelay(stdscr, TRUE); noecho(); keypad(stdscr, TRUE); signal(SIGWINCH, handleresize); init_pair(1, COLOR_BLUE, COLOR_WHITE); cpuscreen = newwin(14, 34, 2, 1); status = newwin(14, 24, 2, 37); wbkgd(status, COLOR_PAIR(1)); wbkgd(cpuscreen, COLOR_PAIR(1)); curs_set(0); /* * Initialize colors */ init_color(127, 0, 0, 0); init_color(128, 0, 0, 666); init_color(129, 0, 666, 0); init_color(130, 0, 666, 666); init_color(131, 666, 0, 0); init_color(132, 666, 0, 666); init_color(133, 666, 333, 0); init_color(134, 1000, 1000, 1000); init_color(135, 333, 333, 333); init_color(136, 333, 333, 1000); init_color(137, 333, 1000, 333); init_color(138, 333, 1000, 1000); init_color(139, 1000, 333, 1000); init_color(140, 1000, 1000, 333); init_color(141, 1000, 1000, 1000); /* Initialize all possible color combinations */ for (f = 0; f < 16; ++f) for (b = 0; b < 16; b++) init_pair(((f << 4) | b) + 16, f+127, b+127); refresh(); wrefresh(cpuscreen); }
void interactive_setup() { int x, y, center; initscr(); start_color(); getmaxyx(stdscr, y, x); center = x - sizeof(MAIN_TITLE); center = center / 2; title_bar = newwin(1, x, 0, 0); output = newwin(y - 1, x, 2, 0); status_bar = newwin(1, x, y - 1, 0); console = newwin((y / 4) + 1, x, y - ( y /4) - 2, 0); filter_menu = newwin(3, x - x / 4 , (y - 3) / 2, ( x - (x - x / 4)) / 2 ); init_pair(1, COLOR_BLACK, COLOR_WHITE); init_pair(2, COLOR_GREEN, COLOR_BLACK); init_pair(3, COLOR_BLACK, COLOR_RED); init_pair(4, COLOR_CYAN, COLOR_BLACK); init_pair(5, COLOR_MAGENTA, COLOR_BLACK); init_pair(6, COLOR_WHITE, COLOR_BLACK); init_pair(7, COLOR_YELLOW, COLOR_BLACK); init_pair(8, COLOR_WHITE, COLOR_BLACK); init_pair(9, COLOR_RED, COLOR_BLACK); init_pair(10, COLOR_BLUE, COLOR_BLACK); init_pair(11, COLOR_WHITE, COLOR_BLUE); scrollok(output, TRUE); nodelay(output, TRUE); scrollok(console, TRUE); noecho(); nodelay(stdscr, TRUE); curs_set(0); wbkgd(title_bar, COLOR_PAIR(11) | A_BOLD | A_DIM ); wbkgd(status_bar, COLOR_PAIR(1) | A_BOLD | A_DIM ); wbkgd(filter_menu, COLOR_PAIR(11) | A_BOLD | A_DIM ); wbkgd(console, COLOR_PAIR(11) | A_BOLD | A_DIM ); mvwprintw(title_bar, 0, center, "%s", MAIN_TITLE); wprintw(status_bar, "[ 00:00:00 ]"); wprintw(status_bar, "%50s %d", "Clients Connected:", 0); wnoutrefresh(title_bar); wnoutrefresh(status_bar); signal(SIGWINCH, catch_resize); doupdate(); }
/* Set background colors to all windows. */ void set_wbkgd (WINDOW * main_win, WINDOW * header_win) { GColors *color = get_color (COLOR_BG); /* background colors */ wbkgd (main_win, COLOR_PAIR (color->pair->idx)); wbkgd (header_win, COLOR_PAIR (color->pair->idx)); wbkgd (stdscr, COLOR_PAIR (color->pair->idx)); wrefresh (main_win); }
void open_dir(WINDOW * win) { int row,col,fd; getmaxyx(win,row,col); start_color(); init_pair(3,COLOR_BLACK,COLOR_BLUE); WINDOW * local_win; delwin(win); refresh(); { win = newwin(LINES-3,COLS,0,0); box(win,0,0); wbkgd(win,COLOR_PAIR(1)); mvwprintw(win,0,(COLS - 14)/2,"MY TEXT-EDITOR"); wrefresh(win); } local_win = subwin(win,4,COLS/3,row/2,(col - COLS/3)/2); box(local_win,0,0); wbkgd(local_win,COLOR_PAIR(3)); getmaxyx(win,row,col); mvwprintw(local_win,1,2,"TYPE IN FILE LOCATION:"); wmove(local_win,2,2); wrefresh(local_win); wrefresh(win); echo(); curs_set(1); mvwgetstr(local_win,2,2,dir); wclear(local_win); werase(local_win); wrefresh(local_win); { int ptr=1,ptrcol=1; long int res; char ch; if ((fd = open(dir,O_RDWR|O_CREAT,S_IRWXO|S_IRWXU|S_IRWXG)) == -1) { perror("Can't open!"); exit(1); } while((res = read(fd,&ch,1)) > 0) { if (ch == '\n') { ptrcol++; ptr = 1; continue; } mvwprintw(win,ptrcol,ptr++,"%c",ch); } wrefresh(win); } close(fd); delwin(local_win); }
void MessageBox(WINDOW* parent, string title, string message) { int nColumns = message.size() + 4; int nLines = nColumns / MAX_MESSAGEBOX_COLS + 5; WINDOW* messageBox = 0; WINDOW* textArea = 0; if (nColumns < MIN_MESSAGEBOX_COLS) nColumns = MIN_MESSAGEBOX_COLS; else if (nColumns > MAX_MESSAGEBOX_COLS) nColumns = MAX_MESSAGEBOX_COLS; messageBox = subwin(parent, nLines, nColumns, (LINES - nLines)/2, (COLS - nColumns)/2); if (messageBox == 0) { Log::getInstance().write("Failed to intialize message box window."); return; } textArea = subwin(messageBox, nLines - 4, nColumns - 4, (LINES - nLines)/2 + 2, (COLS - nColumns)/2 + 2); if (textArea == 0) { delwin(messageBox); Log::getInstance().write("Failed to intialize textArea window."); return; } nodelay(parent, false); nodelay(messageBox, false); wclear(parent); wbkgd(messageBox, COLOR_PAIR(ColorPairManager::getInstance().getColorPair(COLOR_WHITE, COLOR_BLUE))); wbkgd(textArea, COLOR_PAIR(ColorPairManager::getInstance().getColorPair(COLOR_WHITE, COLOR_BLUE))); wborder(messageBox, 0, 0, 0, 0, 0, 0, 0, 0); mvwaddstr(messageBox, 0, 5, title.c_str()); //mvwaddstr(messageBox, 2, (nColumns - message.size())/2, message.c_str()); waddstr(textArea, message.c_str()); wrefresh(messageBox); wgetch(messageBox); wclear(parent); wrefresh(parent); delwin(textArea); delwin(messageBox); nodelay(parent, true); }
/* * This sets the background attribute of the widget. */ static void _setBKattrUScale (CDKOBJS *object, chtype attrib) { if (object != 0) { CDKUSCALE *widget = (CDKUSCALE *)object; wbkgd (widget->win, attrib); wbkgd (widget->fieldWin, attrib); if (widget->labelWin != 0) { wbkgd (widget->labelWin, attrib); } } }
/* * This sets the background attribute of the widget. */ static void _setBKattrScroll (CDKOBJS *object, chtype attrib) { if (object != 0) { CDKSCROLL *widget = (CDKSCROLL *)object; wbkgd (widget->win, attrib); wbkgd (widget->listWin, attrib); if (widget->scrollbarWin != 0) { wbkgd (widget->scrollbarWin, attrib); } } }
int main(void) { int flag=0; initscr(); atexit(quit); clear(); noecho(); curs_set(0); cbreak(); keypad(stdscr, 1); start_color(); init_pair(1, COLOR_YELLOW, COLOR_BLUE); init_pair(2, COLOR_BLACK, COLOR_WHITE); init_pair(3, COLOR_BLACK, COLOR_YELLOW); win1 = newwin(10, 25, 5, 10); win2 = newwin(10, 25, 10, 15); box(win1, ACS_VLINE, ACS_HLINE); box(win2, ACS_VLINE, ACS_HLINE); pan1 = new_panel(win1); pan2 = new_panel(win2); bkgd(COLOR_PAIR(1)); wbkgd(win1, COLOR_PAIR(2)); wbkgd(win2, COLOR_PAIR(3)); mvaddstr(2,4, "F9 beendet das Programm"); mvwaddstr(win1, 2, 3, "Druecke eine Taste"); mvwaddstr(win2, 7, 3, "Druecke eine Taste"); update_panels(); doupdate(); while(getch() != KEY_F(9)) { if (flag==0) { top_panel(pan1); flag = 1; } else { top_panel(pan2); flag = 0; } update_panels(); doupdate(); } return (0); }
void refresh_playlist(int begin_pos) { int i, p_item; int max_items; char *str, *str2; item *curr; wclear(playlist_win); if(active_win == PLAYLIST_WIN) { if(color) { wattron(playlist_win, COLOR_PAIR(1)); wbkgd(playlist_win, COLOR_PAIR(1)); } wattrset(playlist_win, A_BOLD); } else if (color) { wattron(playlist_win, COLOR_PAIR(2)); wbkgd(playlist_win, COLOR_PAIR(2)); } box(playlist_win, 0, 0); wattrset(playlist_win, A_NORMAL); max_items = playlist_win->_maxy - 1; i = 0; p_item = begin_pos; while((curr = get(&playlist_h, p_item, &playlist_t)) && i < max_items) { if((c_p_p >= 0) && (c_p_p == p_item)) { wattrset(playlist_win, A_BOLD); } if((p_p >= 0) && (p_p == p_item)) { wattrset(playlist_win, A_REVERSE); } str2 = name(curr->file); str = strpad(str2, playlist_win->_maxx - 1); mvwaddstr(playlist_win, i + 1, 1, str); free(str2); free(str); wattrset(playlist_win, A_NORMAL); p_item++; i++; } wnoutrefresh(playlist_win); wnoutrefresh(browser_win); doupdate(); }
/* * This sets the background attribute of the widget. */ static void _setBKattrFSlider (CDKOBJS *object, chtype attrib) { if (object != 0) { CDKFSLIDER *widget = (CDKFSLIDER *)object; /* Set the widgets background attribute. */ wbkgd (widget->win, attrib); wbkgd (widget->fieldWin, attrib); if (widget->labelWin != 0) { wbkgd (widget->labelWin, attrib); } } }
static void ui_window(WINDOW **w, int x, int y, int l, int h, int c, bool boxed) { w[0] = newwin(h, l, y, x); if (has_colors()) { wbkgd(w[0], COLOR_PAIR(c)); } if (boxed) { box(w[0], 0, 0); w[1] = subwin(w[0], h - 2, l - 2, y + 1, x + 1); //w[1] = newwin(h - 2, l - 2, y + 1, x + 1); if (has_colors()) { wbkgd(w[1], COLOR_PAIR(c)); } } }
int prepare_status_window() { struct window_dimensions *dimensions; WINDOW *win; dimensions = malloc(sizeof (struct window_dimensions)); if (!dimensions) { return (-1); } status_win_dimensions = dimensions; set_status_window_size(); win = newwin(dimensions->height, dimensions->width, dimensions->starty, dimensions->startx); if (!win) { return (-1); } init_pair(1, COLOR_RED, COLOR_GREEN); attron(COLOR_PAIR(1)); wbkgd(win, COLOR_PAIR(1)); box(win, 0, 0); attroff(COLOR_PAIR(1)); wrefresh(win); status_win = win; return (0); }
void drawStatsArea() { wclear(stats); wbkgd(stats,COLOR_PAIR(0) | A_DIM); //wattrset(stats,COLOR_PAIR(1)); box(stats,ACS_VLINE,ACS_HLINE); wattrset(stats,A_BOLD); mvwprintw(stats, 1, 1, player.player_name); wattrset(stats,A_NORMAL); mvwprintw(stats, 2, 1, "%s", races[player.race].race_name); mvwprintw(stats, 3, 1, "Gold: %i", player.gold); mvwprintw(stats, 4, 1, "Level: %i", player.level); mvwprintw(stats, 5, 1, "HP: %i", player.hp); mvwprintw(stats, 6, 1, "XP: %i", player.xp); mvwprintw(stats, 7, 1, "STR: %i", player.str); mvwprintw(stats, 8, 1, "DEF: %i", player.def); mvwprintw(stats, 9, 1, "AGI: %i", player.agi); //mvwprintw(stats,10,1,"X: %i",player.x); //mvwprintw(stats,11,1,"Y: %i",player.y); //mvwprintw(stats,12,1,"TopX: %i",mapTopX); //mvwprintw(stats,13,1,"TopY: %i",mapTopY); mvwhline(stats,16,1,ACS_HLINE,18); mvwprintw(stats, 17, 1, "Slain: %i",player.slain); mvwprintw(stats, 18, 1, "XP Needed: %i", 100 - player.xp_earned); wrefresh(stats); }
void create_status_bar(void) { int rows, cols, i; getmaxyx(stdscr, rows, cols); is_active[1] = TRUE; is_new[1] = FALSE; for (i = 2; i < 12; i++) { is_active[i] = FALSE; is_new[i] = FALSE; } remaining_active = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); remaining_new = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); current = 1; int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET); status_bar = newwin(1, cols, rows-2, 0); wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT)); wattron(status_bar, bracket_attrs); mvwprintw(status_bar, 0, cols - 34, _active); mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket); wattroff(status_bar, bracket_attrs); if (last_time) { g_date_time_unref(last_time); } last_time = g_date_time_new_now_local(); _status_bar_draw(); }