X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be5a51fb592f3fa2ba38ac6cd1e488d6d806058c..cfcc02a8a4f019e3846b73660209080602e44967:/utils/helpview/src/client.cpp?ds=sidebyside diff --git a/utils/helpview/src/client.cpp b/utils/helpview/src/client.cpp index 218d658a70..dfcae4f0d0 100644 --- a/utils/helpview/src/client.cpp +++ b/utils/helpview/src/client.cpp @@ -2,7 +2,7 @@ // Name: client.cpp // Purpose: Remote help sample client // Author: Julian Smart -// Modified by: Eric Dowty +// Modified by: Eric Dowty // Created: 25/01/99 // RCS-ID: $Id$ // Copyright: (c) Julian Smart @@ -95,9 +95,9 @@ wxListBox *the_list = NULL; bool MyApp::OnInit() { wxString a_appname, a_service, a_windowname, a_book; - + m_help = NULL; - + // for MSW (DDE classes), a_service is 'service name', apparently an arbitrary string // for Unix, should be a valid file name (for a nonexistent file) // for nonMSW, nonUnix, must be port number, for example "4242" (TCP/IP based classes) @@ -105,62 +105,62 @@ bool MyApp::OnInit() a_service = "/tmp/wxWidgets-helpconnection"; //a_service = "4242"; a_windowname = "HTML Help Test: %s"; - + #if defined(__WXMSW__) a_appname = "helpview.exe"; #else a_appname = "./helpview"; #endif - + //a_book = "helpfiles/testing.hhp"; a_book = "test.zip"; - - wxConfig *conf = (wxConfig*) wxConfig::Get(); - + + wxConfig *conf = (wxConfig*) wxConfig::Get(); + #if defined(USE_REMOTE) m_help = new wxRemoteHtmlHelpController(); - m_help->SetServer( a_appname ); - m_help->SetService( a_service ); + m_help->SetServer( a_appname ); + m_help->SetService( a_service ); #else m_help = new wxHtmlHelpController(); #endif - - //this is a dummy for wxRemoteHtmlHelpController + + //this is a dummy for wxRemoteHtmlHelpController m_help->UseConfig(conf); - - m_help->AddBook( a_book ); - m_help->SetTitleFormat( a_windowname ); - - // Create the main frame window + + m_help->AddBook( a_book ); + m_help->SetTitleFormat( a_windowname ); + + // Create the main frame window MyFrame* frame = new MyFrame(NULL, "Help Client"); - frame->Show(TRUE); - - return TRUE; + frame->Show(true); + + return true; } int MyApp::OnExit() { delete m_help; - delete wxConfig::Set(NULL); + delete wxConfig::Set(NULL); return 0; } // Define my frame constructor MyFrame::MyFrame(wxFrame *frame, const wxString& title) -: wxFrame(frame, -1, title, wxDefaultPosition, wxSize( 200, 100 ) ) +: wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize( 200, 100 ) ) { m_panel = NULL; - + // Give it an icon SetIcon(wxICON(mondrian)); - + // Make a menubar wxMenu *file_menu = new wxMenu; - + file_menu->Append(CLIENT_HELPMAIN, "Help - Main"); file_menu->Append(CLIENT_HELPBOOK1, "Help - Book1"); file_menu->Append(CLIENT_HELPBOOK2, "Help - Book2"); - + file_menu->Append(CLIENT_HELPINDEX, "Help - DisplayIndex"); file_menu->Append(CLIENT_HELPCONTENTS, "Help - DisplayContents"); file_menu->Append(CLIENT_HELPSEARCH, "Help - KeywordSearch"); @@ -168,71 +168,71 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) file_menu->Append(CLIENT_HELPADDBOOK, "Help - AddBook"); file_menu->Append(CLIENT_HELPTEMPDIR, "Help - SetTempDir"); file_menu->Append(CLIENT_HELPQUIT, "Help - Kill Server"); - + file_menu->Append(DIALOG_MODAL, "Modal dialog"); file_menu->Append(CLIENT_QUIT, "Quit"); - + wxMenuBar *menu_bar = new wxMenuBar; - + menu_bar->Append(file_menu, "File"); - + // Associate the menu bar with the frame SetMenuBar(menu_bar); - + // Make a panel m_panel = new wxPanel(this ); - - m_modalbutton = new wxButton( this, BUTTON_MODAL, "Modal Dialog", - wxPoint(10,10), wxSize(-1, -1) ); + + m_modalbutton = new wxButton( this, BUTTON_MODAL, "Modal Dialog", + wxPoint(10,10), wxDefaultSize ); } void MyFrame::OnHelp_Book1(wxCommandEvent& event) { - wxGetApp().m_help->Display( "book1.htm" ); + wxGetApp().m_help->Display( "book1.htm" ); } void MyFrame::OnHelp_Book2(wxCommandEvent& event) { - wxGetApp().m_help->Display( "book2.htm" ); + wxGetApp().m_help->Display( "book2.htm" ); } void MyFrame::OnHelp_Main(wxCommandEvent& event) { - wxGetApp().m_help->Display( "main.htm" ); + wxGetApp().m_help->Display( "main.htm" ); } void MyFrame::OnHelp_Index(wxCommandEvent& event) { - wxGetApp().m_help->DisplayIndex( ); + wxGetApp().m_help->DisplayIndex( ); } void MyFrame::OnHelp_Contents(wxCommandEvent& event) { - wxGetApp().m_help->DisplayContents( ); + wxGetApp().m_help->DisplayContents( ); } void MyFrame::OnHelp_Search(wxCommandEvent& event) { - wxGetApp().m_help->KeywordSearch( "enjoy" ); + wxGetApp().m_help->KeywordSearch( "enjoy" ); } void MyFrame::OnHelp_Title(wxCommandEvent& event) { - wxGetApp().m_help->SetTitleFormat( "Another_Title: %s" ); + wxGetApp().m_help->SetTitleFormat( "Another_Title: %s" ); } void MyFrame::OnHelp_Addbook(wxCommandEvent& event) { - wxGetApp().m_help->AddBook("helpfiles/another.hhp" ); + wxGetApp().m_help->AddBook("helpfiles/another.hhp" ); } void MyFrame::OnHelp_Tempdir(wxCommandEvent& event) { - wxGetApp().m_help->SetTempDir( "tempdir" ); + wxGetApp().m_help->SetTempDir( "tempdir" ); } void MyFrame::OnHelp_Quitserver(wxCommandEvent& event) { - // if (!wxGetApp().m_help->m_connection->Poke( wxT("--YouAreDead"), wxT("") ) ) - // wxLogError(wxT("wxRemoteHtmlHelpController - YouAreDead Failed")); - - wxGetApp().m_help->Quit(); + // if (!wxGetApp().m_help->m_connection->Poke( wxT("--YouAreDead"), wxT("") ) ) + // wxLogError(wxT("wxRemoteHtmlHelpController - YouAreDead Failed")); + + wxGetApp().m_help->Quit(); } void MyFrame::OnExit(wxCommandEvent& event) @@ -247,7 +247,7 @@ void MyFrame::ModalDlg(wxCommandEvent& WXUNUSED(event)) } BEGIN_EVENT_TABLE(MyModalDialog, wxDialog) -EVT_BUTTON(-1, MyModalDialog::OnButton) +EVT_BUTTON(wxID_ANY, MyModalDialog::OnButton) END_EVENT_TABLE() // ---------------------------------------------------------------------------- @@ -255,23 +255,22 @@ END_EVENT_TABLE() // ---------------------------------------------------------------------------- MyModalDialog::MyModalDialog(wxWindow *parent) -: wxDialog(parent, -1, wxString("Modal dialog")) +: wxDialog(parent, wxID_ANY, wxString("Modal dialog")) { wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); - - m_main = new wxButton(this, -1, "Main"); - m_book1 = new wxButton(this, -1, "Book1"); - m_book2 = new wxButton(this, -1, "Book2"); + + m_main = new wxButton(this, wxID_ANY, "Main"); + m_book1 = new wxButton(this, wxID_ANY, "Book1"); + m_book2 = new wxButton(this, wxID_ANY, "Book2"); sizerTop->Add(m_main, 0, wxALIGN_CENTER | wxALL, 5); sizerTop->Add(m_book1, 0, wxALIGN_CENTER | wxALL, 5); sizerTop->Add(m_book2, 0, wxALIGN_CENTER | wxALL, 5); - - SetAutoLayout(TRUE); + SetSizer(sizerTop); - + sizerTop->SetSizeHints(this); sizerTop->Fit(this); - + m_main->SetFocus(); m_main->SetDefault(); }