X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffecfa5aeb540b54914739dbb8603edbbd4c00a0..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/palmos/msgdlg.cpp diff --git a/src/palmos/msgdlg.cpp b/src/palmos/msgdlg.cpp index 689982e0d3..63aa1bdd04 100644 --- a/src/palmos/msgdlg.cpp +++ b/src/palmos/msgdlg.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msgdlg.cpp +// Name: src/palmos/msgdlg.cpp // Purpose: wxMessageDialog -// Author: William Osborne +// Author: William Osborne - minimal working wxPalmOS port // Modified by: // Created: 10/13/04 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) William Osborne // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,19 +36,10 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, long style, const wxPoint& WXUNUSED(pos)) { -#ifdef __WXDEBUG__ - // check for common programming errors - if ( (style & wxID_OK) == wxID_OK ) - { - // programmer probably confused wxID_OK with wxOK. Correct one is wxOK. - wxFAIL_MSG( _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") ); - } -#endif // __WXDEBUG__ - m_caption = caption; m_message = message; - m_dialogStyle = style; - m_parent = parent; + m_parent = parent; + SetMessageDialogStyle(style); } int wxMessageDialog::ShowModal() @@ -56,35 +47,36 @@ int wxMessageDialog::ShowModal() int AlertID=1000; int Result=0; int wxResult=wxID_OK; - + const long style = GetMessageDialogStyle(); + // Handle to the currently running application database DmOpenRef AppDB; SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB); // Translate wx styles into Palm OS styles - if (m_dialogStyle & wxYES_NO) + if (style & wxYES_NO) { - if (m_dialogStyle & wxCANCEL) + if (style & wxCANCEL) AlertID=1300; // Yes No Cancel else AlertID=1200; // Yes No } - if (m_dialogStyle & wxOK) + if (style & wxOK) { - if (m_dialogStyle & wxCANCEL) + if (style & wxCANCEL) AlertID=1100; // Ok Cancel else AlertID=1000; // Ok } // Add the icon styles - if (m_dialogStyle & wxICON_EXCLAMATION) + if (style & wxICON_EXCLAMATION) AlertID=AlertID+0; // Warning - else if (m_dialogStyle & wxICON_HAND) + else if (style & wxICON_HAND) AlertID=AlertID+1; // Error - else if (m_dialogStyle & wxICON_INFORMATION) + else if (style & wxICON_INFORMATION) AlertID=AlertID+2; // Information - else if (m_dialogStyle & wxICON_QUESTION) + else if (style & wxICON_QUESTION) AlertID=AlertID+3; // Confirmation // The Palm OS Dialog API does not support custom titles in a dialog box. @@ -99,7 +91,7 @@ int wxMessageDialog::ShowModal() AlertPtr+=8; // Clear out any old title. This must be done with a static array of chars - // because using MemSet is not supported on resources and could result in + // because using MemSet is not supported on resources and could result in // crashes or unpredictable behaviour. char ClearTitle[25]={' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; MemMove(AlertPtr,&ClearTitle,25); @@ -108,14 +100,14 @@ int wxMessageDialog::ShowModal() int TitleLength=m_caption.length(); if(TitleLength>25) TitleLength=25; - + // Center the title in the window int BufferLength=(25-TitleLength)/2; AlertPtr+=BufferLength; // Copy the title MemMove(AlertPtr,m_caption.c_str(),TitleLength); - + // Release the resource MemHandleUnlock(AlertHandle); DmReleaseResource(AlertHandle); @@ -156,6 +148,6 @@ int wxMessageDialog::ShowModal() wxResult=wxID_CANCEL; } - return wxResult; + return wxResult; }