コード例 #1
0
ファイル: MainWnd.cpp プロジェクト: Crawping/DuiLib_Ultimate
void CMainWnd::Notify( TNotifyUI &msg )
{
	if(msg.sType.CompareNoCase(DUI_MSGTYPE_SCROLL) == 0)
	{
		CVerticalLayoutUI* pTabPanel = (CVerticalLayoutUI*)msg.pSender;
		CString sName = msg.pSender->GetName();
		int nPage = (int)msg.wParam;
		CString sTabPanel = sName;
		int nIdx = sTabPanel.Find(_T("@"));
		if(nIdx == -1) return;
		CString sType = sTabPanel.Mid(nIdx + 1);
		if(nPage < 1) nPage = 1;
		if(nPage > 200) nPage = 200;

		int nScrollPos = (nPage - 1) * pTabPanel->GetVerticalScrollBar()->GetLineSize();
		SIZE szSize = {0, nScrollPos};
		pTabPanel->SetScrollPos(szSize, false);

		m_Data.LoadBizhi(sType, nPage, 10);
	}
	else if(msg.sType.CompareNoCase(DUI_MSGTYPE_SELECTCHANGED) == 0)
	{
		COptionUI* pTabBtn = (COptionUI*)msg.pSender;
		CTabLayoutUI* pTabLayout = (CTabLayoutUI*)m_PaintManager.FindControl(_T("wp_tablayout"));
		CString sName = pTabBtn->GetName();
		if(sName == _T("wp_tabbtn") && pTabLayout)
		{
			CString sType = pTabBtn->GetUserData();
			CString sTabPanel;
			sTabPanel.Format(_T("wp_tabpanel@%s"), sType);
			CVerticalLayoutUI* pTabPanel = (CVerticalLayoutUI*)m_PaintManager.FindControl(sTabPanel);
			if(pTabPanel == NULL)
			{
				m_Data.LoadBizhi(sType, 1, 10);
			}
			else
			{
				pTabLayout->SelectItem(pTabPanel);
			}
		}
	}
	else if(msg.sType.CompareNoCase(DUI_MSGTYPE_CLICK_WPFAV) == 0)
	{
		MessageBox(NULL, _T("收藏成功"), _T("百度壁纸 - 提示"), MB_OK);
	}
	else if(msg.sType.CompareNoCase(DUI_MSGTYPE_CLICK_WPSET) == 0)
	{
		CWPButton* pWPBtn = (CWPButton*)msg.pSender;
		pWPBtn->SetWP();
	}
	return WindowImplBase::Notify(msg);
}
コード例 #2
0
void CDuiFrameWnd::DeleteFileItem()
{
	COptionUI* pOption = NULL;
	CVerticalLayoutUI* pLayout = (CVerticalLayoutUI*)m_PaintManager.FindControl(_T("playlist"));
	int nIndex = pLayout->GetCount();

	for (int i = 0; i < nIndex;i++)
	{
		pOption = (COptionUI*)pLayout->GetItemAt(i);
		if (pOption->IsSelected())
		{
			CDuiString strPath = pOption->GetUserData();
			m_cPlayList.deleteFile(strPath.GetData());
			pLayout->RemoveAt(i);
			break;
		}

	}


}