#include <sgstroke.h>
Inheritance diagram for StrokeTypeItem:
Public Member Functions | |
StrokeTypeItem (StrokeTypeAttrValue *pStroke, const String &strDescription) | |
Constructs a user-interface item representing a stroke type. | |
~StrokeTypeItem () | |
Destructor. | |
virtual StrokeTypeAttrValue * | GetStrokeTypeAttrValue () |
virtual StrokeDefinition * | GetStrokeDefinition () |
Get the StrokeDefinition for this item. | |
virtual StrokeHandle | GetStrokeHandle () |
Get the StrokeHandle for this item. | |
virtual BOOL | IsRepeating () |
Determins if the stroke repeats. | |
virtual INT32 | NumRepeats () |
See Returns. | |
virtual BOOL | OverridesFill () |
Determins if the stroke overrides the fill or not. | |
virtual BOOL | OverridesTrans () |
Determins if the stroke overrides transparency or not. | |
virtual void | RenderItem (RenderRegion *pRender, DocRect *pDocRect, INT32 Width=c_nDefaultLineWidth) |
Renders a representation of the stroke into the given renderregion. This is used by the line properties dialog since all the stuff needed seems to be private... | |
virtual void | UpdateGalleryItem () |
Updates the gallery item's cached data to represent any changes this Stoke might have had done to it. Also redraw the gallery if necessary. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (StrokeTypeItem) | |
virtual void | SetAttributes (RenderRegion *pRegion) const |
Sets the stroke typeattributes in the given render-region to render this item correctly. | |
virtual NodeAttribute * | CreateNewAttribute (BOOL fIsAdjust) const |
Create a NodeAttribute representing the attribute this item applies. | |
virtual MILLIPOINT | GetWidth () const |
Called by the line gallery formatting code. | |
virtual CCRuntimeClass ** | GetAttribRuntimeClasses () const |
Used when searching for display items representing the selection's current attributes. | |
virtual BOOL | IsEqualValueToAny (NodeAttribute **ppOtherAttribs) const |
Used when searching for display items representing the selection's current attributes. | |
virtual MILLIPOINT | GetHorzGap () const |
Called by the formatting code to determine the gap between items of this type. | |
Private Attributes | |
StrokeTypeAttrValue * | pStrokeDef |
Definition at line 121 of file sgstroke.h.
|
Constructs a user-interface item representing a stroke type.
Definition at line 143 of file sgstroke.cpp. 00144 : LineAttrItem(strDescription, BELOW) 00145 { 00146 ERROR3IF(pStroke == NULL, "Illegal NULL param"); 00147 pStrokeDef = pStroke; 00148 }
|
|
Destructor.
Definition at line 163 of file sgstroke.cpp. 00164 { 00165 if (pStrokeDef != NULL) 00166 delete pStrokeDef; 00167 }
|
|
|
|
Create a NodeAttribute representing the attribute this item applies.
Implements LineAttrItem. Definition at line 211 of file sgstroke.cpp. 00212 { 00213 return(pStrokeDef->MakeNode()); 00214 }
|
|
Used when searching for display items representing the selection's current attributes.
Implements LineAttrItem. Definition at line 253 of file sgstroke.cpp. 00254 { 00255 static CCRuntimeClass* aprtc[] = 00256 { 00257 CC_RUNTIME_CLASS(AttrStrokeType), 00258 NULL 00259 }; 00260 00261 return aprtc; 00262 }
|
|
Called by the formatting code to determine the gap between items of this type.
Reimplemented from LineAttrItem. Definition at line 314 of file sgstroke.cpp. 00315 { 00316 // I would like the gap to be the same all the way around 00317 return(GetVertGap()); 00318 }
|
|
Get the StrokeDefinition for this item.
Definition at line 430 of file sgstroke.cpp. 00431 { 00432 StrokeHandle Handle = GetStrokeHandle(); 00433 if(Handle != StrokeHandle(-1)) 00434 return StrokeComponent::FindStroke(Handle); 00435 00436 return NULL; 00437 }
|
|
Get the StrokeHandle for this item.
Definition at line 451 of file sgstroke.cpp. 00452 { 00453 StrokeTypeAttrValue *pAttrValue = GetStrokeTypeAttrValue(); 00454 if(pAttrValue != NULL) 00455 { 00456 PathProcessorStroke *pProcessor = pAttrValue->GetPathProcessor(); 00457 if (pProcessor != NULL && pProcessor->IsKindOf(CC_RUNTIME_CLASS(PathProcessorStrokeVector))) 00458 { 00459 StrokeHandle Handle = ((PathProcessorStrokeVector *)pProcessor)->GetStrokeDefinition(); 00460 return Handle; 00461 } 00462 } 00463 00464 return StrokeHandle_NoStroke; 00465 }
|
|
Definition at line 132 of file sgstroke.h. 00132 {return pStrokeDef;}
|
|
Called by the line gallery formatting code.
Reimplemented from LineAttrItem. Definition at line 231 of file sgstroke.cpp. 00232 { 00233 return 2 * LineAttrItem::GetWidth() / 3; 00234 }
|
|
Used when searching for display items representing the selection's current attributes.
Implements LineAttrItem. Definition at line 281 of file sgstroke.cpp. 00282 { 00283 if (*ppOtherAttribs == NULL) // When multiple attribs are selected, this will be NULL 00284 return(FALSE); 00285 00286 AttrStrokeType* pAttr = (AttrStrokeType *) *ppOtherAttribs; 00287 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeType)), 00288 "StrokeTypeItem::IsEqualValueToAny - unexpected object type"); 00289 00290 if (pAttr != NULL) 00291 { 00292 StrokeTypeAttrValue *pOther = (StrokeTypeAttrValue *) pAttr->GetAttributeValue(); 00293 return((*pStrokeDef) == (*pOther)); 00294 } 00295 00296 return(FALSE); 00297 }
|
|
Determins if the stroke repeats.
Definition at line 333 of file sgstroke.cpp. 00334 { 00335 BOOL Repeating = FALSE; 00336 StrokeDefinition *pStroke = GetStrokeDefinition(); 00337 if (pStroke != NULL) 00338 { 00339 Repeating = pStroke->IsRepeating(); 00340 } 00341 00342 return Repeating; 00343 }
|
|
See Returns.
Definition at line 358 of file sgstroke.cpp. 00359 { 00360 INT32 Repeats = 0; 00361 StrokeDefinition *pStroke = GetStrokeDefinition(); 00362 if (pStroke != NULL) 00363 { 00364 Repeats = pStroke->NumRepeats(); 00365 } 00366 00367 return Repeats; 00368 }
|
|
Determins if the stroke overrides the fill or not.
Definition at line 382 of file sgstroke.cpp. 00383 { 00384 BOOL OverridesFill = FALSE; 00385 StrokeDefinition *pStroke = GetStrokeDefinition(); 00386 if (pStroke != NULL) 00387 { 00388 OverridesFill = pStroke->OverrideFill(); 00389 } 00390 00391 return OverridesFill; 00392 }
|
|
Determins if the stroke overrides transparency or not.
Definition at line 406 of file sgstroke.cpp. 00407 { 00408 BOOL OverridesTrans = FALSE; 00409 StrokeDefinition *pStroke = GetStrokeDefinition(); 00410 if (pStroke != NULL) 00411 { 00412 OverridesTrans = pStroke->OverrideTrans(); 00413 } 00414 00415 return OverridesTrans; 00416 }
|
|
Renders a representation of the stroke into the given renderregion. This is used by the line properties dialog since all the stuff needed seems to be private...
Definition at line 484 of file sgstroke.cpp. 00485 { 00486 if(pRender == NULL || pDocRect == NULL) 00487 { 00488 ERROR3("StrokeTypeItem::RenderItem given null params"); 00489 return; 00490 } 00491 00492 pRender->SaveContext(); 00493 00494 // Make sure we're anti-aliasing 00495 Quality AntiAliasQuality(Quality::QualityMax); 00496 QualityAttribute AntiAliasQualityAttr(AntiAliasQuality); 00497 pRender->SetQuality(&AntiAliasQualityAttr,FALSE); 00498 00499 // Render the background rectangle 00500 DialogColourInfo RedrawColours; 00501 pRender->SetLineColour(RedrawColours.DialogBack()); 00502 pRender->SetFillColour(RedrawColours.DialogBack()); 00503 pRender->DrawRect(pDocRect); 00504 00505 // Draw the Saturation vs. Value square 00506 Path SquarePath; 00507 LinearFillAttribute ValueGradFill; 00508 LinearTranspFillAttribute TransFill; 00509 00510 ValueGradFill.Colour = DocColour(255L, 0L, 0L); 00511 ValueGradFill.EndColour = DocColour(255L, 255L, 255L); 00512 00513 DocCoord ThePoint(pDocRect->lo.x, pDocRect->hi.y); 00514 ValueGradFill.SetStartPoint(&ThePoint); 00515 ThePoint = DocCoord(pDocRect->hi.x, pDocRect->hi.y); 00516 ValueGradFill.SetEndPoint(&ThePoint); 00517 ValueGradFill.SetEndPoint2(NULL); 00518 00519 pRender->SetFillGeometry(&ValueGradFill, FALSE); // Set Grad-filled 00520 00521 //pRender->DrawRect(pDocRect); 00522 00523 /* SquarePath.Initialise(12, 12); 00524 SquarePath.FindStartOfPath(); 00525 00526 SquarePath.InsertMoveTo(ValSatSquare.lo); 00527 SquarePath.InsertLineTo(DocCoord(ValSatSquare.hi.x, ValSatSquare.lo.y)); 00528 SquarePath.InsertLineTo(ValSatSquare.hi); 00529 SquarePath.InsertLineTo(DocCoord(ValSatSquare.lo.x, ValSatSquare.hi.y)); 00530 SquarePath.IsFilled = TRUE; 00531 00532 pRender->DrawPath(&SquarePath); // Render the value square 00533 00534 // Render a white linear-grad-transparency square over the top to get the 00535 // effect of the Saturation gradient 00536 pRender->SetFillColour(DocColour(0L, 0L, 0L)); 00537 00538 // Set transparency to circular 0% at center, 100% at radius, && plot it 00539 TransFill.SetStartPoint(&ValSatSquare.hi); 00540 ThePoint = DocCoord(ValSatSquare.hi.x, ValSatSquare.lo.y); 00541 TransFill.SetEndPoint(&ThePoint); 00542 TransFill.SetEndPoint2(NULL); 00543 TransFill.Transp = 255; 00544 TransFill.EndTransp = 0; 00545 TransFill.TranspType = 2; // 'Stained glass' transparency 00546 00547 pRender->SetTranspFillGeometry(&TransFill, FALSE); 00548 */ 00549 00550 00551 pRender->SetLineColour(RedrawColours.TextFore()); 00552 00553 SetAttributes(pRender); 00554 pRender->SetLineWidth((INT32)((double)Width * 0.8)); 00555 DrawItem(pRender, *pDocRect); 00556 00557 pRender->RestoreContext(); 00558 }
|
|
Sets the stroke typeattributes in the given render-region to render this item correctly.
Implements LineAttrItem. Definition at line 185 of file sgstroke.cpp. 00186 { 00187 // Set a 16pt line width - nice & thick 00188 pRegion->SetLineWidth(16000); 00189 00190 // Set the line width (this overrides the "default" line width set by the caller). 00191 pStrokeDef->Render(pRegion, FALSE); 00192 }
|
|
Updates the gallery item's cached data to represent any changes this Stoke might have had done to it. Also redraw the gallery if necessary.
Definition at line 574 of file sgstroke.cpp. 00575 { 00576 StrokeDefinition *pStroke = GetStrokeDefinition(); 00577 if(pStroke != NULL) 00578 { 00579 SetDescription(pStroke->GetStrokeName()); 00580 } 00581 00582 ForceRedrawOfMyself(); 00583 }
|
|
Definition at line 152 of file sgstroke.h. |