#include <sgtree.h>
Inheritance diagram for SGDisplayItem:
Public Member Functions | |
SGDisplayItem () | |
DisplayItem constructor. | |
virtual BOOL | HandleEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo) |
Handles a SuperGallery DisplayTree event. | |
virtual BOOL | DefaultPreDragHandler (SGMouseInfo *Mouse, SGMiscInfo *MiscInfo) |
Provides part 1 of the default selection model for clicks on gallery display items. Should be called by all derived gallery DisplayItems to handle clicks upon them, when multiple-selection support is desired. | |
virtual BOOL | DefaultClickHandler (SGMouseInfo *Mouse, SGMiscInfo *MiscInfo, BOOL AfterDrag=FALSE, BOOL AdjustDoubleClick=TRUE) |
Provides the default selection model for clicks on gallery display items. Should be called by all derived gallery DisplayItems to handle clicks upon them, when multiple-selection support is desired. | |
virtual void | RemoveFromTree (void) |
De-links this node/subtree from the DisplayTree. This DOES NOT DELETE the node, just unlinks it in preparation for being deleted. | |
virtual void | AddItem (SGDisplayNode *NodeToInsert, SGSortKey *SortInfo=NULL) |
OVERRIDES the DisplayNode action, and gives an ERROR3 - DisplayItems are only allowed to be leaf-nodes, and hence you cannot insert items as children of them. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (SGDisplayItem) |
This class should be used to derive new DisplayItem classes from for each of the SuperGalleries. For example, the Froodle SuperGallery might provide two types of SGDisplayItem: MonoOn FroodleSGDisplayItem (which holds a pointer to a Froodle in a document) LibFroodleSGDisplayItem (which holds the information on a Froodle in an open FroodleLibrary file) MonoOff
Definition at line 1509 of file sgtree.h.
|
DisplayItem constructor.
Definition at line 5434 of file sgtree.cpp.
|
|
OVERRIDES the DisplayNode action, and gives an ERROR3 - DisplayItems are only allowed to be leaf-nodes, and hence you cannot insert items as children of them.
Reimplemented from SGDisplayNode. Definition at line 5556 of file sgtree.cpp. 05557 { 05558 ERROR3("You can't SGDisplayItem::AddItem() - DisplayItems are supposed to be leaf nodes"); 05559 }
|
|
|
|
Provides the default selection model for clicks on gallery display items. Should be called by all derived gallery DisplayItems to handle clicks upon them, when multiple-selection support is desired.
Reimplemented from SGDisplayNode. Definition at line 5661 of file sgtree.cpp. 05663 { 05664 return(SGDisplayNode::DefaultClickHandler(Mouse, MiscInfo, AfterDrag, AdjustDoubleClick)); 05665 }
|
|
Provides part 1 of the default selection model for clicks on gallery display items. Should be called by all derived gallery DisplayItems to handle clicks upon them, when multiple-selection support is desired.
See the SGDisplayColour (kernel.cpp) for an example of use Notes: The code for this has now been moved into the SGDisplayNode base class since group selection is now also required.
Reimplemented from SGDisplayNode. Definition at line 5621 of file sgtree.cpp. 05622 { 05623 return(SGDisplayNode::DefaultPreDragHandler(Mouse, MiscInfo)); 05624 }
|
|
Handles a SuperGallery DisplayTree event.
A node need not handle a specific event - if it does not handle it, it should return FALSE. Redraw and Formatting handlers should never return TRUE, as this will prevent the event from continuing through the tree. ClaimPoint handlers should always return FALSE, unless they contain the given point, in which case they should return TRUE. Non-leaf-nodes must call SGDisplayNode::GiveEventToMyChildren in order to pass the event dow the tree. THIS node is a leaf-node, so it doesn't. Derived DisplayItem classes should call this base class method if they wish to handle CLAIMPOINT broadcasts to provide drag-target detection.
Reimplemented from SGDisplayNode. Reimplemented in SGNameItem, SGDisplayDATATYPE, SGDisplayKernelBitmap, SGDisplayColour, SGDisplayLibColour, SGDisplayFrame, SGDisplayLayer, SGClipartItem, SGFillsItem, SGLibDisplayItem, LineAttrItem, SGNameItem, SGDisplayPreviewFonts, and SGLibFontItem. Definition at line 5479 of file sgtree.cpp. 05481 { 05482 switch(EventType) 05483 { 05484 case SGEVENT_CLAIMPOINT: 05485 { 05486 SGClaimPointInfo *PointInfo = GetClaimPointInfo(EventType, EventInfo); 05487 05488 // If the point hit us, we must claim the event so that the caller 05489 // knows which tree item contains the point. 05490 if (FormatRect.ContainsCoord(PointInfo->Position)) 05491 { 05492 PointInfo->ClosestSoFar = 0; 05493 PointInfo->Claimant = this; // Let 'em know it was me! 05494 return(TRUE); 05495 } 05496 05497 // OK, we don't OWN the point, but are we closer to it than anyone else 05498 // checked so far? If so, we update ClosestSoFar and Claimant, but we 05499 // do not claim the event (so others can check if they are closer) 05500 05501 // Find the distance to the 2 closest edges of the rectangle. Then 05502 // the approx. distance to the rectangle is the larger of the two. 05503 INT32 XDist = 0; 05504 if (FormatRect.lo.x > PointInfo->Position.x) 05505 XDist = FormatRect.lo.x - PointInfo->Position.x; 05506 else if (FormatRect.hi.x < PointInfo->Position.x) 05507 XDist = PointInfo->Position.x - FormatRect.lo.x; 05508 05509 INT32 YDist = 0; 05510 if (FormatRect.lo.y > PointInfo->Position.y) 05511 YDist = FormatRect.lo.y - PointInfo->Position.y; 05512 else if (FormatRect.hi.y < PointInfo->Position.y) 05513 YDist = PointInfo->Position.y - FormatRect.lo.y; 05514 05515 XDist = max(XDist, YDist); // XDist is now approx the dist to the point 05516 05517 if (XDist < PointInfo->ClosestSoFar) 05518 { 05519 PointInfo->Claimant = this; 05520 PointInfo->ClosestSoFar = XDist; 05521 // drop through to pass the event on... 05522 } 05523 } 05524 break; 05525 05526 05527 default: 05528 return(SGDisplayNode::HandleEvent(EventType, EventInfo, MiscInfo)); 05529 } 05530 05531 return(FALSE); 05532 }
|
|
De-links this node/subtree from the DisplayTree. This DOES NOT DELETE the node, just unlinks it in preparation for being deleted.
Reimplemented from SGDisplayNode. Definition at line 5582 of file sgtree.cpp. 05583 { 05584 // SetSelected(FALSE); 05585 SGDisplayNode::RemoveFromTree(); 05586 }
|