ReDOS-ified project files

Added menubar for wxHTML help viewer on Mac
Added some Mac-specific code for HelpView


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2003-01-16 12:26:09 +00:00
parent 5ab6aab880
commit d9b21c9f47
11 changed files with 78 additions and 11 deletions

View File

@ -168,6 +168,11 @@ protected:
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);
#ifdef __WXMAC__
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
#endif
// Images: // Images:
enum { enum {
IMG_Book = 0, IMG_Book = 0,

View File

@ -252,6 +252,25 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
SetIcon(wxArtProvider::GetIcon(wxART_HELP, wxART_HELP_BROWSER)); 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; int notebook_page = 0;
CreateStatusBar(); CreateStatusBar();
@ -1497,6 +1516,19 @@ void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt)
evt.Skip(); 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) BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame)
EVT_ACTIVATE(wxHtmlHelpFrame::OnActivate) EVT_ACTIVATE(wxHtmlHelpFrame::OnActivate)
EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_OPTIONS, wxHtmlHelpFrame::OnToolbar) 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_BUTTON(wxID_HTML_INDEXBUTTONALL, wxHtmlHelpFrame::OnIndexAll)
EVT_COMBOBOX(wxID_HTML_BOOKMARKSLIST, wxHtmlHelpFrame::OnBookmarksSel) EVT_COMBOBOX(wxID_HTML_BOOKMARKSLIST, wxHtmlHelpFrame::OnBookmarksSel)
EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow)
#ifdef __WXMAC__
EVT_MENU(wxID_CLOSE, wxHtmlHelpFrame::OnQuit)
EVT_MENU(wxID_ABOUT, wxHtmlHelpFrame::OnAbout)
#endif
END_EVENT_TABLE() END_EVENT_TABLE()
#endif // wxUSE_WXHTML_HELP #endif // wxUSE_WXHTML_HELP

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="jpeg" - Package Owner=<4> # 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 ** # ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104 # TARGTYPE "Win32 (x86) Static Library" 0x0104

View File

@ -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! # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
############################################################################### ###############################################################################

View File

@ -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 # Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT ** # ** DO NOT EDIT **

View File

@ -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! # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
############################################################################### ###############################################################################

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="tiff" - Package Owner=<4> # 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 ** # ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104 # TARGTYPE "Win32 (x86) Static Library" 0x0104

View File

@ -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! # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
############################################################################### ###############################################################################

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4> # 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 ** # ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104 # TARGTYPE "Win32 (x86) Static Library" 0x0104

View File

@ -27,6 +27,7 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#include "wx/filename.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/wxhtml.h" #include "wx/wxhtml.h"
#include "wx/fs_zip.h" #include "wx/fs_zip.h"
@ -60,6 +61,10 @@ bool hvApp::OnInit()
wxArtProvider::PushProvider(new AlternateArtProvider); wxArtProvider::PushProvider(new AlternateArtProvider);
#ifdef __WXMAC__
wxFileName::MacRegisterDefaultTypeAndCreator( "htb" , 'HTBD' , 'HTBA' ) ;
#endif
int istyle = wxHF_DEFAULT_STYLE; int istyle = wxHF_DEFAULT_STYLE;
wxString service, windowName, book[10], titleFormat, argStr; 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 ) if ( bookCount < 1 )
{ {
wxString s = wxFileSelector( wxT("Open help file"), wxString s = wxFileSelector( wxT("Open help file"),
@ -157,7 +164,8 @@ bool hvApp::OnInit()
bookCount = 1; bookCount = 1;
} }
} }
#endif
#if hvUSE_IPC #if hvUSE_IPC
if ( createServer ) { if ( createServer ) {
@ -267,6 +275,18 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller)
return FALSE; 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 * Art provider class
*/ */

View File

@ -16,7 +16,7 @@
#pragma interface "help.cpp" #pragma interface "help.cpp"
#endif #endif
#define hvVERSION 1.02 #define hvVERSION 1.03
// If 1, start a server to allow this to be used // If 1, start a server to allow this to be used
// as an external help viewer. // as an external help viewer.
@ -47,7 +47,12 @@ public:
/// Clean up the application's data. /// Clean up the application's data.
virtual int OnExit(); 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 /// Prompt the user for a book to open
bool OpenBook(wxHtmlHelpController* controller); bool OpenBook(wxHtmlHelpController* controller);