// /// Called by EvHelp() to activate the help file with the help context ID. // void THelpFileManager::ActivateHelp(TWindow* /*window*/, int helpFileContextId, uint helpCmd) { if (helpCmd == HELP_INDEX || helpCmd == HELP_CONTENTS) helpCmd = HELP_FINDER; TApplication* app = TYPESAFE_DOWNCAST(this, TApplication); #if !defined(NO_HTMLHELP) if(UseHTMLHelp){ if (app) HelpState = ToBool(HtmlHelp(app->GetMainWindow(), GetHelpFile().c_str(), helpCmd, helpFileContextId) != 0); else HelpState = ToBool(HtmlHelp(0, GetHelpFile().c_str(), helpCmd, helpFileContextId) != 0); } else{ #endif if (app) HelpState = ToBool(app->GetMainWindow()->WinHelp(GetHelpFile().c_str(), helpCmd, helpFileContextId)); else HelpState = ToBool(::WinHelp(0, GetHelpFile().c_str(), helpCmd, helpFileContextId)); #if !defined(NO_HTMLHELP) } #endif }
// /// Responds to a menu item selection. // void TRecentFiles::CmFile(uint id) { TApplication* app = TYPESAFE_DOWNCAST(this, TApplication); TFrameWindow* window = app ? app->GetMainWindow() : 0; if (window) { // Foward menu selection command to specified target // window->SendMessage(MruMessage, id, 0); } }
// /// Deactivates the help. // void THelpFileManager::DeactivateHelp() { TApplication* app = TYPESAFE_DOWNCAST(this, TApplication); #if !defined(NO_HTMLHELP) if(UseHTMLHelp){ if (app) HtmlHelp(app->GetMainWindow(), GetHelpFile().c_str(), HELP_QUIT, 0); else HtmlHelp(0, GetHelpFile().c_str(), HELP_QUIT, 0); } else{ #endif if (app) app->GetMainWindow()->WinHelp(GetHelpFile().c_str(), HELP_QUIT, 0); else ::WinHelp(0, GetHelpFile().c_str(), HELP_QUIT, 0); #if !defined(NO_HTMLHELP) } #endif }
bool THelpFileManager::ProcessHelpMsg (MSG& msg) { if (msg.message == WM_COMMAND) { // help command from menu or from gadget from "what this?" for gadget if (ContextHelp || (::GetKeyState(VK_F1) < 0)) { ContextHelp = false; HELPINFO Info; Info.cbSize = sizeof(Info); Info.iContextType = HELPINFO_MENUITEM; Info.iCtrlId = static_cast<int>(msg.wParam); Info.dwContextId = 0; EvHelp(Info); return true; } } else{ switch (msg.message) { case WM_KEYDOWN : if (msg.wParam == VK_F1) { // If the Shift/F1 then set the help cursor and turn on the modal help state. if (::GetKeyState(VK_SHIFT) < 0 && !ContextHelp) { CmContextHelp(); return true; // Gobble up the message. } } else { if (ContextHelp && (msg.wParam == VK_ESCAPE)) { ContextHelp = false; TApplication* app = TYPESAFE_DOWNCAST(this, TApplication); if (app) app->GetMainWindow()->SetCursor(0, IDC_ARROW); //????????????????? return true; // Gobble up the message. } } break; case WM_MOUSEMOVE : case WM_NCMOUSEMOVE : if(ContextHelp){ SetHelpCursor(); return true; // Gobble up the message. } break; case WM_INITMENU : if(ContextHelp) { SetHelpCursor(); return true; // Gobble up the message. } break; case WM_ENTERIDLE : if(msg.wParam == MSGF_MENU) if (GetKeyState(VK_F1) < 0) { ContextHelp = true; TApplication* app = TYPESAFE_DOWNCAST(this, TApplication); if (app) app->GetMainWindow()->PostMessage(WM_KEYDOWN, VK_RETURN, 0L); return true; // Gobble up the message. } break; default : ; } // End of switch } // Continue normal processing. return false; }