www.pudn.com > QQandSample.rar > CtrView.cpp
// CtrView.cpp : implementation file
//
#include "stdafx.h"
#include "Rotation.h"
#include "CtrView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCtrView
IMPLEMENT_DYNCREATE(CCtrView, CView)
CCtrView::CCtrView()
{
}
CCtrView::~CCtrView()
{
}
BEGIN_MESSAGE_MAP(CCtrView, CView)
//{{AFX_MSG_MAP(CCtrView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
ON_MESSAGE(WM_OUTBAR_NOTIFY, OnOutbarNotify)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCtrView drawing
void CCtrView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CCtrView diagnostics
#ifdef _DEBUG
void CCtrView::AssertValid() const
{
CView::AssertValid();
}
void CCtrView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCtrView message handlers
void CCtrView::OnInitialUpdate()
{
//创建抽屉
DWORD dwf = CGfxOutBarCtrl::fDragItems|
CGfxOutBarCtrl::fAddGroups|
CGfxOutBarCtrl::fAnimation;
CRect rc;
GetClientRect(&rc);
wndBar.Create(WS_CHILD|WS_VISIBLE, rc, this,IDC_LST_MENU, dwf);
wndBar.SetOwner(this);
//创建并设置大小图标链表
imaLarge.Create(IDB_IMAGELIST, 32, 0, RGB(0,130,132));
wndBar.SetImageList(&imaLarge, CGfxOutBarCtrl::fLargeIcon);
// wndBar.SetImageList(&imaSmall, CGfxOutBarCtrl::fSmallIcon);
wndBar.SetAnimationTickCount(10);
wndBar.SetAnimSelHighlight(200);
//创建4个抽屉
///增加抽屉函数:AddFolder
wndBar.AddFolder("时域分析", 0);
wndBar.AddFolder("频谱分析", 1);
//抽屉1:时域分析
wndBar.InsertItem(0, 0, "示波", 0, 0);
wndBar.InsertItem(0, 1, "暂停", 1, 0);
wndBar.InsertItem(0, 2, "采集", 2, 0);
wndBar.InsertItem(0, 3, " 参数设置", 3, 0);
//抽屉3:频域分析
wndBar.InsertItem(1, 1, "幅值谱", 0, 0);
wndBar.InsertItem(1, 2, "相位谱", 1, 0);
// 默认选择抽屉1
wndBar.SetSelFolder(0);
//设置分割条位置
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
}
//接受抽屉内条目发出的消息:用户自定义消息
CCtrView::OnOutbarNotify(WPARAM wParam, LPARAM lParam)
{
//释放鼠标控制
if(::GetCapture()!=NULL)
ReleaseCapture();
int iFolder = wndBar.GetSelFolder();// 得到抽屉号:函数 GetSelFolder()
int index = (int) lParam;//抽屉内的条目号
pRotationView->iFloder=iFolder;
pRotationView->iItem=index;
if(iFolder==0&&index==1)
{
wndBar.InsertItem(0, 1, "运行", 1, 0);
}
pRotationView->Command(iFolder,index);
}