Patch [ 584078 ] Misc samples fixes from Dimitri Schoolwerth
Addresses: printf-format warinigs indentation/style unused variable warnings used wxID_ABOUT for about menu entry removed references to "minimal sample" in other samples some other misc warinigs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -195,7 +195,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
msg.Printf( _T("This is the about dialog of wxArtProvider sample.\n")
|
||||
_T("Welcome to %s"), wxVERSION_STRING);
|
||||
|
||||
wxMessageBox(msg, _T("About Minimal"), wxOK | wxICON_INFORMATION, this);
|
||||
wxMessageBox(msg, _T("About wxArtProvider sample"),
|
||||
wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnBrowser(wxCommandEvent& WXUNUSED(event))
|
||||
|
@@ -199,7 +199,7 @@ void MyApp::OnConnected(wxDialUpEvent& event)
|
||||
msg = event.IsConnectedEvent() ? wxT("Successfully connected")
|
||||
: wxT("Dialing failed");
|
||||
|
||||
wxLogStatus(wxT(""));
|
||||
wxLogStatus(wxEmptyString);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -88,8 +88,7 @@ private:
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About
|
||||
ID_MENU_QUIT = 1,
|
||||
};
|
||||
|
||||
|
||||
@@ -101,7 +100,7 @@ IMPLEMENT_APP(MyApp)
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
MyFrame *frame = new MyFrame(_T("Minimal wxWindows App"),
|
||||
MyFrame *frame = new MyFrame(_T("Erase sample"),
|
||||
wxPoint(50, 50), wxSize(450, 340));
|
||||
|
||||
frame->Show(TRUE);
|
||||
@@ -114,26 +113,22 @@ bool MyApp::OnInit()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(ID_MENU_QUIT, MyFrame::OnQuit)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
wxApp::s_macAboutMenuItemId = Minimal_About;
|
||||
#endif
|
||||
|
||||
SetIcon(wxICON(mondrian));
|
||||
|
||||
wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
|
||||
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(Minimal_About, _T("&About...\tCtrl-A"), _T("Show about dialog"));
|
||||
helpMenu->Append(wxID_ABOUT, _T("&About...\tCtrl-A"), _T("Show about dialog"));
|
||||
|
||||
menuFile->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||
menuFile->Append(ID_MENU_QUIT, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, _T("&File"));
|
||||
|
@@ -122,7 +122,7 @@ private:
|
||||
void DoAsyncExec(const wxString& cmd);
|
||||
|
||||
// the PID of the last process we launched asynchronously
|
||||
int m_pidLast;
|
||||
long m_pidLast;
|
||||
|
||||
// last command we executed
|
||||
wxString m_cmdLast;
|
||||
@@ -505,16 +505,16 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
|
||||
if ( sig == 0 )
|
||||
{
|
||||
if ( wxProcess::Exists(pid) )
|
||||
wxLogStatus(_T("Process %d is running."), pid);
|
||||
wxLogStatus(_T("Process %ld is running."), pid);
|
||||
else
|
||||
wxLogStatus(_T("No process with pid = %d."), pid);
|
||||
wxLogStatus(_T("No process with pid = %ld."), pid);
|
||||
}
|
||||
else // not SIGNONE
|
||||
{
|
||||
wxKillError rc = wxProcess::Kill(pid, (wxSignal)sig);
|
||||
if ( rc == wxKILL_OK )
|
||||
{
|
||||
wxLogStatus(_T("Process %d killed with signal %d."), pid, sig);
|
||||
wxLogStatus(_T("Process %ld killed with signal %d."), pid, sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -527,7 +527,7 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
|
||||
_T("unspecified error"),
|
||||
};
|
||||
|
||||
wxLogStatus(_T("Failed to kill process %d with signal %d: %s"),
|
||||
wxLogStatus(_T("Failed to kill process %ld with signal %d: %s"),
|
||||
pid, sig, errorText[rc]);
|
||||
}
|
||||
}
|
||||
@@ -549,7 +549,8 @@ void MyFrame::DoAsyncExec(const wxString& cmd)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(_T("Process %ld (%s) launched."), m_pidLast, cmd.c_str());
|
||||
wxLogStatus( _T("Process %ld (%s) launched."),
|
||||
m_pidLast, cmd.c_str() );
|
||||
|
||||
m_cmdLast = cmd;
|
||||
}
|
||||
@@ -570,6 +571,7 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxLogStatus(_T("Process '%s' terminated with exit code %d."),
|
||||
cmd.c_str(), code);
|
||||
|
||||
m_cmdLast = cmd;
|
||||
}
|
||||
|
||||
@@ -676,7 +678,7 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
// always execute the filter asynchronously
|
||||
MyPipedProcess2 *process = new MyPipedProcess2(this, cmd, input);
|
||||
int pid = wxExecute(cmd, wxEXEC_ASYNC, process);
|
||||
long pid = wxExecute(cmd, wxEXEC_ASYNC, process);
|
||||
if ( pid )
|
||||
{
|
||||
wxLogStatus( _T("Process %ld (%s) launched."), pid, cmd.c_str() );
|
||||
|
@@ -77,7 +77,6 @@ enum
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About,
|
||||
Minimal_Print,
|
||||
Minimal_Preview,
|
||||
Minimal_PageSetup,
|
||||
@@ -95,7 +94,7 @@ enum
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(Minimal_Print, MyFrame::OnPrint)
|
||||
EVT_MENU(Minimal_Preview, MyFrame::OnPreview)
|
||||
EVT_MENU(Minimal_PageSetup, MyFrame::OnPageSetup)
|
||||
@@ -163,7 +162,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
menuFile->Append(Minimal_Print, "Print...");
|
||||
menuFile->Append(Minimal_Preview, "Preview...");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Minimal_About, "&About");
|
||||
menuFile->Append(wxID_ABOUT, "&About");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Minimal_Quit, "&Exit");
|
||||
|
||||
|
@@ -103,7 +103,6 @@ wxFSFile* MyVFS::OpenFile(wxFileSystem& fs, const wxString& location)
|
||||
|
||||
// event handlers (these functions should _not_ be virtual)
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnBack(wxCommandEvent& event);
|
||||
void OnForward(wxCommandEvent& event);
|
||||
|
||||
@@ -121,7 +120,6 @@ wxFSFile* MyVFS::OpenFile(wxFileSystem& fs, const wxString& location)
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About,
|
||||
Minimal_Back,
|
||||
Minimal_Forward,
|
||||
|
||||
@@ -138,7 +136,6 @@ wxFSFile* MyVFS::OpenFile(wxFileSystem& fs, const wxString& location)
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(Minimal_Back, MyFrame::OnBack)
|
||||
EVT_MENU(Minimal_Forward, MyFrame::OnForward)
|
||||
END_EVENT_TABLE()
|
||||
@@ -220,12 +217,6 @@ wxHtmlWindow *html;
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
|
||||
|
@@ -26,8 +26,6 @@
|
||||
#include "wx/html/htmlwin.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
@@ -49,11 +47,12 @@ TAG_HANDLER_BEGIN(MYBIND, "MYBIND")
|
||||
|
||||
tag.ScanParam(wxT("X"), wxT("%i"), &ax);
|
||||
tag.ScanParam(wxT("Y"), wxT("%i"), &ay);
|
||||
if (tag.HasParam(wxT("FLOAT")))
|
||||
fl = ax;
|
||||
|
||||
if (tag.HasParam(wxT("FLOAT"))) fl = ax;
|
||||
|
||||
wnd = new wxTextCtrl(m_WParser->GetWindow(), -1, tag.GetParam(wxT("NAME")),
|
||||
wxPoint(0,0), wxSize(ax, ay), wxTE_MULTILINE);
|
||||
|
||||
wnd->Show(TRUE);
|
||||
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlWidgetCell(wnd, fl));
|
||||
@@ -72,13 +71,6 @@ TAGS_MODULE_BEGIN(MyBind)
|
||||
TAGS_MODULE_END(MyBind)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -105,7 +97,6 @@ TAGS_MODULE_END(MyBind)
|
||||
|
||||
// event handlers (these functions should _not_ be virtual)
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnBack(wxCommandEvent& event);
|
||||
void OnForward(wxCommandEvent& event);
|
||||
|
||||
@@ -123,7 +114,6 @@ TAGS_MODULE_END(MyBind)
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About,
|
||||
Minimal_Back,
|
||||
Minimal_Forward,
|
||||
|
||||
@@ -140,7 +130,6 @@ TAGS_MODULE_END(MyBind)
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(Minimal_Back, MyFrame::OnBack)
|
||||
EVT_MENU(Minimal_Forward, MyFrame::OnForward)
|
||||
END_EVENT_TABLE()
|
||||
@@ -221,12 +210,6 @@ wxHtmlWindow *html;
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
|
||||
@@ -237,9 +220,3 @@ wxHtmlWindow *html;
|
||||
{
|
||||
if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -51,7 +51,6 @@
|
||||
|
||||
// event handlers (these functions should _not_ be virtual)
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnBack(wxCommandEvent& event);
|
||||
void OnForward(wxCommandEvent& event);
|
||||
|
||||
@@ -69,7 +68,6 @@
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About,
|
||||
Minimal_Back,
|
||||
Minimal_Forward
|
||||
};
|
||||
@@ -83,7 +81,6 @@
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(Minimal_Back, MyFrame::OnBack)
|
||||
EVT_MENU(Minimal_Forward, MyFrame::OnForward)
|
||||
END_EVENT_TABLE()
|
||||
@@ -126,6 +123,7 @@
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// application would exit immediately.
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -174,18 +172,11 @@ wxHtmlWindow *html;
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
|
||||
}
|
||||
|
||||
|
||||
void MyFrame::OnForward(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
|
||||
|
@@ -47,8 +47,8 @@ protected:
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h,
|
||||
wxLocale& m_locale);
|
||||
MyFrame(wxFrame *frame, const wxChar *title,
|
||||
const wxPoint& pos, const wxSize& size, wxLocale& m_locale);
|
||||
|
||||
public:
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
@@ -66,14 +66,13 @@ enum
|
||||
{
|
||||
MINIMAL_QUIT = 1,
|
||||
MINIMAL_TEXT,
|
||||
MINIMAL_ABOUT,
|
||||
MINIMAL_TEST,
|
||||
MINIMAL_OPEN
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(MINIMAL_QUIT, MyFrame::OnQuit)
|
||||
EVT_MENU(MINIMAL_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(MINIMAL_TEST, MyFrame::OnPlay)
|
||||
EVT_MENU(MINIMAL_OPEN, MyFrame::OnOpen)
|
||||
END_EVENT_TABLE()
|
||||
@@ -126,15 +125,16 @@ bool MyApp::OnInit()
|
||||
#endif
|
||||
|
||||
// Create the main frame window
|
||||
MyFrame *frame = new MyFrame((wxFrame *) NULL, _("International wxWindows App"),
|
||||
50, 50, 350, 60, m_locale);
|
||||
MyFrame *frame = new MyFrame( (wxFrame *) NULL,
|
||||
_("International wxWindows App"), wxPoint(50, 50), wxSize(350, 60),
|
||||
m_locale);
|
||||
|
||||
// Give it an icon
|
||||
frame->SetIcon(wxICON(mondrian));
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
file_menu->Append(MINIMAL_ABOUT, _("&About..."));
|
||||
file_menu->Append(wxID_ABOUT, _("&About..."));
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(MINIMAL_QUIT, _("E&xit"));
|
||||
|
||||
@@ -155,11 +155,12 @@ bool MyApp::OnInit()
|
||||
}
|
||||
|
||||
// My frame constructor
|
||||
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y,
|
||||
int w, int h, wxLocale& l)
|
||||
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)),
|
||||
MyFrame::MyFrame(wxFrame *frame, const wxChar *title,
|
||||
const wxPoint& pos, const wxSize& size, wxLocale& l)
|
||||
: wxFrame(frame, -1, title, pos, size),
|
||||
m_locale(l)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
|
||||
@@ -183,10 +184,9 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString str = wxGetTextFromUser(_("Enter your number:"),
|
||||
_("Try to guess my number!"),
|
||||
"", this);
|
||||
if ( str.IsEmpty() )
|
||||
return;
|
||||
_("Try to guess my number!"), wxEmptyString, this);
|
||||
|
||||
if ( str.IsEmpty() ) return;
|
||||
|
||||
int num;
|
||||
wxSscanf(str, wxT("%d"), &num);
|
||||
@@ -196,7 +196,8 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||
str = "You've found a bug in this program!";
|
||||
else if ( num != 17 ) // a more implicit way to write _()
|
||||
str = wxGetTranslation(wxT("Bad luck! try again..."));
|
||||
else {
|
||||
else
|
||||
{
|
||||
str.Empty();
|
||||
// string must be split in two -- otherwise the translation won't be found
|
||||
str << _("Congratulations! you've won. Here is the magic phrase:")
|
||||
|
@@ -21,7 +21,11 @@
|
||||
#endif
|
||||
|
||||
#if !wxUSE_JOYSTICK
|
||||
#error You must set wxUSE_JOYSTICK to 1 in setup.h!
|
||||
# error You must set wxUSE_JOYSTICK to 1 in setup.h
|
||||
#endif
|
||||
|
||||
#if !wxUSE_STATUSBAR
|
||||
# error You must set wxUSE_STATUSBAR to 1 in setup.h
|
||||
#endif
|
||||
|
||||
#include "wx/wave.h"
|
||||
@@ -40,7 +44,7 @@ long ypos = -1;
|
||||
int winNumber = 1;
|
||||
|
||||
// Initialise this in OnInit, not statically
|
||||
bool MyApp::OnInit(void)
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
wxJoystick stick(wxJOYSTICK1);
|
||||
if (!stick.IsOk())
|
||||
@@ -48,6 +52,7 @@ bool MyApp::OnInit(void)
|
||||
wxMessageBox("No joystick detected!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if wxUSE_WAVE
|
||||
m_fire.Create("gun.wav");
|
||||
#endif // wxUSE_WAVE
|
||||
@@ -57,8 +62,8 @@ bool MyApp::OnInit(void)
|
||||
|
||||
// Create the main frame window
|
||||
|
||||
frame = new MyFrame(NULL, "Joystick Demo", wxPoint(0, 0), wxSize(500, 400),
|
||||
wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
|
||||
frame = new MyFrame(NULL, "Joystick Demo", wxDefaultPosition,
|
||||
wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
|
||||
|
||||
// Give it an icon (this is ignored in MDI mode: uses resources)
|
||||
#ifdef __WXMSW__
|
||||
@@ -73,19 +78,16 @@ bool MyApp::OnInit(void)
|
||||
|
||||
file_menu->Append(JOYTEST_QUIT, "&Exit");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(JOYTEST_ABOUT, "&About");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
frame->CreateStatusBar();
|
||||
|
||||
frame->CenterOnScreen();
|
||||
frame->Show(TRUE);
|
||||
|
||||
SetTopWindow(frame);
|
||||
@@ -105,7 +107,7 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
|
||||
joystick.SetCapture(this);
|
||||
}
|
||||
|
||||
MyCanvas::~MyCanvas(void)
|
||||
MyCanvas::~MyCanvas()
|
||||
{
|
||||
wxJoystick joystick(wxJOYSTICK1);
|
||||
joystick.ReleaseCapture();
|
||||
@@ -129,6 +131,7 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.DrawLine(xpos, ypos, pt.x, pt.y);
|
||||
}
|
||||
|
||||
xpos = pt.x;
|
||||
ypos = pt.y;
|
||||
|
||||
@@ -137,6 +140,7 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
|
||||
sprintf(buf, "Joystick (%d, %d) Fire!", pt.x, pt.y);
|
||||
else
|
||||
sprintf(buf, "Joystick (%d, %d)", pt.x, pt.y);
|
||||
|
||||
frame->SetStatusText(buf);
|
||||
|
||||
#if wxUSE_WAVE
|
||||
@@ -151,15 +155,16 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(JOYTEST_QUIT, MyFrame::OnQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
const long style):
|
||||
wxFrame(parent, -1, title, pos, size, style)
|
||||
MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos,
|
||||
const wxSize& size, const long style)
|
||||
: wxFrame(parent, -1, title, pos, size, style)
|
||||
{
|
||||
canvas = new MyCanvas(this);
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame(void)
|
||||
MyFrame::~MyFrame()
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& event)
|
||||
|
@@ -13,7 +13,7 @@
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit(void);
|
||||
bool OnInit();
|
||||
|
||||
// Joystick max values
|
||||
int m_maxX;
|
||||
@@ -30,7 +30,7 @@ class MyCanvas: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||
~MyCanvas(void);
|
||||
~MyCanvas();
|
||||
void OnJoystickEvent(wxJoystickEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
@@ -40,8 +40,9 @@ class MyFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
MyCanvas *canvas;
|
||||
MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||
~MyFrame(void);
|
||||
MyFrame(wxFrame *parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, const long style);
|
||||
~MyFrame();
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
|
||||
@@ -49,4 +50,3 @@ DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define JOYTEST_QUIT 1
|
||||
#define JOYTEST_ABOUT 2
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: propsize.cpp
|
||||
// Purpose: Minimal wxWindows sample
|
||||
// Purpose: wxWindows propsize sample
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// License: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
@@ -86,7 +86,6 @@ enum
|
||||
{
|
||||
// menu items
|
||||
Minimal_Quit = 1,
|
||||
Minimal_About
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -98,7 +97,7 @@ enum
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Create a new application object: this macro will allow wxWindows to create
|
||||
@@ -148,7 +147,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
|
||||
|
||||
menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
|
||||
menuFile->Append(wxID_ABOUT, "&About...\tCtrl-A", "Show about dialog");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||
|
||||
@@ -168,6 +167,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#define AddLine(orient) \
|
||||
Add( new wxStaticLine( this, -1, wxDefaultPosition, wxSize(2,2), orient), \
|
||||
0, wxEXPAND)
|
||||
|
||||
#define AddButton(label,align) Add( \
|
||||
new wxButton( this, -1, label, wxDefaultPosition, wxSize(100,50)), \
|
||||
1, wxSHAPED | align)
|
||||
@@ -190,11 +190,13 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// sizer that preserves it's shape
|
||||
wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL );
|
||||
vsizer->Add(
|
||||
new wxButton( this, -1, "up", wxDefaultPosition, wxSize(100,25)), \
|
||||
new wxButton( this, -1, "up", wxDefaultPosition, wxSize(100,25) ),
|
||||
1, wxEXPAND);
|
||||
|
||||
vsizer->Add(
|
||||
new wxButton( this, -1, "down", wxDefaultPosition, wxSize(100,25)), \
|
||||
new wxButton( this, -1, "down", wxDefaultPosition, wxSize(100,25) ),
|
||||
1, wxEXPAND);
|
||||
|
||||
hsizer2->Add(vsizer, 1, wxSHAPED | wxALIGN_CENTER);
|
||||
hsizer2->AddLine(wxVERTICAL);
|
||||
hsizer2->AddButton( "six", wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
@@ -219,7 +221,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// topsizer->SetSizeHints( this );
|
||||
|
||||
SetSizer( topsizer );
|
||||
SetAutoLayout( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -223,7 +223,7 @@ void *MyThread::Entry()
|
||||
{
|
||||
wxString text;
|
||||
|
||||
text.Printf(wxT("Thread 0x%x started (priority = %d).\n"),
|
||||
text.Printf(wxT("Thread 0x%x started (priority = %u).\n"),
|
||||
GetId(), GetPriority());
|
||||
WriteText(text);
|
||||
// wxLogMessage(text); -- test wxLog thread safeness
|
||||
|
@@ -494,10 +494,10 @@ void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
|
||||
|
||||
void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
|
||||
{
|
||||
int sel = event.GetInt();
|
||||
long sel = event.GetInt();
|
||||
m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
|
||||
|
||||
wxLogMessage(_T("Combobox item %d selected"), sel);
|
||||
wxLogMessage(_T("Combobox item %ld selected"), sel);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
|
@@ -491,20 +491,20 @@ void ListboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
|
||||
|
||||
void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
|
||||
{
|
||||
int sel = event.GetInt();
|
||||
long sel = event.GetInt();
|
||||
m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
|
||||
|
||||
wxLogMessage(_T("Listbox item %d selected"), sel);
|
||||
wxLogMessage(_T("Listbox item %ld selected"), sel);
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage(_T("Listbox item %d double clicked"), event.GetInt());
|
||||
wxLogMessage( _T("Listbox item %ld double clicked"), event.GetInt() );
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage(_T("Listbox item %d toggled"), event.GetInt());
|
||||
wxLogMessage( _T("Listbox item %ld toggled"), event.GetInt() );
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
|
@@ -231,8 +231,8 @@ SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook,
|
||||
m_textMax = new wxTextCtrl(this, SliderPage_MaxText, _T(""));
|
||||
sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
|
||||
|
||||
m_textMin->SetValue(wxString::Format(_T("%lu"), m_min));
|
||||
m_textMax->SetValue(wxString::Format(_T("%lu"), m_max));
|
||||
m_textMin->SetValue( wxString::Format(_T("%d"), m_min) );
|
||||
m_textMax->SetValue( wxString::Format(_T("%d"), m_max) );
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
@@ -459,7 +459,7 @@ void SliderWidgetsPage::OnUpdateUIOtherSide(wxUpdateUIEvent& event)
|
||||
|
||||
void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
|
||||
{
|
||||
int value = event.GetInt();
|
||||
long value = event.GetInt();
|
||||
|
||||
wxASSERT_MSG( value == m_slider->GetValue(),
|
||||
wxT("slider value should be the same") );
|
||||
|
@@ -224,8 +224,8 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook,
|
||||
m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, _T(""));
|
||||
sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
|
||||
|
||||
m_textMin->SetValue(wxString::Format(_T("%lu"), m_min));
|
||||
m_textMax->SetValue(wxString::Format(_T("%lu"), m_max));
|
||||
m_textMin->SetValue( wxString::Format(_T("%d"), m_min) );
|
||||
m_textMax->SetValue( wxString::Format(_T("%d"), m_max) );
|
||||
|
||||
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
||||
|
||||
@@ -405,13 +405,13 @@ void SpinBtnWidgetsPage::OnSpinBtn(wxCommandEvent& event)
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinBtnUp(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage(_T("Spin button value incremented, will be %d (was %d)"),
|
||||
wxLogMessage( _T("Spin button value incremented, will be %ld (was %d)"),
|
||||
event.GetInt(), m_spinbtn->GetValue() );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnSpinBtnDown(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage(_T("Spin button value decremented, will be %d (was %d)"),
|
||||
wxLogMessage( _T("Spin button value decremented, will be %ld (was %d)"),
|
||||
event.GetInt(), m_spinbtn->GetValue() );
|
||||
}
|
||||
|
||||
|
@@ -604,7 +604,7 @@ void TextWidgetsPage::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||
if ( m_textLineLast )
|
||||
{
|
||||
m_textLineLast->SetValue(
|
||||
wxString::Format(_T("%ld"), m_text->GetNumberOfLines()));
|
||||
wxString::Format(_T("%d"), m_text->GetNumberOfLines()) );
|
||||
}
|
||||
|
||||
if ( m_textSelFrom && m_textSelTo )
|
||||
@@ -699,7 +699,7 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
|
||||
else
|
||||
{
|
||||
long elapsed = sw.Time();
|
||||
wxLogMessage(_T("Loaded file '%s' in %u.%us"),
|
||||
wxLogMessage(_T("Loaded file '%s' in %lu.%us"),
|
||||
filename.c_str(), elapsed / 1000, elapsed % 1000);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user