www.pudn.com > UltraSound.rar > WorkspaceBar.cpp
// WorkspaceBar.cpp : implementation of the CWorkspaceBar class
//
#include "stdafx.h"
#include "UltraSound.h"
#include "WorkspaceBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const int nBorderSize = 1;
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar
BEGIN_MESSAGE_MAP(CWorkspaceBar, CBCGPDockingControlBar)
//{{AFX_MSG_MAP(CWorkspaceBar)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar construction/destruction
CWorkspaceBar::CWorkspaceBar()
{
// TODO: add one-time construction code here
}
CWorkspaceBar::~CWorkspaceBar()
{
}
/////////////////////////////////////////////////////////////////////////////
// CWorkspaceBar message handlers
int CWorkspaceBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty ();
// Create tree windows.
// TODO: create your own tab windows here:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | LVS_REPORT ;
if (!m_List.Create(dwViewStyle, rectDummy, this, 1))
{
TRACE0("Failed to create workspace view\n");
return -1; // fail to create
}
return 0;
}
void CWorkspaceBar::OnSize(UINT nType, int cx, int cy)
{
CBCGPDockingControlBar::OnSize(nType, cx, cy);
m_List.SetWindowPos (NULL, nBorderSize, nBorderSize,
cx - 2 * nBorderSize, cy - 2 * nBorderSize,
SWP_NOACTIVATE | SWP_NOZORDER);
}
void CWorkspaceBar::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rectTree;
m_List.GetWindowRect (rectTree);
ScreenToClient (rectTree);
rectTree.InflateRect (nBorderSize, nBorderSize);
dc.Draw3dRect (rectTree, ::GetSysColor (COLOR_3DSHADOW),
::GetSysColor (COLOR_3DSHADOW));
}