projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix for testing if a property is in allParams - it must be a sequence
[wxWidgets.git]
/
samples
/
thread
/
thread.cpp
diff --git
a/samples/thread/thread.cpp
b/samples/thread/thread.cpp
index 6772a0bbec474b9777a72df25af06df63b6978dd..d85db154a444d8a31f3aa468fb912bd2e8a1d17e 100644
(file)
--- a/
samples/thread/thread.cpp
+++ b/
samples/thread/thread.cpp
@@
-30,6
+30,8
@@
#include "wx/progdlg.h"
#include "wx/progdlg.h"
+#include "../sample.xpm"
+
// define this to use wxExecute in the exec tests, otherwise just use system
#define USE_EXECUTE
// define this to use wxExecute in the exec tests, otherwise just use system
#define USE_EXECUTE
@@
-132,7
+134,8
@@
private:
// ID for the menu commands
enum
{
// ID for the menu commands
enum
{
- THREAD_QUIT = 1,
+ THREAD_QUIT = wxID_EXIT,
+ THREAD_ABOUT = wxID_ABOUT,
THREAD_TEXT = 101,
THREAD_CLEAR,
THREAD_START_THREAD = 201,
THREAD_TEXT = 101,
THREAD_CLEAR,
THREAD_START_THREAD = 201,
@@
-146,7
+149,6
@@
enum
THREAD_EXEC_THREAD,
THREAD_SHOWCPUS,
THREAD_EXEC_THREAD,
THREAD_SHOWCPUS,
- THREAD_ABOUT,
WORKER_EVENT // this one gets sent from the worker thread
};
WORKER_EVENT // this one gets sent from the worker thread
};
@@
-171,7
+173,7
@@
public:
void WriteText(const wxString& text);
public:
void WriteText(const wxString& text);
public:
-
size_t
m_count;
+
unsigned
m_count;
MyFrame *m_frame;
};
MyFrame *m_frame;
};
@@
-264,7
+266,7
@@
public:
public:
MyFrame *m_frame;
public:
MyFrame *m_frame;
-
size_t
m_count;
+
unsigned
m_count;
};
MyWorkerThread::MyWorkerThread(MyFrame *frame)
};
MyWorkerThread::MyWorkerThread(MyFrame *frame)
@@
-361,6
+363,9
@@
MyApp::MyApp()
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
+ if ( !wxApp::OnInit() )
+ return false;
+
// uncomment this to get some debugging messages from the trace code
// on the console (or just set WXTRACE env variable to include "thread")
//wxLog::AddTraceMask("thread");
// uncomment this to get some debugging messages from the trace code
// on the console (or just set WXTRACE env variable to include "thread")
//wxLog::AddTraceMask("thread");
@@
-401,7
+406,7
@@
bool MyApp::OnInit()
menuBar->Append(menuHelp, _T("&Help"));
frame->SetMenuBar(menuBar);
menuBar->Append(menuHelp, _T("&Help"));
frame->SetMenuBar(menuBar);
-
+
// Show the frame
frame->Show(true);
// Show the frame
frame->Show(true);
@@
-415,6
+420,8
@@
MyFrame::MyFrame(wxFrame *frame, const wxString& title,
int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
{
int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
{
+ SetIcon(wxIcon(sample_xpm));
+
m_nRunning = m_nCount = 0;
m_dlgProgress = (wxProgressDialog *)NULL;
m_nRunning = m_nCount = 0;
m_dlgProgress = (wxProgressDialog *)NULL;
@@
-490,7
+497,7
@@
MyThread *MyFrame::CreateThread()
void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
{
void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
{
- static long s_num
= 10
;
+ static long s_num;
s_num = wxGetNumberFromUser(_T("How many threads to start: "), _T(""),
_T("wxThread sample"), s_num, 1, 10000, this);
s_num = wxGetNumberFromUser(_T("How many threads to start: "), _T(""),
_T("wxThread sample"), s_num, 1, 10000, this);
@@
-501,7
+508,7
@@
void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
return;
}
return;
}
-
size_t count = (size_t)s_num
, n;
+
unsigned count = unsigned(s_num)
, n;
wxArrayThread threads;
wxArrayThread threads;
@@
-643,7
+650,7
@@
void MyFrame::OnIdle(wxIdleEvent& event)
m_nRunning = nRunning;
m_nCount = nCount;
m_nRunning = nRunning;
m_nCount = nCount;
- wxLogStatus(this, wxT("%u threads total, %u running."),
nCount, nRunning
);
+ wxLogStatus(this, wxT("%u threads total, %u running."),
unsigned(nCount), unsigned(nRunning)
);
}
//else: avoid flicker - don't print anything
}
//else: avoid flicker - don't print anything