]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/progdlg.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/progdlg.cpp
3 // Purpose: wxProgressDialog implementation
4 // Author: Wlodzimierz ABX Skiba
8 // Copyright: (c) Wlodzimierz Skiba
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
21 #include "wx/progdlg.h"
24 #include "wx/string.h"
25 #include "wx/msgdlg.h"
29 #include <SysEvtMgr.h>
31 IMPLEMENT_CLASS(wxProgressDialog
, wxDialog
)
33 static Boolean
wxProgressCallback(PrgCallbackData
*data
)
38 wxProgressDialog
*dialog
= (wxProgressDialog
*)data
->userDataP
;
43 return dialog
->Callback(data
);
46 wxProgressDialog::wxProgressDialog(const wxString
&title
,
47 wxString
const &message
,
51 :wxDialog(parent
, wxID_ANY
, title
),
56 m_canSkip((style
& wxPD_CAN_SKIP
)==wxPD_CAN_SKIP
)
58 wxString prgTitle
= title
.Mid(0, progressMaxTitle
);
60 m_prgFrame
= PrgStartDialog(prgTitle
.ToAscii(), wxProgressCallback
, this);
63 wxProgressDialog::~wxProgressDialog()
67 PrgStopDialog((ProgressType
*)m_prgFrame
, false);
72 bool wxProgressDialog::Update(int value
, const wxString
& newmsg
, bool *skip
)
82 ProgressType
*prg
= (ProgressType
*)m_prgFrame
;
85 EvtGetEvent(&event
, 0);
86 Boolean handled
= PrgHandleEvent(prg
, &event
);
87 if (!PrgHandleEvent(prg
, &event
))
88 if( PrgUserCancel(prg
) )
91 while(event
.eType
!= sysEventNilEvent
);
93 PrgUpdateDialog(prg
, 0, 0, "", true);
95 m_activeSkip
= m_canSkip
&& true;
100 void wxProgressDialog::Resume()
104 bool wxProgressDialog::Show(bool show
)
109 Boolean
wxProgressDialog::Callback(void *data
)
111 PrgCallbackData
*palmData
= (PrgCallbackData
*)data
;
112 strncpy( palmData
->textP
, m_msg
.ToAscii() , palmData
->textLen
- 1 );
113 palmData
->textChanged
= true;
114 palmData
->displaySkipBtn
= m_canSkip
;
115 palmData
->barMaxValue
= (uint32_t)m_max
;
116 palmData
->barCurValue
= (uint32_t)m_cur
;
117 palmData
->delay
= (m_max
== m_cur
);
122 #endif // wxUSE_PROGRESSDLG