MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / inputBox

Function inputBox

lib/imgui/addon/imguitinyfiledialogs.cpp:1481–1548  ·  view source on GitHub ↗

returns NULL on cancel */

Source from the content-addressed store, hash-verified

1479
1480/* returns NULL on cancel */
1481char const * inputBox(
1482 char const * const aTitle , /* NULL or "" */
1483 char const * const aMessage , /* NULL or "" may NOT contain \n nor \t */
1484 char const * const aDefaultInput ) /* "" , if NULL it's a passwordBox */
1485{
1486 static char lBuff [ MAX_PATH_OR_CMD ] ;
1487
1488#ifndef TINYFD_WIN_CONSOLE_ONLY
1489 DWORD mode = 0;
1490 HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);;
1491 if ( ( !tinyfd_forceConsole || !( GetConsoleWindow() || dialogPresent() ) )
1492 && ( !getenv("SSH_CLIENT") || getenv("DISPLAY") ) )
1493 {
1494 lBuff[0]='\0';
1495 return inputBoxWinGui(lBuff,aTitle,aMessage,aDefaultInput);
1496 }
1497 else
1498#endif /* TINYFD_WIN_CONSOLE_ONLY */
1499 if ( dialogPresent() )
1500 {
1501 lBuff[0]='\0';
1502 return inputBoxWinConsole(lBuff,aTitle,aMessage,aDefaultInput);
1503 }
1504 else
1505 {
1506 lBuff[0]='\0';
1507 if ( !gWarningDisplayed )
1508 {
1509 gWarningDisplayed = 1 ;
1510 printf ("\n\n%s\n", gTitle);
1511 printf ("%s\n\n\n", gMessageWin);
1512 }
1513 if ( aTitle && strlen(aTitle) )
1514 {
1515 printf ("%s\n\n", aTitle);
1516 }
1517 if ( aMessage && strlen(aMessage) )
1518 {
1519 printf("%s\n",aMessage);
1520 }
1521 printf("(esc+enter to cancel): ");
1522#ifndef TINYFD_WIN_CONSOLE_ONLY
1523 if ( ! aDefaultInput )
1524 {
1525 GetConsoleMode(hStdin,&mode);
1526 SetConsoleMode(hStdin,mode & (~ENABLE_ECHO_INPUT) );
1527 }
1528#endif /* TINYFD_WIN_CONSOLE_ONLY */
1529 fgets(lBuff, MAX_PATH_OR_CMD, stdin);
1530#ifndef TINYFD_WIN_CONSOLE_ONLY
1531 if ( ! aDefaultInput )
1532 {
1533 SetConsoleMode(hStdin,mode);
1534 printf ("\n");
1535 }
1536#endif /* TINYFD_WIN_CONSOLE_ONLY */
1537 printf ("\n");
1538 if ( strchr(lBuff,27) )

Callers 5

saveFileDialogFunction · 0.85
openFileDialogFunction · 0.85
selectFolderDialogFunction · 0.85
colorChooserFunction · 0.85

Calls 3

dialogPresentFunction · 0.85
inputBoxWinGuiFunction · 0.85
inputBoxWinConsoleFunction · 0.85

Tested by

no test coverage detected