SGDisplayRoot Class Reference

This DisplayTree node type is used by the SuperGallery The top (root) level of the DisplayTree is made up of a single SGDisplayRoot node. This node is used as a single entry-point for all tree-wide actions which the SuperGallery applies to it (redraw, reformatting, etc). More...

#include <sgtree.h>

Inheritance diagram for SGDisplayRoot:

SGDisplayNode CCObject SimpleCCObject SGDisplayRootScroll List of all members.

Public Member Functions

 SGDisplayRoot (SuperGallery *ParentGal)
 SGDisplayRoot constructor (makes root nodes invisible by default).
virtual SGDisplayNodeGetChild (void) const
 Finds the child of this DisplayTree Node. Returns NULL if you have reached the boundary of the tree.
virtual SuperGalleryGetParentGallery (void) const
 Returns the SuperGallery which 'owns' this node (and its subtree).
virtual void InsertAfter (SGDisplayNode *NodeToInsert)
 OVERRIDES SGDisplayNode::InsertAfter.
virtual void InsertBefore (SGDisplayNode *NodeToInsert)
 OVERRIDES SGDisplayNode::InsertBefore.
virtual void RemoveFromTree (void)
 OVERRIDES SGDisplayNode::RemoveFromTree The root node cannot be removed from the tree - it returns quietly, taking no action (this allows the generic treatment of DestroyTree to work without having to take special action for delinking the root node).
virtual void DestroySubtree (BOOL IncludingThisNode=TRUE)
 DESTROYS the subtree starting at this root node. This does a depth-first recursive scan of the subtree, delinking each item, and then CALLING EACH ITEMS DESTRUCTOR.
virtual void InitFormatInfo (SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo)
 Resets the formatting info structure to default values for the start of a formatting pass. Must be called before SGDisplayRoot::Redraw.
virtual BOOL HandleEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo)
 Handles a SuperGallery DisplayTree event.
virtual INT32 CalculateListExtent (SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo)
 Causes the entire subtree from this node to format themselves, and returns the 'height' of the entire list display, in millipoints.
virtual INT32 GetCachedListExtent (void)
 Returns the 'height' of the entire list display, in millipoints. This return value is only valid after the tree has been formatted (including a previous call to CalculateListExtent), so long as the cached tree format is still valid. Use with care.
virtual void SetScrollOffset (INT32 NewOffset, SGMiscInfo *MiscInfo)
 Changes the scroll offset, and if necessary, redraws the scroll bar.
virtual INT32 GetScrollOffset (void)
virtual void RedrawScrollBar (SGMiscInfo *MiscInfo)
 Causes the scroll bar, if any, to be redrawn. In the base class, this method does nothing.
virtual SGDisplayItemFindNextSelectedItem (SGDisplayNode *CurrentItem=NULL, BOOL *SkipGroup=NULL)
 Scanning the selection within a Display Tree - this will scan over multiple documents/libraries without blinking an eyelid.
virtual INT32 GetSelectedItemCount (void)
 To determine how many eaf items of this tree are selected.
virtual SGDisplayGroupFindNextSelectedGroup (SGDisplayNode *CurrentGroup=NULL)
 Scanning the group-selection within a Display Tree.
virtual INT32 GetSelectedGroupCount (void)
 To determine how many eaf Groups of this tree are selected.
virtual void SelectRange (SGDisplayNode *PrimeNode, SGDisplayNode *AnchorNode)
 Selects the PrimeNode, and if possible, all sibling nodes between it and the Anchor node. If Anchor == NULL or is not found, only PrimeNode is selected. Does not deselect any nodes - you should call SelectItems first to clear the seln.

Static Public Member Functions

static SGDisplayNodeFindNextItemInTree (SGDisplayNode *StartItem)
 Given an item in the tree, find the next one.

Protected Member Functions

 SGDisplayRoot ()
 Dumps TRACE output to the debugger showing the layout of the tree THIS FUNCTION IS ONLY PRESENT IN DEBUG BUILDS (ifdef _DEBUG) It will also only produce debug output if your UserName is "Jason"SGDisplayRoot constructor (makes root nodes invisible by default).
virtual void SetChild (SGDisplayNode *NewChild)
 Sets the child of this DisplayTree Node. Overrides to base class method to allow the child to be set.

Protected Attributes

SGDisplayNodeChild
SuperGalleryParentGallery
INT32 ScrollExtent

Private Member Functions

 CC_DECLARE_DYNAMIC (SGDisplayRoot)

Detailed Description

This DisplayTree node type is used by the SuperGallery The top (root) level of the DisplayTree is made up of a single SGDisplayRoot node. This node is used as a single entry-point for all tree-wide actions which the SuperGallery applies to it (redraw, reformatting, etc).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/10/94
By default, the root node is completely invisible on the display, and is just used for internal tidiness. However, galleries could override this class to make a new root type (e.g. you could override the redraw of the entire tree in certain display modes, to give a "show one item at a time" mode, etc)

If the root node has no children, it becomes visible, redrawing itself as a piece of grey text reading 'No items' or similar.

See also:
SGDisplayRootScroll

SuperGallery; SGDisplayNode; SGDisplayGroup; SGDisplayItem;

Definition at line 1157 of file sgtree.h.


Constructor & Destructor Documentation

SGDisplayRoot::SGDisplayRoot  )  [protected]
 

Dumps TRACE output to the debugger showing the layout of the tree THIS FUNCTION IS ONLY PRESENT IN DEBUG BUILDS (ifdef _DEBUG) It will also only produce debug output if your UserName is "Jason"SGDisplayRoot constructor (makes root nodes invisible by default).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/94
See also:
SGDisplayNode::SGDisplayNode

Definition at line 2896 of file sgtree.cpp.

02897 {
02898     Child = NULL;
02899 
02900     Flags.Invisible = TRUE;         // The root node is always invisible
02901     ParentGallery = NULL;
02902     ScrollExtent = 0;
02903 
02904     ERROR3("SGDisplayRoot constructed in an illegal manner");
02905 }

SGDisplayRoot::SGDisplayRoot SuperGallery ParentGal  ) 
 

SGDisplayRoot constructor (makes root nodes invisible by default).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/94
Parameters:
ParentGal - A pointer to the parent gallery of this node/tree [INPUTS]
See also:
SGDisplayNode::SGDisplayNode

Definition at line 2924 of file sgtree.cpp.

02925 {
02926     Child = NULL;
02927 
02928     Flags.Invisible = TRUE;         // The root node is always invisible
02929     ParentGallery = ParentGal;
02930     ScrollExtent = 0;
02931 }


Member Function Documentation

INT32 SGDisplayRoot::CalculateListExtent SGFormatInfo FormatInfo,
SGMiscInfo MiscInfo
[virtual]
 

Causes the entire subtree from this node to format themselves, and returns the 'height' of the entire list display, in millipoints.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/94
Parameters:
FormatInfo - should have been initialised with InitFormatInfo [INPUTS] MiscInfo - Miscellanous info needed for formatting
FormatInfo is updated as appropriate [OUTPUTS]
Returns:
The needed (window scroll) extent to contain the entire list if it were to be redrawn right now. NOTE that this is a positive value; if you wish to use this to find the bottom of the virtual space coordinates, you must negate it (as Virtual space runs from 0 to -Extent)
See also:
SGDisplayRoot::InitFormatInfo; SGDisplayRoot::GetCachedListExtent

Definition at line 3298 of file sgtree.cpp.

03299 {
03300     if (GetChild() == NULL) 
03301         return(0);
03302 
03303     // Ask ourself to handle a FORMAT event. This recursively formats the tree, and returns
03304     // with FormatInfo indicating the state at the end of formatting (FormatInfo->LinePos
03305     // is at the end position of the list, and hence gives us the extent)
03306     HandleEvent(SGEVENT_FORMAT, FormatInfo, MiscInfo);
03307     return(ScrollExtent);
03308 }

SGDisplayRoot::CC_DECLARE_DYNAMIC SGDisplayRoot   )  [private]
 

void SGDisplayRoot::DestroySubtree BOOL  IncludingThisNode = TRUE  )  [virtual]
 

DESTROYS the subtree starting at this root node. This does a depth-first recursive scan of the subtree, delinking each item, and then CALLING EACH ITEMS DESTRUCTOR.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/94
Parameters:
IncludingThisNode - TRUE (The default) to delete this node (the root of [INPUTS] the subtree) as well as all its children. FALSE to delete its children only (This leaves this node untouched, but vapes all child nodes) NOTE - This parameter is ignored, and always treated as FALSE
IT DOES NOT destruct the root node, however (i.e. it destroys the tree down to the point where only the root is left alive).

Returns:
Errors: May be generated by the RemoveFromTree and destructor calls if the subtree is in some way corrupt - see these calls for details.
See also:
SuperGallery; SGDisplayNode::RemoveFromTree; SGDisplayNode::DestroySubtree

Reimplemented from SGDisplayNode.

Definition at line 3108 of file sgtree.cpp.

03109 {
03110     // Destroy all our children, but DO NOT delete 'this' node!
03111     SGDisplayNode::DestroySubtree(FALSE);
03112 }

SGDisplayNode * SGDisplayRoot::FindNextItemInTree SGDisplayNode StartItem  )  [static]
 

Given an item in the tree, find the next one.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/04/96
Parameters:
StartItem - Item from which to start looking for next item [INPUTS]
Returns:
The next item, or NULL if no further items found
Notes: This function will skip virtualised groups, so if you need to do something globally, don't call this...

See also:
SGDisplayRoot::GetSelectedItemCount;

Definition at line 3718 of file sgtree.cpp.

03719 {
03720     ERROR3IF(StartItem == NULL, "SGDisplayRoot::FindNextItemInTree given a NULL StartItem - bad");
03721     if(StartItem == NULL) return NULL;
03722 
03723     SGDisplayNode *Item = StartItem;
03724 
03725     // If this is the last item in the group, skip to the next group
03726     if (Item->GetNext() == NULL)
03727     {
03728         ERROR3IF(Item->GetParent() == NULL, "Tree linkage corruption");
03729 
03730         // Check if we're the last group
03731         if (Item->GetParent()->GetNext() != NULL)
03732         {
03733             SGDisplayNode *TmpItem = Item->GetParent()->GetNext();
03734 
03735             // Jump over any virtualised groups
03736             while(TmpItem != NULL && TmpItem->GetChild() == NULL)
03737                 TmpItem = TmpItem->GetNext();
03738 
03739             // Check if gone over last group
03740             if(TmpItem == NULL)
03741                 Item = NULL;
03742             else
03743                 Item = TmpItem->GetChild();
03744         }
03745         else
03746             Item = NULL;
03747     }
03748     else
03749         Item = Item->GetNext();     // Get next sibling item
03750 
03751     return Item;
03752 }

SGDisplayGroup * SGDisplayRoot::FindNextSelectedGroup SGDisplayNode CurrentGroup = NULL  )  [virtual]
 

Scanning the group-selection within a Display Tree.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/95
Parameters:
CurrentGroup - NULL to find the first selected Group, else [INPUTS] An SGDisplayGroup indicating the 'position' to search from for the next selected Group
Returns:
NULL (if no selection), or A pointer to the first selected leaf of this tree which occurs after the 'CurrentGroup'. If CurrentGroup is NULL, then the first selected leaf node is returned.
Notes: This method relies heavily on the flat (root/group/Group) structure of current display trees - it will fail horribly if this simple layout is changed.

Warning: It may be possible for groups AND items to be selected at one time. This essentially filters Items out of the selection scan.

See also:
SGDisplayRoot::FindNextSelectedItem; SGDisplayRoot::GetSelectedGroupCount

Definition at line 3629 of file sgtree.cpp.

03630 {
03631     // Find the current group node - my first child, or the the current Group's parent.
03632     if (CurrentGroup != NULL)
03633         CurrentGroup = ((SGDisplayGroup *) CurrentGroup)->GetNext();
03634     else
03635         CurrentGroup = (SGDisplayGroup *) GetChild();
03636 
03637     ERROR3IF(CurrentGroup != NULL && !CurrentGroup->IsKindOf(CC_RUNTIME_CLASS(SGDisplayGroup)),
03638                 "The gallery displaytree seems to have mutated- "
03639                 "where have my lovely groups gone?");
03640 
03641     // Search each sibling group in turn until we find another selected leaf Group
03642     while (CurrentGroup != NULL)
03643     {
03644         if (CurrentGroup->IsSelected())     // Found a selected group - return it
03645             return((SGDisplayGroup *)CurrentGroup);
03646 
03647         CurrentGroup = ((SGDisplayGroup *) CurrentGroup)->GetNext();
03648     }
03649 
03650     // No more selected groups
03651     return(NULL);
03652 }

SGDisplayItem * SGDisplayRoot::FindNextSelectedItem SGDisplayNode CurrentItem = NULL,
BOOL *  SkipGroup = NULL
[virtual]
 

Scanning the selection within a Display Tree - this will scan over multiple documents/libraries without blinking an eyelid.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/95
Parameters:
CurrentItem - NULL to find the first selected item, else [INPUTS] An SGDisplayItem (node) indicating the 'position' to search from for the next selected item
if Non-NULL, SkipGroup will be filled in with TRUE if the scan has just [OUTPUTS] skipped onto a new document/library group within the tree, or FALSE if the scan remains in the same group as the last selected node was in. If CurrentItem was NULL on entry, this returned value will be TRUE.
Returns:
NULL (if no selection), or A pointer to the first selected leaf of this tree which occurs after the 'CurrentItem'. If CurrentItem is NULL, then the first selected leaf node is returned.
Use to scan through multiple-group selections, or to find the first selected item without having to know which document/library group it belongs to.

Notes: This method relies heavily on the flat (root/group/item) structure of current display trees - it will fail horribly if this simple layout is changed.

Warning: It may be possible for groups AND items to be selected at one time. This essentially filters Groups out of the selection scan.

See also:
SGDisplayNode::FindSubtree; SGDisplayGroup::FindNextSelectedItem; SGDisplayRoot::GetSelectedItemCount; SGDisplayGroup::GetSelectedItemCount; SGDisplayRoot::FindNextSelectedGroup

Definition at line 3457 of file sgtree.cpp.

03459 {
03460     BOOL ReturnSkip = (CurrentItem == NULL);
03461     SGDisplayItem *ReturnItem = NULL;
03462 
03463     // Find the current group node - my first child, or the the current item's parent.
03464     SGDisplayGroup *CurrentGroup;
03465     if (CurrentItem != NULL)
03466         CurrentGroup = (SGDisplayGroup *) CurrentItem->GetParent();
03467     else
03468         CurrentGroup = (SGDisplayGroup *) GetChild();
03469 
03470     ERROR3IF(CurrentGroup != NULL && !CurrentGroup->IsKindOf(CC_RUNTIME_CLASS(SGDisplayGroup)),
03471                 "The gallery displaytree seems to have mutated- "
03472                 "where have my lovely groups gone?");
03473 
03474     // Search each sibling group in turn until we find another selected leaf item
03475     while (CurrentGroup != NULL && ReturnItem == NULL)
03476     {
03477         ReturnItem = CurrentGroup->FindNextSelectedItem((SGDisplayItem *)CurrentItem);
03478         if (ReturnItem == NULL)
03479         {
03480             // No more selected items in this group - skip onto the next group, and flag
03481             // the fact that we had to skip to a different group
03482             ReturnSkip   = TRUE;
03483             CurrentGroup = (SGDisplayGroup *) CurrentGroup->GetNext();
03484             CurrentItem  = NULL;
03485         }
03486     }
03487 
03488     // Return the SkipGroup output
03489     if (SkipGroup != NULL)
03490         *SkipGroup = ReturnSkip;
03491 
03492     
03493     // And return NULL or the next selected node
03494     return(ReturnItem);
03495 }

INT32 SGDisplayRoot::GetCachedListExtent void   )  [virtual]
 

Returns the 'height' of the entire list display, in millipoints. This return value is only valid after the tree has been formatted (including a previous call to CalculateListExtent), so long as the cached tree format is still valid. Use with care.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/3/95
Returns:
The currently cached value for the scroll extent
See also:
SGDisplayRoot::CalculateListExtent

Definition at line 3330 of file sgtree.cpp.

03331 {
03332     return(ScrollExtent);
03333 }

SGDisplayNode * SGDisplayRoot::GetChild void   )  const [virtual]
 

Finds the child of this DisplayTree Node. Returns NULL if you have reached the boundary of the tree.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/10/94 (Made virtual 13/5/95)
Returns:
A pointer to the first child of this SGDisplayNode object, or NULL
See also:
SuperGallery; SGDisplayNode::GetParent; SGDisplayNode::GetNext; SGDisplayNode::GetPrevious

Reimplemented from SGDisplayNode.

Definition at line 2951 of file sgtree.cpp.

02952 {
02953     return(Child);
02954 }

SuperGallery * SGDisplayRoot::GetParentGallery void   )  const [virtual]
 

Returns the SuperGallery which 'owns' this node (and its subtree).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
Returns:
The parent SuperGallery, or NULL
See also:
SGDisplayNode::GetParentGallery

Reimplemented from SGDisplayNode.

Definition at line 2997 of file sgtree.cpp.

02998 {
02999     ERROR3IF(ParentGallery == NULL, "I have no parent gallery! This is not right!");
03000 
03001     return(ParentGallery);
03002 }

INT32 SGDisplayRoot::GetScrollOffset void   )  [virtual]
 

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/95
Returns:
In the base class, always returns 0

The current Scroll offset. This is a positive MLLIPOINT value. Note that virtual coordinates go from 0 to -Extent, so the point of VirtualSpace which maps to the top left displayed pixel on screen is at (-ScrollOffset).

In the base class, no scrollbar is supplied; this method does nothing

See also:
SGDisplayRoot::SetScrollOffset; SGDisplayRootScroll::GetScrollOffset

Reimplemented in SGDisplayRootScroll.

Definition at line 3383 of file sgtree.cpp.

03384 {
03385     // Base class does nothing - There is no scroll offset
03386     return(0);
03387 }

INT32 SGDisplayRoot::GetSelectedGroupCount void   )  [virtual]
 

To determine how many eaf Groups of this tree are selected.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/95
Returns:
The number of Groups in this display tree which are selected (may return 0)
Notes: This scans the selection (is not cached), so calling it multiple times should be avoided where possible

This method relies heavily on the flat (root/group/Group) structure of current display trees - it will fail horribly if this simple layout is changed.

See also:
SGDisplayRoot::FindNextSelectedGroup; SGDisplayGroup::GetSelectedGroupCount

Definition at line 3678 of file sgtree.cpp.

03679 {
03680     INT32 Count = 0;
03681 
03682     SGDisplayGroup *Ptr = (SGDisplayGroup *) GetChild();
03683     while (Ptr != NULL)
03684     {
03685         if (Ptr->IsSelected())
03686             Count++;
03687 
03688         Ptr = (SGDisplayGroup *) Ptr->GetNext();
03689     }
03690 
03691     return(Count);
03692 }

INT32 SGDisplayRoot::GetSelectedItemCount void   )  [virtual]
 

To determine how many eaf items of this tree are selected.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/95
Returns:
The number of items in this display tree which are selected (may return 0)
Notes: This scans the selection (is not cached), so calling it multiple times should be avoided where possible

This method relies heavily on the flat (root/group/item) structure of current display trees - it will fail horribly if this simple layout is changed.

See also:
SGDisplayRoot::FindNextSelectedItem; SGDisplayGroup::GetSelectedItemCount; SGDisplayRoot::GetSelectedGroupCount

Definition at line 3522 of file sgtree.cpp.

03523 {
03524     INT32 Count = 0;
03525 
03526     SGDisplayGroup *Ptr = (SGDisplayGroup *) GetChild();
03527     while (Ptr != NULL)
03528     {
03529         Count += Ptr->GetSelectedItemCount();
03530         Ptr = (SGDisplayGroup *) Ptr->GetNext();
03531     }
03532 
03533     return(Count);
03534 }

BOOL SGDisplayRoot::HandleEvent SGEventType  EventType,
void *  EventInfo,
SGMiscInfo MiscInfo
[virtual]
 

Handles a SuperGallery DisplayTree event.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/10/94
Parameters:
See SGDisplayNode::HandleEvent [INPUTS]
Returns:
TRUE if the event was handled successfully FALSE if it was not
Notes: This overrides the pure virtual SGDisplayNode::HandleEvent method

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.

Non-leaf-nodes must call SGDisplayNode::GiveEventToMyChildren in order to pass the event down the tree.

See also:
SGDisplayNode::HandleEvent; SGDisplayGroup::HandleEvent; SGDisplayItem::HandleEvent; SGDisplayRoot::InitFormatInfo; SGDisplayRoot::CalculateListExtent; SGDisplayNode::GiveEventToMyChildren

Reimplemented from SGDisplayNode.

Reimplemented in SGDisplayRootScroll.

Definition at line 3185 of file sgtree.cpp.

03187 {
03188     switch (EventType)
03189     {
03190         case SGEVENT_FORMAT:
03191             // Do nothing, but ensure we don't use the 'default:' case.
03192             break;
03193 
03194         case SGEVENT_REDRAW:
03195             {
03196                 SGRedrawInfo *RedrawInfo = GetRedrawInfo(EventType, EventInfo);
03197 
03198                 // This line is to stop the white flicker when backgrounding the items
03199                 // Hmmm... There are a few problems which need sorting out though !
03200                 if (BkgEraseMode == TRUE)
03201                 {
03202                     StartRendering(RedrawInfo, MiscInfo);
03203 
03204                     RenderRegion *pRender = RedrawInfo->Renderer;
03205 
03206                     // Set default background colour
03207                     pRender->SetFillColour(RedrawInfo->Background);
03208                     pRender->SetLineColour(COLOUR_TRANS);   //RedrawInfo->Background);
03209 
03210                     // Work out height first to avoid ENSURE in DocRect ctor
03211                     INT32 height=ScrollExtent;
03212                     // Extend the rect if necessary to ensure entire window bg is filled
03213                     if (ScrollExtent < MiscInfo->WindowHeight)
03214                         height = MiscInfo->WindowHeight;
03215 
03216                     if ((height>=0) && (MiscInfo->MaxWidth>=0))
03217                     {
03218                         // Fill entire display window background with bg colour
03219                         DocRect WindowBG(0, -height, MiscInfo->MaxWidth, 0);
03220                         pRender->DrawRect(&WindowBG);
03221                     }
03222 
03223                     StopRendering(RedrawInfo, MiscInfo);
03224                 }
03225                 else
03226                     BkgEraseMode = TRUE;
03227 
03228                 if (GetChild() == NULL) // We have no children (empty tree)
03229                 {
03230                     // Redraw ourself as 'No Items' indicator
03231                     // ERROR3("SGDisplayRoot::Redraw - I have no children to draw");
03232                     return(TRUE);   // Might as well return TRUE - there is nobody else!
03233                 }
03234             }
03235             break;
03236 
03237 
03238         default:
03239             return(SGDisplayNode::HandleEvent(EventType, EventInfo, MiscInfo));
03240     }
03241 
03242     // We have children, so recursively call them all with this event
03243     BOOL result = GiveEventToMyChildren(EventType, EventInfo, MiscInfo);
03244 
03245     // If we've just reformatted the tree, remember the new list extent
03246     if (EventType == SGEVENT_FORMAT)
03247     {
03248         SGFormatInfo *FormatInfo = GetFormatInfo(EventType, EventInfo);
03249 
03250         ScrollExtent = (ABS(FormatInfo->LinePos));
03251         SetScrollOffset(GetScrollOffset(), MiscInfo);   // Ensure not scrolled off end!
03252 
03253         if (FormatInfo->LastInvalidNode != NULL)
03254         {
03255             // The immediately previous (final) node had invalid bounds.
03256             // We'd better include the blank part of the list below it in the
03257             // invalid bounds, to ensure we don't leave little bits of stuff past the end
03258             // of the list if it has got smaller.
03259 
03260             ERROR3IF(FormatInfo->InvalidBounds.hi.y > 0,
03261                         "Gallery display formatting error - LastInvalidNode should be NULL "
03262                         "if there haven't been any invalid nodes yet");
03263 
03264             FormatInfo->InvalidBounds.lo.y = FormatInfo->LinePos - MiscInfo->WindowHeight;
03265         }
03266     }
03267 
03268     return(result);
03269 }

void SGDisplayRoot::InitFormatInfo SGFormatInfo FormatInfo,
SGMiscInfo MiscInfo
[virtual]
 

Resets the formatting info structure to default values for the start of a formatting pass. Must be called before SGDisplayRoot::Redraw.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/10/94
Parameters:
FormatInfo - Points at the format information to be initialised [INPUTS] MiscInfo - Points at a structure containing standard 'MiscInfo'
FormatInfo is initialised as appropriate [OUTPUTS] MiscInfo->MaxWidth is gridlocked to the pixel grid
See also:
SGDisplayRoot::Redraw

Definition at line 3136 of file sgtree.cpp.

03137 {
03138     MiscInfo->MaxWidth = GridLock(MiscInfo, MiscInfo->MaxWidth); // Maximum width of formatting lines
03139 
03140     FormatInfo->LinePos = 0;                                // Start at the top of the list
03141     FormatInfo->LineHeight = 0;                             // The current line is 0 height so far
03142     FormatInfo->AvailableWidth = MiscInfo->MaxWidth;        // The full line is left to allocate
03143     FormatInfo->IndentLevel = 0;                            // Initially we are not indented
03144 
03145     FormatInfo->AccumulateBounds = FALSE;                   // By default, don't accumulate bounds
03146     FormatInfo->LastInvalidNode  = NULL;                    // For the group dragging redraw fix
03147     FormatInfo->InvalidBounds = DocRect(0, 1, MiscInfo->MaxWidth, 2);
03148 }

void SGDisplayRoot::InsertAfter SGDisplayNode NodeToInsert  )  [virtual]
 

OVERRIDES SGDisplayNode::InsertAfter.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/94
Parameters:
NodeToInsert - the new node to insert into the tree [INPUTS]
Insertions at the root node are always converted to AddItem() calls, to insert the item as the last child of the root node. The root cannot have siblings!

See also:
SGDisplayNode::AddItem

Reimplemented from SGDisplayNode.

Definition at line 3025 of file sgtree.cpp.

03026 {
03027     AddItem(NodeToInsert);
03028 }

void SGDisplayRoot::InsertBefore SGDisplayNode NodeToInsert  )  [virtual]
 

OVERRIDES SGDisplayNode::InsertBefore.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/94
Parameters:
NodeToInsert - the new node to insert into the tree [INPUTS]
Insertions at the root node are always converted to AddItem() calls, to insert the item as the last child of the root node. The root cannot have siblings!

See also:
SGDisplayNode::AddItem

Reimplemented from SGDisplayNode.

Definition at line 3051 of file sgtree.cpp.

03052 {
03053     AddItem(NodeToInsert);
03054 }

void SGDisplayRoot::RedrawScrollBar SGMiscInfo MiscInfo  )  [virtual]
 

Causes the scroll bar, if any, to be redrawn. In the base class, this method does nothing.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/2/95
Parameters:
MiscInfo - The normal MiscInfo for SGDisplayNode events [INPUTS]
See also:
SGDisplayRootScroll::RedrawScrollBar

Reimplemented in SGDisplayRootScroll.

Definition at line 3407 of file sgtree.cpp.

03408 {
03409     // The base class has no scrollbar, so does nothing
03410 }

void SGDisplayRoot::RemoveFromTree void   )  [virtual]
 

OVERRIDES SGDisplayNode::RemoveFromTree The root node cannot be removed from the tree - it returns quietly, taking no action (this allows the generic treatment of DestroyTree to work without having to take special action for delinking the root node).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/94
See also:
SGDisplayNode::RemoveFromTree; SGDisplayNode::DestroySubtree

Reimplemented from SGDisplayNode.

Definition at line 3074 of file sgtree.cpp.

03075 {
03076     // do nothing
03077 }

void SGDisplayRoot::SelectRange SGDisplayNode PrimeNode,
SGDisplayNode AnchorNode
[virtual]
 

Selects the PrimeNode, and if possible, all sibling nodes between it and the Anchor node. If Anchor == NULL or is not found, only PrimeNode is selected. Does not deselect any nodes - you should call SelectItems first to clear the seln.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/95
Parameters:
PrimeNode - The node which MUST be selected. May NOT be NULL. [INPUTS]
AnchorNode - The other node, specifying a range of sibling nodes to be selected. May be NULL, in which case only PrimeNode is selected

Note: The code to do the selection is now sub-contracted out to SelectRangeGroups and SelectRangeItems, depending on the type of the two given nodes.

If prime node is an item and the other a group, nothing will be selected... If prime node is an item and the null, the item will be selected...

Definition at line 3562 of file sgtree.cpp.

03563 {
03564     ERROR3IF(PrimeNode == NULL, "SGDisplayRoot::SelectRange - PrimeNode must be non-NULL");
03565 
03566     if (AnchorNode == NULL || PrimeNode->GetParent() != AnchorNode->GetParent())
03567     {
03568         // There is no anchor, or the prime/anchor nodes are not siblings, so
03569         // we cannot select a range - select PrimeNode, deselect all others
03570         ParentGallery->SelectItems(FALSE);
03571         ParentGallery->SelectGroups(FALSE);
03572 
03573         // Paint the list now to reduce the chance of large redraws if the
03574         // old/new selections are far apart.
03575         ParentGallery->PaintListNow();
03576 
03577         PrimeNode->SetSelected(TRUE);
03578         ParentGallery->PaintListNow();
03579     }
03580     else if (PrimeNode->IS_KIND_OF(SGDisplayItem) && (AnchorNode == NULL || AnchorNode->IS_KIND_OF(SGDisplayItem)))
03581     {
03582         // We are selecting a range of items so deselect all groups first
03583         ParentGallery->SelectGroups(FALSE); // Deselect all groups
03584         SelectRangeItems((SGDisplayItem *)PrimeNode, (SGDisplayItem *)AnchorNode);
03585     }
03586     else if (PrimeNode->IS_KIND_OF(SGDisplayGroup) && (AnchorNode == NULL || AnchorNode->IS_KIND_OF(SGDisplayGroup)))
03587     {
03588         // We are selecting a range of groups so deselect all items first
03589         ParentGallery->SelectItems(FALSE);  // Deselect all items
03590         SelectRangeGroups((SGDisplayGroup *)PrimeNode, (SGDisplayGroup *)AnchorNode);
03591     }
03592 
03593     // And ensure the gallery updates itself appropriately
03594     ParentGallery->SelectionHasChanged();
03595 }

void SGDisplayRoot::SetChild SGDisplayNode NewChild  )  [protected, virtual]
 

Sets the child of this DisplayTree Node. Overrides to base class method to allow the child to be set.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/10/94
Parameters:
A pointer to the new first-child of this SGDisplayNode object [INPUTS]
See also:
SuperGallery; SGDisplayNode::GetParent; SGDisplayNode::GetNext; SGDisplayNode::GetPrevious

Reimplemented from SGDisplayNode.

Definition at line 2975 of file sgtree.cpp.

02976 {
02977     Child = NewChild;
02978 }

void SGDisplayRoot::SetScrollOffset INT32  NewOffset,
SGMiscInfo MiscInfo
[virtual]
 

Changes the scroll offset, and if necessary, redraws the scroll bar.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/95
Parameters:
NewOffset - The new scroll offset. [INPUTS] This is a number between 0 and LengthOfList, in MILLIPOINTs
MiscInfo - the usual

In the base class, no scrollbar is supplied; this method does nothing

See also:
SGDisplayRoot::GetScrollOffset; SGDisplayRootScroll::SetScrollOffset

Reimplemented in SGDisplayRootScroll.

Definition at line 3357 of file sgtree.cpp.

03358 {
03359     // Base class does nothing
03360 }


Member Data Documentation

SGDisplayNode* SGDisplayRoot::Child [protected]
 

Definition at line 1230 of file sgtree.h.

SuperGallery* SGDisplayRoot::ParentGallery [protected]
 

Definition at line 1232 of file sgtree.h.

INT32 SGDisplayRoot::ScrollExtent [protected]
 

Definition at line 1234 of file sgtree.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:01:04 2007 for Camelot by  doxygen 1.4.4