?? gridtreebtncell.cpp
字號:
/*****************************************************************************
COPYRIGHT (C) 2000, Ken Bertelson <kenbertelson@hotmail.com>
*****************************************************************************/
#include "stdafx.h"
#include "..\Include\GridTreeBtnCell.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNCREATE(CGridTreeBtnCell, CGridTreeCell)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGridTreeBtnCell::CGridTreeBtnCell()
: CGridTreeCell()
{
}
CGridTreeBtnCell::~CGridTreeBtnCell()
{
}
void CGridTreeBtnCell::Reset()
{
CGridTreeCell::Reset();
m_GridBtnCell.Reset();
}
BOOL CGridTreeBtnCell::Draw(CDC* pDC, int nRow, int nCol, CRect rect,
BOOL bEraseBkgnd /*=TRUE*/)
{
CRect RectCell( rect);
if( CGridTreeCell::DrawTreeCell( pDC, nRow, nCol, &RectCell, bEraseBkgnd) )
{
if( m_GridBtnCell.DrawBtnCell( pDC, nRow, nCol, &RectCell, bEraseBkgnd) )
{
// call button class to finish it off
return CGridCellBase::Draw( pDC, nRow, nCol, RectCell, bEraseBkgnd);
}
}
return FALSE;
}
BOOL CGridTreeBtnCell::GetTextRect( LPRECT pRect) // i/o: i=dims of cell rect; o=dims of text rect
{
// move text over to allow for level indentation
pRect->left += GetTreeIndent();
return m_GridBtnCell.GetTextRect( pRect);
}
CSize CGridTreeBtnCell::GetCellExtent(CDC* pDC)
{
CSize sizeBase = m_GridBtnCell.GetCellExtent(pDC);
// move text over to allow for level indentation
sizeBase.cx += GetTreeIndent();
return sizeBase;
}
BOOL CGridTreeBtnCell::Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar)
{
point.x -= GetTreeIndent(); // adjust point clicked to account for tree
return m_GridBtnCell.Edit( nRow, nCol, rect, point, nID, nChar);
}
void CGridTreeBtnCell::EndEdit()
{
m_GridBtnCell.EndEdit();
}
void CGridTreeBtnCell::OnEndEdit()
{
m_GridBtnCell.OnEndEdit();
}
void CGridTreeBtnCell::OnClick( CPoint PointCellRelative)
{
PointCellRelative.x -= GetTreeIndent(); // adjust point clicked to account for tree
m_GridBtnCell.OnClick( PointCellRelative);
}
void CGridTreeBtnCell::OnClickDown( CPoint PointCellRelative)
{
ASSERT( m_pTreeColumn != NULL);
if( TreeHitPlusMinus( PointCellRelative) ) // relative coordinates of mouse click
{
// returns: T=hit a plus or minus; F=Missed it or tree cell has no plus or minus
m_pTreeColumn->TreeExpandCollapseToggle( m_iRow); // Grid row of node to toggle
return;
}
PointCellRelative.x -= GetTreeIndent(); // adjust point clicked to account for tree
m_GridBtnCell.OnClickDown( PointCellRelative);
}
void CGridTreeBtnCell::OnRClick( CPoint PointCellRelative)
{
PointCellRelative.x -= GetTreeIndent(); // adjust point clicked to account for tree
m_GridBtnCell.OnRClick( PointCellRelative);
}
void CGridTreeBtnCell::OnDblClick( CPoint PointCellRelative)
{
ASSERT( m_pTreeColumn != NULL);
if( GetState() & GVIS_READONLY
|| !m_pTreeColumn->GetGrid()->IsEditable() )
{
if( !TreeHitPlusMinus( PointCellRelative) ) // relative coordinates of mouse click
{
// returns: T=hit a plus or minus; F=Missed it or tree cell has no plus or minus
m_pTreeColumn->TreeExpandCollapseToggle( m_iRow); // Grid row of node to toggle
return;
}
}
PointCellRelative.x -= GetTreeIndent(); // adjust point clicked to account for tree
m_GridBtnCell.OnDblClick( PointCellRelative);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -