wxDialog::Show is virtual as elsewhere. Native PalmOS progress dialog.
[wxWidgets.git] / src / palmos / progdlg.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/progdlg.cpp
3 // Purpose: wxProgressDialog implementation
4 // Author: Wlodzimierz ABX Skiba
5 // Modified by:
6 // Created: 29.12.2004
7 // RCS-ID: $Id$
8 // Copyright: (c) Wlodzimierz Skiba
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "progdlg.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/string.h"
25 #endif //WX_PRECOMP
26
27 #if wxUSE_PROGRESSDLG
28
29 //****************
30 //* NEEDS DEBUGING
31 //****************
32
33 #include "wx/progdlg.h"
34 #include "wx/msgdlg.h"
35
36 IMPLEMENT_CLASS(wxProgressDialog, wxDialog)
37
38 static Boolean wxProgressCallback(PrgCallbackData *data)
39 {
40 if(!data)
41 return false;
42
43 wxProgressDialog *dialog = (wxProgressDialog *)data->userDataP;
44
45 if(!dialog)
46 return false;
47
48 // /* uint16_t */ data->bitmapId = 0;
49 // /* DmOpenRef */ data->bitmapDatabase = 0;
50 /* char * */ data->textP = "test";
51 // /* status_t */ data->error;
52 // /* uint16_t */ data->canceled;
53 /* uint16_t */ data->textChanged = false;
54 /* uint16_t */ data->displaySkipBtn = true;
55 // /* uint16_t */ data->skipped:1;
56 // /* uint32_t */ data->timeout;
57 /* uint32_t */ data->barMaxValue = (uint32_t)dialog->GetMaxValue();
58 /* uint32_t */ data->barCurValue = (uint32_t)dialog->GetCurValue();
59 /* uint16_t */ data->delay = false ;
60
61 /* NOT USED
62 data->spareBits1:10;
63 data->padding1;
64 data->padding2;
65 data->barMessage;
66 data->barFlags;
67 data->spareBits2:15;
68 */
69
70 return true;
71 }
72
73 wxProgressDialog::wxProgressDialog(const wxString &title,
74 wxString const &message,
75 int maximum,
76 wxWindow *parent,
77 int style)
78 :wxDialog(parent, wxID_ANY, title),
79 m_prgFrame(NULL),
80 m_msg(message),
81 m_cur(0),
82 m_max(maximum)
83 {
84 wxString prgTitle = title.Mid(0, progressMaxTitle);
85
86 m_prgFrame = PrgStartDialog(prgTitle.ToAscii(), wxProgressCallback, this);
87 }
88
89 wxProgressDialog::~wxProgressDialog()
90 {
91 if(m_prgFrame)
92 {
93 PrgStopDialog(m_prgFrame, false);
94 m_prgFrame = NULL;
95 }
96 }
97
98 bool wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
99 {
100 if(!m_prgFrame)
101 return false;
102 if(!newmsg.empty())
103 SetMessage(newmsg);
104 m_cur = value;
105 // PrgUpdateDialog crashes, needs debugging
106 // PrgUpdateDialog(m_prgFrame, 0, 1, newmsg.ToAscii(), true);
107 return true;
108 }
109
110 void wxProgressDialog::Resume()
111 {
112 }
113
114 bool wxProgressDialog::Show(bool show)
115 {
116 return false;
117 }
118
119 #endif // wxUSE_PROGRESSDLG