1 //播放列表专用的控件类,从CListCtrlEx派生,用于实现设置CListCtrl控件文字颜色 2 //以及鼠标提示信息 3 #pragma once 4 #include "AudioCommon.h" 5 #include "ColorConvert.h" 6 #include "ListCtrlEx.h" 7 #include "Common.h" 8 9 // CPlayListCtrl 10 11 class CPlayListCtrl : public CListCtrlEx 12 { 13 DECLARE_DYNAMIC(CPlayListCtrl) 14 15 public: 16 CPlayListCtrl(const vector<SongInfo>& all_song_info); 17 virtual ~CPlayListCtrl(); 18 19 void ShowPlaylist(DisplayFormat display_format, bool search_result = false); //显示播放列表 20 void QuickSearch(const wstring& key_words); //根据关键字执行快速查找,查找文件名、歌曲标题、艺术家和唱片集,将找到的曲目的序号保存在m_search_result中 21 void GetItemSelectedSearched(vector<int>& item_selected); //获取处于搜索状态下播放列表选中的项目 22 virtual void ShowPopupMenu(CMenu* pMenu, int item_index, CWnd* pWnd) override; 23 24 void AdjustColumnWidth(); 25 26 bool SetRowHeight(int height); 27 28 protected: 29 30 CToolTipCtrl m_toolTip; //文本提示类 31 int m_nItem; //存放行号 32 //int m_nSubItem; //存放列号 33 34 const vector<SongInfo>& m_all_song_info; //储存播放列表中所有歌曲的信息 35 vector<int> m_search_result; //储存快速搜索结果的歌曲序号 36 bool m_searched{ false }; 37 ListData m_list_data; 38 39 protected: 40 void CalculateColumeWidth(vector<int>& width); 41 42 afx_msg void OnMouseMove(UINT nFlags, CPoint point); 43 virtual BOOL PreTranslateMessage(MSG* pMsg); 44 45 DECLARE_MESSAGE_MAP() 46 virtual void PreSubclassWindow(); 47 afx_msg void OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult); 48 }; 49