void CMusicListItemUI::DoEvent(TEventUI& event) { if( event.Type == UIEVENT_MOUSEENTER ) { if( IsEnabled() ) { m_uButtonState |= UISTATE_HOT; Hot(); Invalidate(); } if (m_pMusicInfoDlg == NULL) { m_pMusicInfoDlg = new CMusicInfoDialog; m_pMusicInfoDlg->Init(_T("xmls\\MusicList\\MusicInfoWnd.xml"),m_pManager->GetPaintWindow(), 357); m_pMusicInfoDlg->ResetWindow(GetPos().top - 10, GetMedia()); } // CMusicInfoDialog *pMusicInfoDlg = (static_cast<CMusicListGroupUI*>(GetParentNode()))->GetMusicList()->GetMusicInfoDialog(); // if (pMusicInfoDlg != NULL) // { // pMusicInfoDlg->ResetWindow(GetPos().top - 10, GetMedia()); // pMusicInfoDlg->ShowWindow(); // } return; } else if( event.Type == UIEVENT_MOUSELEAVE ) { if( (m_uButtonState & UISTATE_HOT) != 0 ) { m_uButtonState &= ~UISTATE_HOT; Hot(false); Invalidate(); } if (m_pMusicInfoDlg != NULL) { m_pMusicInfoDlg->Close(); m_pMusicInfoDlg = NULL; } // CMusicInfoDialog *pMusicInfoDlg = (static_cast<CMusicListGroupUI*>(GetParentNode()))->GetMusicList()->GetMusicInfoDialog(); // if (pMusicInfoDlg != NULL) // { // pMusicInfoDlg->ShowWindow(false); // } return; } else if( event.Type == UIEVENT_CONTEXTMENU ) { if( IsContextMenuUsed() ) { m_pManager->SendNotify(this, DUI_MSGTYPE_MENU, event.wParam, event.lParam); } } else CTreeNodeUI::DoEvent(event); }
//============================================================================= // // LoadStdImage() // // Purpose: The LoadStdImage() Loads the image for the button. This // function (or LoadStdStyle()) must be called at a minimum. // Automatically generates the other standard states. // // Parameters: // [IN] id // resource id, one of the resources already imported with the // resource editor, usually begins with IDR_ // // [IN] pType // pointer to string describing the resource type // // Returns: BOOL // Non zero if successful, otherwise zero // //============================================================================= BOOL StyleButton::LoadStdImage(UINT id, LPCTSTR pType) { CRect rect; GetClientRect(rect); Stack Std(rect); Std.AddImage(CPoint(0,0), id, pType); m_StdStyle.AddStack(Std); Stack Press(rect); Press.AddImage(CPoint(1,1), id, pType); m_StdPStyle.AddStack(Press); Stack Hot(rect); Hot.AddImage(CPoint(0,0), id, pType, FALSE, LIGHTEN); m_StdHStyle.AddStack(Hot); Stack Gray(rect); Gray.AddImage(CPoint(0,0), id, pType, FALSE, GRAYSCALE); m_StdGStyle.AddStack(Gray); // create background Stack Back(rect); Back.FillSolid(CLEAR); m_Background.AddStack(Back); return TRUE; }
//============================================================================= // // LoadAltImage() // // Purpose: The LoadAltImage() Loads the alternate image for the button. // This function call is optional // Automatically generates the other alternate states. // // Parameters: // [IN] id // resource id, one of the resources already imported with the // resource editor, usually begins with IDR_ // // [IN] pType // pointer to string describing the resource type // // Returns: BOOL // Non zero if successful, otherwise zero // //============================================================================= BOOL StyleButton::LoadAltImage(UINT id, LPCTSTR pType) { CRect rect; GetClientRect(rect); Stack Std(rect); Std.AddImage(CPoint(0,0), id, pType); m_AltStyle.AddStack(Std); Stack Press(rect); Press.AddImage(CPoint(1,1), id, pType); m_AltPStyle.AddStack(Press); Stack Hot(rect); Hot.AddImage(CPoint(0,0), id, pType, FALSE, LIGHTEN); m_AltHStyle.AddStack(Hot); m_bHaveAltStyle = TRUE; return TRUE; }