X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/555f645a40d21b575f6154e484e2cddcb950a341..cae8f1bf03fb6d6c3e1d1578f790715388ef8ccf:/src/palmos/progdlg.cpp diff --git a/src/palmos/progdlg.cpp b/src/palmos/progdlg.cpp index 29da0fa77d..f7be8c1df5 100644 --- a/src/palmos/progdlg.cpp +++ b/src/palmos/progdlg.cpp @@ -26,13 +26,12 @@ #if wxUSE_PROGRESSDLG -//**************** -//* NEEDS DEBUGING -//**************** - #include "wx/progdlg.h" #include "wx/msgdlg.h" +#include +#include + IMPLEMENT_CLASS(wxProgressDialog, wxDialog) static Boolean wxProgressCallback(PrgCallbackData *data) @@ -45,29 +44,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 +56,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 +68,7 @@ wxProgressDialog::~wxProgressDialog() { if(m_prgFrame) { - PrgStopDialog(m_prgFrame, false); + PrgStopDialog((ProgressType *)m_prgFrame, false); m_prgFrame = NULL; } } @@ -100,10 +78,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 +110,17 @@ 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; + palmData->displaySkipBtn = m_canSkip; + palmData->barMaxValue = (uint32_t)m_max; + palmData->barCurValue = (uint32_t)m_cur; + palmData->delay = (m_max == m_cur); + + return true; +} + #endif // wxUSE_PROGRESSDLG