// 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 <Progress.h>
+#include <SysEvtMgr.h>
IMPLEMENT_CLASS(wxProgressDialog, wxDialog)
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,
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);
}
{
if(m_prgFrame)
{
- PrgStopDialog(m_prgFrame, false);
+ PrgStopDialog((ProgressType *)m_prgFrame, false);
m_prgFrame = NULL;
}
}
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;
}
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