diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index 0f6ac5b4e6..2d8c439e13 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -168,6 +168,11 @@ protected: void OnCloseWindow(wxCloseEvent& event); void OnActivate(wxActivateEvent& event); +#ifdef __WXMAC__ + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); +#endif + // Images: enum { IMG_Book = 0, diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 43d9494eec..332129b273 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -252,6 +252,25 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, SetIcon(wxArtProvider::GetIcon(wxART_HELP, wxART_HELP_BROWSER)); + // On the Mac, each modeless frame must have a menubar. + // TODO: add more menu items, and perhaps add a style to show + // the menubar: compulsory on the Mac, optional elsewhere. +#ifdef __WXMAC__ + wxMenuBar* menuBar = new wxMenuBar; + + wxMenu* fileMenu = new wxMenu; + fileMenu->Append(wxID_HTML_OPENFILE, _("&Open...")); + fileMenu->Append(wxID_ABOUT, _("&About...")); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_CLOSE, _("&Close")); + +// wxMenu* helpMenu = new wxMenu; +// helpMenu->Append(wxID_ABOUT, _("&About...")); + + menuBar->Append(fileMenu); + SetMenuBar(menuBar); +#endif + int notebook_page = 0; CreateStatusBar(); @@ -1497,6 +1516,19 @@ void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt) evt.Skip(); } +#ifdef __WXMAC__ +void wxHtmlHelpFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void wxHtmlHelpFrame::OnAbout(wxCommandEvent& event) +{ + wxMessageBox(wxT("wxWindows HTML Help Viewer (c) 1998-2003, Vaclav Slavik et al"), wxT("HelpView"), + wxICON_INFORMATION|wxOK, this); +} +#endif + BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame) EVT_ACTIVATE(wxHtmlHelpFrame::OnActivate) EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_OPTIONS, wxHtmlHelpFrame::OnToolbar) @@ -1512,6 +1544,11 @@ BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame) EVT_BUTTON(wxID_HTML_INDEXBUTTONALL, wxHtmlHelpFrame::OnIndexAll) EVT_COMBOBOX(wxID_HTML_BOOKMARKSLIST, wxHtmlHelpFrame::OnBookmarksSel) EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) +#ifdef __WXMAC__ + EVT_MENU(wxID_CLOSE, wxHtmlHelpFrame::OnQuit) + EVT_MENU(wxID_ABOUT, wxHtmlHelpFrame::OnAbout) +#endif + END_EVENT_TABLE() #endif // wxUSE_WXHTML_HELP diff --git a/src/jpeg/jpeg.dsp b/src/jpeg/jpeg.dsp index 8ec7e89f34..6bed87d729 100644 --- a/src/jpeg/jpeg.dsp +++ b/src/jpeg/jpeg.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="jpeg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 diff --git a/src/jpeg/jpeg.dsw b/src/jpeg/jpeg.dsw index 31caaf9876..df7d94f2ca 100644 --- a/src/jpeg/jpeg.dsw +++ b/src/jpeg/jpeg.dsw @@ -1,4 +1,4 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 +Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### diff --git a/src/png/png.dsp b/src/png/png.dsp index b2458bfde4..dafe6c208e 100644 --- a/src/png/png.dsp +++ b/src/png/png.dsp @@ -1,4 +1,4 @@ -# Microsoft Developer Studio Project File - Name="png" - Package Owner=<4> +# Microsoft Developer Studio Project File - Name="png" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** diff --git a/src/png/png.dsw b/src/png/png.dsw index 58c98b69e6..81ddffbbf0 100644 --- a/src/png/png.dsw +++ b/src/png/png.dsw @@ -1,4 +1,4 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 +Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### diff --git a/src/tiff/tiff.dsp b/src/tiff/tiff.dsp index e608866278..e7ab091c47 100644 --- a/src/tiff/tiff.dsp +++ b/src/tiff/tiff.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="tiff" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 diff --git a/src/tiff/tiff.dsw b/src/tiff/tiff.dsw index 8e9111524c..bec9eea0d9 100644 --- a/src/tiff/tiff.dsw +++ b/src/tiff/tiff.dsw @@ -1,4 +1,4 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 +Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### diff --git a/src/zlib/zlib.dsp b/src/zlib/zlib.dsp index 73fff52a14..4d5a7a276f 100644 --- a/src/zlib/zlib.dsp +++ b/src/zlib/zlib.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 diff --git a/utils/helpview/src/helpview.cpp b/utils/helpview/src/helpview.cpp index 4020230846..b2ed6bb6fd 100644 --- a/utils/helpview/src/helpview.cpp +++ b/utils/helpview/src/helpview.cpp @@ -27,6 +27,7 @@ #include "wx/wx.h" #endif +#include "wx/filename.h" #include "wx/image.h" #include "wx/wxhtml.h" #include "wx/fs_zip.h" @@ -60,6 +61,10 @@ bool hvApp::OnInit() wxArtProvider::PushProvider(new AlternateArtProvider); +#ifdef __WXMAC__ + wxFileName::MacRegisterDefaultTypeAndCreator( "htb" , 'HTBD' , 'HTBA' ) ; +#endif + int istyle = wxHF_DEFAULT_STYLE; wxString service, windowName, book[10], titleFormat, argStr; @@ -138,7 +143,9 @@ bool hvApp::OnInit() } } - //no book - query user + // No book - query user; but not on Mac, since there + // may be an AppleEvent to open a document on the way +#ifndef __WXMAC__ if ( bookCount < 1 ) { wxString s = wxFileSelector( wxT("Open help file"), @@ -157,7 +164,8 @@ bool hvApp::OnInit() bookCount = 1; } } - +#endif + #if hvUSE_IPC if ( createServer ) { @@ -267,6 +275,18 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller) return FALSE; } +#ifdef __WXMAC__ +/// Respond to Apple Event for opening a document +void hvApp::MacOpenFile(const wxString& filename) +{ + wxBusyCursor bcur; + wxFileName fileName(filename); + m_helpController->AddBook(fileName); + m_helpController->DisplayContents(); +} +#endif + + /* * Art provider class */ diff --git a/utils/helpview/src/helpview.h b/utils/helpview/src/helpview.h index e49a93031a..d4fc4cde2e 100644 --- a/utils/helpview/src/helpview.h +++ b/utils/helpview/src/helpview.h @@ -16,7 +16,7 @@ #pragma interface "help.cpp" #endif -#define hvVERSION 1.02 +#define hvVERSION 1.03 // If 1, start a server to allow this to be used // as an external help viewer. @@ -47,7 +47,12 @@ public: /// Clean up the application's data. virtual int OnExit(); - + +#ifdef __WXMAC__ + /// Respond to Apple Event for opening a document + virtual void MacOpenFile(const wxString& filename); +#endif + /// Prompt the user for a book to open bool OpenBook(wxHtmlHelpController* controller);