📄 createchannelpage5.cpp
字号:
// CreateChannelPage5.cpp : implementation file
//
#include "stdafx.h"
#include "BeeReader.h"
#include "CreateChannelPage5.h"
#include "CreateChannelSheet.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCreateChannelPage5 dialog
IMPLEMENT_DYNCREATE(CCreateChannelPage5, CPropertyPage)
CCreateChannelPage5::CCreateChannelPage5() : CPropertyPage(CCreateChannelPage5::IDD)
{
//{{AFX_DATA_INIT(CCreateChannelPage5)
m_bSelectAll = FALSE;
//}}AFX_DATA_INIT
}
void CCreateChannelPage5::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCreateChannelPage5)
DDX_Control(pDX, IDC_LIST1, m_pList);
DDX_Check(pDX, IDC_CHECK1, m_bSelectAll);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCreateChannelPage5, CPropertyPage)
//{{AFX_MSG_MAP(CCreateChannelPage5)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnItemchangedList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCreateChannelPage5 message handlers
BOOL CCreateChannelPage5::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
if ( !m_imageList.Create( 16, 16, ILC_COLOR24 | ILC_MASK, 1, 1 ) )
{
TRACE0("Failed to create image list.\n");
return -1;
}
// load the tree images bitmap and add it to the image list.
/*
m_bitmap.LoadBitmap( IDB_CHANNEL_SMALL );
m_imageList.Add( &m_bitmap, RGB( 0x00,0xff,0x00 ) );
m_pList.SetImageList( &m_imageList,LVSIL_SMALL);
*/
m_pList.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
m_pList.SetExtendedStyle(m_pList.GetExtendedStyle()|LVS_EX_CHECKBOXES );
m_pList.InsertColumn( 0 , _T("频道名称"),LVCFMT_LEFT,250 );
m_pList.InsertColumn( 1 , _T("地 址"),LVCFMT_LEFT,150 );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CCreateChannelPage5::OnSetActive()
{
// TODO: Add your specialized code here and/or call the base class
CCreateChannelSheet* pSheet = (CCreateChannelSheet*)GetParent();
pSheet->SetWizardButtons( PSWIZB_BACK | PSWIZB_FINISH );
COutlineItem* pItem = pSheet->opml.GetNextItem(TRUE);
m_pList.LockWindowUpdate();
m_pList.DeleteAllItems();
int nIndex = 0;
while( pItem )
{
if( !pSheet->FilterChannel( pItem->GetXmlUrl() ) )
{
m_pList.InsertItem( nIndex,pItem->GetTitle());
m_pList.SetItemText( nIndex,1,pItem->GetXmlUrl());
m_pList.SetItemData(nIndex,(DWORD)pItem );
}
pItem = pSheet->opml.GetNextItem(FALSE);
}
m_pList.UnlockWindowUpdate();
return CPropertyPage::OnSetActive();
}
BOOL CCreateChannelPage5::OnWizardFinish()
{
CCreateChannelSheet* pSheet = (CCreateChannelSheet*)GetParent();
CMainFrame* pMainWnd = (CMainFrame*)AfxGetMainWnd();
ASSERT(pMainWnd);
COutlineItem* pItem = NULL;
CRSSChannel* pChannel = NULL;
for( int i=0; i<m_pList.GetItemCount();i++)
{
if( m_pList.GetCheck(i) )
{
pItem = (COutlineItem*)m_pList.GetItemData(i);
ASSERT(pItem);
pChannel = new CRSSChannel;
pChannel->SetURL( pItem->GetXmlUrl() );
pChannel->SetTitle( pItem->GetTitle() );
pMainWnd->CreateChannel( pSheet->page2.GetParentNode(), pChannel );
pMainWnd->GetRSSManager()->AddChannel( pChannel, pChannel->GetURL() );
pMainWnd->GetNewsTree()->SendMessage(WM_UPDATE_CHANNEL,1,(LPARAM)pChannel);
}
}
return CPropertyPage::OnWizardFinish();
}
void CCreateChannelPage5::OnCheck1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
for( int i=0;i<m_pList.GetItemCount();i++)
{
if( m_bSelectAll ) m_pList.SetCheck(i,TRUE);
else m_pList.SetCheck(i,FALSE);
}
}
void CCreateChannelPage5::OnButton1()
{
// TODO: Add your control notification handler code here
}
void CCreateChannelPage5::OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -