void dlg_draw_arrows(WINDOW *dialog, int top_arrow, int bottom_arrow, int x, int top, int bottom) { int cur_x, cur_y; getyx(dialog, cur_y, cur_x); (void) wmove(dialog, top, x); if (top_arrow) { wattrset(dialog, uarrow_attr); (void) waddch(dialog, ACS_UARROW); (void) waddstr(dialog, "(+)"); } else { wattrset(dialog, menubox_attr); (void) whline(dialog, ACS_HLINE, 4); } (void) wmove(dialog, bottom, x); if (bottom_arrow) { wattrset(dialog, darrow_attr); (void) waddch(dialog, ACS_DARROW); (void) waddstr(dialog, "(+)"); } else { wattrset(dialog, menubox_border_attr); (void) whline(dialog, ACS_HLINE, 4); } (void) wmove(dialog, cur_y, cur_x); wrefresh(dialog); }
/** * print_tcp_activity_overview_labels() * -------------------------------- * displays the Activity Overview window, and prints the labels * associated with it. **/ void print_tcp_activity_overview_labels(WINDOW ** scanwin, PANEL ** scanpanel, int highlight) { *scanwin = newwin(LINES - 5, 30, 3, 1); *scanpanel = new_panel(*scanwin); wattrset(*scanwin, BOXATTR); colorwin(*scanwin); box(*scanwin, ACS_VLINE, ACS_HLINE); mvwprintw(*scanwin, 0, 2, " Activity Overview "); wattrset(*scanwin, ACTIVEATTR); mvwprintw(*scanwin, 2, 2, "Access Point Information"); wattrset(*scanwin, STDATTR); mvwprintw(*scanwin, 4, 3, "SSID: "); mvwprintw(*scanwin, 5, 3, "BSSID: "); mvwprintw(*scanwin, 6, 3, "WEP: "); mvwprintw(*scanwin, 7, 3, "Channel:"); mvwprintw(*scanwin, 8, 3, "Total # Nodes:"); wattrset(*scanwin, BOXATTR); wmove(*scanwin, 10, 6); whline(*scanwin, ACS_HLINE, 15); wattrset(*scanwin, ACTIVEATTR); mvwprintw(*scanwin, 12, 2, "Selected Wireless Node"); wattrset(*scanwin, STDATTR); mvwprintw(*scanwin, 14, 3, "MAC: "); mvwprintw(*scanwin, 15, 3, "IP Addr: "); wattrset(*scanwin, BOXATTR); mvwprintw(*scanwin, 17, 2, "TCP Related-Info"); wattrset(*scanwin, STDATTR); mvwprintw(*scanwin, 19, 3, "Total # Conns: "); mvwprintw(*scanwin, 20, 3, "Total pkts: "); mvwprintw(*scanwin, 21, 3, "Total bytes: "); mvwprintw(*scanwin, 22, 3, "Existing pkts: "); mvwprintw(*scanwin, 23, 3, "Existing bytes: "); mvwprintw(*scanwin, 24, 3, "Retran pkts: "); mvwprintw(*scanwin, 25, 3, "Retran bytes: "); mvwprintw(*scanwin, 27, 3, "Waste (%%): "); wattrset(*scanwin, ACTIVEATTR); mvwprintw(*scanwin, 30, 2, "Data Setting"); wattrset(*scanwin, STDATTR); mvwprintw(*scanwin, 32, 3, "Current View: "); wattrset(*scanwin, BOXATTR); wmove(*scanwin, 34, 6); whline(*scanwin, ACS_HLINE, 15); mvwprintw(*scanwin, 35, 3, "Press 'V' to view other"); mvwprintw(*scanwin, 36, 3, "types of data"); wattrset(*scanwin, STDATTR); mvwprintw(*scanwin, LINES - 7, 2, "Elapsed: "); update_panels(); doupdate(); }
void dlg_draw_arrows2(WINDOW *win, int top_arrow, int bottom_arrow, int x, int top, int bottom, chtype attr, chtype borderattr) { chtype save = dlg_get_attrs(win); int cur_x, cur_y; int limit_x = getmaxx(win); bool draw_top = TRUE; bool is_toplevel = (wgetparent(win) == stdscr); getyx(win, cur_y, cur_x); /* * If we're drawing a centered title, do not overwrite with the arrows. */ if (dialog_vars.title && is_toplevel && (top - getbegy(win)) < MARGIN) { int have = (limit_x - dlg_count_columns(dialog_vars.title)) / 2; int need = x + 5; if (need > have) draw_top = FALSE; } if (draw_top) { (void) wmove(win, top, x); if (top_arrow) { (void) wattrset(win, merge_colors(uarrow_attr, attr)); (void) add_acs(win, ACS_UARROW); (void) waddstr(win, "(-)"); } else { (void) wattrset(win, attr); (void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT); } } mouse_mkbutton(top, x - 1, 6, KEY_PPAGE); (void) wmove(win, bottom, x); if (bottom_arrow) { (void) wattrset(win, merge_colors(darrow_attr, borderattr)); (void) add_acs(win, ACS_DARROW); (void) waddstr(win, "(+)"); } else { (void) wattrset(win, borderattr); (void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT); } mouse_mkbutton(bottom, x - 1, 6, KEY_NPAGE); (void) wmove(win, cur_y, cur_x); wrefresh(win); (void) wattrset(win, save); }
main() { int i; WINDOW *win; initscr(); noecho(); nonl(); cbreak(); scrollok(stdscr, TRUE); for (i=0; i<25; i++) printw("This is in the background, this should be left alone!\n"); refresh(); win=newwin(10,50,6,20); scrollok(win,TRUE); wmove(win,0,0); whline(win,0,49); wmove(win,9,0); whline(win,0,49); wrefresh(win); wattrset(win,A_STANDOUT); mvwprintw(win, 0, 14, " Scrolling Demo! "); mvwprintw(win, 9, 14, " Scrolling Demo! "); wattroff(win,A_STANDOUT); wsetscrreg(win, 1,8); mvwprintw(win, 0, 5, " DOWN "); wmove(win,1,0); wrefresh(win); getch(); for (i=0; i<25; i++){ wprintw(win, "This is window line test (%d).\n", i); if (i%2) wattrset(win,A_BOLD); else wattroff(win,A_BOLD); wrefresh(win); } mvwprintw(win, 0, 5, " UP "); wrefresh(win); getch(); for (i=0; i<25; i++) { wmove(win,1,0); winsertln(win); if (i%2) wattrset(win,A_BOLD); else wattroff(win,A_BOLD); wprintw(win, "Scrolling backwards! (%d)\n", i); wrefresh(win); } mvwprintw(win, 0, 5, " DONE "); wrefresh(win); endwin(); }
void simulation::update_screen(WINDOW* scr) { //variable declarations since they can't be made inside of switch statements int y = 0; std::list<std::string>::iterator print_iter = console.begin(); switch (scr_state) { //state 1 is the simulation state case 1: current_map->print_map(scr); break; //state 0 is the initial state case 0: for (;print_iter != console.end(); print_iter++) { mvwprintw(scr, (LINES - CONSOLE_SIZE + y), 0, "%s", (print_iter)->c_str()); y++; } mvwprintw(scr, 0, 0, status_message.c_str()); wmove(scr, 1, 0); whline(scr, ACS_BLOCK, 80); } wrefresh(scr); }
void introTest(WINDOW *win) { werase(win); wmove(win, height / 2 - 5, width / 2); wvline(win, ACS_VLINE, 10); wmove(win, height / 2, width / 2 - 10); whline(win, ACS_HLINE, 20); Continue(win); beep(); werase(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); cbreak(); mvwaddstr(win, 1, 1, "You should have a rectangle in the middle of the screen"); mvwaddstr(win, 2, 1, "You should have heard a beep"); Continue(win); flash(); mvwaddstr(win, 3, 1, "You should have seen a flash"); Continue(win); }
static int SCW_HLine(lua_State *L){ WINDOW **w = checkSelCWindow(L); int n = luaL_checkint(L, 2); char ch = '-'; if(lua_gettop(L) > 2) switch( lua_type(L, 3 )){ case LUA_TNUMBER: ch = lua_tointeger(L, 3 ); break; case LUA_TSTRING: ch = *lua_tostring(L, 3 ); break; default : lua_pushnil(L); lua_pushstring(L, "Hline() expects an integer or a string"); return 2; } if(whline( *w, ch, n ) == ERR){ lua_pushnil(L); lua_pushstring(L, "whline() returned an error"); return 2; } return 0; }
static void gnt_combo_box_draw(GntWidget *widget) { GntComboBox *box = GNT_COMBO_BOX(widget); char *text = NULL, *s; GntColorType type; int len; if (box->dropdown && box->selected) text = gnt_tree_get_selection_text(GNT_TREE(box->dropdown)); if (text == NULL) text = g_strdup(""); if (gnt_widget_has_focus(widget)) type = GNT_COLOR_HIGHLIGHT; else type = GNT_COLOR_NORMAL; wbkgdset(widget->window, '\0' | gnt_color_pair(type)); s = (char*)gnt_util_onscreen_width_to_pointer(text, widget->priv.width - 4, &len); *s = '\0'; mvwaddstr(widget->window, 1, 1, C_(text)); whline(widget->window, ' ' | gnt_color_pair(type), widget->priv.width - 4 - len); mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL)); mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | gnt_color_pair(GNT_COLOR_NORMAL)); wmove(widget->window, 1, 1); g_free(text); GNTDEBUG; }
void print_ids_labels(WINDOW *win) { wattrset(win, BOXATTR); wmove(win, 0, 35 * COLS / 80); whline(win, ACS_HLINE, 23 * COLS / 80); wmove(win, 0, 25 * COLS / 80); wprintw(win, " Probe "); wmove(win, 0, 30 * COLS / 80); wprintw(win, " Assoc "); wmove(win, 0, 35 * COLS / 80); wprintw(win, " ReAssoc "); wmove(win, 0, 41 * COLS / 80); wprintw(win, " DisAssoc "); wmove(win, 0, 49 * COLS / 80); wprintw(win, " Auth "); wmove(win, 0, 53 * COLS / 80); wprintw(win, " DeAuth "); wmove(win, 0, 60 * COLS / 80); wprintw(win, " Status "); wmove(win, 0, 70 * COLS / 80); wprintw(win, " Diagnosis "); update_panels(); doupdate(); }
void split(WINDOW *win) { int x, y; wattrset(win, COLOR_PAIR(2)); whline(win, ACS_HLINE, WINDOW_WIDTH - 1); getyx(win, y, x); wmove(win, y + 1, x); }
int mvhline(int y, int x, chtype ch, int n) { PDC_LOG(("mvhline() - called\n")); if (move(y, x) == ERR) return ERR; return whline(stdscr, ch, n); }
int mvwhline(WINDOW *win, int y, int x, chtype ch, int n) { PDC_LOG(("mvwhline() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return whline(win, ch, n); }
void cCursesOsd::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color) { SetColor(Color, Color); for (int y = y1; y <= y2; y++) { wmove(window, y, x1); // ncurses wants 'y' before 'x'! whline(window, ' ', x2 - x1 + 1); } wsyncup(window); // shouldn't be necessary because of 'syncok()', but w/o it doesn't work }
void do_whline(state *st) { int arity; long slot, ch, max; ei_decode_tuple_header(st->args, &(st->index), &arity); ei_decode_long(st->args, &(st->index), &slot); ei_decode_long(st->args, &(st->index), &ch); ei_decode_long(st->args, &(st->index), &max); encode_ok_reply(st, whline(st->win[slot], (chtype)ch, (int)max)); }
void wnicebox(WINDOW *win, int y, int x, int height, int width, char *boxname) { height += 1; width += 1; wattrset(win, modify_attr(COLOR_PAIR(C_BORDER))); mvwaddch(win, y, x, ACS_ULCORNER); whline(win, ACS_HLINE, width); mvwaddch(win, y, x + width, ACS_URCORNER); mvwaddch(win, y + height, x, ACS_LLCORNER); whline(win, ACS_HLINE, width); mvwaddch(win, y + height, x + width, ACS_LRCORNER); mvwvline(win, y + 1, x + width, ACS_VLINE, height - 1); mvwvline(win, y + 1, x, ACS_VLINE, height - 1); mvwprintw(win, y, x + 2, boxname); return; }
void display(int signo) { int j; sigset_t set; struct mode *p; sigemptyset(&set); sigaddset(&set, SIGALRM); sigprocmask(SIG_BLOCK, &set, NULL); /* Get the load average over the last minute. */ (void)getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])); (*curmode->c_fetch)(); if (curmode->c_flags & CF_LOADAV) { j = 5.0*avenrun[0] + 0.5; dellave -= avenrun[0]; if (dellave >= 0.0) c = '<'; else { c = '>'; dellave = -dellave; } if (dellave < 0.1) c = '|'; dellave = avenrun[0]; wmove(wload, 0, 0); wclrtoeol(wload); whline(wload, c, (j > 50) ? 50 : j); if (j > 50) wprintw(wload, " %4.1f", avenrun[0]); } (*curmode->c_refresh)(); if (curmode->c_flags & CF_LOADAV) wrefresh(wload); wrefresh(wnd); move(CMDLINE, col); refresh(); if (allflag && signo==SIGALRM) { if (allcounter >= turns){ p = curmode; p++; if (p->c_name == NULL) p = modes; switch_mode(p); allcounter=0; } else allcounter++; } sigprocmask(SIG_UNBLOCK, &set, NULL); alarm(naptime); }
void drawMain(){ clear(); attron(COLOR_PAIR(1)); wprintw(win,"RF24Gateway Ncurses Interface by TMRh20 - 2015\n"); whline(win,ACS_HLINE, maxY-2); attroff(COLOR_PAIR(1)); refresh(); /** Display Network Interface Info **/ /*******************************/ //Interface Information struct ifaddrs *ifap, *ifa; int family,s,n; char host[NI_MAXHOST]; retryIF: getifaddrs (&ifap); for (ifa = ifap, n=0; ifa != NULL; ifa = ifa->ifa_next, n++) { if ( tunStr.compare(ifa->ifa_name) != 0 || ifa->ifa_addr == NULL){ if(ifa->ifa_next == NULL ){ drawCfg(0); goto retryIF; }else{ continue; } } mvwprintw(win,2,0,"%8s ", ifa->ifa_name); family = ifa->ifa_addr->sa_family; //This is an IP interface, display the IP if (family == AF_INET || family == AF_INET6) { s = getnameinfo(ifa->ifa_addr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); if (s == 0) { wprintw(win,"IP: %s\n", host); std::string str1 = host; unsigned found = str1.find_last_of("."); subIP = str1.substr(0,found); break; } } } mvwhline(win,15,1,ACS_HLINE, maxY-2); refresh(); }
int File_Entry(CELL * c) { wmove(c->window, c->srow - 2, c->scol - 1); wborder(c->window, 0, 0, 0, 0, 0, 0, 0, 0); mvwaddch(c->window, c->srow - 1, c->max_cols, ACS_RTEE); mvwaddch(c->window, c->srow - 1, c->scol - 1, ACS_LTEE); wmove(c->window, c->srow - 1, c->scol); whline(c->window, ACS_HLINE, c->max_cols - c->scol); mvwaddch(c->window, c->erow + 1, c->scol - 1, ACS_LTEE); mvwaddch(c->window, c->erow + 1, c->max_cols, ACS_RTEE); wmove(c->window, c->erow + 1, c->scol); whline(c->window, ACS_HLINE, c->max_cols - c->scol); wrefresh(c->window); c->current = c->list_start = c->list_end = c->start; return TRUE; }
/** * reset_active_win() * ------------------ * handy function for turning "ACTIVE" status on & off on a given * window. **/ void reset_active_win(WINDOW *win, int toggle) { if (toggle){ wattrset(win, ACTIVEATTR); mvwprintw(win, win->_maxy, win->_maxx - 10, " ACTIVE "); } else{ wattrset(win, BOXATTR); wmove(win, win->_maxy, win->_maxx - 10); whline(win, ACS_HLINE, 8); } }
void curses_window_blank(WINDOW *w) { unsigned int i; for (i = 0; i <= ymax; i++) { wmove(w, i, 0); whline(w, ' ', xmax); } wrefresh(w); }
int hline(chtype h, int n) { int code; #ifdef M_CURSES_TRACE __m_trace("hline(%ld, %d)", h, n); #endif code = whline(stdscr, h, n); return __m_return_code("hline", code); }
void tic_display_board_nc(void){ refresh(); ticwin = newwin(0, 0, 0, 0); getmaxyx(ticwin,hscr,wscr); hbrd = hscr; wbrd = wscr; hcel = hbrd / 3; wcel = wbrd / 3; box(ticwin, 0 , 0); /* 0, 0 gives default characters */ wrefresh(ticwin); wmove(ticwin, hcel, 0); whline(ticwin, '-', wbrd); wmove(ticwin, 2*hcel, 0); whline(ticwin, '-', wbrd); wmove(ticwin, 0, wcel); wvline(ticwin, '|', hbrd); wmove(ticwin, 0, 2*wcel); wvline(ticwin, '|', hbrd); start_color(); init_pair(1, COLOR_BLACK, COLOR_WHITE); wbkgd(ticwin, COLOR_PAIR(1)); wrefresh(ticwin); //mvprintw(0,0,"wscr=%d, hscr=%d, wbrd=%d, hbrd=%d, wcel=%d, hcel=%d\n", wscr, hscr, wbrd, hbrd, wcel, hcel); //mvprintw(2,0,"wscr=%d, hscr=%d, wbrd=%d, hbrd=%d, wcel=%d, hcel=%d\n", wscr, hscr, wbrd, hbrd, wcel, hcel); //mvprintw(4,0,"wscr=%d, hscr=%d, wbrd=%d, hbrd=%d, wcel=%d, hcel=%d\n", wscr, hscr, wbrd, hbrd, wcel, hcel); //wmove(ticwin, hcel, 0); whline(ticwin, '-', 3*wcel); //move(hbrd-3, wbrd); hline('-', 3*wcel); //move(hbrd-(1*hcel), wbrd-(3*wcel)); hline('-', 3*wcel); //move(hbrd-(1*hcel), wbrd-(1*wcel)); hline('-', 3*wcel); //move(hbrd-(3*hcel), wbrd-(3*wcel)); vline('-', 3*hcel); //move(hbrd-(3*hcel), wbrd-(3*wcel)); vline('-', 3*hcel); #if 0 mvprintw((hscr/2)-5, (wscr/2)-4, " | | "); mvprintw((hscr/2)-4, (wscr/2)-4, "-------"); mvprintw((hscr/2)-3, (wscr/2)-4, " | | "); mvprintw((hscr/2)-2, (wscr/2)-4, "-------"); mvprintw((hscr/2)-1, (wscr/2)-4, " | | "); #endif //refresh(); }
/** * Erase a grid of space * Hack -- try to be "semi-efficient". */ static errr Term_wipe_gcu(int x, int y, int n) { term_data *td = (term_data *)(Term->data); wmove(td->win, y, x); if (x + n >= td->t.wid) /* Clear to end of line */ wclrtoeol(td->win); else /* Clear some characters */ whline(td->win, ' ', n); return 0; }
void ConfirmationView::paint_into(WINDOW *view, State state) { int height, width; getmaxyx(view, height, width); (void)height; wattrset(view, UI::Colors::dialog(state == State::Focused)); whline(view, ' ', width); int row = 0; mvwaddnstr(view, row++, 0, _spec.text.c_str(), width); for (std::string line: _spec.supplement) { mvwhline(view, row, 0, ' ', width); mvwaddnstr(view, row, 2, line.c_str(), width - 2); ++row; } }
int mvhline(int y, int x, chtype h, int n) { int code; #ifdef M_CURSES_TRACE __m_trace("mvhline(%d, %d, %ld, %d)", y, x, h, n); #endif if ((code = wmove(stdscr, y, x)) == OK) code = whline(stdscr, h, n); return __m_return_code("mvhline", code); }
int mvwhline(WINDOW *w, int y, int x, chtype h, int n) { int code; #ifdef M_CURSES_TRACE __m_trace("mvwhline(%p, %d, %d, %ld, %d)", w, y, x, h, n); #endif if ((code = wmove(w, y, x)) == OK) code = whline(w, h, n); return __m_return_code("mvwhline", code); }
WINDOW *create_newgrid(int starty, int startx, int nbRow, int nbCol, int spaceBetween, bool gameOverRh) { WINDOW *local_win; local_win = newwin(nbRow * spaceBetween + 1, nbCol * (spaceBetween * 2) + 1, starty, startx); box(local_win, 0, 0); /* 0, 0 gives default characters * for the vertical and horizontal * lines */ for (int i = 1; i < spaceBetween * nbRow; i++) { wmove(local_win, spaceBetween*i, 1); whline(local_win, 0, (nbRow * spaceBetween)*2 - 2); } for (int i = 1; i < spaceBetween * nbCol; i++) { wmove(local_win, 1, (spaceBetween * i)*2); wvline(local_win, 0, nbRow * spaceBetween - 1); } wmove(local_win, 0, 0); if (gameOverRh) { wmove(local_win, (spaceBetween)*2, (spaceBetween * 2) * nbCol); wattron(local_win, COLOR_PAIR(1)); //COLOR init with init_pair wattron(local_win, A_BOLD); //Bold char wvline(local_win, '#', spaceBetween + 1); wattroff(local_win, A_BOLD); wattroff(local_win, COLOR_PAIR(1)); } else { wmove(local_win, spaceBetween * nbRow, (spaceBetween * 2)); wattron(local_win, COLOR_PAIR(1)); //COLOR init with init_pair wattron(local_win, A_BOLD); //Bold char whline(local_win, '#', (spaceBetween * 2)*2 + 1); wattroff(local_win, A_BOLD); wattroff(local_win, COLOR_PAIR(1)); } wrefresh(local_win); /* Show that box */ return local_win; }
/* * draw the borders and title */ static void wdg_percentage_border(struct wdg_object *wo) { WDG_WO_EXT(struct wdg_percentage, ww); size_t c = wdg_get_ncols(wo); /* the object was focused */ if (wo->flags & WDG_OBJ_FOCUSED) { wattron(ww->win, A_BOLD); wbkgdset(ww->win, COLOR_PAIR(wo->focus_color)); } else wbkgdset(ww->win, COLOR_PAIR(wo->border_color)); /* draw the borders */ box(ww->win, 0, 0); /* set the title color */ wbkgdset(ww->win, COLOR_PAIR(wo->title_color)); /* there is a title: print it */ if (wo->title) { wmove(ww->sub, 1, 2); wprintw(ww->sub, wo->title); } /* restore the attribute */ if (wo->flags & WDG_OBJ_FOCUSED) wattroff(ww->win, A_BOLD); /* draw the percentage bar */ wmove(ww->sub, 3, 2); whline(ww->sub, ACS_CKBOARD, c - 6); wbkgdset(ww->sub, COLOR_PAIR(wo->title_color)); //wattron(ww->sub, A_REVERSE); whline(ww->sub, ' ', ww->percent * (c - 6) / 100); //wattroff(ww->sub, A_REVERSE); }
void show_stdd( WINDOW *win, float std ) { wmove( win, 1, 1 ); wattron( win, A_BOLD ); wprintw( win, "Std Dev\n" ); wattroff( win, A_BOLD ); wmove( win, 2, 1 ); whline( win, 0, 5000 ); wmove( win, 3, 1 ); if( res_number > 0 ) wprintw( win, "%.2f\n", std ); else wprintw( win, "No Values\n" ); }
static void setlabels(WINDOW *win, int mode) { wmove(win, 0, 42 * COLS / 80); whline(win, ACS_HLINE, 23 * COLS / 80); if (mode == 0) { mvwprintw(win, 0, 47 * COLS / 80, " Packets "); mvwprintw(win, 0, 59 * COLS / 80, " Bytes "); } else if (mode == 1) { mvwprintw(win, 0, 47 * COLS / 80, " Source MAC Addr "); } else if (mode == 2) { mvwprintw(win, 0, 45 * COLS / 80, " Pkt Size "); mvwprintw(win, 0, 56 * COLS / 80, " Win Size "); } }