mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-05 12:15:19 +02:00
Add support for changing the InputBox's title to the description text provided by the game(or the emulator itself). If none is provided(empty string), fall back to a default string.
This commit is contained in:
@@ -4,12 +4,14 @@
|
||||
|
||||
static TCHAR textBoxContents[256];
|
||||
static TCHAR out[256];
|
||||
static TCHAR windowTitle[256];
|
||||
|
||||
static INT_PTR CALLBACK InputBoxFunc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(GetDlgItem(hDlg,IDC_INPUTBOX),textBoxContents);
|
||||
SetWindowText(hDlg, windowTitle);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
@@ -51,11 +53,21 @@ bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defa
|
||||
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defaultvalue, TCHAR *outvalue, u32 outlength)
|
||||
{
|
||||
const char *defaultTitle = "Input value";
|
||||
|
||||
if (defaultvalue && strlen(defaultvalue)<255)
|
||||
strcpy(textBoxContents,defaultvalue);
|
||||
else
|
||||
strcpy(textBoxContents,"");
|
||||
|
||||
|
||||
if(title && strlen(title) <= 0)
|
||||
strcpy(windowTitle, defaultTitle);
|
||||
else if(title && strlen(title) < 255)
|
||||
strcpy(windowTitle, title);
|
||||
else
|
||||
strcpy(windowTitle, defaultTitle);
|
||||
|
||||
if (IDOK==DialogBox(hInst,(LPCSTR)IDD_INPUTBOX,hParent,InputBoxFunc))
|
||||
{
|
||||
strncpy(outvalue, out, outlength);
|
||||
|
||||
Reference in New Issue
Block a user