示例#1
0
//
/// Event handler for the WM_HELP message.
//
void
THelpFileManager::EvHelp(const HELPINFO& hi)
{
  THelpContext context;
  bool success = false;
  uint hlpCmd = HELP_CONTEXTPOPUP;

  if (hi.iContextType == HELPINFO_MENUITEM){
    success = GetHelpContextFromMenu(context, hi.iCtrlId);
    hlpCmd = HELP_CONTEXT;
  }
  else if (hi.iContextType == HELPINFO_WINDOW)
    success = GetHelpContextFromControl(context, hi.iCtrlId, (HWND)hi.hItemHandle);

  LastHit = hi.MousePos;
  if (::GetKeyState(VK_F1) < 0 && ::GetKeyState(VK_SHIFT) < 0)
  {
    TWindow* wnd = context.GetWindow();
    TWindow* child = wnd->ChildWithId(hi.iCtrlId);
    LastHit = TPoint(wnd->GetWindowAttr().X + child->GetWindowAttr().X, wnd->GetWindowAttr().Y + child->GetWindowAttr().Y);
  }
  else if(::GetKeyState(VK_F1) < 0)
    LastHit = TPoint(-1, -1);

  if (success)
    ActivateHelp(context.GetWindow(), context.GetHelpFileContextId(), hlpCmd);
}
示例#2
0
//
/// Search for child with ID = IDW_TOOLBAR, and if found check that it is
/// GadgetWindow and return it;
//
TGadgetWindow*
TDecoratedFrame::GetControlBar()
{
  TWindow* wnd = ChildWithId(IDW_TOOLBAR);
  if(!wnd){
    wnd = FirstThat(IsHaveGadgetWindow);
    if(!wnd || (wnd = wnd->ChildWithId(IDW_TOOLBAR))==0)
      return 0;
  }
  TGadgetWindow* toolBar = TYPESAFE_DOWNCAST(wnd, TGadgetWindow);
  if(toolBar)
    return toolBar;
  return 0;
}