]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/helpwin.cpp
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
, int server
)
59 m_helpFile
= filename
;
63 bool wxWinHelpController::LoadFile(const wxString
& file
)
69 bool wxWinHelpController::DisplayContents(void)
71 if (m_helpFile
== "") return FALSE
;
73 char buf
[_MAXPATHLEN
];
74 strcpy(buf
, (const char*) m_helpFile
);
75 size_t len
= strlen(buf
);
76 if (!(buf
[len
-1] == 'p' && buf
[len
-2] == 'l' && buf
[len
-3] == 'h' && buf
[len
-4] == '.'))
78 if (wxTheApp
->GetTopWindow())
80 #if defined(__WIN95__)
81 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), buf
, HELP_FINDER
, 0L);
83 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), buf
, HELP_CONTENTS
, 0L);
90 bool wxWinHelpController::DisplaySection(int section
)
92 // No WinHelp equivalent for this
96 bool wxWinHelpController::DisplayBlock(long block
)
98 // Use context number -- a very rough equivalent to block id!
99 if (!m_helpFile
) return FALSE
;
101 char buf
[_MAXPATHLEN
];
102 strcpy(buf
, m_helpFile
);
103 size_t len
= strlen(buf
);
104 if (!(buf
[len
-1] == 'p' && buf
[len
-2] == 'l' && buf
[len
-3] == 'h' && buf
[len
-4] == '.'))
106 if (wxTheApp
->GetTopWindow())
108 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), buf
, HELP_CONTEXT
, (DWORD
)block
);
114 bool wxWinHelpController::KeywordSearch(const wxString
& k
)
116 if (m_helpFile
== "") return FALSE
;
118 char buf
[_MAXPATHLEN
];
119 strcpy(buf
, m_helpFile
);
120 size_t len
= strlen(buf
);
121 if (!(buf
[len
-1] == 'p' && buf
[len
-2] == 'l' && buf
[len
-3] == 'h' && buf
[len
-4] == '.'))
123 if (wxTheApp
->GetTopWindow())
125 WinHelp((HWND
) wxTheApp
->GetTopWindow()->GetHWND(), buf
, HELP_PARTIALKEY
, (DWORD
)(const char*) k
);
131 // Can't close the help window explicitly in WinHelp
132 bool wxWinHelpController::Quit(void)
137 // Don't get notified of WinHelp quitting
138 void wxWinHelpController::OnQuit(void)