Added wxCHMHelpController, updated help demo. Added DisplaySection(const wxString&)

to wxHelpControllerBase. Corrected some Dialog Editor bugs.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7205 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-04-18 10:30:25 +00:00
parent 9d62ffe24a
commit 0a47db39df
31 changed files with 3232 additions and 2770 deletions

View File

@@ -30,48 +30,52 @@
// Defines the API for help controllers
class WXDLLEXPORT wxHelpControllerBase: public wxObject
{
DECLARE_CLASS(wxHelpControllerBase)
DECLARE_CLASS(wxHelpControllerBase)
public:
inline wxHelpControllerBase() {}
inline ~wxHelpControllerBase() {};
// Must call this to set the filename and server name.
// server is only required when implementing TCP/IP-based
// help controllers.
virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; }
virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; }
// Set viewer: only relevant to some kinds of controller
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = "") = 0;
virtual bool DisplayContents(void) = 0;
virtual bool DisplaySection(int sectionNo) = 0;
public:
inline wxHelpControllerBase() {}
inline ~wxHelpControllerBase() {};
// Must call this to set the filename and server name.
// server is only required when implementing TCP/IP-based
// help controllers.
virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; }
virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; }
// Set viewer: only relevant to some kinds of controller
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = "") = 0;
virtual bool DisplayContents(void) = 0;
virtual bool DisplaySection(int sectionNo) = 0;
virtual bool DisplayBlock(long blockNo) = 0;
virtual bool KeywordSearch(const wxString& k) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
bool WXUNUSED(newFrameEachTime) = FALSE)
{
// does nothing by default
}
/// Obtains the latest settings used by the help frame and the help
/// frame.
virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
wxPoint *WXUNUSED(pos) = NULL,
bool *WXUNUSED(newFrameEachTime) = NULL)
{
return (wxFrame*) NULL;// does nothing by default
}
virtual bool Quit(void) = 0;
virtual void OnQuit(void) {};
// By default, uses KeywordSection to display a topic. Implementations
// may override this for more specific behaviour.
virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); };
virtual bool DisplayBlock(long blockNo) = 0;
virtual bool KeywordSearch(const wxString& k) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
bool WXUNUSED(newFrameEachTime) = FALSE)
{
// does nothing by default
}
/// Obtains the latest settings used by the help frame and the help
/// frame.
virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
wxPoint *WXUNUSED(pos) = NULL,
bool *WXUNUSED(newFrameEachTime) = NULL)
{
return (wxFrame*) NULL;// does nothing by default
}
virtual bool Quit(void) = 0;
virtual void OnQuit(void) {};
};
#endif // wxUSE_HELP
#endif
// _WX_HELPBASEH__
// _WX_HELPBASEH__

View File

@@ -70,6 +70,7 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
virtual bool LoadFile(const wxString& file = "");
virtual bool DisplaySection(int sectionNo);
virtual bool DisplaySection(const wxString& section) { return Display(section); }
virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
virtual void SetFrameParameters(const wxString& title,
const wxSize& size,

57
include/wx/msw/helpchm.h Normal file
View File

@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: helpchm.h
// Purpose: Help system: MS HTML Help implementation
// Author: Julian Smart
// Modified by:
// Created: 16/04/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPCHM_H_
#define _WX_HELPCHM_H_
#ifdef __GNUG__
#pragma interface "helpchm.h"
#endif
#include "wx/wx.h"
#if wxUSE_HELP
#include "wx/helpbase.h"
class WXDLLEXPORT wxCHMHelpController: public wxHelpControllerBase
{
DECLARE_CLASS(wxCHMHelpController)
public:
wxCHMHelpController() {}
~wxCHMHelpController() {}
// Must call this to set the filename
virtual bool Initialize(const wxString& file);
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = wxEmptyString);
virtual bool DisplayContents();
virtual bool DisplaySection(int sectionNo);
virtual bool DisplaySection(const wxString& section);
virtual bool DisplayBlock(long blockNo);
virtual bool KeywordSearch(const wxString& k);
virtual bool Quit();
inline wxString GetHelpFile() const { return m_helpFile; }
protected:
// Append extension if necessary.
wxString GetValidFilename(const wxString& file) const;
protected:
wxString m_helpFile;
};
#endif // wxUSE_HELP
#endif
// _WX_HELPCHM_H_

View File

@@ -24,31 +24,33 @@
class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase
{
DECLARE_CLASS(wxWinHelpController)
DECLARE_CLASS(wxWinHelpController)
public:
wxWinHelpController() {};
~wxWinHelpController() {};
public:
wxWinHelpController(void);
~wxWinHelpController(void);
// Must call this to set the filename
virtual bool Initialize(const wxString& file);
// Must call this to set the filename and server name
virtual bool Initialize(const wxString& file);
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = wxEmptyString);
virtual bool DisplayContents();
virtual bool DisplaySection(int sectionNo);
virtual bool DisplayBlock(long blockNo);
virtual bool KeywordSearch(const wxString& k);
virtual bool Quit();
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = "");
virtual bool DisplayContents(void);
virtual bool DisplaySection(int sectionNo);
virtual bool DisplayBlock(long blockNo);
virtual bool KeywordSearch(const wxString& k);
virtual bool Quit(void);
virtual void OnQuit(void);
inline wxString GetHelpFile(void) const { return m_helpFile; }
inline wxString GetHelpFile() const { return m_helpFile; }
protected:
wxString m_helpFile;
// Append extension if necessary.
wxString GetValidFilename(const wxString& file) const;
private:
wxString m_helpFile;
};
#endif // wxUSE_HELP
#endif
// _WX_HELPWIN_H_
// _WX_HELPWIN_H_

View File

@@ -445,9 +445,10 @@
#define wxUSE_IPC 1
// 0 for no interprocess comms
// Note: wxHELP uses IPC under X so these are interdependent!
#define wxUSE_HELP 1
// 0 for no help facility
#define wxUSE_MS_HTML_HELP 0
// 0 for no MS HTML Help
#define wxUSE_RESOURCES 1
// 0 for no wxGetResource/wxWriteResource
#define wxUSE_CONSTRAINTS 1
@@ -605,8 +606,8 @@
// disable the settings which don't work for some compilers
// ----------------------------------------------------------------------------
// These don't work as expected for mingw32 and cygwin32
#if defined(__GNUWIN32__)
// These don't work as expected for mingw32 and cygwin32
#undef wxUSE_MEMORY_TRACING
#define wxUSE_MEMORY_TRACING 0
@@ -615,6 +616,9 @@
#undef wxUSE_DEBUG_NEW_ALWAYS
#define wxUSE_DEBUG_NEW_ALWAYS 0
#undef wxUSE_MS_HTML_HELP
#define wxUSE_MS_HTML_HELP 0
#endif // __GNUWIN32__
// MFC duplicates these operators
@@ -691,6 +695,12 @@
#define wxUSE_LIBJPEG 0
#endif
#if defined(__BORLANDC__)
// Need a BC++-specific htmlhelp.lib before we can enable this
#undef wxUSE_MS_HTML_HELP
#define wxUSE_MS_HTML_HELP 0
#endif
#if defined(__WXMSW__) && defined(__WATCOMC__)
#undef wxUSE_LIBJPEG
#define wxUSE_LIBJPEG 0
@@ -700,6 +710,9 @@
#undef wxUSE_GLCANVAS
#define wxUSE_GLCANVAS 0
#undef wxUSE_MS_HTML_HELP
#define wxUSE_MS_HTML_HELP 0
#endif
#if defined(__WXMSW__) && !defined(__WIN32__)
@@ -740,6 +753,8 @@
#undef wxUSE_GLCANVAS
#define wxUSE_GLCANVAS 0
#undef wxUSE_MS_HTML_HELP
#define wxUSE_MS_HTML_HELP 0
#endif // Win16
// ----------------------------------------------------------------------------

View File

@@ -36,9 +36,13 @@
// Extended styles: for resource usage only
// Use dialog units instead of pixels
#define wxRESOURCE_DIALOG_UNITS 1
#define wxRESOURCE_DIALOG_UNITS 0x0001
// Use default system colour and font
#define wxRESOURCE_USE_DEFAULTS 2
#define wxRESOURCE_USE_DEFAULTS 0x0002
// Old-style vertical label
#define wxRESOURCE_VERTICAL_LABEL 0x0004
// Old-style horizontal label
#define wxRESOURCE_HORIZONTAL_LABEL 0x0008
// Macros to help use dialog units
#define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y))