pos_menu_cursor(const MENU * menu) { WINDOW *win, *sub; int x = 0, y = 0; int err = _nc_menu_cursor_pos(menu, (ITEM *) 0, &y, &x); T((T_CALLED("pos_menu_cursor(%p)"), (const void *)menu)); if (E_OK == err) { win = Get_Menu_UserWin(menu); sub = menu->usersub ? menu->usersub : win; assert(win && sub); if ((menu->opt & O_SHOWMATCH) && (menu->pindex > 0)) x += (menu->pindex + menu->marklen - 1); wmove(sub, y, x); if (win != sub) { wcursyncup(sub); wsyncup(sub); untouchwin(sub); } } RETURN(err); }
/*--------------------------------------------------------------------------- | Facility : libnmenu | Function : pos_menu_cursor | | Description : Position logical cursor to current item in menu | | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid menu | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ int pos_menu_cursor(const MENU * menu) { WINDOW *win, *sub; int x, y; int err = _nc_menu_cursor_pos(menu,(ITEM*)0,&y,&x); if (E_OK==err) { win = menu->userwin ? menu->userwin : stdscr; sub = menu->usersub ? menu->usersub : win; assert(win && sub); if ((menu->opt & O_SHOWMATCH) && (menu->pindex > 0)) x += ( menu->pindex + menu->marklen - 1); wmove(sub,y,x); if ( win != sub ) { wcursyncup(sub); wsyncup(sub); untouchwin(sub); } } RETURN(err); }
void hexedit_set_cursor(struct hexedit *buf) { wmove(buf->win, max_rows(buf->win), 0); wattron(buf->win, A_REVERSE | A_STANDOUT); wclrtoeol(buf->win); if (buf->cursor_offset < buf->len) { wprintw(buf->win, "Len:%lu Off:%lu Val:0x%X", buf->len, buf->cursor_offset, buf->data[buf->cursor_offset]); } else { wprintw(buf->win, "Len:%lu Off:%lu", buf->len, buf->cursor_offset); } wattroff(buf->win, A_REVERSE | A_STANDOUT); wmove(buf->win, buf->cursor_y, buf->cursor_x); wcursyncup(buf->win); wsyncup(buf->win); untouchwin(buf->win); }
/** * Render a fieldset to its window. * * @param fieldset the fieldset */ void fieldset_render(struct fieldset * fieldset) { int i; int x; struct field * field = fieldset->active_field; assert(fieldset->active_field != NULL); /* * Render the fields */ for (i = 0; i < fieldset->fields_n; i++) { if ((fieldset->active_field == fieldset->fields[i]) && (fieldset->inactive == Q_FALSE)) { field_render(fieldset->fields[i], fieldset->window, Q_TRUE); } else { field_render(fieldset->fields[i], fieldset->window, Q_FALSE); } } /* * Drop the cursor */ if ((field->position > field->width) && (field->fixed == Q_TRUE)) { x = field->x + field->width; } else if ((field->position - field->window_start == field->width) && (field->fixed == Q_FALSE)) { x = field->x + field->width - 1; } else { x = field->x + field->position - field->window_start; } screen_win_move_yx(fieldset->window, field->y, x); /* * Push the changes to the display */ screen_win_flush(fieldset->window); wcursyncup((WINDOW *) fieldset->window); }
void c_ecurses_wcursyncup (EIF_POINTER w) { wcursyncup((WINDOW *) w) ; };
void gotoxy(int x, int y) { wmove(win, y - 1, x - 1); wcursyncup(win); }