【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-CJTABCTRLBAR.CPP的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// CJTabCtrlBar.cpp : implementation file
//
// DevStudio Style Resizable Docking Tab Control Bar.
//
// Copyright ?1998 Written by Kirk Stowell
// mailto:kstowel@sprynet.com
// http://www.geocities.com/SiliconValley/Haven/8230
//
// The code contained in this file is based on the original
// CSizingTabCtrlBar class written by Dirk Clemens,
// mailto:dirk_clemens@hotmail.com
// http://www.codeguru.com/docking/sizing_tabctrl_bar.shtml
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name and all copyright
// notices remains intact. If the source code in this file is used in
// any commercial application then a statement along the lines of
// "Portions Copyright ?1998 Kirk Stowell" must be included in
// the startup banner, "About" box or printed documentation. An email
// letting me know that you are using it would be nice as well. That's
// not much to ask considering the amount of work that went into this.
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
// ==========================================================================
// HISTORY:
// ==========================================================================
// 1.00 17 Oct 1998 - Initial re-write and release.
// ==========================================================================
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CJTabCtrlBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCJTabCtrlBar
CCJTabCtrlBar::CCJTabCtrlBar()
{
m_nActiveTab = 0;
}
CCJTabCtrlBar::~CCJTabCtrlBar()
{
while(!m_views.IsEmpty())
{
TCB_ITEM *pMember=m_views.RemoveHead();
delete pMember;
}
}
#define IDC_TABCTRLBAR 1000
BEGIN_MESSAGE_MAP(CCJTabCtrlBar, CCJControlBar)
//{{AFX_MSG_MAP(CCJTabCtrlBar)
ON_WM_CREATE()
ON_NOTIFY(TCN_SELCHANGE, IDC_TABCTRLBAR, OnTabSelChange)
ON_WM_WINDOWPOSCHANGED()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCJTabCtrlBar message handlers
// *** K.Stowell
void CCJTabCtrlBar::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
CWnd *pWnd;
if (IsFloating()) {
m_tabctrl.MoveWindow( 5, 5, lpwndpos->cx-10, lpwndpos->cy-7 );
for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
pWnd=m_views.GetAt(pos)->pWnd;
pWnd->MoveWindow(8, 8, lpwndpos->cx-16, lpwndpos->cy-34);
}
}
else if (IsHorzDocked()) {
m_tabctrl.MoveWindow( 17, 5, lpwndpos->cx-25, lpwndpos->cy-17 );
for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
pWnd=m_views.GetAt(pos)->pWnd;
pWnd->MoveWindow(20, 8, lpwndpos->cx-31, lpwndpos->cy-44);
}
}
else {
m_tabctrl.MoveWindow( 5, 20, lpwndpos->cx-17, lpwndpos->cy-31 );
for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
pWnd=m_views.GetAt(pos)->pWnd;
pWnd->MoveWindow(8, 23, lpwndpos->cx-23, lpwndpos->cy-58);
}
}
CCJControlBar::OnWindowPosChanged(lpwndpos);
}
// *** K.Stowell
CImageList* CCJTabCtrlBar::SetTabImageList(CImageList *pImageList)
{
return m_tabctrl.SetImage