Move MessageBox() to the interface to display it properly in Qt.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2017-10-15 18:58:23 +01:00
parent d4fad7e8eb
commit ae4be77382
6 changed files with 44 additions and 8 deletions

View file

@ -354,6 +354,12 @@ void FrameDrawDiskStatus(HDC x)
FrameRefresh();
}
int MessageBox(HWND, const char * text, const char * caption, UINT)
{
LogFileOutput("MessageBox:\n%s\n%s\n\n", caption, text);
return IDOK;
}
void FrameRefreshStatus(int x, bool)
{
// std::cerr << "Status: " << x << std::endl;

View file

@ -164,6 +164,37 @@ BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCycle
void VideoInitialize() {}
// MessageBox
int MessageBox(HWND, const char * text, const char * caption, UINT type)
{
QMessageBox::StandardButtons buttons = QMessageBox::Ok;
if (type & MB_YESNO)
{
buttons = QMessageBox::Yes | QMessageBox::No;
}
else if (type & MB_YESNOCANCEL)
{
buttons = QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel;
}
QMessageBox::StandardButton result = QMessageBox::information(nullptr, caption, text, buttons);
switch (result)
{
case QMessageBox::Ok:
return IDOK;
case QMessageBox::Yes:
return IDYES;
case QMessageBox::No:
return IDNO;
case QMessageBox::Cancel:
return IDCANCEL;
default:
return IDOK;
}
}
QApple::QApple(QWidget *parent) :
QMainWindow(parent), myTimerID(0), myPreferences(this)
{

View file

@ -10,7 +10,6 @@
#include "Memory.h"
#include "Keyboard.h"
#include "NTSC.h"
#include "Log.h"
static bool bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
@ -69,12 +68,6 @@ UINT IPropertySheet::GetTheFreezesF8Rom(void)
return 0;
}
int MessageBox(HWND, const char * text, const char * caption, UINT)
{
LogFileOutput("MessageBox:\n%s\n%s\n\n", caption, text);
return IDOK;
}
HWND GetDesktopWindow()
{
return NULL;

View file

@ -9,7 +9,6 @@ void InitializeCriticalSection(CRITICAL_SECTION * criticalSection);
void EnterCriticalSection(CRITICAL_SECTION * criticalSection);
void LeaveCriticalSection(CRITICAL_SECTION * criticalSection);
void OutputDebugString(const char * str);
int MessageBox(HWND, const char *, const char *, UINT);
extern int g_nAltCharSetOffset; // alternate character set

View file

@ -36,3 +36,7 @@ BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL *value);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer);
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value);
// MessageBox
int MessageBox(HWND, const char * text, const char * caption, UINT type);

View file

@ -128,3 +128,6 @@ void GetLocalTime(SYSTEMTIME *t);
BOOL GetOpenFileName(LPOPENFILENAME lpofn);
BOOL WINAPI PostMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
// must be provided
int MessageBox(HWND, const char *, const char *, UINT);