#include <ngitem.h>
Inheritance diagram for SGUsedColourItem:
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 |
IndexedColour * | m_picSample |
Definition at line 327 of file ngitem.h.
|
Definition at line 331 of file ngitem.h. 00332 : SGNameItem(strName), m_picSample(0) 00333 { /* empty */ }
|
|
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 }
|
|
Renders the colour icon for this display item.
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 }
|
|
Definition at line 336 of file ngitem.h. 00337 { m_picSample = pCol; }
|
|
|
|
|