// 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
//#define wxUSE_DDE_FOR_IPC 0
#include <wx/ipc.h>
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "mondrian.xpm"
#endif
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)
// should be unique to the client app
- a_service = "/tmp/wxWindows-helpconnection";
+ 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");
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)
}
BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
-EVT_BUTTON(-1, MyModalDialog::OnButton)
+EVT_BUTTON(wxID_ANY, MyModalDialog::OnButton)
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();
}