X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/555f645a40d21b575f6154e484e2cddcb950a341..04fa04d8067d235ab45b5bc05b65f0679634b541:/src/palmos/progdlg.cpp?ds=sidebyside diff --git a/src/palmos/progdlg.cpp b/src/palmos/progdlg.cpp index 29da0fa77d..db371b5917 100644 --- a/src/palmos/progdlg.cpp +++ b/src/palmos/progdlg.cpp @@ -6,32 +6,27 @@ // Created: 29.12.2004 // RCS-ID: $Id$ // Copyright: (c) Wlodzimierz Skiba -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "progdlg.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif +#if wxUSE_PROGRESSDLG + +#include "wx/progdlg.h" + #ifndef WX_PRECOMP #include "wx/string.h" + #include "wx/msgdlg.h" #endif //WX_PRECOMP -#if wxUSE_PROGRESSDLG - -//**************** -//* NEEDS DEBUGING -//**************** - -#include "wx/progdlg.h" -#include "wx/msgdlg.h" +#include +#include IMPLEMENT_CLASS(wxProgressDialog, wxDialog) @@ -45,29 +40,7 @@ static Boolean wxProgressCallback(PrgCallbackData *data) if(!dialog) return false; -// /* uint16_t */ data->bitmapId = 0; -// /* DmOpenRef */ data->bitmapDatabase = 0; - /* char * */ data->textP = "test"; -// /* status_t */ data->error; -// /* uint16_t */ data->canceled; - /* uint16_t */ data->textChanged = false; - /* uint16_t */ data->displaySkipBtn = true; -// /* uint16_t */ data->skipped:1; -// /* uint32_t */ data->timeout; - /* uint32_t */ data->barMaxValue = (uint32_t)dialog->GetMaxValue(); - /* uint32_t */ data->barCurValue = (uint32_t)dialog->GetCurValue(); - /* uint16_t */ data->delay = false ; - - /* NOT USED - data->spareBits1:10; - data->padding1; - data->padding2; - data->barMessage; - data->barFlags; - data->spareBits2:15; - */ - - return true; + return dialog->Callback(data); } wxProgressDialog::wxProgressDialog(const wxString &title, @@ -79,10 +52,11 @@ wxProgressDialog::wxProgressDialog(const wxString &title, m_prgFrame(NULL), m_msg(message), m_cur(0), - m_max(maximum) + m_max(maximum), + m_canSkip((style & wxPD_CAN_SKIP )==wxPD_CAN_SKIP) { wxString prgTitle = title.Mid(0, progressMaxTitle); - + m_prgFrame = PrgStartDialog(prgTitle.ToAscii(), wxProgressCallback, this); } @@ -90,7 +64,7 @@ wxProgressDialog::~wxProgressDialog() { if(m_prgFrame) { - PrgStopDialog(m_prgFrame, false); + PrgStopDialog((ProgressType *)m_prgFrame, false); m_prgFrame = NULL; } } @@ -100,10 +74,26 @@ bool wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip) if(!m_prgFrame) return false; if(!newmsg.empty()) - SetMessage(newmsg); + m_msg = newmsg; m_cur = value; - // PrgUpdateDialog crashes, needs debugging - // PrgUpdateDialog(m_prgFrame, 0, 1, newmsg.ToAscii(), true); + + EventType event; + + ProgressType *prg = (ProgressType *)m_prgFrame; + do + { + EvtGetEvent(&event, 0); + Boolean handled = PrgHandleEvent(prg, &event); + if (!PrgHandleEvent(prg, &event)) + if( PrgUserCancel(prg) ) + return false; + } + while(event.eType != sysEventNilEvent); + + PrgUpdateDialog(prg, 0, 0, "", true); + + m_activeSkip = m_canSkip && true; + return true; } @@ -116,4 +106,19 @@ bool wxProgressDialog::Show(bool show) return false; } +Boolean wxProgressDialog::Callback(void *data) +{ + PrgCallbackData *palmData = (PrgCallbackData *)data; + strncpy( palmData->textP, m_msg.ToAscii() , palmData->textLen - 1 ); + palmData->textChanged = true; +#ifdef __WXPALMOS6__ + palmData->displaySkipBtn = m_canSkip; +#endif // __WXPALMOS6__ + palmData->barMaxValue = (uint32_t)m_max; + palmData->barCurValue = (uint32_t)m_cur; + palmData->delay = (m_max == m_cur); + + return true; +} + #endif // wxUSE_PROGRESSDLG