📄 outbarview.cpp
字号:
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "LeoBlock2004.h"
#include "OutbarView.h"
#include "ListViewInfo.h"
#include "InternetView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COutbarView
IMPLEMENT_DYNCREATE(COutbarView, CView)
COutbarView::COutbarView()
{
}
COutbarView::~COutbarView()
{
}
#ifndef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#endif
BEGIN_MESSAGE_MAP(COutbarView, CView)
//{{AFX_MSG_MAP(COutbarView)
ON_WM_SIZE()
ON_WM_CREATE()
ON_MESSAGE( XTWM_OUTBAR_NOTIFY, OnOutbarNotify )
//}}AFX_MSG_MAP
ON_NOTIFY(PGN_SCROLL, IDC_PAGER_CTRL, OnPagerScroll)
ON_NOTIFY(PGN_CALCSIZE, IDC_PAGER_CTRL, OnPagerCalcSize)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COutbarView drawing
void COutbarView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// COutbarView diagnostics
#ifdef _DEBUG
void COutbarView::AssertValid() const
{
CView::AssertValid();
}
void COutbarView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// COutbarView message handlers
void COutbarView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
if(m_wndPager.GetSafeHwnd()) {
m_wndPager.MoveWindow(0,0,cx,cy);
}
}
int COutbarView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// Create the pager control.
if (!m_wndPager.Create(WS_CHILD|WS_VISIBLE|PGS_VERT,
CRect(0,0,0,0), this, IDC_PAGER_CTRL ))
{
TRACE0("Failed to create CPagerCtrl...\n");
return -1;
}
// Create the OutlookBar control using m_wndPager as the parent.
if (!m_wndOutlookBar.Create( WS_CHILD | WS_VISIBLE | WS_TABSTOP,
CRect(0,0,0,0), &m_wndPager, IDC_OUTBAR ))
{
TRACE0("Failed to create COutlookBar...\n");
return -1;
}
// Set the CWnd object you want messages sent to.
m_wndOutlookBar.SetOwner(this);
m_wndOutlookBar.SetColors(RGB(0xff,0xff,0xff), RGB(0x3a,0x6e,0xa5));
// Add items to the Outlook Bar control.
m_wndOutlookBar.AddMenuItem(IDI_ICON_INTERNET,_T("网络导航")),
m_wndOutlookBar.AddMenuItem(IDI_ICON_REQUEST, _T("下载信息")),
// Insert menu items at a specific index.
//m_wndOutlookBar.InsertMenuItem(0, IDI_ICON_INBOX, _T("收件箱") ),
//m_wndOutlookBar.InsertMenuItem(1, IDI_ICON_OUTBOX, _T("发件箱") ),
//m_wndOutlookBar.InsertMenuItem(2, IDI_ICON_CALENDAR, _T("日历")),
// Set the child HWND to COutlookBar, and button size to 15.
m_wndPager.SetChild(m_wndOutlookBar.GetSafeHwnd());
m_wndPager.SetButtonSize(15);
return 0;
}
BOOL COutbarView::OnPagerCalcSize(NMPGCALCSIZE* pNMPGCalcSize, LRESULT* pResult)
{
switch(pNMPGCalcSize->dwFlag)
{
case PGF_CALCWIDTH:
break;
case PGF_CALCHEIGHT:
pNMPGCalcSize->iHeight = m_wndOutlookBar.GetCount()
*(::GetSystemMetrics(SM_CYICON)*2);
break;
}
*pResult = 0;
return TRUE;
}
BOOL COutbarView::OnPagerScroll(NMPGSCROLL* /*pNMPGScroll*/, LRESULT* pResult)
{
*pResult = 0;
return TRUE;
}
void COutbarView::SetCListViewInfo(CListViewInfo* pListInfo)
{
m_ptrListViewInfo=pListInfo;
}
void COutbarView::OnOutbarNotify(UINT lParam, LONG wParam)
{
switch( wParam ) // control id.
{
case IDC_OUTBAR:
{
// Get the menu item.
XT_CONTENT_ITEM* pContentItems = m_wndOutlookBar.GetMenuItem((int)lParam);
ASSERT(pContentItems);
CInternetView *pInternetView=&(m_ptrListViewInfo->m_pInternetViewBBB);
CListBoxSocInfo *pListBox=&(m_ptrListViewInfo->m_pListBoxInfo);
switch( lParam )
{
case 0:
{
//AfxMessageBox(pContentItems->m_strText);
if(!pInternetView->IsWindowVisible())
{
pListBox->ShowWindow(SW_HIDE);
pInternetView->ShowWindow(SW_SHOW);
}
}
break;
case 1:
{
//AfxMessageBox(pContentItems->m_strText);
if(!pListBox->IsWindowVisible())
{
pInternetView->ShowWindow(SW_HIDE);
pListBox->ShowWindow(SW_SHOW);
}
}
break;
}
pInternetView=NULL;
pListBox=NULL;
}
break;
}
}
BOOL COutbarView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CView::PreCreateWindow(cs))
return FALSE;
cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
// TODO: Add your specialized code here and/or call the base class
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -