#include <webattr.h>
Inheritance diagram for AttrWebAddress:
Public Member Functions | |
AttrWebAddress () | |
Default constructor. | |
AttrWebAddress (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
Constructs a Web Address Attribute at a specific place in the tree. | |
AttrWebAddress (WebAddress url, BOOL fBounding=FALSE, TCHAR *pcFrame=NULL) | |
Specific constructor for an AttrWebAddress. | |
AttrWebAddress (TCHAR *pcURL, BOOL fBounding=FALSE, TCHAR *pcFrame=NULL) | |
Specific constructor for an AttrWebAddress. | |
virtual AttrIndex | GetAttributeIndex () |
virtual INT32 | operator== (const NodeAttribute &NodeAttrib) |
A virtual comparison operator. | |
void | Render (RenderRegion *pRender) |
Set this attribute as current in the render region. | |
virtual BOOL | Blend (BlendAttrParam *pBlendParam) |
Blends one Web Address attribute with another. | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes this AttrWebAddress out to the filter. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
Writes this AttrWebAddress out to the filter. | |
Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
virtual UINT32 | GetAttrNameID (void) |
Returns back a string resource ID describing the attribute, this base class function returns the resource _R(IDS_ATTRIBUTE). | |
virtual UINT32 | GetNodeSize () const |
For finding the size of a node, in concrete classes derived from Node. | |
virtual AttributeValue * | GetAttributeValue () |
virtual CCRuntimeClass * | GetAttributeType () |
BOOL | ShouldBecomeCurrent () |
The attribute manager calls this function before making an attribute current. | |
DocRect | GetClickableRectangle () |
This function calls GetImagemapClickableRectangle() on this node's parent. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
void | GetDebugDetails (StringBase *Str) |
For obtaining debug information about the Node. | |
void | ShowDebugTreeDetails () const |
Public Attributes | |
WebAddressAttribute | Value |
Private Member Functions | |
BOOL | WriteString (CamelotFileRecord *pcfrRecord, TCHAR *pcWrite) |
Writes pcWrite out to the file. | |
void | CopyNodeContents (AttrWebAddress *NodeCopy) |
This method copies the node's contents to the node pointed to by NodeCopy. |
Definition at line 259 of file webattr.h.
|
Default constructor.
Definition at line 152 of file webattr.cpp. 00153 { 00154 Value=WebAddressAttribute(); 00155 }
|
|
Constructs a Web Address Attribute at a specific place in the tree.
Definition at line 179 of file webattr.cpp. 00185 : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected) 00186 { 00187 Value=WebAddressAttribute(); 00188 }
|
|
Specific constructor for an AttrWebAddress.
Definition at line 205 of file webattr.cpp. 00206 { 00207 //Construct our Value member variable using the WebAddressAttribute constructor 00208 Value=WebAddressAttribute(url, fBounding, pcFrame); 00209 }
|
|
Specific constructor for an AttrWebAddress.
Definition at line 226 of file webattr.cpp. 00227 { 00228 //Construct our Value member variable using the WebAddressAttribute constructor 00229 Value=WebAddressAttribute(pcURL, fBounding, pcFrame); 00230 }
|
|
Blends one Web Address attribute with another.
Reimplemented from NodeAttribute. Definition at line 328 of file webattr.cpp. 00329 { 00330 //Check our parameter 00331 ERROR2IF(pBlendParam == NULL, FALSE, "AttrWebAddress::Blend - NULL parameter"); 00332 00333 //Try and blend our WebAddressAttribute member variable 00334 if (Value.Blend(pBlendParam)) 00335 { 00336 // Get the blended attr val. After this call, the ptr is our reponsibility 00337 // so we have to delete it if it's no longer needed 00338 AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal(); 00339 00340 if (pBlendedAttrVal != NULL) 00341 { 00342 // We have a blended attr val, so ask it to make a NodeAttribute out of itself 00343 // and set the pBlendParam's blended NodeAttribute ptr to it 00344 NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode(); 00345 pBlendParam->SetBlendedAttr(pBlendedAttr); 00346 00347 if (pBlendedAttr != NULL) 00348 { 00349 // We were able to make a blended NodeAttribute 00350 // so delete the blended attr val, and return TRUE 00351 delete pBlendedAttrVal; 00352 return TRUE; 00353 } 00354 else 00355 { 00356 // Couldn't make a blended NodeAttribute, so give the blended attr val back 00357 // and return FALSE 00358 pBlendParam->SetBlendedAttrVal(pBlendedAttrVal); 00359 return FALSE; 00360 } 00361 } 00362 } 00363 00364 return FALSE; 00365 }
|
|
This method copies the node's contents to the node pointed to by NodeCopy.
Definition at line 537 of file webattr.cpp. 00538 { 00539 NodeAttribute::CopyNodeContents( NodeCopy ); 00540 00541 NodeCopy->Value=Value; 00542 }
|
|
Reimplemented from NodeAttribute. Definition at line 274 of file webattr.h. 00274 { return ATTR_WEBADDRESS; }
|
|
Reimplemented from NodeAttribute. Definition at line 308 of file webattr.h. 00309 { 00310 return CC_RUNTIME_CLASS(AttrWebAddress); 00311 }
|
|
Reimplemented from NodeAttribute. Definition at line 303 of file webattr.h. 00304 { 00305 return &Value; 00306 }
|
|
Returns back a string resource ID describing the attribute, this base class function returns the resource _R(IDS_ATTRIBUTE).
Reimplemented from NodeAttribute. Definition at line 293 of file webattr.h. 00294 { 00295 return (_R(IDS_WEBADDRESSATTRIBUTE_ID)); 00296 }
|
|
This function calls GetImagemapClickableRectangle() on this node's parent.
Otherwise, the rectangle returned will be the bounding box of the parent node.
Definition at line 597 of file webattr.cpp. 00598 { 00599 //Get our parent 00600 Node* pNode=FindParent(); 00601 00602 00603 //If it's not an object, return a NULL value 00604 if (pNode==NULL) 00605 return DocRect(0,0,0,0); 00606 00607 if (!pNode->IsAnObject()) 00608 return DocRect(0,0,0,0); 00609 00610 //Otherwise, return the bounding box of that object 00611 return (((NodeRenderableBounded*)pNode)->GetImagemapClickableRectangle()); 00612 00613 }
|
|
For obtaining debug information about the Node.
Reimplemented from NodeRenderable. Definition at line 669 of file webattr.cpp. 00670 { 00671 #ifdef _DEBUG 00672 NodeAttribute::GetDebugDetails( Str ); 00673 00674 (*Str) += _T("URL="); 00675 (*Str) += Value.m_url.GetWebAddress(); 00676 (*Str) += _T("\r\n"); 00677 00678 (*Str) += _T("Frame="); 00679 (*Str) += Value.m_pcFrame; 00680 (*Str) += _T("\r\n"); 00681 00682 if (Value.m_fBounding) 00683 (*Str) += _T("Clickable area is RECTANGLE\r\n"); 00684 else 00685 (*Str) += _T("Clickable area is OBJECT SHAPE\r\n"); 00686 00687 #endif 00688 }
|
|
For finding the size of a node, in concrete classes derived from Node.
Reimplemented from Node. Definition at line 298 of file webattr.h. 00299 { 00300 return sizeof(AttrWebAddress); 00301 }
|
|
A virtual comparison operator.
Reimplemented from NodeAttribute. Definition at line 263 of file webattr.cpp. 00264 { 00265 //If naCompare is not an AttrWebAddress, return FALSE 00266 if (!naCompare.IsKindOf(CC_RUNTIME_CLASS(AttrWebAddress))) 00267 return FALSE; 00268 00269 //Otherwise, cast naCompare into an AttrWebAddress pointer 00270 AttrWebAddress* pwaAttr = (AttrWebAddress*) &naCompare; 00271 00272 //And check whether the member variables are the same 00273 BOOL fAreDifferent=Value.IsDifferent((AttributeValue*) &(pwaAttr->Value)); 00274 00275 //And return accordingly 00276 return (!fAreDifferent); 00277 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeRenderable. Definition at line 558 of file webattr.cpp. 00559 { 00560 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00561 ENSURE(IS_A(pNodeCopy, AttrWebAddress), "PolyCopyNodeContents given wrong dest node type"); 00562 00563 if (IS_A(pNodeCopy, AttrWebAddress)) 00564 CopyNodeContents((AttrWebAddress*)pNodeCopy); 00565 }
|
|
Set this attribute as current in the render region.
Reimplemented from NodeAttribute. Definition at line 300 of file webattr.cpp. 00301 { 00302 //Check the render region pointer 00303 if (pRender==NULL) 00304 ERROR2RAW("AttrWebAddress::Render - pRender is NULL"); 00305 00306 //Set the clickable rectangle of our WebAddressAttribute 00307 Value.SetClickableRectangleInRendering(GetClickableRectangle()); 00308 00309 //Then set our WebAddressAttribute member variable into that render region 00310 pRender->SetWebAddress(&Value, FALSE); 00311 }
|
|
The attribute manager calls this function before making an attribute current.
There are some attributes - like this URL Hot Link attribute I'm about to put in - that the user probably won't want to become current. For example, if a user puts a HotLink on an object and happens to have the Give Other Objects Most Recent Attributes option on, all his new objects are going to have HotLinks. That's not good. So those attributes will override this function and return FALSE. Reimplemented from NodeAttribute. Definition at line 313 of file webattr.h. 00314 { 00315 return FALSE; 00316 }
|
|
|
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
Reimplemented from NodeAttribute. Definition at line 509 of file webattr.cpp. 00510 { 00511 AttrWebAddress* NodeCopy = new AttrWebAddress(); 00512 ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 00513 CopyNodeContents(NodeCopy); 00514 return NodeCopy; 00515 }
|
|
Writes this AttrWebAddress out to the filter. > virtual BOOL AttrWebAddress::WritePreChildrenNative(BaseCamelotFilter* pFilter)
Reimplemented from Node. Definition at line 482 of file webattr.cpp. 00483 { 00484 #ifdef DO_EXPORT 00485 return WritePreChildrenWeb(pFilter); 00486 #else 00487 return FALSE; 00488 #endif 00489 }
|
|
Writes this AttrWebAddress out to the filter. > virtual BOOL AttrWebAddress::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
Reimplemented from Node. Definition at line 381 of file webattr.cpp. 00382 { 00383 #ifdef DO_EXPORT 00384 //Check our incoming parameter 00385 ERROR2IF(pFilter == NULL,FALSE,"AttrWebAddress::WritePreChildrenWeb - NULL parameter"); 00386 00387 //Set up some variables. 00388 //This pointer points to the record we are currently writing 00389 CamelotFileRecord* pRecord=NULL; 00390 00391 // Add a description of the TAG_MOULD_BOUNDS record, for older importers that don't understand this record 00392 pFilter->AddTagDescription(TAG_WEBADDRESS,_R(IDS_TAG_WEBADDRESS)); 00393 00394 //And this lets us know whether there's been an error 00395 BOOL ok=TRUE; 00396 00397 //Now, is the clickable area of this attribute the bounding box? 00398 if (Value.m_fBounding) 00399 { 00400 //Yes it is. 00401 //So create a "bounding box" record 00402 pRecord=new CamelotFileRecord(pFilter,TAG_WEBADDRESS_BOUNDINGBOX,TAG_WEBADDRESS_SIZE); 00403 00404 //Check it's been created OK 00405 ok=(pRecord!=NULL); 00406 00407 //Initialise it 00408 if (ok) 00409 pRecord->Init(); 00410 00411 //We also want to write out the start of the record, which is the clickable 00412 //rectangle of this record 00413 00414 //So get the clickable rectangle 00415 DocRect rectBounding=GetClickableRectangle(); 00416 00417 //And write it out 00418 pRecord->WriteCoordInterleaved(rectBounding.lo); 00419 pRecord->WriteCoordInterleaved(rectBounding.hi); 00420 } 00421 else 00422 { 00423 //No, the clickable area of this attribute is the object shape 00424 //So create a normal Web Address record 00425 pRecord=new CamelotFileRecord(pFilter,TAG_WEBADDRESS,TAG_WEBADDRESS_SIZE); 00426 00427 //And check it's been created OK 00428 ok=(pRecord!=NULL); 00429 00430 //Initialise it 00431 if (ok) 00432 pRecord->Init(); 00433 } 00434 00435 //The rest of the data we need to write out is common to both types of record. 00436 //We need to write out the URL and Frame strings, in that order. 00437 00438 00439 //So write out the URL string 00440 String_256 strToWrite=Value.m_url.GetWebAddress(); 00441 00442 if (ok) 00443 ok=WriteString(pRecord, strToWrite); 00444 00445 //And the Frame string 00446 00447 //We do this using our toolkit function WriteString. This function 00448 //will write out a NULL character if the character pointer we pass it 00449 //is NULL 00450 if (ok) 00451 ok=WriteString(pRecord, Value.m_pcFrame); 00452 00453 //And write out our record 00454 if (ok) 00455 ok = pFilter->Write(pRecord); 00456 00457 //And delete it 00458 delete pRecord; 00459 00460 return ok; 00461 #else 00462 return FALSE; 00463 #endif 00464 }
|
|
Writes pcWrite out to the file.
Definition at line 632 of file webattr.cpp. 00633 { 00634 //Does pcWrite point to a string? 00635 if (pcWrite) 00636 { 00637 //Yes. So write out that string. 00638 return pcfrRecord->WriteUnicode(pcWrite); 00639 } 00640 else 00641 { 00642 //No. So write out a NULL character 00643 TCHAR cNull='\0'; 00644 00645 return pcfrRecord->WriteUnicode(&cNull); 00646 } 00647 }
|
|
|