sources/interface.cpp

changeset 89
777b2a10b835
parent 88
08ccaf26cffd
child 91
ac02cf1c3576
equal deleted inserted replaced
88:08ccaf26cffd 89:777b2a10b835
39 39
40 static const int g_pageSize = 10; 40 static const int g_pageSize = 10;
41 41
42 // ------------------------------------------------------------------------------------------------- 42 // -------------------------------------------------------------------------------------------------
43 // 43 //
44 int Interface::color_pair (Color fg, Color bg) 44 chtype Interface::color_pair (Color fg, Color bg)
45 { 45 {
46 return COLOR_PAIR (1 + (int (fg) * NUM_COLORS) + int (bg)); 46 return COLOR_PAIR (1 + (int (fg) * NUM_COLORS) + int (bg));
47 } 47 }
48 48
49 // ------------------------------------------------------------------------------------------------- 49 // -------------------------------------------------------------------------------------------------
207 // 207 //
208 void Interface::render_titlebar() 208 void Interface::render_titlebar()
209 { 209 {
210 if (Title.length() <= COLS) 210 if (Title.length() <= COLS)
211 { 211 {
212 int pair = color_pair (WHITE, BLUE); 212 chtype pair = color_pair (WHITE, BLUE);
213 int startx = (COLS - Title.length()) / 2; 213 int startx = (COLS - Title.length()) / 2;
214 int endx = startx + Title.length(); 214 int endx = startx + Title.length();
215 attron (pair); 215 attron (pair);
216 mvprintw (0, startx, "%s", Title.chars()); 216 mvprintw (0, startx, "%s", Title.chars());
217 mvhline (0, 0, ' ', startx); 217 mvhline (0, 0, ' ', startx);
434 434
435 // ------------------------------------------------------------------------------------------------- 435 // -------------------------------------------------------------------------------------------------
436 // 436 //
437 void Interface::render_input() 437 void Interface::render_input()
438 { 438 {
439 int promptColor = color_pair (WHITE, BLUE); 439 chtype promptColor = color_pair (WHITE, BLUE);
440 440
441 // If we're asking the user if they want to disconnect, we don't render any input strings, 441 // If we're asking the user if they want to disconnect, we don't render any input strings,
442 // just the confirmation message. 442 // just the confirmation message.
443 if (CurrentInputState == INPUTSTATE_CONFIRM_DISCONNECTION) 443 if (CurrentInputState == INPUTSTATE_CONFIRM_DISCONNECTION)
444 { 444 {
495 495
496 // ------------------------------------------------------------------------------------------------- 496 // -------------------------------------------------------------------------------------------------
497 // 497 //
498 void Interface::render_statusbar() 498 void Interface::render_statusbar()
499 { 499 {
500 int color = color_pair (WHITE, BLUE); 500 chtype color = color_pair (WHITE, BLUE);
501 int y = LINES - 1; 501 int y = LINES - 1;
502 attron (color); 502 attron (color);
503 mvhline (y, 0, ' ', COLS); 503 mvhline (y, 0, ' ', COLS);
504 mvprintw (y, 0, "%s", StatusBarText.chars()); 504 mvprintw (y, 0, "%s", StatusBarText.chars());
505 attroff (color); 505 attroff (color);
812 } 812 }
813 } 813 }
814 break; 814 break;
815 815
816 case '\n': 816 case '\n':
817 case '\r':
817 case KEY_ENTER: 818 case KEY_ENTER:
818 switch (CurrentInputState) 819 switch (CurrentInputState)
819 { 820 {
820 case INPUTSTATE_CONFIRM_DISCONNECTION: 821 case INPUTSTATE_CONFIRM_DISCONNECTION:
821 break; // handled above 822 break; // handled above

mercurial