#include <userattr.h>
Inheritance diagram for UserAttribute:
Public Member Functions | |
UserAttribute () | |
UserAttribute & | operator= (const UserAttribute &other) |
Assignment operator for UserAttributes. | |
virtual void | Restore (RenderRegion *, BOOL) |
Again, restoring a User Attribute does nothing. | |
virtual void | Render (RenderRegion *, BOOL Temp=FALSE) |
Rendering a User Attribute does nothing. That's what this function does. | |
virtual NodeAttribute * | MakeNode () |
Make a AttrUser node from this line width attribute. | |
BOOL | IsDifferent (AttributeValue *pAttr) |
See base class version. | |
virtual void | SimpleCopy (AttributeValue *) |
Copies both bits of the data from pValue. | |
virtual BOOL | Blend (BlendAttrParam *pBlendParam) |
Blends this attr val with the attr val held in pBlendParam. | |
virtual BOOL | RenderStroke (RenderRegion *, Path *) |
Static Public Member Functions | |
static BOOL | Init () |
There's no need for this function at the moment but I'll leave it in in case someone needs it in the future. | |
Public Attributes | |
StringBase | Key |
StringBase | LongKey |
StringBase | Value |
const Style * | m_pStyle |
Definition at line 125 of file userattr.h.
|
FUNCTIONS FOR THE UserATTRIBUTE CLASS (Graham 18/8/96) Definition at line 147 of file userattr.cpp. 00148 : m_pStyle(0) 00149 { 00150 // To ensure default constructed UserAttributes can be copied, alloc the strings. 00151 if (!Key.Alloc(0) || !LongKey.Alloc(0) || !Value.Alloc(0)) return; 00152 }
|
|
Blends this attr val with the attr val held in pBlendParam.
Reimplemented from AttributeValue. Definition at line 344 of file userattr.cpp. 00345 { 00346 // Check entry param 00347 ERROR3IF(pBlendParam == NULL,"NULL entry param"); 00348 if (pBlendParam == NULL) return FALSE; 00349 00350 // Check that the pointer to the other User attr val is not NULL, and is a UserAttribute 00351 UserAttribute* pOtherUserAttr = (UserAttribute*) pBlendParam->GetOtherAttrVal(); 00352 ERROR3IF(pOtherUserAttr == NULL,"NULL other attr val"); 00353 ERROR3IF(!IS_A(pOtherUserAttr, UserAttribute),"other attr val not a user attr"); 00354 if (pOtherUserAttr == NULL || !IS_A(pOtherUserAttr, UserAttribute)) return FALSE; 00355 00356 //Graham: Here's the change. If the Keys of the attributes are not the same, we must 00357 //not blend these attributes. 00358 if (Key != pOtherUserAttr->Key && LongKey != pOtherUserAttr->LongKey) 00359 { 00360 return FALSE; 00361 } 00362 00363 // Get a new UserAttribute to hold the blended version, (return FALSE if this fails) 00364 UserAttribute* pBlendedUserAttr = new UserAttribute; 00365 if (pBlendedUserAttr == NULL) return FALSE; 00366 00367 //Graham: For blending two User Attributes with the same Key, we simply 00368 //use the first User Attribute for the first half of the blend, and the 00369 //second User Attribute for the second half of the blend. 00370 StringBase* pStr; 00371 if (pBlendParam->GetBlendRatio() < 0.5) 00372 pStr = &Value; 00373 else 00374 pStr = &(pOtherUserAttr->Value); 00375 00376 ERRORIF(!pBlendedUserAttr->Value.Alloc(pStr->Length()), _R(IDE_NOMORE_MEMORY), FALSE); 00377 pBlendedUserAttr->Value = *pStr; 00378 00379 // Store the ptr to the new blended User width attr val 00380 pBlendParam->SetBlendedAttrVal(pBlendedUserAttr); 00381 return TRUE; 00382 }
|
|
There's no need for this function at the moment but I'll leave it in in case someone needs it in the future.
Reimplemented from SimpleCCObject. Definition at line 202 of file userattr.cpp. 00203 { 00204 UserAttribute *pAttr = new UserAttribute; 00205 if (pAttr == NULL) 00206 return FALSE; 00207 00208 UINT32 ID = AttributeManager::RegisterDefaultAttribute(CC_RUNTIME_CLASS(NodeRenderableInk), 00209 pAttr); 00210 if (ID == ATTR_BAD_ID) 00211 return FALSE; 00212 ENSURE(ID == ATTR_USERATTRIBUTE, "Incorrect ID for attribute!"); 00213 return TRUE; 00214 }
|
|
See base class version.
Reimplemented from AttributeValue. Definition at line 315 of file userattr.cpp. 00316 { 00317 ENSURE_NOT_NULL(pAttr); 00318 00319 ENSURE(GetRuntimeClass() == pAttr->GetRuntimeClass(), 00320 "Different attribute types in AttributeValue::IsDifferent()"); 00321 00322 ENSURE_KIND(pAttr, UserAttribute); 00323 UserAttribute* const pUserAttrVal = (UserAttribute*)pAttr; 00324 00325 // LongKey should always start with Key 00326 return pUserAttrVal->LongKey != LongKey || pUserAttrVal->Value != Value; 00327 }
|
|
Make a AttrUser node from this line width attribute.
Reimplemented from AttributeValue. Definition at line 291 of file userattr.cpp. 00292 { 00293 // Create new attribute node 00294 AttrUser *pAttr = new AttrUser(); 00295 00296 // Copy attribute value into the new node. 00297 pAttr->Value.SimpleCopy(this); 00298 00299 // Return the new node 00300 return pAttr; 00301 }
|
|
Assignment operator for UserAttributes.
Definition at line 168 of file userattr.cpp. 00169 { 00170 if (Key.Alloc(other.Key.Length()) && 00171 LongKey.Alloc(other.LongKey.Length()) && 00172 Value.Alloc(other.Value.Length())) 00173 { 00174 Key = other.Key; 00175 LongKey = other.LongKey; 00176 Value = other.Value; 00177 } 00178 00179 return *this; 00180 }
|
|
Rendering a User Attribute does nothing. That's what this function does.
Implements AttributeValue. Definition at line 231 of file userattr.cpp.
|
|
Definition at line 144 of file userattr.h. 00144 { return FALSE; }
|
|
Again, restoring a User Attribute does nothing.
Implements AttributeValue. Definition at line 253 of file userattr.cpp.
|
|
Copies both bits of the data from pValue.
Implements AttributeValue. Definition at line 272 of file userattr.cpp. 00273 { 00274 *this = *((UserAttribute*) pValue); 00275 }
|
|
Definition at line 146 of file userattr.h. |
|
Definition at line 147 of file userattr.h. |
|
Definition at line 149 of file userattr.h. |
|
Definition at line 148 of file userattr.h. |