int slk_restore() { int i, code = ERR; #ifdef M_CURSES_TRACE __m_trace("slk_clear(void)"); #endif if (__m_screen->_slk._w != (WINDOW *) 0) { for (i = 0; i < 8; ++i) { if (__m_screen->_slk._labels[i] != (char *) 0) { (void) slk_set( i, __m_screen->_slk._labels[i], __m_screen->_slk._justify[i] ); } } code = slk_refresh(); } else if (label_on != (char *) 0) { (void) tputs(label_on, 1, __m_outc); (void) fflush(__m_screen->_of); code = OK; } return __m_return_code("slk_clear", code); }
/*** Refresh the soft label key area. @function slk_refresh @treturn bool `true`, if successful @see slk_refresh(3x) @see curses.window:refresh */ static int Pslk_refresh(lua_State *L) { #if LCURSES_POSIX_COMPLIANT return pushokresult(slk_refresh()); #else return binding_notimplemented(L, "slk_refresh", "curses"); #endif }
slk_restore(void) { T((T_CALLED("slk_restore()"))); if (SP->_slk == NULL) return (ERR); SP->_slk->hidden = FALSE; SP->_slk->dirty = TRUE; returnCode(slk_refresh()); }
NCURSES_SP_NAME(slk_restore) (NCURSES_SP_DCL0) { T((T_CALLED("slk_restore()"))); if (SP_PARM->_slk == NULL) return (ERR); SP_PARM->_slk->hidden = FALSE; SP_PARM->_slk->dirty = TRUE; returnCode(slk_refresh()); }
static void slk_setup( const int slk_format) { int i; static int old_format = 0xa; if( slk_format != old_format) slk_init( slk_format); old_format = slk_format; for( i = 0; labels[i]; i++) slk_set( i + 1, labels[i], 1); slk_refresh( ); }
int slk_restore(void) { SLK *slk = SP->_slk; T(("slk_restore()")); if (slk == NULL) return ERR; slk->hidden = FALSE; slk->dirty = TRUE; return slk_refresh(); }
slk_restore(void) { T((T_CALLED("slk_restore()"))); if (SP->_slk == NULL) return (ERR); SP->_slk->hidden = FALSE; SP->_slk->dirty = TRUE; /* we have to repaint info line eventually */ slk_paint_info(SP->_slk->win); returnCode(slk_refresh()); }
int main(void) { char labels[LCOUNT][19] = { "Help!", "File", "Print", "Text", "Edit", "Quick", "Config", "System" }; int x; slk_init(0); initscr(); for(x=0;x<LCOUNT;x++) slk_set(x+1,labels[x],CENTER); slk_attron(A_BOLD); slk_refresh(); getch(); endwin(); return 0; }
int main(void) { slk_init(0); initscr(); slk_set(1,"Help!",LEFT); slk_set(2,"File",LEFT); slk_set(3,"Print",LEFT); slk_set(4,"Text",CENTER); slk_set(5,"Edit",CENTER); slk_set(6,"Quick",RIGHT); slk_set(7,"Conf",RIGHT); slk_set(8,"Change",RIGHT); slk_refresh(); getch(); endwin(); return 0; }
int main() { char label_text[LMAX][6] = { "Help", "File", "Edit", "Frmt", "Find", "Block", "Ins", "Del", "View", "Switch", "Win", "Help" }; int label; slk_init(3); initscr(); for(label=0;label<LMAX;label++) slk_set(label+1,label_text[label],CENTER); slk_refresh(); getch(); endwin(); return 0; }
int main(void) { char labels[LCOUNT][19] = { "Help!", "File", "Print", "Text", "Edit", "Quick", "Config", "System" }; int x; slk_init(0); initscr(); start_color(); init_pair(1,COLOR_BLUE,COLOR_WHITE); slk_color(1); for(x=0; x<LCOUNT; x++) slk_set(x+1,labels[x],CENTER); slk_refresh(); getch(); endwin(); return 0; }
int main() { char label_text[LMAX][8] = { "S", "O", "F", "T", "K", "E", "Y", "S" }; int label; slk_init(1); initscr(); for(label=0;label<LMAX;label++) slk_set(label+1,label_text[label],CENTER); slk_refresh(); getch(); slk_clear(); getch(); slk_restore(); getch(); endwin(); return 0; }
int main() { char label_text[LMAX][20] = { "I", "AM", "SAM", "DO", "NOT", "LIKE", "THAT", "SAY", "WOULD", "COULD", "YOU", "GREEN EGGS AND HAM" }; int label,ch; slk_init(2); /* 12 soft labels */ initscr(); noecho(); /* disable key echoing */ keypad(stdscr,TRUE); /* Turn on Fkey reading */ /* display the labels and instructions */ for(label=0;label<LMAX;label++) slk_set(label+1,label_text[label],CENTER); slk_refresh(); addstr("Use the Function Keys to type\n"); addstr("Press '?' or '!' or '.' to end a line\n"); addstr("Press Enter to quit\n\n"); refresh(); /* Process input */ while( (ch=getch()) != '\n') { switch(ch) { case '?': case '!': case '.': addch(ch); addch('\n'); break; case KEY_F(1): printw("%s ",label_text[0]); break; case KEY_F(2): printw("%s ",label_text[1]); break; case KEY_F(3): printw("%s ",label_text[2]); break; case KEY_F(4): printw("%s ",label_text[3]); break; case KEY_F(5): printw("%s ",label_text[4]); break; case KEY_F(6): printw("%s ",label_text[5]); break; case KEY_F(7): printw("%s ",label_text[6]); break; case KEY_F(8): printw("%s ",label_text[7]); break; case KEY_F(9): printw("%s ",label_text[8]); break; case KEY_F(10): printw("%s ",label_text[9]); break; case KEY_F(11): printw("%s ",label_text[10]); break; case KEY_F(12): printw("%s ",label_text[11]); break; default: break; } refresh(); } endwin(); return 0; }
static void slk_test(void) /* exercise the soft keys */ { int c, fmt = 1; char buf[9]; c = CTRL('l'); do { switch(c) { case CTRL('l'): erase(); attron(A_BOLD); mvaddstr(0, 20, "Soft Key Exerciser"); attroff(A_BOLD); move(2, 0); P("Available commands are:"); P(""); P("^L -- refresh screen"); P("a -- activate or restore soft keys"); P("d -- disable soft keys"); P("c -- set centered format for labels"); P("l -- set left-justified format for labels"); P("r -- set right-justified format for labels"); P("[12345678] -- set label; labels are numbered 1 through 8"); P("e -- erase stdscr (should not erase labels)"); P("s -- test scrolling of shortened screen"); P("x, q -- return to main menu"); P(""); P("Note: if activating the soft keys causes your terminal to"); P("scroll up one line, your terminal auto-scrolls when anything"); P("is written to the last screen position. The ncurses code"); P("does not yet handle this gracefully."); refresh(); /* fall through */ case 'a': slk_restore(); break; case 'e': wclear(stdscr); break; case 's': move(20, 0); while ((c = getch()) != 'Q') addch(c); break; case 'd': slk_clear(); break; case 'l': fmt = 0; break; case 'c': fmt = 1; break; case 'r': fmt = 2; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': (void) mvaddstr(20, 0, "Please enter the label value: "); wgetnstr(stdscr, buf, 8); slk_set((c - '0'), buf, fmt); slk_refresh(); break; case 'x': case 'q': goto done; default: beep(); } } while ((c = getch()) != EOF); done: erase(); endwin(); }
SCM gucu_slk_refresh () { int ret = slk_refresh (); RETURNTF (ret); }