- All book based controls (notebook, treebook etc.) share now the same
options for orientation (wxBK_TOP, wxBK_DEFAULT, ...) instead of duplicated
wxLB_TOP, wxNB_TOP, wxCHB_TOP, wxTBK_TOP.
+- Added parent window parameter to wxHelpController constructor
+ and added SetParentWindow/GetParentWindow.
wxMSW:
\membersection{wxHelpController::wxHelpController}\label{wxhelpcontrollerctor}
-\func{}{wxHelpController}{\void}
+\func{}{wxHelpController}{\param{wxWindow*}{ parentWindow = NULL}}
Constructs a help instance object, but does not invoke the help viewer.
+If you provide a window, it will be used by some help controller classes, such as
+wxCHMHelpController, wxWinHelpController and wxHtmlHelpController, as the
+parent for the help window instead of the value of \helpref{wxApp::GetTopWindow}{wxappgettopwindow}. You can also change the parent window later with
+\helpref{wxHelpController::SetParentWindow}{wxhelpcontrollersetparentwindow}.
+
\membersection{wxHelpController::\destruct{wxHelpController}}\label{wxhelpcontrollerdtor}
\func{}{\destruct{wxHelpController}}{\void}
\docparam{flags}{This defaults to wxHELP\_NETSCAPE for wxExtHelpController, indicating
that the viewer is a variant of Netscape Navigator.}
+\membersection{wxHelpController::GetParentWindow}\label{wxhelpcontrollergetparentwindow}
+
+\constfunc{virtual bool}{GetParentWindow}{\void}
+
+Returns the window to be used as the parent for the help window. This window is used
+by wxCHMHelpController, wxWinHelpController and wxHtmlHelpController.
+
\membersection{wxHelpController::KeywordSearch}\label{wxhelpcontrollerkeywordsearch}
\func{virtual bool}{KeywordSearch}{\param{const wxString\& }{keyWord}, \param{wxHelpSearchMode }{mode = wxHELP\_SEARCH\_ALL}}
For all other help controllers this function has no effect.
+\membersection{wxHelpController::SetParentWindow}\label{wxhelpcontrollersetparentwindow}
+
+\func{virtual void}{SetParentWindow}{\param{wxWindow* }{parentWindow}}
+
+Sets the window to be used as the parent for the help window. This is used
+by wxCHMHelpController, wxWinHelpController and wxHtmlHelpController.
+
\membersection{wxHelpController::SetViewer}\label{wxhelpcontrollersetviewer}
\func{virtual void}{SetViewer}{\param{const wxString\& }{viewer}, \param{long}{ flags}}
{
DECLARE_CLASS(wxExtHelpController)
public:
- wxExtHelpController();
+ wxExtHelpController(wxWindow* parentWindow = NULL);
~wxExtHelpController();
/** Tell it which browser to use.
class WXDLLEXPORT wxHelpControllerBase: public wxObject
{
public:
- inline wxHelpControllerBase() {}
+ inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; }
inline ~wxHelpControllerBase() {}
// Must call this to set the filename and server name.
virtual bool Quit() = 0;
virtual void OnQuit() {}
+ /// Set the window that can optionally be used for the help window's parent.
+ virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; }
+
+ /// Get the window that can optionally be used for the help window's parent.
+ virtual wxWindow* GetParentWindow() const { return m_parentWindow; }
+
+protected:
+ wxWindow* m_parentWindow;
private:
DECLARE_CLASS(wxHelpControllerBase)
};
DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
public:
- wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE);
+ wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
virtual ~wxHtmlHelpController();
void SetTitleFormat(const wxString& format);
class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase
{
public:
- wxBestHelpController()
- : m_helpControllerType( wxUseNone ),
+ wxBestHelpController(wxWindow* parentWindow = NULL)
+ : wxHelpControllerBase( parentWindow ), m_helpControllerType( wxUseNone ),
m_helpController( NULL )
{
}
newFrameEachTime );
}
+ /// Set the window that can optionally be used for the help window's parent.
+ virtual void SetParentWindow(wxWindow* win) { m_helpController->SetParentWindow(win); }
+
+ /// Get the window that can optionally be used for the help window's parent.
+ virtual wxWindow* GetParentWindow() const { return m_helpController->GetParentWindow(); }
+
protected:
// Append/change extension if necessary.
wxString GetValidFilename(const wxString& file) const;
class WXDLLEXPORT wxCHMHelpController : public wxHelpControllerBase
{
public:
- wxCHMHelpController() { }
+ wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { }
virtual ~wxCHMHelpController();
// Must call this to set the filename
DECLARE_CLASS(wxWinHelpController)
public:
- wxWinHelpController() {}
+ wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {}
~wxWinHelpController() {}
// Must call this to set the filename
class WXDLLEXPORT wxWinceHelpController : public wxHelpControllerBase
{
public:
- wxWinceHelpController() {}
+ wxWinceHelpController(wxWindow* parentWindow): wxHelpControllerBase(parentWindow) {}
virtual ~wxWinceHelpController() {}
// Must call this to set the filename
and a file mapping numerical Section numbers to relative URLS.
*/
-wxExtHelpController::wxExtHelpController()
+wxExtHelpController::wxExtHelpController(wxWindow* parentWindow):
+ wxHelpControllerBase(parentWindow)
{
m_MapList = (wxList*) NULL;
m_NumOfEntries = 0;
IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase)
-wxHtmlHelpController::wxHtmlHelpController(int style)
+wxHtmlHelpController::wxHtmlHelpController(int style, wxWindow* parentWindow):
+ wxHelpControllerBase(parentWindow)
{
m_helpFrame = NULL;
m_Config = NULL;
if (m_Config)
m_helpFrame->UseConfig(m_Config, m_ConfigRoot);
- m_helpFrame->Create(NULL, wxID_HTML_HELPFRAME, wxEmptyString, m_FrameStyle);
+ m_helpFrame->Create(GetParentWindow(), wxID_HTML_HELPFRAME, wxEmptyString, m_FrameStyle);
m_helpFrame->SetTitleFormat(m_titleFormat);
m_helpFrame->Show(true);
bool wxBestHelpController::Initialize( const wxString& filename )
{
// try wxCHMHelpController
- wxCHMHelpController* chm = new wxCHMHelpController;
+ wxCHMHelpController* chm = new wxCHMHelpController(m_parentWindow);
m_helpControllerType = wxUseChmHelp;
// do not warn upon failure
if( chm->Initialize( GetValidFilename( filename ) ) )
{
m_helpController = chm;
+ m_parentWindow = NULL;
return true;
}
delete chm;
// try wxHtmlHelpController
- wxHtmlHelpController* html = new wxHtmlHelpController;
+ wxHtmlHelpController* html = new wxHtmlHelpController(wxHF_DEFAULT_STYLE, m_parentWindow);
m_helpControllerType = wxUseHtmlHelp;
if( html->Initialize( GetValidFilename( filename ) ) )
{
m_helpController = html;
+ m_parentWindow = NULL;
return true;
}
}
}
-static HWND GetSuitableHWND()
+static HWND GetSuitableHWND(wxCHMHelpController* controller)
{
- if (wxTheApp->GetTopWindow())
+ if (controller->GetParentWindow())
+ return (HWND) controller->GetParentWindow()->GetHWND();
+ else if (wxTheApp->GetTopWindow())
return (HWND) wxTheApp->GetTopWindow()->GetHWND();
else
return GetDesktopWindow();
wxString str = GetValidFilename(m_helpFile);
- gs_htmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_DISPLAY_TOPIC, 0L);
+ gs_htmlHelp(GetSuitableHWND(this), (const wxChar*) str, HH_DISPLAY_TOPIC, 0L);
return true;
}
bool isFilename = (section.Find(wxT(".htm")) != wxNOT_FOUND);
if (isFilename)
- gs_htmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_DISPLAY_TOPIC, (DWORD) (const wxChar*) section);
+ gs_htmlHelp(GetSuitableHWND(this), (const wxChar*) str, HH_DISPLAY_TOPIC, (DWORD) (const wxChar*) section);
else
KeywordSearch(section);
return true;
wxString str = GetValidFilename(m_helpFile);
- gs_htmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_HELP_CONTEXT, (DWORD)section);
+ gs_htmlHelp(GetSuitableHWND(this), (const wxChar*) str, HH_HELP_CONTEXT, (DWORD)section);
return true;
}
popup.pszFont = NULL;
popup.pszText = NULL;
- gs_htmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_DISPLAY_TEXT_POPUP, (DWORD) & popup);
+ gs_htmlHelp(GetSuitableHWND(this), (const wxChar*) str, HH_DISPLAY_TEXT_POPUP, (DWORD) & popup);
return true;
}
popup.pszFont = NULL;
popup.pszText = (const wxChar*) text;
- gs_htmlHelp(GetSuitableHWND(), NULL, HH_DISPLAY_TEXT_POPUP, (DWORD) & popup);
+ gs_htmlHelp(GetSuitableHWND(this), NULL, HH_DISPLAY_TEXT_POPUP, (DWORD) & popup);
return true;
}
link.pszWindow = NULL ;
link.fIndexOnFail = TRUE ;
- gs_htmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_KEYWORD_LOOKUP, (DWORD)& link);
+ gs_htmlHelp(GetSuitableHWND(this), (const wxChar*) str, HH_KEYWORD_LOOKUP, (DWORD)& link);
return true;
}
bool wxCHMHelpController::Quit()
{
- gs_htmlHelp(GetSuitableHWND(), 0, HH_CLOSE_ALL, 0L);
+ gs_htmlHelp(GetSuitableHWND(this), 0, HH_CLOSE_ALL, 0L);
return true;
}
#include <string.h>
-static HWND GetSuitableHWND()
+static HWND GetSuitableHWND(wxWinHelpController* controller)
{
- if (wxTheApp->GetTopWindow())
+ if (controller->GetParentWindow())
+ return (HWND) controller->GetParentWindow()->GetHWND();
+ else if (wxTheApp->GetTopWindow())
return (HWND) wxTheApp->GetTopWindow()->GetHWND();
else
return GetDesktopWindow();
wxString str = GetValidFilename(m_helpFile);
#if defined(__WIN95__)
- return (WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_FINDER, 0L) != 0);
+ return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_FINDER, 0L) != 0);
#else
- return (WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_CONTENTS, 0L) != 0);
+ return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_CONTENTS, 0L) != 0);
#endif
}
wxString str = GetValidFilename(m_helpFile);
- return (WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section) != 0);
+ return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_CONTEXT, (DWORD)section) != 0);
}
bool wxWinHelpController::DisplayContextPopup(int contextId)
wxString str = GetValidFilename(m_helpFile);
- return (WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
+ return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
}
bool wxWinHelpController::DisplayBlock(long block)
wxString str = GetValidFilename(m_helpFile);
- return (WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k) != 0);
+ return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k) != 0);
}
// Can't close the help window explicitly in WinHelp
bool wxWinHelpController::Quit(void)
{
- return (WinHelp(GetSuitableHWND(), 0, HELP_QUIT, 0L) != 0);
+ return (WinHelp(GetSuitableHWND(this), 0, HELP_QUIT, 0L) != 0);
}
// Append extension if necessary.