]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/helpwin.cpp
eb74f4960c209c373013c12b81d19c4ae27148a9
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Help system: WinHelp implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "helpwin.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/msw/helpwin.h"
33 #include <wx/msw/private.h>
39 #define _MAXPATHLEN 500
41 // MAX length of Help descriptor
42 #define _MAX_HELP_LEN 500
44 #if !USE_SHARED_LIBRARY
45 IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController
, wxHelpControllerBase
)
48 wxWinHelpController::wxWinHelpController(void)
53 wxWinHelpController::~wxWinHelpController(void)
57 bool wxWinHelpController::Initialize(const wxString
& filename
)
59 m_helpFile
= filename
;
63 bool wxWinHelpController::LoadFile(const wxString
& file
)
69 bool wxWinHelpController::DisplayContents(void)
71 if (m_helpFile
== "") return FALSE
;
73 wxString str
= m_helpFile
;
74 size_t len
= str
.Length();
75 if (!(str
[(size_t)(len
-1)] == 'p' && str
[(size_t)(len
-2)] == 'l' && str
[(size_t)(len
-3)] == 'h' && str
[(size_t)(len
-4)] == '.'))
78 if (wxTheApp
->GetTopWindow())
80 #if defined(__WIN95__)
81 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), (const char*) str
, HELP_FINDER
, 0L);
83 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), (const char*) str
, HELP_CONTENTS
, 0L);
90 bool wxWinHelpController::DisplaySection(int section
)
93 if (m_helpFile
== "") return FALSE
;
95 wxString str
= m_helpFile
;
96 size_t len
= str
.Length();
97 if (!(str
[(size_t)(len
-1)] == 'p' && str
[(size_t)(len
-2)] == 'l' && str
[(size_t)(len
-3)] == 'h' && str
[(size_t)(len
-4)] == '.'))
100 if (wxTheApp
->GetTopWindow())
102 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), (const char*) str
, HELP_CONTEXT
, (DWORD
)section
);
108 bool wxWinHelpController::DisplayBlock(long block
)
110 // Use context number -- a very rough equivalent to block id!
111 if (m_helpFile
== "") return FALSE
;
113 wxString str
= m_helpFile
;
114 size_t len
= str
.Length();
115 if (!(str
[(size_t)(len
-1)] == 'p' && str
[(size_t)(len
-2)] == 'l' && str
[(size_t)(len
-3)] == 'h' && str
[(size_t)(len
-4)] == '.'))
118 if (wxTheApp
->GetTopWindow())
120 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), (const char*) str
, HELP_CONTEXT
, (DWORD
)block
);
126 bool wxWinHelpController::KeywordSearch(const wxString
& k
)
128 if (m_helpFile
== "") return FALSE
;
130 wxString str
= m_helpFile
;
131 size_t len
= str
.Length();
132 if (!(str
[(size_t)(len
-1)] == 'p' && str
[(size_t)(len
-2)] == 'l' && str
[(size_t)(len
-3)] == 'h' && str
[(size_t)(len
-4)] == '.'))
135 if (wxTheApp
->GetTopWindow())
137 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), (const char*) str
, HELP_PARTIALKEY
, (DWORD
)(const char*) k
);
143 // Can't close the help window explicitly in WinHelp
144 bool wxWinHelpController::Quit(void)
146 if (wxTheApp
->GetTopWindow())
148 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), 0, HELP_QUIT
, 0L);
155 // Don't get notified of WinHelp quitting
156 void wxWinHelpController::OnQuit(void)