/*=========================================================================== * * RICHTEXT.CPP - 10 March 1999, Dave Humphrey * * A class based on the standard MFC rich text control to allow additions * such as a right-click popup menu, etc... * *=========================================================================*/ /* Include Files */ #include "stdafx.h" #include "RichText.h" /* Debug Stuff */ #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif /* Allow dynamic creation of class */ IMPLEMENT_DYNCREATE(CRichText, CRichEditCtrl) /*=========================================================================== * * Class CRichText Message Map * *=========================================================================*/ BEGIN_MESSAGE_MAP(CRichText, CRichEditCtrl) //{{AFX_MSG_MAP(CRichText) ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() /*=========================================================================== * End of Class CRichText Message Map *=========================================================================*/ /*=========================================================================== * * Class CRichText Event - OnRButtonDown(); * * Used to display a popup menu when the right mouse button is clicked, if * a menu has been defined with InitMenu(). * *=========================================================================*/ void CRichText::OnRButtonDown(UINT nFlags, CPoint point) { CMenu* pPopup; /* Call the base class member first */ CRichEditCtrl::OnRButtonDown(nFlags, point); /* Modify the coordinates to be screen absolute */ ClientToScreen(&point); /* Retrieve and display the record pop-up menu, if any */ pPopup = m_Menu.GetSubMenu(0); if (pPopup != NULL) pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd()); } /*=========================================================================== * End of Class Event CRichText::OnRButtonDown() *=========================================================================*/