BOOL CElcSkinFrameBase::NcLButtonDown(UINT nHitTest, CPoint point) { GetOppositePoint(point); m_nLBDownItem = ESNWT_NONE; if (HTMENU == nHitTest) { int nIndex = PtInMenuItem(point); if (nIndex != -1) { m_bMenuActivated = !m_bMenuActivated; m_nActiveItem = nIndex; if (m_bMenuActivated) { RedrawMenuBar(); //m_bSelfCancelMenu = TRUE; PopupMenu(nIndex); } else { m_bSelfCancelMenu = TRUE; ::SendMessage(m_hDerive, WM_CANCELMODE, 0, 0); RedrawMenuBar(); } } } else if (HTSYSMENU == nHitTest) { PopupSysMenu(); } else { int nItem = FindButton(nHitTest); if (nItem != -1) { m_nLBDownItem = nHitTest; RedrawButton(m_arrButton[nItem].pButton); return TRUE; } m_nActiveItem = -1; m_bMenuActivated = FALSE; m_nActiveButton = -1; m_nLBDownItem = ESNWT_NONE; RedrawMenuBar(); return FALSE; } return TRUE; }
void AwtMenuBar::DeleteItem(UINT index) { AwtMenu::DeleteItem(index); HWND hOwnerWnd = GetOwnerHWnd(); if (hOwnerWnd != NULL) { VERIFY(::InvalidateRect(hOwnerWnd,0,TRUE)); } RedrawMenuBar(); }
BOOL CElcSkinFrameBase::NcMouseMove(UINT nHitTest, CPoint point) { GetOppositePoint(point); BOOL bChanged = FALSE; int nIndex = 0; int nCount = 0; if (nHitTest == HTMENU) { nIndex = PtInMenuItem(point); if (nIndex != -1) { if (m_nActiveItem != nIndex) { m_nActiveItem = nIndex; RedrawMenuBar(); } return TRUE; } if (m_nActiveItem != -1 && !m_bMenuActivated) { m_nActiveItem = -1; RedrawMenuBar(); } } nCount = (int)m_arrButton.size(); for (nIndex = 0; nIndex < nCount; nIndex ++) { CRect rc = CalcPos(m_arrButton[nIndex].pButton); if (rc.PtInRect(point)) { if (m_nActiveButton != nIndex) { m_nActiveButton = nIndex; RedrawButton(m_arrButton[nIndex].pButton); } return TRUE; } } if (m_nActiveButton != -1) { nIndex = m_nActiveButton; m_nActiveButton = -1; RedrawButton(m_arrButton[nIndex].pButton); } return FALSE; }
BOOL CElcSkinFrameBase::NcRButtonDown(UINT nHitTest, CPoint point) { m_nActiveItem = -1; m_bMenuActivated = FALSE; m_nActiveButton = -1; m_nLBDownItem = ESNWT_NONE; RedrawCaption(); RedrawMenuBar(); PopupSysMenu(); return TRUE; }
BOOL CElcSkinFrameBase::NcLButtonUp(UINT nHitTest, CPoint point) { PressFrameButton(nHitTest); m_nActiveItem = -1; m_bMenuActivated = FALSE; m_nActiveButton = -1; m_nLBDownItem = ESNWT_NONE; RedrawCaption(); RedrawMenuBar(); return TRUE; }
void CElcSkinFrameBase::PopupMenu(int nIndex) { m_nActiveItem = nIndex; if (m_nActiveItem == -1) { return; } HMENU hMenu = ::GetSubMenu(m_hMenu, nIndex); if (!::IsMenu(hMenu)) { ASSERT(0); return; } CPoint point(m_arrMenu[nIndex].rect.left, m_arrMenu[nIndex].rect.bottom); GetScreenPoint(point); int nRet = ::TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, point.x, point.y, 0, m_hDerive, NULL); if (nRet != 0) { m_bMenuActivated = FALSE; m_nActiveItem = -1; ::PostMessage(m_hDerive, WM_COMMAND, nRet, 0); } if (!m_bSelfCancelMenu) { m_bMenuActivated = FALSE; m_nActiveItem = -1; } else m_bSelfCancelMenu = FALSE; RedrawMenuBar(); }
void CElcSkinFrameBase::EnterIdle(UINT nWhy, CWnd* pWho) { if (nWhy == MSGF_MENU && m_bMenuActivated) { CPoint point; GetCursorPos(&point); GetOppositePoint(point); int nIndex = PtInMenuItem(point); if (nIndex != -1 && m_nActiveItem != nIndex) { m_bSelfCancelMenu = TRUE; ::SendMessage(m_hDerive, WM_CANCELMODE, 0, 0); m_nActiveItem = nIndex; RedrawMenuBar(); ::PostMessage(m_hDerive, WM_MENUBAR_NOTIFY, nIndex, 0); } } }
void CElcSkinFrameBase::CheckStates() { CPoint point; GetCursorPos(&point); GetOppositePoint(point); if (m_nActiveButton != -1) { CRect rect = CalcPos(m_arrButton[m_nActiveButton].pButton); if (!rect.PtInRect(point)) { m_nActiveButton = -1; m_nLBDownItem = ESNWT_NONE; RedrawCaption(); } } if (m_nActiveItem != -1) { if (!m_arrMenu[m_nActiveItem].rect.PtInRect(point)) { if (!m_bMenuActivated) { m_nActiveItem = -1; RedrawMenuBar(); } } } }