static void render_ui(ui_t *ui) { chat_tab = COLS-12; log_tab = COLS-6; render_tab_bar(ACTIVE_CHAT); ui->screen = newwin(LINES - 6, COLS - 1, 1, 1); scrollok(ui->screen, TRUE); box(ui->screen, 0, 0); ui->next_line = 1; CHAT = new_panel(ui->screen); chat_history = ui_history_create(); ui->log = newwin(LINES - 6, COLS - 1, 1, 1); scrollok(ui->log, TRUE); box(ui->log, 0, 0); ui->next_log_line = 1; LOG = new_panel(ui->log); log_history = ui_history_create(); ui->alert = newwin(3, COLS, 1, 0); ALERT = new_panel(ui->alert); set_panel_userptr(CHAT, LOG); set_panel_userptr(LOG, ALERT); set_panel_userptr(ALERT, CHAT); top_panel(CHAT); hide_panel(LOG); hide_panel(ALERT); update_panels(); doupdate(); ui->prompt = newwin(4, COLS - 1, LINES - 5, 1); show_prompt(ui, NULL); }
void tx_hide_listbox(struct scroll_list *list) { hide_panel(list->panel); hide_panel(list->borderpanel); update_panels(); doupdate(); }
int del_panel(PANEL *p) { if (__predict_false(p == NULL)) return ERR; (void) hide_panel(p); free(p); /* * If the last panel is removed, remove the phantom stdscr * panel as well. * * A program that wants to switch to a different screen with * set_term(3), or ends and recreates curses session with * endwin(3)/initscr(3), must delete all panels first, since * their windows will become invalid. When it will create its * first new panel afterwards, it will pick up new stdscr. */ if (TAILQ_LAST(&_deck, deck) == &_stdscr_panel) { (void) hide_panel(&_stdscr_panel); assert(TAILQ_EMPTY(&_deck)); } return OK; }
void menupan_hide(MENUPAN *menupan) { assert(menupan); hide_panel(menupan->win); hide_panel(menupan->sub); }
void drawpause() { if (game.paused) { box(stdscr, false, false); wattrset(stdscr, A_BOLD); mvwprintw(stdscr, (LINES/2)-1, (COLS/2)-4, "PAUSED"); wattrset(stdscr, A_NORMAL); hide_panel(game.holdpan); hide_panel(game.brdpan); hide_panel(game.sidepan); } }
static void canned_panel(PANEL * px[MAX_PANELS + 1], NCURSES_CONST char *cmd) { int which = cmd[1] - '0'; saywhat(cmd); switch (*cmd) { case 'h': hide_panel(px[which]); break; case 's': show_panel(px[which]); break; case 't': top_panel(px[which]); break; case 'b': bottom_panel(px[which]); break; case 'd': rmpanel(px[which]); break; } pflush(); wgetch(stdscr); }
void show_chat(ui_t *ui) { chat_tab = COLS-12; log_tab = COLS-6; render_tab_bar(ACTIVE_CHAT); hide_panel(ALERT); reset_borders(ui); wclear(ui->screen); wresize(ui->screen, LINES - 6, COLS - 1); restore_history(ui->screen, chat_history, &ui->next_line); box(ui->screen, 0, 0); hide_panel(LOG); top_panel(CHAT); update_panels(); doupdate(); }
void shNCursesInterface::delTempWin () { hide_panel (mPan[kTemp]); del_panel (mPan[kTemp]); update_panels (); }
void show_log(ui_t *ui) { chat_tab = COLS-12; log_tab = COLS-6; render_tab_bar(ACTIVE_LOG); hide_panel(ALERT); reset_borders(ui); wclear(ui->log); wresize(ui->log, LINES - 6, COLS - 1); mvwin(ui->log, 1, 1); restore_history(ui->log, log_history, &ui->next_log_line); box(ui->log, 0, 0); hide_panel(CHAT); top_panel(LOG); update_panels(); doupdate(); }
void console::initQuitDialog() { this -> quit_window = newwin(5, 40, 5, 5); this -> quit_panel = new_panel(this -> quit_window); hide_panel(this -> quit_panel); update_panels(); mvwprintw(this -> quit_window, 2, 2, "Do you want really quit (Y/n)?"); box(this -> quit_window, 0, 0); doupdate(); }
void console::initGameOverDialog() { this -> game_over_window = newwin(5, 15, 5, 5); this -> game_over_panel = new_panel(this -> game_over_window); hide_panel(this -> game_over_panel); update_panels(); mvwprintw(this -> game_over_window, 2, 2, "GAME OVER"); box(this -> game_over_window, 0, 0); doupdate(); }
/** * map_control -- draw a cursor on the screen and accept control from FSM * @ch: the input word from the FSM */ int map_control(int ch) { bool dozoom = false; struct map_t *tmp; if (!nav_win) map_cursor_init(); top_panel(nav_pan); switch (ch) { case MODE_STARTED: map_controls_active = true; cursor->Show(cursor); show_panel(nav_pan); break; /* Scroll the map in a direction */ case 'w': case 'a': case 's': case 'd': case 'W': case 'A': case 'S': case 'D': map_scroll(MAPBOOK->active, ch); break; /* Move the zoom frame in a direction */ case 'h': case 'j': case 'k': case 'l': case 'H': case 'J': case 'K': case 'L': cursor->Move(cursor, ch); break; /* Select the current zoom frame */ case '\n': dozoom = true; break; case KEY_ESC: case 'm': map_controls_active = false; show_dock(); cursor->Hide(cursor); hide_panel(nav_pan); return MODE_RELEASE; } /* Adjust for changing y0 or x0 of the map pad */ y_map = pos_y(cursor->pos) + pos_y(ACTIVE->pos); x_map = pos_x(cursor->pos) + pos_x(ACTIVE->pos); zoomlevel = MAPBOOK->page; print_map_control(y_map, x_map); draw_zoom_box(ACTIVE, y_map, x_map); if (dozoom) set_zoom(MAPBOOK, y_map, x_map); return MODE_PERSIST; }
bool top_globalstats_resize(void *ptr, int width, int height, int *consumed_height) { struct globalstat_controller *c = ptr; int i; top_log("%s\n", __func__); *consumed_height = 0; setup_globalstats_geometry(c, width, height, consumed_height); if(ERR == wresize(c->window, *consumed_height, width)) { top_log("wresize error: height %d width %d\n", *consumed_height, width); return true; } if(ERR == move_panel(c->panel, 0, 0)) { top_log("move_panel error: 0 0\n"); return true; } for(i = 0; i < GLOBALSTAT_TOTAL; ++i) { struct globalstat *gs = c->stats + i; // MWW: Skip the frameworks window if we've got them disabled if (!top_prefs_get_frameworks() && (i == GLOBALSTAT_SHAREDLIBS)) continue; if(skip_globalstat(i)) { /* Skip and hide the panels for these. */ hide_panel(gs->panel); continue; } gs = c->stats + i; /* * Avoid errors below by resizing and moving the panel to a known * good size/offfset. */ wresize(gs->window, 1, 1); move_panel(gs->panel, 0, 0); if(ERR == move_panel(gs->panel, gs->y, gs->x)) return true; if(ERR == wresize(gs->window, gs->size.height, gs->size.width)) return true; if(ERR == werase(gs->window)) return true; } return false; }
void console::initNewGameDialog() { this -> new_game_window = newwin(7, 40, 5, 5); this -> new_game_panel = new_panel(this -> new_game_window); hide_panel(this -> new_game_panel); update_panels(); mvwprintw(this -> new_game_window, 2, 2, "Novice"); mvwprintw(this -> new_game_window, 3, 2, "Normal"); mvwprintw(this -> new_game_window, 4, 2, "Hard"); box(this -> new_game_window, 0, 0); doupdate(); }
/* window.["hidden"] = true/false hide or unhide the window. Stack: 1: the instance table 2: the accessed key 3: the value to set */ int lui_window_set_hidden(lua_State *L) { PANEL *p = check_window(L, 1); if (lua_toboolean(L, 3)) /* hidden = true -> hide the window */ hide_panel(p); else /* hidden = false -> show the window */ show_panel(p); update_panels(); return 0; /* TODO: send something ? */ }
void drawctrls() { if (game.paused) { box(stdscr, false, false); wattrset(stdscr, A_BOLD); mvwprintw(stdscr, (LINES/2)-4, (COLS/2)-3, "CONTROLS"); wattrset(stdscr, A_NORMAL); mvwprintw(stdscr, (LINES/2)-3, (COLS/2)-6, "right - right/h"); mvwprintw(stdscr, (LINES/2)-2, (COLS/2)-5, "left - left/l"); mvwprintw(stdscr, (LINES/2)-1, (COLS/2)-7, "rotate - up/k"); mvwprintw(stdscr, (LINES/2)+0, (COLS/2)-5, "down - down/j"); mvwprintw(stdscr, (LINES/2)+1, (COLS/2)-5, "drop - space"); mvwprintw(stdscr, (LINES/2)+2, (COLS/2)-6, "pause - p"); mvwprintw(stdscr, (LINES/2)+3, (COLS/2)-9, "controls - ?"); mvwprintw(stdscr, (LINES/2)+4, (COLS/2)-5, "quit - q"); hide_panel(game.holdpan); hide_panel(game.brdpan); hide_panel(game.sidepan); } }
static int lcp_show_panel(lua_State *L) { PANEL *p = lcp_check(L, 1); if (lua_isnoneornil(L, 2) || lua_toboolean(L, 2)) lua_pushboolean(L, B(show_panel(p))); else lua_pushboolean(L, B(hide_panel(p))); return 1; }
void CWidget::hide() { DEBUG_ui("CWidget::hide [" + _name + "]"); hide_panel(_panel); _visible = false; // Hide subwidgets too if(_layout) _layout->hide(); _changed = true; }
static void remove_tail(struct statistics_controller *c) { int i; for(i = c->get_total_possible(c) - 1; i >= 0; --i) { if(c->state[i].instance && c->state[i].instance->visible) { c->state[i].instance->visible = false; hide_panel(c->state[i].instance->panel); c->total_active_statistics--; return; } } }
static void read_window_close_current(void) { gui_remove_key_listener(&close_listener); if (resize_listener_added) { gui_remove_resize_listener(&resize_listener); resize_listener_added = 0; } hide_panel(read_panel); update_panels(); doupdate(); }
int del_panel(PANEL *pan) { if (pan) { if (_panel_is_linked(pan)) hide_panel(pan); free((char *)pan); return OK; } return ERR; }
int show_panel(PANEL *pan) { if (!pan) return ERR; if (pan == _top_panel) return OK; if (_panel_is_linked(pan)) hide_panel(pan); _panel_link_top(pan); return OK; }
int bottom_panel(PANEL *pan) { if (!pan) return ERR; if (pan == _bottom_panel) return OK; if (_panel_is_linked(pan)) hide_panel(pan); _panel_link_bottom(pan); return OK; }
int bottom_panel(PANEL *p) { if (__predict_false(p == NULL)) return ERR; if (__predict_false(PANEL_HIDDEN(p))) return ERR; (void) hide_panel(p); DECK_INSERT_BOTTOM(p); return OK; }
//------------------------------------------------------------------------------ int del_panel( PANEL* pan ) { __QCS_FCONTEXT( "del_panel" ); if( pan ) { if( _panel_is_linked( pan ) ) { hide_panel( pan ); } free( (char*)pan ); return 0; } return ERR; }
void ui_destroy(ui_t *ui) { // If there is no ui panel, we're done if (!ui || !ui->panel) return; // Hide this panel before destroying hide_panel(ui->panel); // If panel has a destructor function use it if (ui->destroy) ui->destroy(ui->panel); // Initialize panel pointer ui->panel = NULL; }
void show_split(ui_t *ui) { chat_tab = (COLS/2)-7; log_tab = COLS-6; render_tab_bar(ACTIVE_CHAT); hide_panel(ALERT); reset_borders(ui); wresize(ui->screen, LINES - 6, COLS/2 - 1); box(ui->screen, 0, 0); show_panel(CHAT); wresize(ui->log, LINES - 6, COLS/2); mvwin(ui->log, 1, COLS/2); box(ui->log, 0, 0); show_panel(LOG); update_panels(); doupdate(); show_prompt(ui, NULL); }
int display_bridging_locked(WINDOW *mainw,struct panel_state *ps){ memset(ps,0,sizeof(*ps)); if(new_display_panel(mainw,ps,BRIDGEROWS,0,L"press 'b' to dismiss display")){ goto err; } //update_bridge_details(panel_window(ps->p)); return OK; err: if(ps->p){ WINDOW *psw = panel_window(ps->p); hide_panel(ps->p); del_panel(ps->p); delwin(psw); } memset(ps,0,sizeof(*ps)); return ERR; }
int display_network_locked(WINDOW *mainw,struct panel_state *ps){ memset(ps,0,sizeof(*ps)); if(new_display_panel(mainw,ps,NETWORKROWS,0,L"press 'n' to dismiss display")){ goto err; } update_network_details(panel_window(ps->p)); return OK; err: if(ps->p){ WINDOW *psw = panel_window(ps->p); hide_panel(ps->p); del_panel(ps->p); delwin(psw); } memset(ps,0,sizeof(*ps)); return ERR; }
/* * Functions definitions */ void send_xy(out_t *info){ int xy[2]; char buff[BUFF_S]; char tmp[5]; char *lin_col[2]; char *end; int (*attr_ch)(WINDOW*, int); lin_col[0] = "Digite a linha [0-99]: "; lin_col[1] = "Digite a coluna [0-99]: "; flushinp(); show_panel(info->panel); for( int i = 0; i < 2; i++ ){ attr_ch = wattroff; do{ attr_ch(info->win, COLOR_PAIR(1)); memset(tmp, 0, 5); wclear(info->win); box(info->win, 0, 0); mvwaddstr(info->win, 1, 1, lin_col[i]); wgetnstr(info->win, tmp, 5); xy[i] = strtol(tmp, &end, 10); attr_ch = wattron; }while( tmp == end || *end != 0 || xy[i] < 0 || xy[i] > 99 ); } sprintf(buff, "%d*%d", xy[0], xy[1]); send(info->socket, buff, strlen(buff), 0); memset(buff, 0, BUFF_S); hide_panel(info->panel); update_panels(); return; }