Renamed functions

This commit is contained in:
Dimitris Panokostas 2017-04-17 01:05:35 +02:00
parent 04f410d5ca
commit dcece9256c
2 changed files with 66 additions and 6 deletions

View file

@ -18,7 +18,8 @@
static bool dialogResult = false;
static bool dialogFinished = false;
static SDL_Keycode dialogButtonPressed;
static SDL_Keycode dialogKeyPressed;
static Uint8 dialogButtonPressed;
static gcn::Window* wndShowMessage;
static gcn::Button* cmdOK;
@ -95,7 +96,7 @@ static void ExitShowMessage()
delete wndShowMessage;
}
static void ShowMessageWaitButtonLoop()
static void ShowMessageWaitKeyLoop()
{
while (!dialogFinished)
{
@ -112,7 +113,7 @@ static void ShowMessageWaitButtonLoop()
break;
default:
dialogButtonPressed = event.key.keysym.sym;
dialogKeyPressed = event.key.keysym.sym;
dialogFinished = true;
break;
}
@ -134,6 +135,47 @@ static void ShowMessageWaitButtonLoop()
}
}
static void ShowMessageWaitButtonLoop()
{
while (!dialogFinished)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.scancode)
{
case VK_ESCAPE:
dialogFinished = true;
break;
default: ;
}
}
if (event.type == SDL_JOYBUTTONDOWN)
{
dialogButtonPressed = event.jbutton.button;
dialogFinished = true;
break;
}
//-------------------------------------------------
// Send event to guisan-controls
//-------------------------------------------------
gui_input->pushInput(event);
}
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
// Finally we update the screen.
UpdateGuiScreen();
}
}
static void ShowMessageLoop()
{
while (!dialogFinished)
@ -213,7 +255,7 @@ bool ShowMessage(const char* title, const char* line1, const char* line2, const
return dialogResult;
}
SDL_Keycode ShowMessage(const char* title, const char* line1, const char* button1)
SDL_Keycode ShowMessageForKey(const char* title, const char* line1, const char* button1)
{
dialogResult = false;
dialogFinished = false;
@ -224,8 +266,25 @@ SDL_Keycode ShowMessage(const char* title, const char* line1, const char* button
cmdOK->setVisible(false);
cmdCancel->setCaption(button1);
ShowMessageWaitKeyLoop();
ExitShowMessage();
return dialogKeyPressed;
}
Uint8 ShowMessageForButton(const char* title, const char* message, const char* button1)
{
dialogResult = false;
dialogFinished = false;
InitShowMessage();
wndShowMessage->setCaption(title);
lblText1->setCaption(message);
cmdOK->setVisible(false);
cmdCancel->setCaption(button1);
ShowMessageWaitButtonLoop();
ExitShowMessage();
return dialogButtonPressed;
}
}

View file

@ -103,7 +103,8 @@ void RegisterRefreshFunc(void (*func)(void));
void DisableResume(void);
bool ShowMessage(const char* title, const char* line1, const char* line2, const char* button1, const char* button2);
SDL_Keycode ShowMessage(const char* title, const char* line1, const char* button1);
SDL_Keycode ShowMessageForKey(const char* title, const char* line1, const char* button1);
Uint8 ShowMessageForButton(const char* title, const char* message, const char* button1);
bool SelectFolder(const char* title, char* value);
bool SelectFile(const char* title, char* value, const char* filter[], bool create = false);
bool EditFilesysVirtual(int unit_no);