void Resume();
virtual bool Show( bool show = true );
- wxString GetMessage(){return m_msg;}
- void SetMessage(wxString const &message){m_msg = message;}
+ Boolean Callback(PrgCallbackData *data);
- int GetMaxValue(){return m_max;}
- int GetCurValue(){return m_cur;}
private:
ProgressType *m_prgFrame;
wxString m_msg;
int m_max,m_cur;
+ bool m_canSkip;
+ bool m_activeSkip;
// Virtual function hiding supression
virtual void Update() { wxDialog::Update(); }
#if wxUSE_PROGRESSDLG
-//****************
-//* NEEDS DEBUGING
-//****************
-
#include "wx/progdlg.h"
#include "wx/msgdlg.h"
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)
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;
+
+ do
+ {
+ EvtGetEvent(&event, 0);
+ Boolean handled = PrgHandleEvent(m_prgFrame, &event);
+ if (!PrgHandleEvent(m_prgFrame, &event))
+ if( PrgUserCancel(m_prgFrame) )
+ return false;
+ }
+ while(event.eType != sysEventNilEvent);
+
+ PrgUpdateDialog(m_prgFrame, 0, 0, "", true);
+
+ m_activeSkip = m_canSkip && true;
+
return true;
}
return false;
}
+Boolean wxProgressDialog::Callback(PrgCallbackData *data)
+{
+ strncpy( data->textP, m_msg.ToAscii() , data->textLen - 1 );
+ data->textChanged = true;
+ data->displaySkipBtn = m_canSkip;
+ data->barMaxValue = (uint32_t)m_max;
+ data->barCurValue = (uint32_t)m_cur;
+ data->delay = (m_max == m_cur);
+
+ return true;
+}
+
#endif // wxUSE_PROGRESSDLG