Accounting Software
Small Business Software Estimating Software
Time Tracking SoftwareTime Management SoftwareTime Billing SoftwareContact Management SoftwareCustomer Management SoftwareProject Management SoftwareBusiness Management Software

Table Column Captions (Source Code)

Link to: header | tables directory

Copyright Turtle Creek Software 1996-2006. All Rights Reserved.

Comments

CTableColumnCaption

This class manages table column captions for the Goldenseal estimating software,
small business management software, construction project management software and
construction estimating software.

It's the caption on a table column title

SUPERCLASS = CTCS_Caption

Constructor

/*********************************************************************************
CTableColumnCaption constructor from stream
*********************************************************************************/
CTableColumnCaption::CTableColumnCaption(LStream *inStream)
: CTCS_Caption(inStream)
{
mTableRef = nil;
}
/*********************************************************************************
CTableColumnCaption default constructor
*********************************************************************************/
CTableColumnCaption::CTableColumnCaption(const SPaneInfo &paneInfo,
const CTCS_TextInfo &textInfo,
const CTextString &text)
: CTCS_Caption(paneInfo, textInfo, text)
{
mTableRef = nil;
}

Source Code

/*********************************************************************************

DrawSelf

draw the table column caption. This draws a gray panel background
and then draws the caption text
*********************************************************************************/
void CTableColumnCaption::DrawSelf()
{
if (mFrameSize.width)
{
// get the local frame and clip to it
TCS_Rect frameR;
CalcLocalFrameRect(frameR);
TStClipRgnState clipSaver;
clipSaver.ClipToIntersection(frameR);

TStColorPenState penState; // TCS moved 2/20/04
penState.Normalize();

Boolean isEnabled = true; // rev TCS 1/24/01

if (mTableRef)
isEnabled = mTableRef->IsEnabled() && mTableRef->TableCanBeChanged();

// draw the gray panel background
if (isEnabled)
{
CGrayPanelAttachment::DrawGrayPanel(frameR);
}
else
{
TCS_SetRGBForeColor(&gAGARamp[r1]); // rev TCS 1/24/01
TCS_InsetRect(&frameR, 1, 1);
TCS_PaintRect(&frameR);
TCS_InsetRect(&frameR, -1, -1);
}

// save the pen state and set up the port text info
CTCS_TextInfo::SetPortTextInfo(mTextInfo);

if (!isEnabled)
TCS_SetRGBForeColor(&gAGARamp[r11]);

// get the size of our string under these conditions
CStringGraphic strGraphic(mText);
SInt32 strWidth = strGraphic.GetWidth(); // rev TCS 9/17/02
SInt32 strHeight = strGraphic.GetHeight();

// position the string at the centre of the rectangle
// and draw it there
TCS_MoveTo((frameR.right + frameR.left - strWidth)/2, frameR.top + strHeight);
strGraphic.Draw();
}
else
{ // if column width is zero, don't draw the caption(TCS 11/11/98)
}
}
/*********************************************************************************

PrintPanelSelf TCS 10/18/00

print the table column caption. We override the draw method, since we do NOT want
a gray panel

*********************************************************************************/
void CTableColumnCaption::PrintPanelSelf(const PanelSpec &/*inPanel*/)
{
if (mFrameSize.width)
{
// get the local frame and clip to it
TCS_Rect frameR;
CalcLocalFrameRect(frameR);
TStClipRgnState clipSaver;
clipSaver.ClipToIntersection(frameR);

// save the pen state and set up the port text info
TStColorPenState penState;
penState.Normalize();
CTCS_TextInfo::SetPortTextInfo(mTextInfo);

// get the size of our string under these conditions
CStringGraphic strGraphic(mText);
SInt32 strWidth = strGraphic.GetWidth(); // rev TCS 9/17/02
SInt32 strHeight = strGraphic.GetHeight();

// position the string at the centre of the rectangle
// and draw it there
TCS_MoveTo((frameR.right + frameR.left - strWidth)/2, frameR.top + strHeight);
strGraphic.Draw();
}
else
{ // if column width is zero, don't draw the caption(TCS 11/11/98)
}
}
/*********************************************************************************

SetTable TCS 1/24/01

set the table used by this title bar

*********************************************************************************/
void CTableColumnCaption::SetTable(CTCS_Table *aTable)
{
mTableRef = aTable;
}