]>
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"
32 IMPLEMENT_CLASS(wxProgressDialog
, wxDialog
)
34 static Boolean
wxProgressCallback(PrgCallbackData
*data
)
39 wxProgressDialog
*dialog
= (wxProgressDialog
*)data
->userDataP
;
44 return dialog
->Callback(data
);
47 wxProgressDialog::wxProgressDialog(const wxString
&title
,
48 wxString
const &message
,
52 :wxDialog(parent
, wxID_ANY
, title
),
57 m_canSkip((style
& wxPD_CAN_SKIP
)==wxPD_CAN_SKIP
)
59 wxString prgTitle
= title
.Mid(0, progressMaxTitle
);
61 m_prgFrame
= PrgStartDialog(prgTitle
.ToAscii(), wxProgressCallback
, this);
64 wxProgressDialog::~wxProgressDialog()
68 PrgStopDialog(m_prgFrame
, false);
73 bool wxProgressDialog::Update(int value
, const wxString
& newmsg
, bool *skip
)
85 EvtGetEvent(&event
, 0);
86 Boolean handled
= PrgHandleEvent(m_prgFrame
, &event
);
87 if (!PrgHandleEvent(m_prgFrame
, &event
))
88 if( PrgUserCancel(m_prgFrame
) )
91 while(event
.eType
!= sysEventNilEvent
);
93 PrgUpdateDialog(m_prgFrame
, 0, 0, "", true);
95 m_activeSkip
= m_canSkip
&& true;
100 void wxProgressDialog::Resume()
104 bool wxProgressDialog::Show(bool show
)
109 Boolean
wxProgressDialog::Callback(PrgCallbackData
*data
)
111 strncpy( data
->textP
, m_msg
.ToAscii() , data
->textLen
- 1 );
112 data
->textChanged
= true;
113 data
->displaySkipBtn
= m_canSkip
;
114 data
->barMaxValue
= (uint32_t)m_max
;
115 data
->barCurValue
= (uint32_t)m_cur
;
116 data
->delay
= (m_max
== m_cur
);
121 #endif // wxUSE_PROGRESSDLG