74 lines
2.1 KiB
C++
74 lines
2.1 KiB
C++
//---------------------------------------------------------------------------
|
|
#include <vcl.h>
|
|
#pragma hdrstop
|
|
|
|
#include "ListViewText.h"
|
|
//---------------------------------------------------------------------------
|
|
#pragma package(smart_init)
|
|
//---------------------------------------------------------------------------
|
|
__fastcall TListViewText::TListViewText(TComponent* Owner)
|
|
: TListViewBase( Owner )
|
|
{
|
|
m_VcText = NULL;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
__fastcall TListViewText::~TListViewText()
|
|
{
|
|
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
int __fastcall TListViewText::DoCellHgt(TTableView *Sender, int iCellIndex)
|
|
{
|
|
return CELL_HEIGHT;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
int __fastcall TListViewText::DoMDNum(TTableView *Sender)
|
|
{
|
|
if( m_VcText ) {
|
|
int nSize = m_VcText->size();
|
|
return m_VcText->size();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
int __fastcall TListViewText::DoCellData(TStateBtn *sender)
|
|
{
|
|
sender->SetData((void *)((*m_VcText)[sender->Index]));
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TListViewText::DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas)
|
|
{
|
|
TStateBtn *pBtn = (TStateBtn *)sender;
|
|
char *strProg = (char *)pBtn->m_Data;
|
|
|
|
if( Bs_NORMAL==BsTmp ) {
|
|
pCanvas->Brush->Color = LP_ITEM_DEF;
|
|
}else if( Bs_ENTER==BsTmp ){
|
|
pCanvas->Brush->Color = LP_ITEM_OVER;
|
|
}else if( Bs_DOWN==BsTmp ){
|
|
pCanvas->Brush->Color = LP_ITEM_SELECTED;
|
|
}
|
|
|
|
if( BsTmp==Bs_NORMAL ||
|
|
BsTmp==Bs_ENTER ||
|
|
BsTmp==Bs_DOWN )
|
|
{
|
|
pCanvas->FillRect(rtTmp);
|
|
|
|
pCanvas->Brush->Style = bsClear;
|
|
pCanvas->Font->Color = FontClolor;
|
|
|
|
String strCaption = strProg;
|
|
TSize szFont = pCanvas->TextExtent(strCaption);
|
|
// pCanvas->Font->Size = 8;
|
|
pCanvas->TextOutW(rtTmp.Left+4,
|
|
rtTmp.Top+(rtTmp.Height()-szFont.Height)/2,
|
|
strCaption);
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
|