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")
 | 
					    msg.Printf( _T("This is the about dialog of wxArtProvider sample.\n")
 | 
				
			||||||
                _T("Welcome to %s"), wxVERSION_STRING);
 | 
					                _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))
 | 
					void MyFrame::OnBrowser(wxCommandEvent& WXUNUSED(event))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -199,7 +199,7 @@ void MyApp::OnConnected(wxDialUpEvent& event)
 | 
				
			|||||||
        msg = event.IsConnectedEvent() ? wxT("Successfully connected")
 | 
					        msg = event.IsConnectedEvent() ? wxT("Successfully connected")
 | 
				
			||||||
                                       : wxT("Dialing failed");
 | 
					                                       : wxT("Dialing failed");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wxLogStatus(wxT(""));
 | 
					        wxLogStatus(wxEmptyString);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,8 +88,7 @@ private:
 | 
				
			|||||||
enum
 | 
					enum
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // menu items
 | 
					    // menu items
 | 
				
			||||||
    Minimal_Quit = 1,
 | 
					    ID_MENU_QUIT = 1,
 | 
				
			||||||
    Minimal_About
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -101,7 +100,7 @@ IMPLEMENT_APP(MyApp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool MyApp::OnInit()
 | 
					bool MyApp::OnInit()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MyFrame *frame = new MyFrame(_T("Minimal wxWindows App"),
 | 
					    MyFrame *frame = new MyFrame(_T("Erase sample"),
 | 
				
			||||||
                                 wxPoint(50, 50), wxSize(450, 340));
 | 
					                                 wxPoint(50, 50), wxSize(450, 340));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    frame->Show(TRUE);
 | 
					    frame->Show(TRUE);
 | 
				
			||||||
@@ -114,26 +113,22 @@ bool MyApp::OnInit()
 | 
				
			|||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
    EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
					    EVT_MENU(ID_MENU_QUIT,  MyFrame::OnQuit)
 | 
				
			||||||
    EVT_MENU(Minimal_About, MyFrame::OnAbout)
 | 
					    EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
 | 
				
			||||||
END_EVENT_TABLE()
 | 
					END_EVENT_TABLE()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// frame constructor
 | 
					// frame constructor
 | 
				
			||||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
					MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
				
			||||||
       : wxFrame((wxFrame *)NULL, -1, title, pos, size)
 | 
					       : wxFrame((wxFrame *)NULL, -1, title, pos, size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef __WXMAC__
 | 
					 | 
				
			||||||
    wxApp::s_macAboutMenuItemId = Minimal_About;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SetIcon(wxICON(mondrian));
 | 
					    SetIcon(wxICON(mondrian));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
 | 
					    wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxMenu *helpMenu = new wxMenu;
 | 
					    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();
 | 
					    wxMenuBar *menuBar = new wxMenuBar();
 | 
				
			||||||
    menuBar->Append(menuFile, _T("&File"));
 | 
					    menuBar->Append(menuFile, _T("&File"));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,7 +122,7 @@ private:
 | 
				
			|||||||
    void DoAsyncExec(const wxString& cmd);
 | 
					    void DoAsyncExec(const wxString& cmd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // the PID of the last process we launched asynchronously
 | 
					    // the PID of the last process we launched asynchronously
 | 
				
			||||||
    int m_pidLast;
 | 
					    long m_pidLast;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // last command we executed
 | 
					    // last command we executed
 | 
				
			||||||
    wxString m_cmdLast;
 | 
					    wxString m_cmdLast;
 | 
				
			||||||
@@ -505,16 +505,16 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
 | 
				
			|||||||
    if ( sig == 0 )
 | 
					    if ( sig == 0 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if ( wxProcess::Exists(pid) )
 | 
					        if ( wxProcess::Exists(pid) )
 | 
				
			||||||
            wxLogStatus(_T("Process %d is running."), pid);
 | 
					            wxLogStatus(_T("Process %ld is running."), pid);
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            wxLogStatus(_T("No process with pid = %d."), pid);
 | 
					            wxLogStatus(_T("No process with pid = %ld."), pid);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else // not SIGNONE
 | 
					    else // not SIGNONE
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        wxKillError rc = wxProcess::Kill(pid, (wxSignal)sig);
 | 
					        wxKillError rc = wxProcess::Kill(pid, (wxSignal)sig);
 | 
				
			||||||
        if ( rc == wxKILL_OK )
 | 
					        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
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -527,7 +527,7 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
 | 
				
			|||||||
                _T("unspecified error"),
 | 
					                _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]);
 | 
					                        pid, sig, errorText[rc]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -543,13 +543,14 @@ void MyFrame::DoAsyncExec(const wxString& cmd)
 | 
				
			|||||||
    m_pidLast = wxExecute(cmd, wxEXEC_ASYNC, process);
 | 
					    m_pidLast = wxExecute(cmd, wxEXEC_ASYNC, process);
 | 
				
			||||||
    if ( !m_pidLast )
 | 
					    if ( !m_pidLast )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        wxLogError(_T("Execution of '%s' failed."), cmd.c_str());
 | 
					        wxLogError( _T("Execution of '%s' failed."), cmd.c_str() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        delete process;
 | 
					        delete process;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    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;
 | 
					        m_cmdLast = cmd;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -564,12 +565,13 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
 | 
				
			|||||||
    if ( !cmd )
 | 
					    if ( !cmd )
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxLogStatus(_T("'%s' is running please wait..."), cmd.c_str());
 | 
					    wxLogStatus( _T("'%s' is running please wait..."), cmd.c_str() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int code = wxExecute(cmd, wxEXEC_SYNC);
 | 
					    int code = wxExecute(cmd, wxEXEC_SYNC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxLogStatus(_T("Process '%s' terminated with exit code %d."),
 | 
					    wxLogStatus(_T("Process '%s' terminated with exit code %d."),
 | 
				
			||||||
                cmd.c_str(), code);
 | 
					        cmd.c_str(), code);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_cmdLast = cmd;
 | 
					    m_cmdLast = cmd;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -676,10 +678,10 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // always execute the filter asynchronously
 | 
					    // always execute the filter asynchronously
 | 
				
			||||||
    MyPipedProcess2 *process = new MyPipedProcess2(this, cmd, input);
 | 
					    MyPipedProcess2 *process = new MyPipedProcess2(this, cmd, input);
 | 
				
			||||||
    int pid = wxExecute(cmd, wxEXEC_ASYNC, process);
 | 
					    long pid = wxExecute(cmd, wxEXEC_ASYNC, process);
 | 
				
			||||||
    if ( pid )
 | 
					    if ( pid )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        wxLogStatus(_T("Process %ld (%s) launched."), pid, cmd.c_str());
 | 
					        wxLogStatus( _T("Process %ld (%s) launched."), pid, cmd.c_str() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        m_running.Add(process);
 | 
					        m_running.Add(process);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,7 +77,6 @@ enum
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    // menu items
 | 
					    // menu items
 | 
				
			||||||
    Minimal_Quit = 1,
 | 
					    Minimal_Quit = 1,
 | 
				
			||||||
    Minimal_About,
 | 
					 | 
				
			||||||
    Minimal_Print,
 | 
					    Minimal_Print,
 | 
				
			||||||
    Minimal_Preview,
 | 
					    Minimal_Preview,
 | 
				
			||||||
    Minimal_PageSetup,
 | 
					    Minimal_PageSetup,
 | 
				
			||||||
@@ -95,7 +94,7 @@ enum
 | 
				
			|||||||
// simple menu events like this the static method is much simpler.
 | 
					// simple menu events like this the static method is much simpler.
 | 
				
			||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
    EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
 | 
					    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_Print, MyFrame::OnPrint)
 | 
				
			||||||
    EVT_MENU(Minimal_Preview, MyFrame::OnPreview)
 | 
					    EVT_MENU(Minimal_Preview, MyFrame::OnPreview)
 | 
				
			||||||
    EVT_MENU(Minimal_PageSetup, MyFrame::OnPageSetup)
 | 
					    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_Print, "Print...");
 | 
				
			||||||
    menuFile->Append(Minimal_Preview, "Preview...");
 | 
					    menuFile->Append(Minimal_Preview, "Preview...");
 | 
				
			||||||
    menuFile->AppendSeparator();
 | 
					    menuFile->AppendSeparator();
 | 
				
			||||||
    menuFile->Append(Minimal_About, "&About");
 | 
					    menuFile->Append(wxID_ABOUT, "&About");
 | 
				
			||||||
    menuFile->AppendSeparator();
 | 
					    menuFile->AppendSeparator();
 | 
				
			||||||
    menuFile->Append(Minimal_Quit, "&Exit");
 | 
					    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)
 | 
					    // event handlers (these functions should _not_ be virtual)
 | 
				
			||||||
      void OnQuit(wxCommandEvent& event);
 | 
					      void OnQuit(wxCommandEvent& event);
 | 
				
			||||||
      void OnAbout(wxCommandEvent& event);
 | 
					 | 
				
			||||||
      void OnBack(wxCommandEvent& event);
 | 
					      void OnBack(wxCommandEvent& event);
 | 
				
			||||||
      void OnForward(wxCommandEvent& event);
 | 
					      void OnForward(wxCommandEvent& event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -121,7 +120,6 @@ wxFSFile* MyVFS::OpenFile(wxFileSystem& fs, const wxString& location)
 | 
				
			|||||||
   {
 | 
					   {
 | 
				
			||||||
    // menu items
 | 
					    // menu items
 | 
				
			||||||
   Minimal_Quit = 1,
 | 
					   Minimal_Quit = 1,
 | 
				
			||||||
   Minimal_About,
 | 
					 | 
				
			||||||
   Minimal_Back,
 | 
					   Minimal_Back,
 | 
				
			||||||
   Minimal_Forward,
 | 
					   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.
 | 
					// simple menu events like this the static method is much simpler.
 | 
				
			||||||
   BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					   BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
   EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
					   EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
				
			||||||
   EVT_MENU(Minimal_About, MyFrame::OnAbout)
 | 
					 | 
				
			||||||
   EVT_MENU(Minimal_Back, MyFrame::OnBack)
 | 
					   EVT_MENU(Minimal_Back, MyFrame::OnBack)
 | 
				
			||||||
   EVT_MENU(Minimal_Forward, MyFrame::OnForward)
 | 
					   EVT_MENU(Minimal_Forward, MyFrame::OnForward)
 | 
				
			||||||
   END_EVENT_TABLE()
 | 
					   END_EVENT_TABLE()
 | 
				
			||||||
@@ -220,12 +217,6 @@ wxHtmlWindow *html;
 | 
				
			|||||||
      Close(TRUE);
 | 
					      Close(TRUE);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 | 
					 | 
				
			||||||
   {
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
 | 
					   void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
   if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
 | 
					   if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,6 @@
 | 
				
			|||||||
#include "wx/html/htmlwin.h"
 | 
					#include "wx/html/htmlwin.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,25 +39,26 @@ TAG HANDER FOR 'MYBIND' TAG
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TAG_HANDLER_BEGIN(MYBIND, "MYBIND")
 | 
					TAG_HANDLER_BEGIN(MYBIND, "MYBIND")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TAG_HANDLER_PROC(tag)
 | 
					TAG_HANDLER_PROC(tag)
 | 
				
			||||||
    {
 | 
					{
 | 
				
			||||||
        wxWindow *wnd;
 | 
					    wxWindow *wnd;
 | 
				
			||||||
        int ax, ay;
 | 
					    int ax, ay;
 | 
				
			||||||
        int fl = 0;
 | 
					    int fl = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tag.ScanParam(wxT("X"), wxT("%i"), &ax);
 | 
					    tag.ScanParam(wxT("X"), wxT("%i"), &ax);
 | 
				
			||||||
        tag.ScanParam(wxT("Y"), wxT("%i"), &ay);
 | 
					    tag.ScanParam(wxT("Y"), wxT("%i"), &ay);
 | 
				
			||||||
        if (tag.HasParam(wxT("FLOAT")))
 | 
					 | 
				
			||||||
            fl = ax;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wnd = new wxTextCtrl(m_WParser->GetWindow(), -1, tag.GetParam(wxT("NAME")),
 | 
					    if (tag.HasParam(wxT("FLOAT"))) fl = ax;
 | 
				
			||||||
                             wxPoint(0,0), wxSize(ax, ay), wxTE_MULTILINE);
 | 
					 | 
				
			||||||
        wnd->Show(TRUE);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        m_WParser->GetContainer()->InsertCell(new wxHtmlWidgetCell(wnd, fl));
 | 
					    wnd = new wxTextCtrl(m_WParser->GetWindow(), -1, tag.GetParam(wxT("NAME")),
 | 
				
			||||||
 | 
					        wxPoint(0,0), wxSize(ax, ay), wxTE_MULTILINE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return FALSE;
 | 
					    wnd->Show(TRUE);
 | 
				
			||||||
    }
 | 
					
 | 
				
			||||||
 | 
					    m_WParser->GetContainer()->InsertCell(new wxHtmlWidgetCell(wnd, fl));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TAG_HANDLER_END(MYBIND)
 | 
					TAG_HANDLER_END(MYBIND)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,64 +71,55 @@ TAGS_MODULE_BEGIN(MyBind)
 | 
				
			|||||||
TAGS_MODULE_END(MyBind)
 | 
					TAGS_MODULE_END(MyBind)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// private classes
 | 
					// private classes
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Define a new application type, each program should derive a class from wxApp
 | 
					// Define a new application type, each program should derive a class from wxApp
 | 
				
			||||||
   class MyApp : public wxApp
 | 
					class MyApp : public wxApp
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
   public:
 | 
					public:
 | 
				
			||||||
    // override base class virtuals
 | 
					    // override base class virtuals
 | 
				
			||||||
    // ----------------------------
 | 
					    // ----------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // this one is called on application startup and is a good place for the app
 | 
					    // this one is called on application startup and is a good place for the app
 | 
				
			||||||
    // initialization (doing it here and not in the ctor allows to have an error
 | 
					    // initialization (doing it here and not in the ctor allows to have an error
 | 
				
			||||||
    // return: if OnInit() returns false, the application terminates)
 | 
					    // return: if OnInit() returns false, the application terminates)
 | 
				
			||||||
      virtual bool OnInit();
 | 
					    virtual bool OnInit();
 | 
				
			||||||
   };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Define a new frame type: this is going to be our main frame
 | 
					// Define a new frame type: this is going to be our main frame
 | 
				
			||||||
   class MyFrame : public wxFrame
 | 
					class MyFrame : public wxFrame
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
   public:
 | 
					public:
 | 
				
			||||||
    // ctor(s)
 | 
					    // ctor(s)
 | 
				
			||||||
      MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
 | 
					    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // event handlers (these functions should _not_ be virtual)
 | 
					    // event handlers (these functions should _not_ be virtual)
 | 
				
			||||||
      void OnQuit(wxCommandEvent& event);
 | 
					    void OnQuit(wxCommandEvent& event);
 | 
				
			||||||
      void OnAbout(wxCommandEvent& event);
 | 
					    void OnBack(wxCommandEvent& event);
 | 
				
			||||||
      void OnBack(wxCommandEvent& event);
 | 
					    void OnForward(wxCommandEvent& event);
 | 
				
			||||||
      void OnForward(wxCommandEvent& event);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
   private:
 | 
					private:
 | 
				
			||||||
    // any class wishing to process wxWindows events must use this macro
 | 
					    // any class wishing to process wxWindows events must use this macro
 | 
				
			||||||
    DECLARE_EVENT_TABLE()
 | 
					    DECLARE_EVENT_TABLE()
 | 
				
			||||||
   };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// constants
 | 
					// constants
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IDs for the controls and the menu commands
 | 
					// IDs for the controls and the menu commands
 | 
				
			||||||
   enum
 | 
					enum
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // menu items
 | 
					    // menu items
 | 
				
			||||||
   Minimal_Quit = 1,
 | 
					    Minimal_Quit = 1,
 | 
				
			||||||
   Minimal_About,
 | 
					    Minimal_Back,
 | 
				
			||||||
   Minimal_Back,
 | 
					    Minimal_Forward,
 | 
				
			||||||
   Minimal_Forward,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // controls start here (the numbers are, of course, arbitrary)
 | 
					    // controls start here (the numbers are, of course, arbitrary)
 | 
				
			||||||
   Minimal_Text = 1000,
 | 
					    Minimal_Text = 1000,
 | 
				
			||||||
   };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// event tables and other macros for wxWindows
 | 
					// event tables and other macros for wxWindows
 | 
				
			||||||
@@ -138,45 +128,44 @@ TAGS_MODULE_END(MyBind)
 | 
				
			|||||||
// the event tables connect the wxWindows events with the functions (event
 | 
					// the event tables connect the wxWindows events with the functions (event
 | 
				
			||||||
// handlers) which process them. It can be also done at run-time, but for the
 | 
					// handlers) which process them. It can be also done at run-time, but for the
 | 
				
			||||||
// simple menu events like this the static method is much simpler.
 | 
					// simple menu events like this the static method is much simpler.
 | 
				
			||||||
   BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
   EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
					    EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
				
			||||||
   EVT_MENU(Minimal_About, MyFrame::OnAbout)
 | 
					    EVT_MENU(Minimal_Back, MyFrame::OnBack)
 | 
				
			||||||
   EVT_MENU(Minimal_Back, MyFrame::OnBack)
 | 
					    EVT_MENU(Minimal_Forward, MyFrame::OnForward)
 | 
				
			||||||
   EVT_MENU(Minimal_Forward, MyFrame::OnForward)
 | 
					END_EVENT_TABLE()
 | 
				
			||||||
   END_EVENT_TABLE()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // Create a new application object: this macro will allow wxWindows to create
 | 
					// Create a new application object: this macro will allow wxWindows to create
 | 
				
			||||||
   // the application object during program execution (it's better than using a
 | 
					// the application object during program execution (it's better than using a
 | 
				
			||||||
   // static object for many reasons) and also declares the accessor function
 | 
					// static object for many reasons) and also declares the accessor function
 | 
				
			||||||
   // wxGetApp() which will return the reference of the right type (i.e. MyApp and
 | 
					// wxGetApp() which will return the reference of the right type (i.e. MyApp and
 | 
				
			||||||
   // not wxApp)
 | 
					// not wxApp)
 | 
				
			||||||
   IMPLEMENT_APP(MyApp)
 | 
					IMPLEMENT_APP(MyApp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // ============================================================================
 | 
					// ============================================================================
 | 
				
			||||||
   // implementation
 | 
					// implementation
 | 
				
			||||||
   // ============================================================================
 | 
					// ============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
   // the application class
 | 
					// the application class
 | 
				
			||||||
   // ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // `Main program' equivalent: the program execution "starts" here
 | 
					// `Main program' equivalent: the program execution "starts" here
 | 
				
			||||||
   bool MyApp::OnInit()
 | 
					bool MyApp::OnInit()
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // Create the main application window
 | 
					    // Create the main application window
 | 
				
			||||||
      MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
 | 
					    MyFrame *frame = new MyFrame( "wxHtmlWindow testing application",
 | 
				
			||||||
         wxPoint(50, 50), wxSize(640, 480));
 | 
					        wxPoint(50, 50), wxSize(640, 480) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Show it and tell the application that it's our main window
 | 
					    // Show it and tell the application that it's our main window
 | 
				
			||||||
    // @@@ what does it do exactly, in fact? is it necessary here?
 | 
					    // @@@ what does it do exactly, in fact? is it necessary here?
 | 
				
			||||||
      frame->Show(TRUE);
 | 
					    frame->Show(TRUE);
 | 
				
			||||||
      SetTopWindow(frame);
 | 
					    SetTopWindow(frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // success: wxApp::OnRun() will be called which will enter the main message
 | 
					    // success: wxApp::OnRun() will be called which will enter the main message
 | 
				
			||||||
    // loop and the application will run. If we returned FALSE here, the
 | 
					    // loop and the application will run. If we returned FALSE here, the
 | 
				
			||||||
    // application would exit immediately.
 | 
					    // application would exit immediately.
 | 
				
			||||||
      return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
   }
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// main frame
 | 
					// main frame
 | 
				
			||||||
@@ -185,61 +174,49 @@ TAGS_MODULE_END(MyBind)
 | 
				
			|||||||
wxHtmlWindow *html;
 | 
					wxHtmlWindow *html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// frame constructor
 | 
					// frame constructor
 | 
				
			||||||
   MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
					MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
				
			||||||
   : wxFrame((wxFrame *)NULL, -1, title, pos, size)
 | 
					: wxFrame((wxFrame *)NULL, -1, title, pos, size)
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // create a menu bar
 | 
					    // create a menu bar
 | 
				
			||||||
      wxMenu *menuFile = new wxMenu;
 | 
					    wxMenu *menuFile = new wxMenu;
 | 
				
			||||||
      wxMenu *menuNav = new wxMenu;
 | 
					    wxMenu *menuNav = new wxMenu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      menuFile->Append(Minimal_Quit, "E&xit");
 | 
					    menuFile->Append(Minimal_Quit, "E&xit");
 | 
				
			||||||
      menuNav->Append(Minimal_Back, "Go &BACK");
 | 
					    menuNav->Append(Minimal_Back, "Go &BACK");
 | 
				
			||||||
      menuNav->Append(Minimal_Forward, "Go &FORWARD");
 | 
					    menuNav->Append(Minimal_Forward, "Go &FORWARD");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // now append the freshly created menu to the menu bar...
 | 
					    // now append the freshly created menu to the menu bar...
 | 
				
			||||||
      wxMenuBar *menuBar = new wxMenuBar;
 | 
					    wxMenuBar *menuBar = new wxMenuBar;
 | 
				
			||||||
      menuBar->Append(menuFile, "&File");
 | 
					    menuBar->Append(menuFile, "&File");
 | 
				
			||||||
      menuBar->Append(menuNav, "&Navigate");
 | 
					    menuBar->Append(menuNav, "&Navigate");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // ... and attach this menu bar to the frame
 | 
					    // ... and attach this menu bar to the frame
 | 
				
			||||||
      SetMenuBar(menuBar);
 | 
					    SetMenuBar(menuBar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      CreateStatusBar(2);
 | 
					    CreateStatusBar(2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      html = new wxHtmlWindow(this);
 | 
					    html = new wxHtmlWindow(this);
 | 
				
			||||||
      html -> SetRelatedFrame(this, "VFS Demo: '%s'");
 | 
					    html -> SetRelatedFrame(this, "VFS Demo: '%s'");
 | 
				
			||||||
      html -> SetRelatedStatusBar(1);
 | 
					    html -> SetRelatedStatusBar(1);
 | 
				
			||||||
      html -> LoadPage("start.htm");
 | 
					    html -> LoadPage("start.htm");
 | 
				
			||||||
   }
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// event handlers
 | 
					// event handlers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 | 
					void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // TRUE is to force the frame to close
 | 
					    // TRUE is to force the frame to close
 | 
				
			||||||
      Close(TRUE);
 | 
					    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!");
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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!");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,49 +30,47 @@
 | 
				
			|||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Define a new application type, each program should derive a class from wxApp
 | 
					// Define a new application type, each program should derive a class from wxApp
 | 
				
			||||||
   class MyApp : public wxApp
 | 
					class MyApp : public wxApp
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
   public:
 | 
					public:
 | 
				
			||||||
    // override base class virtuals
 | 
					    // override base class virtuals
 | 
				
			||||||
    // ----------------------------
 | 
					    // ----------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // this one is called on application startup and is a good place for the app
 | 
					    // this one is called on application startup and is a good place for the app
 | 
				
			||||||
    // initialization (doing it here and not in the ctor allows to have an error
 | 
					    // initialization (doing it here and not in the ctor allows to have an error
 | 
				
			||||||
    // return: if OnInit() returns false, the application terminates)
 | 
					    // return: if OnInit() returns false, the application terminates)
 | 
				
			||||||
      virtual bool OnInit();
 | 
					    virtual bool OnInit();
 | 
				
			||||||
   };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Define a new frame type: this is going to be our main frame
 | 
					// Define a new frame type: this is going to be our main frame
 | 
				
			||||||
   class MyFrame : public wxFrame
 | 
					class MyFrame : public wxFrame
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
   public:
 | 
					public:
 | 
				
			||||||
    // ctor(s)
 | 
					    // ctor(s)
 | 
				
			||||||
      MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
 | 
					    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // event handlers (these functions should _not_ be virtual)
 | 
					    // event handlers (these functions should _not_ be virtual)
 | 
				
			||||||
      void OnQuit(wxCommandEvent& event);
 | 
					    void OnQuit(wxCommandEvent& event);
 | 
				
			||||||
      void OnAbout(wxCommandEvent& event);
 | 
					    void OnBack(wxCommandEvent& event);
 | 
				
			||||||
      void OnBack(wxCommandEvent& event);
 | 
					    void OnForward(wxCommandEvent& event);
 | 
				
			||||||
      void OnForward(wxCommandEvent& event);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
   private:
 | 
					private:
 | 
				
			||||||
    // any class wishing to process wxWindows events must use this macro
 | 
					    // any class wishing to process wxWindows events must use this macro
 | 
				
			||||||
    DECLARE_EVENT_TABLE()
 | 
					    DECLARE_EVENT_TABLE()
 | 
				
			||||||
   };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// constants
 | 
					// constants
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IDs for the controls and the menu commands
 | 
					// IDs for the controls and the menu commands
 | 
				
			||||||
   enum
 | 
					enum
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // menu items
 | 
					    // menu items
 | 
				
			||||||
   Minimal_Quit = 1,
 | 
					    Minimal_Quit = 1,
 | 
				
			||||||
   Minimal_About,
 | 
					    Minimal_Back,
 | 
				
			||||||
   Minimal_Back,
 | 
					    Minimal_Forward
 | 
				
			||||||
   Minimal_Forward
 | 
					};
 | 
				
			||||||
   };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// event tables and other macros for wxWindows
 | 
					// event tables and other macros for wxWindows
 | 
				
			||||||
@@ -81,53 +79,53 @@
 | 
				
			|||||||
// the event tables connect the wxWindows events with the functions (event
 | 
					// the event tables connect the wxWindows events with the functions (event
 | 
				
			||||||
// handlers) which process them. It can be also done at run-time, but for the
 | 
					// handlers) which process them. It can be also done at run-time, but for the
 | 
				
			||||||
// simple menu events like this the static method is much simpler.
 | 
					// simple menu events like this the static method is much simpler.
 | 
				
			||||||
   BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
   EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
					    EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
				
			||||||
   EVT_MENU(Minimal_About, MyFrame::OnAbout)
 | 
					    EVT_MENU(Minimal_Back, MyFrame::OnBack)
 | 
				
			||||||
   EVT_MENU(Minimal_Back, MyFrame::OnBack)
 | 
					    EVT_MENU(Minimal_Forward, MyFrame::OnForward)
 | 
				
			||||||
   EVT_MENU(Minimal_Forward, MyFrame::OnForward)
 | 
					END_EVENT_TABLE()
 | 
				
			||||||
   END_EVENT_TABLE()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // Create a new application object: this macro will allow wxWindows to create
 | 
					// Create a new application object: this macro will allow wxWindows to create
 | 
				
			||||||
   // the application object during program execution (it's better than using a
 | 
					// the application object during program execution (it's better than using a
 | 
				
			||||||
   // static object for many reasons) and also declares the accessor function
 | 
					// static object for many reasons) and also declares the accessor function
 | 
				
			||||||
   // wxGetApp() which will return the reference of the right type (i.e. MyApp and
 | 
					// wxGetApp() which will return the reference of the right type (i.e. MyApp and
 | 
				
			||||||
   // not wxApp)
 | 
					// not wxApp)
 | 
				
			||||||
   IMPLEMENT_APP(MyApp)
 | 
					IMPLEMENT_APP(MyApp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // ============================================================================
 | 
					// ============================================================================
 | 
				
			||||||
   // implementation
 | 
					// implementation
 | 
				
			||||||
   // ============================================================================
 | 
					// ============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
   // the application class
 | 
					// the application class
 | 
				
			||||||
   // ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
   // `Main program' equivalent: the program execution "starts" here
 | 
					// `Main program' equivalent: the program execution "starts" here
 | 
				
			||||||
   bool MyApp::OnInit()
 | 
					bool MyApp::OnInit()
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
     #if wxUSE_LIBPNG
 | 
					#if wxUSE_LIBPNG
 | 
				
			||||||
     wxImage::AddHandler(new wxPNGHandler);
 | 
					    wxImage::AddHandler(new wxPNGHandler);
 | 
				
			||||||
     #endif
 | 
					#endif
 | 
				
			||||||
     #if wxUSE_LIBJPEG
 | 
					#if wxUSE_LIBJPEG
 | 
				
			||||||
     wxImage::AddHandler(new wxJPEGHandler);
 | 
					    wxImage::AddHandler(new wxJPEGHandler);
 | 
				
			||||||
     #endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     wxFileSystem::AddHandler(new wxZipFSHandler);
 | 
					    wxFileSystem::AddHandler(new wxZipFSHandler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Create the main application window
 | 
					    // Create the main application window
 | 
				
			||||||
      MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
 | 
					    MyFrame *frame = new MyFrame( "wxHtmlWindow testing application",
 | 
				
			||||||
         wxPoint(50, 50), wxSize(640, 480));
 | 
					        wxPoint(50, 50), wxSize(640, 480) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Show it and tell the application that it's our main window
 | 
					    // Show it and tell the application that it's our main window
 | 
				
			||||||
    // @@@ what does it do exactly, in fact? is it necessary here?
 | 
					    // @@@ what does it do exactly, in fact? is it necessary here?
 | 
				
			||||||
      frame->Show(TRUE);
 | 
					    frame->Show(TRUE);
 | 
				
			||||||
      SetTopWindow(frame);
 | 
					    SetTopWindow(frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // success: wxApp::OnRun() will be called which will enter the main message
 | 
					    // success: wxApp::OnRun() will be called which will enter the main message
 | 
				
			||||||
    // loop and the application will run. If we returned FALSE here, the
 | 
					    // loop and the application will run. If we returned FALSE here, the
 | 
				
			||||||
    // application would exit immediately.
 | 
					    // application would exit immediately.
 | 
				
			||||||
      return TRUE;
 | 
					
 | 
				
			||||||
   }
 | 
					    return TRUE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
// main frame
 | 
					// main frame
 | 
				
			||||||
@@ -136,57 +134,50 @@
 | 
				
			|||||||
wxHtmlWindow *html;
 | 
					wxHtmlWindow *html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// frame constructor
 | 
					// frame constructor
 | 
				
			||||||
   MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
					MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
				
			||||||
   : wxFrame((wxFrame *)NULL, -1, title, pos, size)
 | 
					: wxFrame((wxFrame *)NULL, -1, title, pos, size)
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // create a menu bar
 | 
					    // create a menu bar
 | 
				
			||||||
      wxMenu *menuFile = new wxMenu;
 | 
					    wxMenu *menuFile = new wxMenu;
 | 
				
			||||||
      wxMenu *menuNav = new wxMenu;
 | 
					    wxMenu *menuNav = new wxMenu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      menuFile->Append(Minimal_Quit, "E&xit");
 | 
					    menuFile->Append(Minimal_Quit, "E&xit");
 | 
				
			||||||
      menuNav->Append(Minimal_Back, "Go &BACK");
 | 
					    menuNav->Append(Minimal_Back, "Go &BACK");
 | 
				
			||||||
      menuNav->Append(Minimal_Forward, "Go &FORWARD");
 | 
					    menuNav->Append(Minimal_Forward, "Go &FORWARD");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // now append the freshly created menu to the menu bar...
 | 
					    // now append the freshly created menu to the menu bar...
 | 
				
			||||||
      wxMenuBar *menuBar = new wxMenuBar;
 | 
					    wxMenuBar *menuBar = new wxMenuBar;
 | 
				
			||||||
      menuBar->Append(menuFile, "&File");
 | 
					    menuBar->Append(menuFile, "&File");
 | 
				
			||||||
      menuBar->Append(menuNav, "&Navigate");
 | 
					    menuBar->Append(menuNav, "&Navigate");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // ... and attach this menu bar to the frame
 | 
					    // ... and attach this menu bar to the frame
 | 
				
			||||||
      SetMenuBar(menuBar);
 | 
					    SetMenuBar(menuBar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      CreateStatusBar(1);
 | 
					    CreateStatusBar(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      {
 | 
					    {
 | 
				
			||||||
      html = new wxHtmlWindow(this);
 | 
					    html = new wxHtmlWindow(this);
 | 
				
			||||||
      html -> SetRelatedFrame(this, "HTML : %s");
 | 
					    html -> SetRelatedFrame(this, "HTML : %s");
 | 
				
			||||||
      html -> SetRelatedStatusBar(0);
 | 
					    html -> SetRelatedStatusBar(0);
 | 
				
			||||||
      html -> LoadPage("start.htm");
 | 
					    html -> LoadPage("start.htm");
 | 
				
			||||||
      }
 | 
					    }
 | 
				
			||||||
   }
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// event handlers
 | 
					// event handlers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 | 
					void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 | 
				
			||||||
   {
 | 
					{
 | 
				
			||||||
    // TRUE is to force the frame to close
 | 
					    // TRUE is to force the frame to close
 | 
				
			||||||
      Close(TRUE);
 | 
					    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))
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
   void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
 | 
					    if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
 | 
				
			||||||
   {
 | 
					}
 | 
				
			||||||
   if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   void MyFrame::OnForward(wxCommandEvent& WXUNUSED(event))
 | 
					 | 
				
			||||||
   {
 | 
					 | 
				
			||||||
   if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,45 +37,44 @@
 | 
				
			|||||||
class MyApp: public wxApp
 | 
					class MyApp: public wxApp
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual bool OnInit();
 | 
					    virtual bool OnInit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  wxLocale m_locale; // locale we'll be using
 | 
					    wxLocale m_locale; // locale we'll be using
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Define a new frame type
 | 
					// Define a new frame type
 | 
				
			||||||
class MyFrame: public wxFrame
 | 
					class MyFrame: public wxFrame
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h,
 | 
					    MyFrame(wxFrame *frame, const wxChar *title,
 | 
				
			||||||
          wxLocale& m_locale);
 | 
					        const wxPoint& pos, const wxSize& size, wxLocale& m_locale);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  void OnQuit(wxCommandEvent& event);
 | 
					    void OnQuit(wxCommandEvent& event);
 | 
				
			||||||
  void OnAbout(wxCommandEvent& event);
 | 
					    void OnAbout(wxCommandEvent& event);
 | 
				
			||||||
  void OnPlay(wxCommandEvent& event);
 | 
					    void OnPlay(wxCommandEvent& event);
 | 
				
			||||||
  void OnOpen(wxCommandEvent& event);
 | 
					    void OnOpen(wxCommandEvent& event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DECLARE_EVENT_TABLE()
 | 
					    DECLARE_EVENT_TABLE()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxLocale& m_locale;
 | 
					    wxLocale& m_locale;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ID for the menu commands
 | 
					// ID for the menu commands
 | 
				
			||||||
enum
 | 
					enum
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  MINIMAL_QUIT = 1,
 | 
					    MINIMAL_QUIT = 1,
 | 
				
			||||||
  MINIMAL_TEXT,
 | 
					    MINIMAL_TEXT,
 | 
				
			||||||
  MINIMAL_ABOUT,
 | 
					    MINIMAL_TEST,
 | 
				
			||||||
  MINIMAL_TEST,
 | 
					    MINIMAL_OPEN
 | 
				
			||||||
  MINIMAL_OPEN
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
  EVT_MENU(MINIMAL_QUIT, MyFrame::OnQuit)
 | 
					    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_TEST, MyFrame::OnPlay)
 | 
				
			||||||
  EVT_MENU(MINIMAL_OPEN, MyFrame::OnOpen)
 | 
					    EVT_MENU(MINIMAL_OPEN, MyFrame::OnOpen)
 | 
				
			||||||
END_EVENT_TABLE()
 | 
					END_EVENT_TABLE()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
IMPLEMENT_APP(MyApp)
 | 
					IMPLEMENT_APP(MyApp)
 | 
				
			||||||
@@ -84,131 +83,133 @@ IMPLEMENT_APP(MyApp)
 | 
				
			|||||||
// `Main program' equivalent, creating windows and returning main app frame
 | 
					// `Main program' equivalent, creating windows and returning main app frame
 | 
				
			||||||
bool MyApp::OnInit()
 | 
					bool MyApp::OnInit()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const wxString langs[] =
 | 
					    const wxString langs[] =
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
      _T("(System default)"),
 | 
					        _T("(System default)"),
 | 
				
			||||||
      _T("French"),
 | 
					        _T("French"),
 | 
				
			||||||
      _T("German"),
 | 
					        _T("German"),
 | 
				
			||||||
      _T("Russian"),
 | 
					        _T("Russian"),
 | 
				
			||||||
      _T("English"),
 | 
					        _T("English"),
 | 
				
			||||||
      _T("English (U.S.)")
 | 
					        _T("English (U.S.)")
 | 
				
			||||||
  };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SetExitOnFrameDelete(FALSE);
 | 
					    SetExitOnFrameDelete(FALSE);
 | 
				
			||||||
  int lng = wxGetSingleChoiceIndex(_T("Please choose language:"), _T("Language"), 
 | 
					    int lng = wxGetSingleChoiceIndex(_T("Please choose language:"), _T("Language"), 
 | 
				
			||||||
                                   WXSIZEOF(langs), langs);
 | 
					                                   WXSIZEOF(langs), langs);
 | 
				
			||||||
  SetExitOnFrameDelete(TRUE);
 | 
					    SetExitOnFrameDelete(TRUE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  switch (lng)
 | 
					    switch (lng)
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
      case 0 : m_locale.Init(wxLANGUAGE_DEFAULT); break;
 | 
					        case 0 : m_locale.Init(wxLANGUAGE_DEFAULT); break;
 | 
				
			||||||
      case 1 : m_locale.Init(wxLANGUAGE_FRENCH); break;
 | 
					        case 1 : m_locale.Init(wxLANGUAGE_FRENCH); break;
 | 
				
			||||||
      case 2 : m_locale.Init(wxLANGUAGE_GERMAN); break;
 | 
					        case 2 : m_locale.Init(wxLANGUAGE_GERMAN); break;
 | 
				
			||||||
      case 3 : m_locale.Init(wxLANGUAGE_RUSSIAN); break;
 | 
					        case 3 : m_locale.Init(wxLANGUAGE_RUSSIAN); break;
 | 
				
			||||||
      case 4 : m_locale.Init(wxLANGUAGE_ENGLISH); break;
 | 
					        case 4 : m_locale.Init(wxLANGUAGE_ENGLISH); break;
 | 
				
			||||||
      case -1:
 | 
					        case -1:
 | 
				
			||||||
      case 5 : m_locale.Init(wxLANGUAGE_ENGLISH_US); break;
 | 
					        case 5 : m_locale.Init(wxLANGUAGE_ENGLISH_US); break;
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Initialize the catalogs we'll be using
 | 
					    // Initialize the catalogs we'll be using
 | 
				
			||||||
  /* not needed any more, done in wxLocale ctor
 | 
					    /* not needed any more, done in wxLocale ctor
 | 
				
			||||||
  m_locale.AddCatalog("wxstd");      // 1) for library messages
 | 
					    m_locale.AddCatalog("wxstd");      // 1) for library messages
 | 
				
			||||||
  */
 | 
					    */
 | 
				
			||||||
  m_locale.AddCatalog(wxT("internat"));      // 2) our private one
 | 
					    m_locale.AddCatalog(wxT("internat"));      // 2) our private one
 | 
				
			||||||
  /* this catalog is installed in standard location on Linux systems,
 | 
					    /* this catalog is installed in standard location on Linux systems,
 | 
				
			||||||
     it might not be installed on yours - just ignore the errrors
 | 
					     it might not be installed on yours - just ignore the errrors
 | 
				
			||||||
     or comment out this line then */
 | 
					     or comment out this line then */
 | 
				
			||||||
#ifdef __LINUX__
 | 
					#ifdef __LINUX__
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
    wxLogNull noLog;
 | 
					    wxLogNull noLog;
 | 
				
			||||||
    m_locale.AddCatalog("fileutils");  // 3) and another just for testing
 | 
					    m_locale.AddCatalog("fileutils");  // 3) and another just for testing
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Create the main frame window
 | 
					    // Create the main frame window
 | 
				
			||||||
  MyFrame *frame = new MyFrame((wxFrame *) NULL, _("International wxWindows App"),
 | 
					    MyFrame *frame = new MyFrame( (wxFrame *) NULL,
 | 
				
			||||||
                               50, 50, 350, 60, m_locale);
 | 
					        _("International wxWindows App"), wxPoint(50, 50), wxSize(350, 60),
 | 
				
			||||||
 | 
					        m_locale);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Give it an icon
 | 
					    // Give it an icon
 | 
				
			||||||
  frame->SetIcon(wxICON(mondrian));
 | 
					    frame->SetIcon(wxICON(mondrian));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Make a menubar
 | 
					    // Make a menubar
 | 
				
			||||||
  wxMenu *file_menu = new wxMenu;
 | 
					    wxMenu *file_menu = new wxMenu;
 | 
				
			||||||
  file_menu->Append(MINIMAL_ABOUT, _("&About..."));
 | 
					    file_menu->Append(wxID_ABOUT, _("&About..."));
 | 
				
			||||||
  file_menu->AppendSeparator();
 | 
					    file_menu->AppendSeparator();
 | 
				
			||||||
  file_menu->Append(MINIMAL_QUIT, _("E&xit"));
 | 
					    file_menu->Append(MINIMAL_QUIT, _("E&xit"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxMenu *test_menu = new wxMenu;
 | 
					    wxMenu *test_menu = new wxMenu;
 | 
				
			||||||
  test_menu->Append(MINIMAL_OPEN, _("&Open bogus file"));
 | 
					    test_menu->Append(MINIMAL_OPEN, _("&Open bogus file"));
 | 
				
			||||||
  test_menu->Append(MINIMAL_TEST, _("&Play a game"));
 | 
					    test_menu->Append(MINIMAL_TEST, _("&Play a game"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxMenuBar *menu_bar = new wxMenuBar;
 | 
					    wxMenuBar *menu_bar = new wxMenuBar;
 | 
				
			||||||
  menu_bar->Append(file_menu, _("&File"));
 | 
					    menu_bar->Append(file_menu, _("&File"));
 | 
				
			||||||
  menu_bar->Append(test_menu, _("&Test"));
 | 
					    menu_bar->Append(test_menu, _("&Test"));
 | 
				
			||||||
  frame->SetMenuBar(menu_bar);
 | 
					    frame->SetMenuBar(menu_bar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Show the frame
 | 
					    // Show the frame
 | 
				
			||||||
  frame->Show(TRUE);
 | 
					    frame->Show(TRUE);
 | 
				
			||||||
  SetTopWindow(frame);
 | 
					    SetTopWindow(frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// My frame constructor
 | 
					// My frame constructor
 | 
				
			||||||
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y,
 | 
					MyFrame::MyFrame(wxFrame *frame, const wxChar *title,
 | 
				
			||||||
                 int w, int h, wxLocale& l)
 | 
					    const wxPoint& pos, const wxSize& size, wxLocale& l)
 | 
				
			||||||
       : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)),
 | 
					       : wxFrame(frame, -1, title, pos, size),
 | 
				
			||||||
         m_locale(l)
 | 
					         m_locale(l)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    // Empty
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
 | 
					void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  Close(TRUE);
 | 
					    Close(TRUE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 | 
					void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wxString localeInfo;
 | 
					    wxString localeInfo;
 | 
				
			||||||
  localeInfo.Printf(_("Language: %s\nSystem locale name: %s\nCanonical locale name: %s\n"),
 | 
					    localeInfo.Printf( _("Language: %s\nSystem locale name: %s\nCanonical locale name: %s\n"),
 | 
				
			||||||
                      m_locale.GetLocale(),
 | 
					        m_locale.GetLocale(),
 | 
				
			||||||
                      m_locale.GetSysName().c_str(),
 | 
					        m_locale.GetSysName().c_str(),
 | 
				
			||||||
                      m_locale.GetCanonicalName().c_str());
 | 
					        m_locale.GetCanonicalName().c_str() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxMessageDialog(this, wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart"))
 | 
					    wxMessageDialog(this, wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart"))
 | 
				
			||||||
                          + wxT("\n\n") + localeInfo,
 | 
					        + wxT("\n\n") + localeInfo,
 | 
				
			||||||
                  _("About Internat"), wxOK | wxICON_INFORMATION).ShowModal();
 | 
					        _("About Internat"), wxOK | wxICON_INFORMATION).ShowModal();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
 | 
					void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wxString str = wxGetTextFromUser(_("Enter your number:"),
 | 
					    wxString str = wxGetTextFromUser(_("Enter your number:"),
 | 
				
			||||||
                                   _("Try to guess my number!"),
 | 
					        _("Try to guess my number!"), wxEmptyString, this);
 | 
				
			||||||
                                  "", this);
 | 
					 | 
				
			||||||
  if ( str.IsEmpty() )
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int num;
 | 
					    if ( str.IsEmpty() ) return;
 | 
				
			||||||
  wxSscanf(str, wxT("%d"), &num);
 | 
					 | 
				
			||||||
  if ( num == 0 )
 | 
					 | 
				
			||||||
    str = _("You've probably entered an invalid number.");
 | 
					 | 
				
			||||||
  else if ( num == 9 )  // this message is not translated (not in catalog)
 | 
					 | 
				
			||||||
    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 {
 | 
					 | 
				
			||||||
    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:")
 | 
					 | 
				
			||||||
        << _("cannot create fifo `%s'");
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxMessageBox(str, _("Result"), wxOK | wxICON_INFORMATION);
 | 
					    int num;
 | 
				
			||||||
 | 
					    wxSscanf(str, wxT("%d"), &num);
 | 
				
			||||||
 | 
					    if ( num == 0 )
 | 
				
			||||||
 | 
					        str = _("You've probably entered an invalid number.");
 | 
				
			||||||
 | 
					    else if ( num == 9 )  // this message is not translated (not in catalog)
 | 
				
			||||||
 | 
					        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
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        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:")
 | 
				
			||||||
 | 
					            << _("cannot create fifo `%s'");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wxMessageBox(str, _("Result"), wxOK | wxICON_INFORMATION);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MyFrame::OnOpen(wxCommandEvent&)
 | 
					void MyFrame::OnOpen(wxCommandEvent&)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  // open a bogus file -- the error message should be also translated if you've
 | 
					    // open a bogus file -- the error message should be also translated if you've
 | 
				
			||||||
  // got wxstd.mo somewhere in the search path
 | 
					    // got wxstd.mo somewhere in the search path
 | 
				
			||||||
  wxFile file(wxT("NOTEXIST.ING"));
 | 
					    wxFile file(wxT("NOTEXIST.ING"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,11 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !wxUSE_JOYSTICK
 | 
					#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
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "wx/wave.h"
 | 
					#include "wx/wave.h"
 | 
				
			||||||
@@ -40,57 +44,55 @@ long ypos = -1;
 | 
				
			|||||||
int winNumber = 1;
 | 
					int winNumber = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Initialise this in OnInit, not statically
 | 
					// Initialise this in OnInit, not statically
 | 
				
			||||||
bool MyApp::OnInit(void)
 | 
					bool MyApp::OnInit()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wxJoystick stick(wxJOYSTICK1);
 | 
					    wxJoystick stick(wxJOYSTICK1);
 | 
				
			||||||
  if (!stick.IsOk())
 | 
					    if (!stick.IsOk())
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
    wxMessageBox("No joystick detected!");
 | 
					        wxMessageBox("No joystick detected!");
 | 
				
			||||||
    return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if wxUSE_WAVE
 | 
					#if wxUSE_WAVE
 | 
				
			||||||
  m_fire.Create("gun.wav");
 | 
					    m_fire.Create("gun.wav");
 | 
				
			||||||
#endif // wxUSE_WAVE
 | 
					#endif // wxUSE_WAVE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  m_maxX = stick.GetXMax();
 | 
					    m_maxX = stick.GetXMax();
 | 
				
			||||||
  m_maxY = stick.GetYMax();
 | 
					    m_maxY = stick.GetYMax();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Create the main frame window
 | 
					    // Create the main frame window
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  frame = new MyFrame(NULL, "Joystick Demo", wxPoint(0, 0), wxSize(500, 400),
 | 
					    frame = new MyFrame(NULL, "Joystick Demo", wxDefaultPosition,
 | 
				
			||||||
   wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
 | 
					        wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Give it an icon (this is ignored in MDI mode: uses resources)
 | 
					  // Give it an icon (this is ignored in MDI mode: uses resources)
 | 
				
			||||||
#ifdef __WXMSW__
 | 
					#ifdef __WXMSW__
 | 
				
			||||||
  frame->SetIcon(wxIcon("joyicon"));
 | 
					    frame->SetIcon(wxIcon("joyicon"));
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __X__
 | 
					#ifdef __X__
 | 
				
			||||||
  frame->SetIcon(wxIcon("joyicon.xbm"));
 | 
					    frame->SetIcon(wxIcon("joyicon.xbm"));
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Make a menubar
 | 
					    // Make a menubar
 | 
				
			||||||
  wxMenu *file_menu = new wxMenu;
 | 
					    wxMenu *file_menu = new wxMenu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  file_menu->Append(JOYTEST_QUIT, "&Exit");
 | 
					    file_menu->Append(JOYTEST_QUIT, "&Exit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxMenu *help_menu = new wxMenu;
 | 
					    wxMenuBar *menu_bar = new wxMenuBar;
 | 
				
			||||||
  help_menu->Append(JOYTEST_ABOUT, "&About");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxMenuBar *menu_bar = new wxMenuBar;
 | 
					    menu_bar->Append(file_menu, "&File");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  menu_bar->Append(file_menu, "&File");
 | 
					    // Associate the menu bar with the frame
 | 
				
			||||||
  menu_bar->Append(help_menu, "&Help");
 | 
					    frame->SetMenuBar(menu_bar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Associate the menu bar with the frame
 | 
					    frame->CreateStatusBar();
 | 
				
			||||||
  frame->SetMenuBar(menu_bar);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  frame->CreateStatusBar();
 | 
					    frame->CenterOnScreen();
 | 
				
			||||||
 | 
					    frame->Show(TRUE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  frame->Show(TRUE);
 | 
					    SetTopWindow(frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SetTopWindow(frame);
 | 
					    return TRUE;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  return TRUE;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
 | 
					BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
 | 
				
			||||||
@@ -99,13 +101,13 @@ END_EVENT_TABLE()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Define a constructor for my canvas
 | 
					// Define a constructor for my canvas
 | 
				
			||||||
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
 | 
					MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
 | 
				
			||||||
 wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER)
 | 
					    wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxJoystick joystick(wxJOYSTICK1);
 | 
					    wxJoystick joystick(wxJOYSTICK1);
 | 
				
			||||||
    joystick.SetCapture(this);
 | 
					    joystick.SetCapture(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MyCanvas::~MyCanvas(void)
 | 
					MyCanvas::~MyCanvas()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxJoystick joystick(wxJOYSTICK1);
 | 
					    wxJoystick joystick(wxJOYSTICK1);
 | 
				
			||||||
    joystick.ReleaseCapture();
 | 
					    joystick.ReleaseCapture();
 | 
				
			||||||
@@ -113,62 +115,65 @@ MyCanvas::~MyCanvas(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
 | 
					void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wxClientDC dc(this);
 | 
					    wxClientDC dc(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxPoint pt(event.GetPosition());
 | 
					    wxPoint pt(event.GetPosition());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Scale to canvas size
 | 
					    // Scale to canvas size
 | 
				
			||||||
  int cw, ch;
 | 
					    int cw, ch;
 | 
				
			||||||
  GetSize(&cw, &ch);
 | 
					    GetSize(&cw, &ch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  pt.x = (long) (((double)pt.x/(double)wxGetApp().m_maxX) * cw);
 | 
					    pt.x = (long) (((double)pt.x/(double)wxGetApp().m_maxX) * cw);
 | 
				
			||||||
  pt.y = (long) (((double)pt.y/(double)wxGetApp().m_maxY) * ch);
 | 
					    pt.y = (long) (((double)pt.y/(double)wxGetApp().m_maxY) * ch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (xpos > -1 && ypos > -1 && event.IsMove() && event.ButtonIsDown())
 | 
					    if (xpos > -1 && ypos > -1 && event.IsMove() && event.ButtonIsDown())
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
    dc.SetPen(*wxBLACK_PEN);
 | 
					        dc.SetPen(*wxBLACK_PEN);
 | 
				
			||||||
    dc.DrawLine(xpos, ypos, pt.x, pt.y);
 | 
					        dc.DrawLine(xpos, ypos, pt.x, pt.y);
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
  xpos = pt.x;
 | 
					 | 
				
			||||||
  ypos = pt.y;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  char buf[100];
 | 
					    xpos = pt.x;
 | 
				
			||||||
  if (event.ButtonDown())
 | 
					    ypos = pt.y;
 | 
				
			||||||
    sprintf(buf, "Joystick (%d, %d) Fire!", pt.x, pt.y);
 | 
					
 | 
				
			||||||
  else
 | 
					    char buf[100];
 | 
				
			||||||
    sprintf(buf, "Joystick (%d, %d)", pt.x, pt.y);
 | 
					    if (event.ButtonDown())
 | 
				
			||||||
  frame->SetStatusText(buf);
 | 
					        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
 | 
					#if wxUSE_WAVE
 | 
				
			||||||
  if (event.ButtonDown() && wxGetApp().m_fire.IsOk())
 | 
					    if (event.ButtonDown() && wxGetApp().m_fire.IsOk())
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
    wxGetApp().m_fire.Play();
 | 
					        wxGetApp().m_fire.Play();
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
#endif // wxUSE_WAVE
 | 
					#endif // wxUSE_WAVE
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
  EVT_MENU(JOYTEST_QUIT, MyFrame::OnQuit)
 | 
					    EVT_MENU(JOYTEST_QUIT, MyFrame::OnQuit)
 | 
				
			||||||
END_EVENT_TABLE()
 | 
					END_EVENT_TABLE()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
 | 
					MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos,
 | 
				
			||||||
const long style):
 | 
					    const wxSize& size, const long style)
 | 
				
			||||||
  wxFrame(parent, -1, title, pos, size, style)
 | 
					    : wxFrame(parent, -1, title, pos, size, style)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  canvas = new MyCanvas(this);
 | 
					    canvas = new MyCanvas(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MyFrame::~MyFrame(void)
 | 
					MyFrame::~MyFrame()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    // Empty
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MyFrame::OnQuit(wxCommandEvent& event)
 | 
					void MyFrame::OnQuit(wxCommandEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
      Close(TRUE);
 | 
					    Close(TRUE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MyFrame::OnActivate(wxActivateEvent& event)
 | 
					void MyFrame::OnActivate(wxActivateEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (event.GetActive() && canvas)
 | 
					    if (event.GetActive() && canvas)
 | 
				
			||||||
    canvas->SetFocus();
 | 
					        canvas->SetFocus();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,8 +12,8 @@
 | 
				
			|||||||
// Define a new application
 | 
					// Define a new application
 | 
				
			||||||
class MyApp: public wxApp
 | 
					class MyApp: public wxApp
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public:
 | 
					public:
 | 
				
			||||||
    bool OnInit(void);
 | 
					    bool OnInit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Joystick max values
 | 
					    // Joystick max values
 | 
				
			||||||
    int     m_maxX;
 | 
					    int     m_maxX;
 | 
				
			||||||
@@ -28,9 +28,9 @@ DECLARE_APP(MyApp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class MyCanvas: public wxScrolledWindow
 | 
					class MyCanvas: public wxScrolledWindow
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public:
 | 
					public:
 | 
				
			||||||
    MyCanvas(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
 | 
					    MyCanvas(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
 | 
				
			||||||
    ~MyCanvas(void);
 | 
					    ~MyCanvas();
 | 
				
			||||||
    void OnJoystickEvent(wxJoystickEvent& event);
 | 
					    void OnJoystickEvent(wxJoystickEvent& event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DECLARE_EVENT_TABLE()
 | 
					    DECLARE_EVENT_TABLE()
 | 
				
			||||||
@@ -38,10 +38,11 @@ class MyCanvas: public wxScrolledWindow
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class MyFrame: public wxFrame
 | 
					class MyFrame: public wxFrame
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public:
 | 
					public:
 | 
				
			||||||
    MyCanvas *canvas;
 | 
					    MyCanvas *canvas;
 | 
				
			||||||
    MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
 | 
					    MyFrame(wxFrame *parent, const wxString& title,
 | 
				
			||||||
    ~MyFrame(void);
 | 
					        const wxPoint& pos, const wxSize& size, const long style);
 | 
				
			||||||
 | 
					    ~MyFrame();
 | 
				
			||||||
    void OnActivate(wxActivateEvent& event);
 | 
					    void OnActivate(wxActivateEvent& event);
 | 
				
			||||||
    void OnQuit(wxCommandEvent& event);
 | 
					    void OnQuit(wxCommandEvent& event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,4 +50,3 @@ DECLARE_EVENT_TABLE()
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define JOYTEST_QUIT        1
 | 
					#define JOYTEST_QUIT        1
 | 
				
			||||||
#define JOYTEST_ABOUT       2
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
/////////////////////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
// Name:        propsize.cpp
 | 
					// Name:        propsize.cpp
 | 
				
			||||||
// Purpose:     Minimal wxWindows sample
 | 
					// Purpose:     wxWindows propsize sample
 | 
				
			||||||
// Author:      Julian Smart
 | 
					// Author:      Julian Smart
 | 
				
			||||||
// Modified by:
 | 
					// Modified by:
 | 
				
			||||||
// Created:     04/01/98
 | 
					// Created:     04/01/98
 | 
				
			||||||
// RCS-ID:      $Id$
 | 
					// RCS-ID:      $Id$
 | 
				
			||||||
// Copyright:   (c) Julian Smart
 | 
					// Copyright:   (c) Julian Smart
 | 
				
			||||||
// Licence:     wxWindows licence
 | 
					// License:     wxWindows license
 | 
				
			||||||
/////////////////////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ============================================================================
 | 
					// ============================================================================
 | 
				
			||||||
@@ -86,7 +86,6 @@ enum
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    // menu items
 | 
					    // menu items
 | 
				
			||||||
    Minimal_Quit = 1,
 | 
					    Minimal_Quit = 1,
 | 
				
			||||||
    Minimal_About
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
@@ -98,7 +97,7 @@ enum
 | 
				
			|||||||
// simple menu events like this the static method is much simpler.
 | 
					// simple menu events like this the static method is much simpler.
 | 
				
			||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
					BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 | 
				
			||||||
    EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
					    EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
 | 
				
			||||||
    EVT_MENU(Minimal_About, MyFrame::OnAbout)
 | 
					    EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
 | 
				
			||||||
END_EVENT_TABLE()
 | 
					END_EVENT_TABLE()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Create a new application object: this macro will allow wxWindows to create
 | 
					// 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
 | 
					    // create a menu bar
 | 
				
			||||||
    wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
 | 
					    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->AppendSeparator();
 | 
				
			||||||
    menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
 | 
					    menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -166,60 +165,62 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 | 
				
			|||||||
#endif // wxUSE_STATUSBAR
 | 
					#endif // wxUSE_STATUSBAR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define AddLine(orient) \
 | 
					#define AddLine(orient) \
 | 
				
			||||||
     Add( new wxStaticLine( this, -1, wxDefaultPosition, wxSize(2,2), orient), \
 | 
					    Add( new wxStaticLine( this, -1, wxDefaultPosition, wxSize(2,2), orient), \
 | 
				
			||||||
     0, wxEXPAND)
 | 
					    0, wxEXPAND)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define AddButton(label,align) Add( \
 | 
					#define AddButton(label,align) Add( \
 | 
				
			||||||
     new wxButton( this, -1, label, wxDefaultPosition, wxSize(100,50)), \
 | 
					    new wxButton( this, -1, label, wxDefaultPosition, wxSize(100,50)), \
 | 
				
			||||||
     1, wxSHAPED | align)
 | 
					    1, wxSHAPED | align)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
 | 
					    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
 | 
				
			||||||
  // top row -- top-aligned
 | 
					    // top row -- top-aligned
 | 
				
			||||||
  wxBoxSizer *hsizer1 = new wxBoxSizer( wxHORIZONTAL );
 | 
					    wxBoxSizer *hsizer1 = new wxBoxSizer( wxHORIZONTAL );
 | 
				
			||||||
  hsizer1->AddButton( "one", wxALIGN_LEFT | wxALIGN_TOP);
 | 
					    hsizer1->AddButton( "one", wxALIGN_LEFT | wxALIGN_TOP);
 | 
				
			||||||
  hsizer1->AddLine(wxVERTICAL);
 | 
					    hsizer1->AddLine(wxVERTICAL);
 | 
				
			||||||
  hsizer1->AddButton( "two", wxALIGN_CENTER_HORIZONTAL | wxALIGN_TOP);
 | 
					    hsizer1->AddButton( "two", wxALIGN_CENTER_HORIZONTAL | wxALIGN_TOP);
 | 
				
			||||||
  hsizer1->AddLine(wxVERTICAL);
 | 
					    hsizer1->AddLine(wxVERTICAL);
 | 
				
			||||||
  hsizer1->AddButton( "three", wxALIGN_RIGHT | wxALIGN_TOP);
 | 
					    hsizer1->AddButton( "three", wxALIGN_RIGHT | wxALIGN_TOP);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  topsizer->Add(hsizer1, 1, wxEXPAND);
 | 
					    topsizer->Add(hsizer1, 1, wxEXPAND);
 | 
				
			||||||
  topsizer->AddLine(wxHORIZONTAL);
 | 
					    topsizer->AddLine(wxHORIZONTAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxBoxSizer *hsizer2 = new wxBoxSizer( wxHORIZONTAL );
 | 
					    wxBoxSizer *hsizer2 = new wxBoxSizer( wxHORIZONTAL );
 | 
				
			||||||
  hsizer2->AddButton( "four", wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
 | 
					    hsizer2->AddButton( "four", wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
 | 
				
			||||||
  hsizer2->AddLine(wxVERTICAL);
 | 
					    hsizer2->AddLine(wxVERTICAL);
 | 
				
			||||||
  // sizer that preserves it's shape
 | 
					    // sizer that preserves it's shape
 | 
				
			||||||
  wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL );
 | 
					    wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL );
 | 
				
			||||||
  vsizer->Add(
 | 
					    vsizer->Add(
 | 
				
			||||||
     new wxButton( this, -1, "up", wxDefaultPosition, wxSize(100,25)), \
 | 
					        new wxButton( this, -1, "up", wxDefaultPosition, wxSize(100,25) ),
 | 
				
			||||||
     1, wxEXPAND);
 | 
					        1, wxEXPAND);
 | 
				
			||||||
  vsizer->Add(
 | 
					 | 
				
			||||||
     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);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  topsizer->Add(hsizer2, 1, wxEXPAND);
 | 
					    vsizer->Add(
 | 
				
			||||||
  topsizer->AddLine(wxHORIZONTAL);
 | 
					        new wxButton( this, -1, "down", wxDefaultPosition, wxSize(100,25) ),
 | 
				
			||||||
 | 
					        1, wxEXPAND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxBoxSizer *hsizer3 = new wxBoxSizer( wxHORIZONTAL );
 | 
					    hsizer2->Add(vsizer, 1, wxSHAPED | wxALIGN_CENTER);
 | 
				
			||||||
  hsizer3->AddButton( "seven", wxALIGN_LEFT | wxALIGN_BOTTOM);
 | 
					    hsizer2->AddLine(wxVERTICAL);
 | 
				
			||||||
  hsizer3->AddLine(wxVERTICAL);
 | 
					    hsizer2->AddButton( "six", wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
 | 
				
			||||||
  hsizer3->AddButton( "eight", wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM);
 | 
					 | 
				
			||||||
  hsizer3->AddLine(wxVERTICAL);
 | 
					 | 
				
			||||||
  // wxEXPAND should have no effect
 | 
					 | 
				
			||||||
  hsizer3->AddButton( "nine", wxEXPAND | wxALIGN_RIGHT | wxALIGN_BOTTOM);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  topsizer->Add(hsizer3, 1, wxEXPAND);
 | 
					    topsizer->Add(hsizer2, 1, wxEXPAND);
 | 
				
			||||||
 | 
					    topsizer->AddLine(wxHORIZONTAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // set frame to minimum size
 | 
					    wxBoxSizer *hsizer3 = new wxBoxSizer( wxHORIZONTAL );
 | 
				
			||||||
  topsizer->Fit( this );
 | 
					    hsizer3->AddButton( "seven", wxALIGN_LEFT | wxALIGN_BOTTOM);
 | 
				
			||||||
 | 
					    hsizer3->AddLine(wxVERTICAL);
 | 
				
			||||||
 | 
					    hsizer3->AddButton( "eight", wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM);
 | 
				
			||||||
 | 
					    hsizer3->AddLine(wxVERTICAL);
 | 
				
			||||||
 | 
					    // wxEXPAND should have no effect
 | 
				
			||||||
 | 
					    hsizer3->AddButton( "nine", wxEXPAND | wxALIGN_RIGHT | wxALIGN_BOTTOM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // don't allow frame to get smaller than what the sizers tell ye
 | 
					    topsizer->Add(hsizer3, 1, wxEXPAND);
 | 
				
			||||||
  // topsizer->SetSizeHints( this );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SetSizer( topsizer );
 | 
					    // set frame to minimum size
 | 
				
			||||||
  SetAutoLayout( TRUE );
 | 
					    topsizer->Fit( this );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // don't allow frame to get smaller than what the sizers tell ye
 | 
				
			||||||
 | 
					    // topsizer->SetSizeHints( this );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SetSizer( topsizer );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -223,7 +223,7 @@ void *MyThread::Entry()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    wxString text;
 | 
					    wxString text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    text.Printf(wxT("Thread 0x%x started (priority = %d).\n"),
 | 
					    text.Printf(wxT("Thread 0x%x started (priority = %u).\n"),
 | 
				
			||||||
                GetId(), GetPriority());
 | 
					                GetId(), GetPriority());
 | 
				
			||||||
    WriteText(text);
 | 
					    WriteText(text);
 | 
				
			||||||
    // wxLogMessage(text); -- test wxLog thread safeness
 | 
					    // wxLogMessage(text); -- test wxLog thread safeness
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -494,10 +494,10 @@ void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
 | 
					void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int sel = event.GetInt();
 | 
					    long sel = event.GetInt();
 | 
				
			||||||
    m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
 | 
					    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)
 | 
					void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -209,7 +209,7 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook,
 | 
				
			|||||||
                                            _T("Set &range"),
 | 
					                                            _T("Set &range"),
 | 
				
			||||||
                                            GaugePage_RangeText,
 | 
					                                            GaugePage_RangeText,
 | 
				
			||||||
                                            &m_textRange);
 | 
					                                            &m_textRange);
 | 
				
			||||||
    m_textRange->SetValue(wxString::Format(_T("%lu"), m_range));
 | 
					    m_textRange->SetValue( wxString::Format(_T("%lu"), m_range) );
 | 
				
			||||||
    sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 | 
					    sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    btn = new wxButton(this, GaugePage_Progress, _T("Simulate &progress"));
 | 
					    btn = new wxButton(this, GaugePage_Progress, _T("Simulate &progress"));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -491,20 +491,20 @@ void ListboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
 | 
					void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int sel = event.GetInt();
 | 
					    long sel = event.GetInt();
 | 
				
			||||||
    m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
 | 
					    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)
 | 
					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)
 | 
					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)
 | 
					void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -231,8 +231,8 @@ SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook,
 | 
				
			|||||||
    m_textMax = new wxTextCtrl(this, SliderPage_MaxText, _T(""));
 | 
					    m_textMax = new wxTextCtrl(this, SliderPage_MaxText, _T(""));
 | 
				
			||||||
    sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
 | 
					    sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_textMin->SetValue(wxString::Format(_T("%lu"), m_min));
 | 
					    m_textMin->SetValue( wxString::Format(_T("%d"), m_min) );
 | 
				
			||||||
    m_textMax->SetValue(wxString::Format(_T("%lu"), m_max));
 | 
					    m_textMax->SetValue( wxString::Format(_T("%d"), m_max) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 | 
					    sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -449,7 +449,7 @@ void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
 | 
					void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    event.SetText( wxString::Format(_T("%d"), m_slider->GetValue()));
 | 
					    event.SetText( wxString::Format(_T("%d"), m_slider->GetValue()) );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SliderWidgetsPage::OnUpdateUIOtherSide(wxUpdateUIEvent& event)
 | 
					void SliderWidgetsPage::OnUpdateUIOtherSide(wxUpdateUIEvent& event)
 | 
				
			||||||
@@ -459,10 +459,10 @@ void SliderWidgetsPage::OnUpdateUIOtherSide(wxUpdateUIEvent& event)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
 | 
					void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int value = event.GetInt();
 | 
					    long value = event.GetInt();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxASSERT_MSG( value == m_slider->GetValue(),
 | 
					    wxASSERT_MSG( value == m_slider->GetValue(),
 | 
				
			||||||
                  wxT("slider value should be the same") );
 | 
					        wxT("slider value should be the same") );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxEventType eventType = event.GetEventType();
 | 
					    wxEventType eventType = event.GetEventType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -224,8 +224,8 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook,
 | 
				
			|||||||
    m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, _T(""));
 | 
					    m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, _T(""));
 | 
				
			||||||
    sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
 | 
					    sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_textMin->SetValue(wxString::Format(_T("%lu"), m_min));
 | 
					    m_textMin->SetValue( wxString::Format(_T("%d"), m_min) );
 | 
				
			||||||
    m_textMax->SetValue(wxString::Format(_T("%lu"), m_max));
 | 
					    m_textMax->SetValue( wxString::Format(_T("%d"), m_max) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 | 
					    sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -405,14 +405,14 @@ void SpinBtnWidgetsPage::OnSpinBtn(wxCommandEvent& event)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void SpinBtnWidgetsPage::OnSpinBtnUp(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());
 | 
					                  event.GetInt(), m_spinbtn->GetValue() );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SpinBtnWidgetsPage::OnSpinBtnDown(wxCommandEvent& event)
 | 
					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());
 | 
					                  event.GetInt(), m_spinbtn->GetValue() );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SpinBtnWidgetsPage::OnSpinCtrl(wxCommandEvent& event)
 | 
					void SpinBtnWidgetsPage::OnSpinCtrl(wxCommandEvent& event)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -604,7 +604,7 @@ void TextWidgetsPage::OnIdle(wxIdleEvent& WXUNUSED(event))
 | 
				
			|||||||
    if ( m_textLineLast )
 | 
					    if ( m_textLineLast )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_textLineLast->SetValue(
 | 
					        m_textLineLast->SetValue(
 | 
				
			||||||
                wxString::Format(_T("%ld"), m_text->GetNumberOfLines()));
 | 
					                wxString::Format(_T("%d"), m_text->GetNumberOfLines()) );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( m_textSelFrom && m_textSelTo )
 | 
					    if ( m_textSelFrom && m_textSelTo )
 | 
				
			||||||
@@ -699,7 +699,7 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
 | 
				
			|||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            long elapsed = sw.Time();
 | 
					            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);
 | 
					                         filename.c_str(), elapsed / 1000, elapsed % 1000);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user