Esempio n. 1
0
//
/// Use the Windows message to get the active mdi child, and then down cast
/// to our MDI child derived class before returning it.
//
TMDIChild*
TMDIClient::GetActiveMDIChild()
{
  THandle hWnd = THandle(HandleMessage(WM_MDIGETACTIVE));

  return TYPESAFE_DOWNCAST(GetWindowPtr(hWnd), TMDIChild);
}
Esempio n. 2
0
void
THelpFileManager::CmWhatIsThis()
{
  PRECONDITION(LastParent);
  if(!LastParent)
    return;
  LastParent->ScreenToClient(LastHit); // TWindow
  HWND hWnd = LastParent->ChildWindowFromPoint(LastHit);
  HELPINFO Info;
  Info.cbSize       = sizeof(Info);
  Info.MousePos     = LastHit;

  if(hWnd){
    TGadgetWindow* gwin = TYPESAFE_DOWNCAST(GetWindowPtr(hWnd), TGadgetWindow);
    if(gwin){
      TGadget* gd = gwin->GadgetFromPoint(LastHit);
      if(gd){
        Info.iContextType = HELPINFO_MENUITEM;
        Info.iCtrlId      = gd->GetId();
        EvHelp(Info);
      }
      return;
    }
  }
  Info.iContextType = HELPINFO_WINDOW;
  Info.dwContextId  = 0;

  // If the click wasn't on one of the controls, open Help for dialog.
  if (hWnd == 0 || hWnd == LastParent->GetHandle()){
    Info.iContextType = HELPINFO_MENUITEM;
    Info.iCtrlId      = IDHELP;
    Info.hItemHandle  = LastParent->GetHandle();
  }
  else{
    Info.iCtrlId      = ::GetDlgCtrlID(hWnd);
    Info.hItemHandle  = hWnd;
  }
  EvHelp(Info);
}
Esempio n. 3
0
//创建或获取DockBar
RingDockBar* RingDockSite::CreateDockBar(RingBaseWnd* wnd,BOOL bCanSize)
{
	if(wnd == NULL)
		return NULL;
	
	RingDockBar* dockbar = NULL;

	//判断是否已有dockbar与wnd绑定,是为防止多次调用AddBar
	if(wnd->GetParent() == m_hWnd)
		dockbar = GetDockBar(wnd);
	else
	{
		//DockBar内的窗口其父窗口句柄为DockSite,但m_parent为原父窗口对象
		RingBaseWnd* parent = GetWindowPtr(wnd->GetParent());
		if(parent)
		{			
			if(parent->GetWindowType() == ITIS_DOCKSITE)	//已加入,但非停靠在本区域
				dockbar = ((RingDockSite*)parent)->GetDockBar(wnd);
			else if(parent->GetWindowType() == ITIS_FLYBAR)
				dockbar = ((RingFlyBar*)parent)->GetDockBar();
		}
	}
	
	if(dockbar == NULL)
	{
		//创建dockbar
		if(bCanSize)
			dockbar = new RingSizeBar;
		else
		{
			if(wnd->GetWindowType() == ITIS_MENUBAR)
				dockbar = new RingAllLineBar;
			else
				dockbar = new RingDockBar;
		}
	}
	return dockbar;
}
Esempio n. 4
0
CtrlMemView *CtrlMemView::getFrom(HWND hwnd)
{
    return (CtrlMemView *)GetWindowPtr(hwnd, 0);
}
Esempio n. 5
0
void	THelp :: ProcessHelpRequest  ( TOrigin		Origin,
				       THotkeyType	Type,
				       HWND		hwnd,
				       uint		message,
				       WPARAM		wparam,
				       LPARAM		lparam )
    {
	THelpQueryContext		Context ;
	register int			i, depth, found, nesting ;
	register THelpDefinition *	HelpDef ;
	register THelpEntry *		Entry		=  NULL ,
			    *		ep,
			    *		sp ;
	HWND				ControlHwnd ;
	HMENU				hMenu ;
	register char *			p ;
	TWindow *			OwlWindow	=  GetWindowPtr ( hwnd ) ;




// La fenêtre veut-elle nous donner son contexte d'aide ?	
	Context. hwnd		=  hwnd ;
	Context. message	=  message ;
	Context. wparam		=  wparam ;
	Context. lparam		=  lparam ;
	Context. Origin		=  Origin ;
	Context. Type		=  Type ;
	memset ( & Context. Entry, 0, sizeof ( Context. Entry ) ) ;

	SendMessage ( hwnd, WM_QUERYHELPCONTEXT, 0, ( LPARAM ) & Context ) ;


	if  ( Context. Entry. ContextParam )
	   {
		Entry = & Context. Entry ;
		goto  GotHelpEntry ;
	    }


// Rechercher si cette fenêtre n'est pas déjà déclarée dans notre liste
	for  ( i = 0 ; i < MAX_HELP_ENTRIES ;  i ++ )
	   {
		if  ( HelpTable [i]. HelpFileIndex  ==  -1 )
			continue ;

		if  ( HelpTable [i]. AppliesTo  ==  WindowObject  &&
			HelpTable [i]. WindowHwnd  ==  hwnd )
		   {
			HelpDef = HelpTable + i ;
			goto  GotHelpDef ;
		    }
	     }


// Pas trouvée dans la table : s'agit-il d'une fenêtre OWL ?
// Si le focus est sur un contrôle, faudrait peut-être mieux prendre la
// boîte de dialogue parent...
	if  ( OwlWindow  ==  NULL  ||  OwlWindow -> GetDlgCtrlID ( ) )
		OwlWindow = GetWindowPtr ( GetParent ( hwnd ) ) ;

	if  ( OwlWindow  !=  NULL )
	   {
		const char *  zz = typeid ( * OwlWindow ). name ( ) ;


		for  ( i = 0 ; i < MAX_HELP_ENTRIES ; i ++ )
		    {
			if  ( HelpTable [i]. HelpFileIndex  ==  -1 )
				continue ;


			if  ( HelpTable [i]. AppliesTo  ==  ClassObject  &&
				! strcmp ( HelpTable [i]. ClassName, zz ) ) 
			   {
				HelpDef = HelpTable + i ;
				goto  GotHelpDef ;
			    }
		      }
	     }


// C'est la fin des haricots...
	NotFound ( TRUE, NULL, Origin, Type, hwnd, message, wparam, lparam ) ;
	return ;


GotHelpDef :
	// L'entrée dans la table d'aide a été trouvée ; il s'agit maintenant
	// de retrouver le contexte adéquat
	if  ( Origin  ==  WindowHelp  ||  Origin  ==  DialogBoxHelp )
	   {
		if  ( Type  ==  Contextual )
		   {
			ControlHwnd  =  GetFocus ( ) ;
			i = GetDlgCtrlID ( ControlHwnd ) ;

			for  ( ep = HelpDef -> ControlEntries ; 
					ep  !=  NULL  &&
					ep -> Type  !=  EndOfTable  &&
					ep -> Type  !=  WindowEnd ; ep ++ )
			   {
				if  ( i  ==  ep -> Id )
				   {
					Entry = ep ;
					break ;
				     }
			     }
		     }


	//  L'aide demandée n'est pas contextuelle OU 
	//  le contrôle qui a le focus n'appartient pas à cette fenêtre OU
	//  aucun contexte n'a été trouvé dans les contrôles pour cette
	// fenêtre
		if  ( Entry  ==  NULL )
		   {

		// Si la fenêtre est une boîte de dialogue, on va essayer de
		// voir s'il existe un contexte spécifique.
		// Note : cela ne sera possible que si l'aide est relative à une
		// classe OWL
			TWindow *	W = GetWindowPtr ( hwnd ) ;
			TDialog *	D = NULL ;


			if  ( W  !=  NULL )
				D = dynamic_cast <TDialog *> ( W ) ;


			if  ( D  ==  NULL )
			   {
				Entry = HelpDef -> WindowEntries ;
				goto  GotHelpEntry ;
			    }

		// Ca ne marche que si le nom de la ressource dialogue est
		// défini comme un nombre entier !!!
			i = ( int ) D -> Attr. Name ;				


		// Recherche de la WindowEntry ayant le bon numéro de boîte
		// ou, à défaut, de celle qui possède un id à 0.
			for  ( ep = HelpDef -> WindowEntries, sp = NULL ;
					ep  !=  NULL		&&	
					ep -> Type  !=  WindowEnd  &&
					ep -> Type  !=  EndOfTable ; ep ++ )
			  {
				if  ( ! ep -> Id  &&  sp  == NULL )
					sp = ep ; 	// 1er id à zéro
				else if  ( ep -> Id  ==  i )
				   {
					sp = ep ;
					break ;
				    }
			    }

			ep = ( sp  ==  NULL ) ?  HelpDef -> WindowEntries : sp ;
			goto  GotHelpDef ;
		    }
	      }	
		
	
	
// Cas des menus
	if  ( Origin  ==  MenuHelp )
	   {
		if  ( Type  ==  Normal )		// le cas le plus simple
		   {
			Entry = HelpDef -> MenuEntries ;
			goto  GotHelpEntry ;
		    }
			

	// Menu popup : on va  recherche son entrée dans la table en se basant
	// sur l'identificateur de son premier élément
		if  ( LastSelectedMenuType  & MF_SYSMENU )
		   {
			Entry = HelpDef -> MenuEntries ;
			goto  GotHelpEntry ;
		    }


		if  ( LastSelectedMenuType  & MF_POPUP )
		   {
			hMenu = LastSelectedMenuHandle ;
			depth = 0 ;
			i = -1 ;

			while  ( i  ==  -1 )
			   {
				i = GetMenuItemID ( hMenu, 0 ) ;
				hMenu = GetSubMenu ( hMenu, 0 ) ;
				depth ++ ;

				if  ( hMenu  ==  NULL )
					break ;
			     }
				

		// Aucun sous-élément n'a été trouvé !
			if  ( i  ==  -1 )
			   {
				Entry = HelpDef -> MenuEntries ;
				goto  GotHelpEntry ;
			    }

		// Un élément a été trouvé : on le cherche dans les entrées
			nesting = 0 ;

			for  ( sp = NULL, ep  =  HelpDef -> MenuEntries, found = 0 ; 
					ep  !=  NULL  &&
					ep -> Type !=  EndOfTable  &&  
					( ep  -> Type  != MenuEnd  ||  nesting ) ; ep ++ )
			   {
				if  ( ! ep -> Id )	
					sp = ep ;	// Dernier élément nul
				else if  ( ep -> Id  ==  i )
				   {
					found = 1 ;
					break ;
				    }

				if  ( ep -> Type  ==   MenuStart )
					nesting ++ ;
				else if  ( ep -> Type  !=  MenuEnd )
					nesting -- ;
			     }

		// Pas trouvé : on mettra l'aide en ligne sur le 1er élément
			if  ( ! found  ||  sp  ==  NULL )
			   {
				Entry = HelpDef -> MenuEntries ;
				goto  GotHelpEntry ;
			    }


		// Trouvé : dans le do...while, on a été susceptibles de descendre
		// plusieurs niveau de menu (si le 1er élément du menu est un
		// popup, dont le 1er élément est un popup, etc..)
		// On va essayer de remonter à partir de sp pour retrouver 
		// l'index du 1er popup
			while  ( depth  &&  sp  >=  HelpDef -> MenuEntries )
			   {
				depth -- ; 

				if  ( ! sp -> Id  &&  ! depth )
				   {
					Entry = sp ;
					goto   GotHelpEntry ;
				    }

				sp -- ;
			     }

			Entry = HelpDef -> MenuEntries ;
			goto  GotHelpEntry ;
		    }
		else
		   {
		// L'élément de menu n'est pas un popup
			nesting = 0 ;

			for  ( ep = HelpDef -> MenuEntries ; 
						ep  !=  NULL  &&
						ep -> Type  !=  EndOfTable  &&
						( ep -> Type  !=  MenuEnd || nesting ) ; ep ++ )
			   {
				if  ( ep -> Id  ==  LastSelectedMenu )
				   {
					Entry = ep ;
					goto  GotHelpEntry ;
				    }
				
				if  ( ep -> Type  ==  MenuStart )
					nesting ++ ;
				else if  ( ep -> Type  ==  MenuEnd )
					nesting -- ;
			    }
		     }
	    }



GotHelpEntry :

// On arrive ici avec Entry qui est peut-être nul; dans ce cas, on appelle l'index
	p = HelpFileNames [ HelpDef -> HelpFileIndex ] ;

// Si le pointeur est nul, on essaie de prendre par défaut l'aide relative à
// la fenêtre
	if  ( Entry  ==  NULL )
		Entry = HelpDef -> WindowEntries ;

	if  ( Entry  ==  NULL )
	   {
		NotFound ( FALSE, p, Origin, Type, hwnd, message, wparam, lparam ) ;
		Help ( p ) ;
	    }
	else
	   {
:: MessageBox ( NULL, "HELP", MB_OK, "ID = %d, KeyValue = [%s]",
Entry -> Id, Entry -> ContextParam ) ;

		if  ( Entry -> Type  ==  ByID )
			Help ( p, Entry -> ContextParam ) ;
		else
			Help ( p, ( char * ) Entry -> ContextParam ) ;
	    }

// Ouf, c'est fini ! j'en ferai pas tous les jours, des comme ça
     }
Esempio n. 6
0
void CWindow::UpdateWindow()
{
	BeginUpdate(GetWindowPtr());
	EndUpdate(GetWindowPtr());
}
Esempio n. 7
0
//
// Support for nwe HTML Help
//
HWND
THelpFileManager::HtmlHelp(TWindow* wnd, LPCTSTR lpszHelp, uint uCmd,  uint32 data)
{
  // translate uCommand into HTML command
  uint command = uCmd;
  if(WinToHTML){
    switch(uCmd){
      case HELP_FINDER:
        command = HH_HELP_FINDER;
        break;
      case HELP_CONTENTS:  //== HELP_INDEX
        command = HH_HELP_CONTEXT;    //
        break;
      case HELP_WM_HELP:
        command = HH_TP_HELP_WM_HELP;
        break;
      case HELP_CONTEXTMENU:
        command = HH_TP_HELP_CONTEXTMENU;
        break;
      case HELP_QUIT:
        command = HH_CLOSE_ALL;
        break;
      case HELP_CONTEXTPOPUP: {
//-----------------------
//Start Ole Änderung 02.04.2002
//          command = HH_TP_HELP_CONTEXTMENU;
               command = HH_DISPLAY_TEXT_POPUP;
          if(THtmlHelp::IsAvailable()){
                  if(LastHit == TPoint(-1, -1))
                    HtmlHelp(GetWindowPtr(GetDesktopWindow()), lpszHelp, HH_HELP_CONTEXT,data) ;
                  else
                  {
                    HH_POPUP hPop; // HTML Help popup structure
                    memset(&hPop, 0, sizeof(hPop));
                    hPop.cbStruct         = sizeof(hPop);
                    hPop.clrBackground    = -1;
                    hPop.clrForeground    = -1;
                    hPop.rcMargins.left   = -1;
                    hPop.rcMargins.bottom = -1;
                    hPop.rcMargins.right  = -1;
                    hPop.pt               = LastHit;
                    hPop.idString         = data;
                    hPop.pszText          = NULL;
                    hPop.pszFont          = NULL;

            if(wnd)
                      return THtmlHelp::Dll()->HtmlHelp(*wnd, lpszHelp, command, (DWORD)&hPop);
            else
                      return THtmlHelp::Dll()->HtmlHelp(0, lpszHelp, command, (DWORD)&hPop);
                  }

//            if(wnd)
//              return THtmlHelp::Dll()->HtmlHelp(*wnd,lpszHelp,command,data);
//            else
//              return THtmlHelp::Dll()->HtmlHelp(0, lpszHelp,command,data);
//Ende  Ole Änderung 02.04.2002
//-----------------------
          }
          return 0;
        }
    }
  }
  if(THtmlHelp::IsAvailable()){
    if(wnd)
      return THtmlHelp::Dll()->HtmlHelp(*wnd,lpszHelp,command,data);
    else
      return THtmlHelp::Dll()->HtmlHelp(0, lpszHelp,command,data);
  }
  return 0;
}