| 403 | } |
| 404 | |
| 405 | virtual void render(int x, int y, int w) |
| 406 | { |
| 407 | int c = greyedout ? 128 : 255; |
| 408 | bool sel = isselection(); |
| 409 | if(sel) |
| 410 | { |
| 411 | renderbg(x+w-menurighttabwidth, y-FONTH/6, menurighttabwidth, menuselbgcolor); |
| 412 | renderbg(x, y-FONTH/6, w-menurighttabwidth-FONTH/2, menuseldescbgcolor); |
| 413 | } |
| 414 | draw_text(text, x, y, c, c, c); |
| 415 | int cibl = (int)strlen(input.buf); // current input-buffer length |
| 416 | int iboff = input.pos > 14 ? (input.pos < cibl ? input.pos - 14 : cibl - 14) : (input.pos == -1 ? (cibl > 14 ? cibl - 14 : 0) : 0); // input-buffer offset |
| 417 | string showinput, tempinputbuf; int sc = 14; |
| 418 | copystring(tempinputbuf, input.buf); |
| 419 | if(hideinput && !(SDL_GetModState() & MOD_KEYS_CTRL)) |
| 420 | { // "mask" user input with asterisks, use for menuitemtextinputs that take passwords |
| 421 | for(char *c = tempinputbuf; *c; c++) |
| 422 | *c = '*'; |
| 423 | } |
| 424 | while(iboff > 0) |
| 425 | { |
| 426 | copystring(showinput, tempinputbuf + iboff - 1, sc + 2); |
| 427 | if(text_width(showinput) > menurighttabwidth) break; |
| 428 | iboff--; sc++; |
| 429 | } |
| 430 | while(iboff + sc < cibl) |
| 431 | { |
| 432 | copystring(showinput, tempinputbuf + iboff, sc + 2); |
| 433 | if(text_width(showinput) > menurighttabwidth) break; |
| 434 | sc++; |
| 435 | } |
| 436 | copystring(showinput, tempinputbuf + iboff, sc + 1); |
| 437 | draw_text(showinput, x+w-menurighttabwidth, y, c, c, c, 255, sel && !greyedout ? (input.pos>=0 ? (input.pos > sc ? sc : input.pos) : cibl) : -1); |
| 438 | } |
| 439 | |
| 440 | virtual void focus(bool on) |
| 441 | { |
nothing calls this directly
no test coverage detected