SGUsedColourItem Class Reference

#include <ngitem.h>

Inheritance diagram for SGUsedColourItem:

SGNameItem SGDisplayItem SGDisplayItem SGDisplayNode SGDisplayNode CCObject CCObject SimpleCCObject SimpleCCObject List of all members.

Public Member Functions

 SGUsedColourItem (const StringBase &strName)
void SetPatchColour (IndexedColour *pCol)

Protected Member Functions

virtual void CalcUiBounds (SGFormatInfo *, SGMiscInfo *)
virtual void DrawLabel (SGRedrawInfo *, SGMiscInfo *)
 Renders the colour icon for this display item.

Protected Attributes

DocRect m_rPatch
IndexedColourm_picSample

Detailed Description

Definition at line 327 of file ngitem.h.


Constructor & Destructor Documentation

SGUsedColourItem::SGUsedColourItem const StringBase strName  )  [inline]
 

Definition at line 331 of file ngitem.h.

00332       : SGNameItem(strName), m_picSample(0)
00333             { /* empty */ }


Member Function Documentation

void SGUsedColourItem::CalcUiBounds SGFormatInfo pFormatInfo,
SGMiscInfo pMiscInfo
[protected, virtual]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/6/99
Parameters:
(see SGNameGroup::CalcUiBounds) [INPUTS]
Returns:
The width of a colour icon plus a little gap.
See also:
SGNameGroup::RegisterMember; SGUsedColours::IsMember; CreateDisplayScan::CreateItems::Do

Reimplemented from SGNameItem.

Definition at line 1348 of file ngitem.cpp.

01349 {
01350     SGNameItem::CalcUiBounds(pFormatInfo, pMiscInfo);
01351 
01352     // Work out the new maximum bounds of the patch and the text.
01353     m_rPatch = m_rText;
01354     MILLIPOINT w = m_rPatch.Width(), h = m_rPatch.Height();
01355     m_rPatch.hi.x = m_rPatch.lo.x + (h <= w ? h : w);
01356     m_rText.lo.x = m_rPatch.hi.x + SG_GapBeforeText / 2;
01357 
01358     // Deflate the patch a little and pixel-align.
01359     m_rPatch.Inflate(4 * -pMiscInfo->PixelSize, 4 * -pMiscInfo->PixelSize);
01360     m_rPatch.Translate(-4, 0);
01361     GridLockRect(pMiscInfo, &m_rPatch);
01362     GridLockRect(pMiscInfo, &m_rText);
01363 }

void SGUsedColourItem::DrawLabel SGRedrawInfo pRedrawInfo,
SGMiscInfo pMiscInfo
[protected, virtual]
 

Renders the colour icon for this display item.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/6/99
Parameters:
(see SGNameItem::HandleRedraw) [INPUTS]
See also:
SGNameItem::DrawLabel

Reimplemented from SGNameItem.

Definition at line 1377 of file ngitem.cpp.

01378 {
01379     SGNameItem::DrawLabel(pRedrawInfo, pMiscInfo);
01380 
01381     // Save the context, or we disturb the colour system.  Set the outline.
01382     pRedrawInfo->Renderer->SaveContext();
01383     pRedrawInfo->Renderer->SetLineWidth(0);
01384     pRedrawInfo->Renderer->SetLineColour(COLOUR_BLACK);
01385 
01386     // Make a short-lived reference to the indexed colour.
01387     DocColour dcFill;
01388     ERROR3IF(m_picSample == 0, "SGUsedColourItem::DrawLabel: no indexed colour");
01389     dcFill.MakeRefToIndexedColour(m_picSample);
01390     pRedrawInfo->Renderer->SetFillColour(dcFill);
01391 
01392     // Render a circle for a spot colour, rectangle for others.
01393     extern void DrawCircle(RenderRegion*, DocRect&);
01394     if (m_picSample->IsSpotOrTintOfSpot())
01395         DrawCircle(pRedrawInfo->Renderer, m_rPatch);
01396     else
01397         pRedrawInfo->Renderer->DrawRect(&m_rPatch);
01398 
01399     // Restore context as per SGDisplayColour::HandleRedraw.
01400     pRedrawInfo->Renderer->RestoreContext();
01401 }

void SGUsedColourItem::SetPatchColour IndexedColour pCol  )  [inline]
 

Definition at line 336 of file ngitem.h.

00337             { m_picSample = pCol; }


Member Data Documentation

IndexedColour* SGUsedColourItem::m_picSample [protected]
 

Definition at line 345 of file ngitem.h.

DocRect SGUsedColourItem::m_rPatch [protected]
 

Definition at line 344 of file ngitem.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:01:13 2007 for Camelot by  doxygen 1.4.4