]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "progdlg.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/string.h"
29 #include "wx/progdlg.h"
30 #include "wx/msgdlg.h"
33 #include <SysEvtMgr.h>
35 IMPLEMENT_CLASS(wxProgressDialog
, wxDialog
)
37 static Boolean
wxProgressCallback(PrgCallbackData
*data
)
42 wxProgressDialog
*dialog
= (wxProgressDialog
*)data
->userDataP
;
47 return dialog
->Callback(data
);
50 wxProgressDialog::wxProgressDialog(const wxString
&title
,
51 wxString
const &message
,
55 :wxDialog(parent
, wxID_ANY
, title
),
60 m_canSkip((style
& wxPD_CAN_SKIP
)==wxPD_CAN_SKIP
)
62 wxString prgTitle
= title
.Mid(0, progressMaxTitle
);
64 m_prgFrame
= PrgStartDialog(prgTitle
.ToAscii(), wxProgressCallback
, this);
67 wxProgressDialog::~wxProgressDialog()
71 PrgStopDialog((ProgressType
*)m_prgFrame
, false);
76 bool wxProgressDialog::Update(int value
, const wxString
& newmsg
, bool *skip
)
86 ProgressType
*prg
= (ProgressType
*)m_prgFrame
;
89 EvtGetEvent(&event
, 0);
90 Boolean handled
= PrgHandleEvent(prg
, &event
);
91 if (!PrgHandleEvent(prg
, &event
))
92 if( PrgUserCancel(prg
) )
95 while(event
.eType
!= sysEventNilEvent
);
97 PrgUpdateDialog(prg
, 0, 0, "", true);
99 m_activeSkip
= m_canSkip
&& true;
104 void wxProgressDialog::Resume()
108 bool wxProgressDialog::Show(bool show
)
113 Boolean
wxProgressDialog::Callback(void *data
)
115 PrgCallbackData
*palmData
= (PrgCallbackData
*)data
;
116 strncpy( palmData
->textP
, m_msg
.ToAscii() , palmData
->textLen
- 1 );
117 palmData
->textChanged
= true;
118 palmData
->displaySkipBtn
= m_canSkip
;
119 palmData
->barMaxValue
= (uint32_t)m_max
;
120 palmData
->barCurValue
= (uint32_t)m_cur
;
121 palmData
->delay
= (m_max
== m_cur
);
126 #endif // wxUSE_PROGRESSDLG