#include <ngitem.h>
Inheritance diagram for SGNameItem:
Public Member Functions | |
SGNameItem (const StringBase &strName) | |
Construct an SGNameItem. | |
NodeSetProperty * | GetPropertyNode () |
returns a cached ptr to this sets property node. This is NULLed in Reset() and filled with a search on demand | |
void | ResetCachedPropertyNode () |
BOOL | IsABackBar () |
BOOL | IsEqual (const StringBase &strOther) const |
BOOL | IsEmpty () const |
BOOL | IsAllSelected () const |
BOOL | IsNoneSelected () const |
BOOL | IsExclusivelySelected () const |
BOOL | IsMember (Node *pNode) const |
INT32 | GetNodeCount () const |
INT32 | GetObjectCount () const |
INT32 | GetSelectedCount () const |
const DocRect & | GetSetBounds () const |
const DocRect & | GetOldSetBounds () const |
const DocRect & | GetSetSelectedBounds () const |
BOOL | HasChangedBounds () const |
void | SetSetBounds (const DocRect &r) |
SGNameProp * | GetProperty (INT32 nIndex=-1) const |
virtual void | GetNameText (String_256 *pResult) |
To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods. Notes: **** TO DO **** Modify this method to return the correct text. You may also want to add an override for the GetFullInfoText() method if you can provide a full-info display mode. | |
virtual const String_256 * | GetNameTextPtr () const |
void | Reset (BOOL fPropagateChanges=TRUE) |
Resets the state of the object in preparation for a refresh. | |
void | Include (Node *pNode) |
Called by the CreateScan::Do when a node is discovered that is a member of this set item. Updates the running totals of member objects and selected member objects. | |
virtual INT32 | CompareTo (SGDisplayNode *pOther, INT32 nKey) |
Overrides the default comparator so that it takes into accounted appended numbers. | |
virtual void | DragWasReallyAClick (SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo) |
Called by the dragging code when a drag turns out to be a mundane single click. | |
SGNameItem (const String_256 &strName) | |
SGNameItem constructor. | |
virtual void | GetNameText (String_256 *pResult) |
To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods. | |
virtual BOOL | GetBubbleHelp (DocCoord *pMousePos, String_256 *pResult) |
Called by the parent gallery when bubble help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help. | |
virtual BOOL | GetStatusLineHelp (DocCoord *pMousePos, String_256 *pResult) |
Called by the parent gallery when status line help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help. | |
virtual BOOL | HandleEvent (SGEventType EventType, void *pEventInfo, SGMiscInfo *pMiscInfo) |
Handles a SuperGallery DisplayTree event. | |
Document * | GetDocument () |
Public Attributes | |
BOOL | m_SetIsAffectedTrigger |
BOOL | m_IsATrigger |
BOOL | m_IsPartOfThisStretch |
INT32 | m_BarNumber |
DocCoord | m_Translation |
Protected Member Functions | |
virtual void | CalcUiBounds (SGFormatInfo *pFormatInfo, SGMiscInfo *pMiscInfo) |
Calculates the bounds of the distinct UI items that make up a line in the Attribute gallery. Notes: Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item. | |
virtual void | DrawLabel (SGRedrawInfo *pRedrawInfo, SGMiscInfo *pMiscInfo) |
Default implementation for drawing the label of an item, the renderer has already been set up with default attributes. Notes: Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item. | |
virtual BOOL | GetBubbleHelp (DocCoord *pMousePos, String_256 *pResult) |
Called by the parent gallery when bubble help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help. Notes: The base class returns FALSE (i.e. provides no help) If you can provide help, then override the base class method to do so. | |
virtual BOOL | GetStatusLineHelp (DocCoord *pMousePos, String_256 *pResult) |
Called by the parent gallery when status line help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help. Notes: The base class returns FALSE (i.e. provides no help) If you can provide help, then override the base class method to do so. | |
virtual void | CalculateMyRect (SGFormatInfo *pFormatInfo, SGMiscInfo *pMiscInfo) |
Shared code for NameItem items to calculate where they will appear in the grand scheme of things. | |
virtual void | HandleRedraw (SGRedrawInfo *pRedrawInfo, SGMiscInfo *pMiscInfo) |
SGNameItem item redraw method - removed from the main HandleEvent method merely to make the code tidier. Notes: Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item. | |
virtual BOOL | HandleEvent (SGEventType EventType, void *pEventInfo, SGMiscInfo *pMiscInfo) |
Handles a SuperGallery display event. Notes: VERY IMPORTANT: The rendering must be enclosed by calls to StartRendering and StopRendering, to ensure that rendering works properly (in the future we may change the redraw system to use a GRenderRegion for each individual item, rather than one global one for the window, for which these calls will be essential). | |
virtual void | CalculateMyRect (SGFormatInfo *pFormatInfo, SGMiscInfo *pMiscInfo) |
virtual void | HandleRedraw (SGRedrawInfo *pRedrawInfo, SGMiscInfo *pMiscInfo) |
Protected Attributes | |
String_256 | m_strName |
DocRect | m_rToggle |
DocRect | m_rText |
DocRect | m_rProp |
NodeSetProperty * | m_pCachedPropertyNode |
Private Member Functions | |
CC_DECLARE_DYNAMIC (SGNameItem) | |
CC_DECLARE_DYNAMIC (SGNameItem) | |
Private Attributes | |
DocRect | m_rSetBounds |
DocRect | m_rOldSetBounds |
DocRect | m_rSelectBounds |
INT32 | m_nNodes |
INT32 | m_nObjects |
INT32 | m_nSelected |
String_256 | m_strSetName |
AttributeSets::Intersect | m_eIntersect |
Definition at line 176 of file ngitem.h.
|
Construct an SGNameItem.
Definition at line 166 of file ngitem.cpp. 00167 : m_strName(strName), 00168 m_pCachedPropertyNode(0), 00169 m_nNodes(0), 00170 m_nObjects(0), 00171 m_nSelected(0) 00172 { 00173 // TRACEUSER( "JustinF", _T("SGNameItem::SGNameItem(%s)\n"), (LPCTSTR) m_strName); 00174 }
|
|
SGNameItem constructor.
Definition at line 173 of file sgname.cpp. 00174 : m_strSetName(strName), 00175 m_eIntersect(AttributeSets::Intersect::NONE) 00176 { 00177 // TRACEUSER( "JustinF", _T("SGNameItem %s\n"), (LPCTSTR) m_strSetName); 00178 }
|
|
Calculates the bounds of the distinct UI items that make up a line in the Attribute gallery. Notes: Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item.
Reimplemented in SGUsedColourItem. Definition at line 601 of file ngitem.cpp. 00602 { 00603 // pMiscInfo can't be null (pFormatInfo can be as it's not very useful). 00604 ERROR3IF(pMiscInfo == 0, "SGNameItem::CalcUiBounds: null input/output argument"); 00605 00606 // Work out the maximum bounds of the toggle gadget, label and property. 00607 m_rText = FormatRect; 00608 m_rText.hi.x -= SG_GapBeforeText / 2; 00609 m_rToggle = m_rText; 00610 m_rToggle.hi.x = m_rToggle.lo.x + SG_DefaultSmallIcon; 00611 m_rText.lo.x = m_rToggle.hi.x + SG_GapBeforeText; 00612 00613 // Split the label bounds with the property. 00614 SGNameProp* pProp = GetProperty(); 00615 if (pProp == 0) 00616 m_rProp.MakeEmpty(); 00617 else 00618 { 00619 m_rProp = m_rText; 00620 PORTNOTE("other", "Removed SuperGallery related stuff" ) 00621 #if !defined(EXCLUDE_FROM_XARALX) 00622 pProp->CalcUiBounds(this, pFormatInfo, pMiscInfo, &m_rProp); 00623 #endif 00624 m_rText.hi.x = m_rProp.lo.x - SG_GapBeforeText; 00625 } 00626 00627 // Pixel-align. 00628 GridLockRect(pMiscInfo, &m_rToggle); 00629 GridLockRect(pMiscInfo, &m_rText); 00630 GridLockRect(pMiscInfo, &m_rProp); 00631 }
|
|
|
|
Shared code for NameItem items to calculate where they will appear in the grand scheme of things.
Definition at line 650 of file ngitem.cpp. 00651 { 00652 CalculateFormatRect(pFormatInfo, pMiscInfo, SG_InfiniteWidth, SG_DefaultSmallIcon); 00653 CalcUiBounds(pFormatInfo, pMiscInfo); 00654 }
|
|
|
|
|
|
Overrides the default comparator so that it takes into accounted appended numbers.
Reimplemented from SGDisplayNode. Definition at line 327 of file ngitem.cpp. 00328 { 00329 ERROR3IF(pItem == 0, "SGNameItem::CompareTo: null input"); 00330 ERROR3IF(!pItem->IS_KIND_OF(SGNameItem), "SGNameItem::CompareTo: not an SGNameItem"); 00331 00332 switch (nKey) 00333 { 00334 case SGSORTKEY_BYNAME: 00335 { 00336 // Compare the strings character by character until we can determine their 00337 // lexical order. If the characters to be compared are numeric, then parse 00338 // and compare them as ordinals. 00339 LPCTSTR pchThis = m_strName, pchOther = ((SGNameItem*) pItem)->m_strName; 00340 for (;;) 00341 { 00342 // Eat up any whitespace. 00343 while (StringBase::IsSpace(*pchThis)) pchThis = camStrinc(pchThis); 00344 while (StringBase::IsSpace(*pchOther)) pchOther = camStrinc(pchOther); 00345 00346 // Check if we've reached the end of the strings. If we have reached 00347 // the end of both, they are equal. Otherwise the one that is shortest 00348 // is 'lower'. 00349 if (*pchThis == TEXT('\0')) 00350 return (*pchOther == TEXT('\0')) ? 0 : -1; 00351 else if (*pchOther == TEXT('\0')) 00352 return 1; 00353 00354 // Are the next two characters to be compared numeric? 00355 if (StringBase::IsNumeric(*pchThis) && StringBase::IsNumeric(*pchOther)) 00356 { 00357 // Span and copy the integers embedded in each string. 00358 String_256 strThisNum, strOtherNum; 00359 LPTSTR pchThisNum = strThisNum, pchOtherNum = strOtherNum; 00360 00361 do { 00362 *pchThisNum = *pchThis; 00363 pchThisNum = camStrinc(pchThisNum); 00364 pchThis = camStrinc(pchThis); 00365 } while (StringBase::IsNumeric(*pchThis)); 00366 00367 do { 00368 *pchOtherNum = *pchOther; 00369 pchOtherNum = camStrinc(pchOtherNum); 00370 pchOther = camStrinc(pchOther); 00371 } while (StringBase::IsNumeric(*pchOther)); 00372 00373 *pchThisNum = *pchOtherNum = TEXT('\0'); 00374 00375 // Convert and compare the numbers. 00376 INT32 nThis, nOther; 00377 Convert::StringToLong( strThisNum, &nThis ); 00378 Convert::StringToLong( strOtherNum, &nOther ); 00379 if (nThis < nOther) 00380 return -1; 00381 else if (nThis > nOther) 00382 return 1; 00383 00384 // Restart all tests as we may now be pointing at a null or a space. 00385 continue; 00386 } 00387 00388 // The characters are not both numeric, so perform a normal comparison. 00389 INT32 nTest = *pchOther - *pchThis; 00390 PORTNOTE("other", "Removed CompareString, rwplace with simple subtraction" ) 00391 #if !defined(EXCLUDE_FROM_XARALX) 00392 ::CompareString(LOCALE_USER_DEFAULT, 00393 NORM_IGNOREKANATYPE | 00394 NORM_IGNOREWIDTH | 00395 NORM_IGNORECASE, 00396 pchThis, 1, pchOther, 1) - 2; 00397 #endif 00398 00399 if (nTest != 0) return nTest; 00400 00401 // The strings are still equal so compare the next characters. 00402 pchThis = camStrinc(pchThis); 00403 pchOther = camStrinc(pchOther); 00404 } 00405 } 00406 break; 00407 00408 default: 00409 // Let the base class handle all other types of comparison. 00410 return SGDisplayItem::CompareTo(pItem, nKey); 00411 } 00412 00413 return 0; 00414 }
|
|
Called by the dragging code when a drag turns out to be a mundane single click.
Reimplemented from SGDisplayNode. Definition at line 428 of file ngitem.cpp. 00429 { 00430 // NB. called post-drag. 00431 DefaultClickHandler(pMouseInfo, pMiscInfo, TRUE); 00432 }
|
|
Default implementation for drawing the label of an item, the renderer has already been set up with default attributes. Notes: Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item.
Reimplemented in SGUsedColourItem. Definition at line 672 of file ngitem.cpp. 00673 { 00674 pRedrawInfo->Renderer->DrawFixedSystemText(&m_strName, m_rText); 00675 }
|
|
Called by the parent gallery when bubble help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help.
Reimplemented from SGDisplayNode. |
|
Called by the parent gallery when bubble help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help. Notes: The base class returns FALSE (i.e. provides no help) If you can provide help, then override the base class method to do so.
Reimplemented from SGDisplayNode. Definition at line 455 of file ngitem.cpp. 00456 { 00457 ERROR3IF(pResult == 0, "SGNameItem::GetBubbleHelp: invalid null params"); 00458 00459 // Matt - 16/09/2000 - Added for tooltip help over properties 00460 // Work out which UI item is hovered over, if any... 00461 if (m_nObjects > 0 && m_rProp.ContainsCoord(*pMousePos)) 00462 { 00463 //Then we're hovering over the properties section... 00464 SGNameProp* pProp = GetProperty(); 00465 if (pProp->GetIndex() == 0) 00466 { 00467 //Then it's an EXPORT property 00468 TRACEUSER( "matt", _T("...EXPORTY...\n")); 00469 } 00470 else if (pProp->GetIndex() == 1) 00471 { 00472 //Then it's a SLICE tickbox 00473 TRACEUSER( "matt", _T("SLICEY...\n")); 00474 } 00475 else if (pProp->GetIndex() == 2) 00476 { 00477 //Then it's a STRETCH tickbox 00478 TRACEUSER( "matt", _T("...STRETCHY...\n")); 00479 } 00480 00481 String strNameGal( _R(IDBBL_NAMEGAL_NONE) ); 00482 return pResult->MakeMsg(_R(IDBBL_NAMEGAL_ITEM), &strNameGal, &m_strName); 00483 } 00484 else 00485 { 00486 // Work out the intersection with the user selection. 00487 UINT32 id; 00488 if (IsNoneSelected()) 00489 id = _R(IDBBL_NAMEGAL_NONE); 00490 else if (IsAllSelected()) 00491 id = _R(IDBBL_NAMEGAL_ALL); 00492 else 00493 id = _R(IDBBL_NAMEGAL_SOME); 00494 00495 // Create the bubble help text. 00496 String strNameGal( id ); 00497 return pResult->MakeMsg(_R(IDBBL_NAMEGAL_ITEM), &strNameGal, &m_strName); 00498 } 00499 }
|
|
Definition at line 234 of file sgname.h. 00235 { return ((SGDisplayGroup*) GetParent())->GetParentDocument(); }
|
|
To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods.
Reimplemented from SGDisplayNode. |
|
To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods. Notes: **** TO DO **** Modify this method to return the correct text. You may also want to add an override for the GetFullInfoText() method if you can provide a full-info display mode.
Reimplemented from SGDisplayNode. Definition at line 196 of file ngitem.cpp. 00197 { 00198 ERROR3IF(pResult == 0, "SGNameItem::GetNameText: illegal null param"); 00199 *pResult = m_strName; 00200 }
|
|
Definition at line 216 of file ngitem.h. 00216 { return &m_strName; };
|
|
Definition at line 425 of file ngitem.h. 00426 { 00427 return m_nNodes; 00428 }
|
|
Definition at line 440 of file ngitem.h. 00441 { 00442 return m_nObjects; 00443 }
|
|
Definition at line 395 of file ngitem.h. 00396 { 00397 return m_rOldSetBounds; 00398 }
|
|
Definition at line 216 of file ngitem.cpp. 00217 { 00218 // No document means no properties. 00219 Document* pDoc = Document::GetSelected(); 00220 if (pDoc == 0) return 0; 00221 00222 // Only 'Used Names' have properties (for now). 00223 if (GetParent() != NameGallery::Instance()->GetUsedNames()) 00224 return 0; 00225 00226 // Fetch the current property? 00227 if (nIndex == -1) nIndex = NameGallery::Instance()->GetPropertyIndex(); 00228 ERROR3IF(nIndex < 0 || nIndex >= SGNameProp::nPropertyCount, 00229 "SGNameItem::GetProperty: index out of range"); 00230 00231 // Retrieve the SGNameProp* from the associated NodeSetProperty. 00232 NodeSetProperty* pSetProp = pDoc->GetSetSentinel()->FindPropertyNode(m_strName); 00233 if (pSetProp == 0) return 0; 00234 SGNameProp* pProp = pSetProp->GetProperty(nIndex); 00235 ERROR3IF(pProp == 0, "SGNameItem::GetProperty: no property"); 00236 return pProp; 00237 }
|
|
returns a cached ptr to this sets property node. This is NULLed in Reset() and filled with a search on demand
Definition at line 269 of file ngitem.cpp. 00270 { 00271 // scan for the property node and cache this ptr 00272 return (m_pCachedPropertyNode != 0) 00273 ? m_pCachedPropertyNode 00274 : m_pCachedPropertyNode = 00275 Document::GetCurrent()->GetSetSentinel()->FindPropertyNode(m_strName); 00276 }
|
|
Definition at line 455 of file ngitem.h. 00456 { 00457 return m_nSelected; 00458 }
|
|
Definition at line 380 of file ngitem.h. 00381 { 00382 return m_rSetBounds; 00383 }
|
|
Definition at line 410 of file ngitem.h. 00411 { 00412 return m_rSelectBounds; 00413 }
|
|
Called by the parent gallery when status line help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help.
Reimplemented from SGDisplayNode. |
|
Called by the parent gallery when status line help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help. Notes: The base class returns FALSE (i.e. provides no help) If you can provide help, then override the base class method to do so.
Reimplemented from SGDisplayNode. Definition at line 522 of file ngitem.cpp. 00523 { 00524 // Matt - 16/09/2000 - Added for statusbar help over properties 00525 // Work out which UI item is hovered over, if any... 00526 if (m_nObjects > 0 && m_rProp.ContainsCoord(*pMousePos)) 00527 { 00528 //Then we're hovering over the properties section... 00529 SGNameProp* pProp = GetProperty(); 00530 if (pProp->GetIndex() == 0) 00531 { 00532 //Then it's an EXPORT property 00533 TRACEUSER( "matt", _T("...EXPORTY...\n")); 00534 return pResult->MakeMsg(_R(IDBBL_NAMEGAL_PROPEXPORTOPT)); 00535 } 00536 else if (pProp->GetIndex() == 1) 00537 { 00538 //Then it's a SLICE tickbox 00539 TRACEUSER( "matt", _T("SLICEY...\n")); 00540 return pResult->MakeMsg(_R(IDBBL_NAMEGAL_PROPSLICE)); 00541 } 00542 else if (pProp->GetIndex() == 2) 00543 { 00544 //Then it's a STRETCH tickbox 00545 TRACEUSER( "matt", _T("...STRETCHY...\n")); 00546 return pResult->MakeMsg(_R(IDBBL_NAMEGAL_PROPSTRETCH)); 00547 } 00548 } 00549 else 00550 { 00551 String strSel; 00552 00553 // Intersect this item's set with the selected objects. 00554 if (IsNoneSelected()) 00555 strSel = _R(IDBBL_NAMEGAL_NONE); 00556 else if (IsAllSelected()) 00557 strSel = _R(IDBBL_NAMEGAL_ALL); 00558 else 00559 strSel = _R(IDBBL_NAMEGAL_SOME); 00560 00561 strSel.toLower(); 00562 00563 // What is the mouse pointing at? 00564 UINT32 idMask; 00565 SGNameGroup* pGroup = (SGNameGroup*) GetParent(); 00566 if (m_rToggle.ContainsCoord(*pMousePos)) 00567 // Over the selection toggle gadget. 00568 idMask = _R(IDST_NAMEGAL_ITEM_SEL_GADGET); 00569 else if (pGroup == NameGallery::Instance()->GetUsedNames()) 00570 // Over a 'Used Name' 00571 idMask = _R(IDST_NAMEGAL_NAME_ITEM); 00572 else 00573 // Over 'Used' something else. 00574 idMask = _R(IDST_NAMEGAL_OTHER_ITEM); 00575 00576 // Build up a specific message. 00577 String strType(pGroup->GetTypeID()); 00578 return pResult->MakeMsg(idMask, &strSel, &m_strName, &strType, &strType); 00579 } 00580 00581 // It failed, so return FALSE. 00582 return FALSE; 00583 }
|
|
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 SGDisplayItem. |
|
Handles a SuperGallery display event. Notes: VERY IMPORTANT: The rendering must be enclosed by calls to StartRendering and StopRendering, to ensure that rendering works properly (in the future we may change the redraw system to use a GRenderRegion for each individual item, rather than one global one for the window, for which these calls will be essential). SGEVENT_FORMAT 0 SGEVENT_REDRAW (SGRedrawInfo*) SGEVENT_BGREDRAW 0 SGEVENT_BGFLUSH 0 - May have 0 MiscInfo SGEVENT_MOUSECLICK (SGMouseInfo*) SGEVENT_DRAGSTARTED (DragMessage*) SGEVENT_CLAIMPOINT (SGMouseInfo*) SGEVENT_THUMBMSG (ThumbMessage*) - May have 0 MiscInfo Use the provided SGDisplayNode::Get[Format]Info() inlines to retrieve this information - they provide useful error/type checking, and hide the cast pMiscInfo - almost always provided. Contains a few useful bits of info that may be needed for all event types. This may be 0 for special event types (see sgtree.h for the enum and information on which ones may pass 0 MiscInfo
Reimplemented from SGDisplayItem. Definition at line 793 of file ngitem.cpp. 00794 { 00795 switch (nEventType) 00796 { 00797 case SGEVENT_FORMAT: 00798 { 00799 SGFormatInfo* pFormatInfo = GetFormatInfo(nEventType, pEventInfo); 00800 CalculateMyRect(pFormatInfo, pMiscInfo); 00801 CalcUiBounds(0, pMiscInfo); 00802 break; 00803 } 00804 00805 case SGEVENT_REDRAW: 00806 { 00807 DocRect MyRect(FormatRect); // Rely on FormatRect being cached from above 00808 SGRedrawInfo* pRedrawInfo = GetRedrawInfo(nEventType, pEventInfo); 00809 if (IMustRedraw(pRedrawInfo)) 00810 { 00811 StartRendering(pRedrawInfo, pMiscInfo); 00812 pRedrawInfo->Renderer->SaveContext(); 00813 HandleRedraw(pRedrawInfo, pMiscInfo); 00814 pRedrawInfo->Renderer->RestoreContext(); 00815 StopRendering(pRedrawInfo, pMiscInfo); 00816 } 00817 break; 00818 } 00819 00820 case SGEVENT_MOUSECLICK: 00821 { 00822 // Work out which UI item has been clicked on, if any. 00823 SGMouseInfo* pMouseInfo = GetMouseInfo(nEventType, pEventInfo); 00824 if (m_rToggle.ContainsCoord(pMouseInfo->Position)) 00825 { 00826 TRACEUSER( "matt", _T("m_rToggle Contains the Mouse Coords\n")); 00827 if (m_nObjects > 0) 00828 { 00829 TRACEUSER( "matt", _T("Num Objects > 0\n")); 00830 // It's a click on the selection toggle gadget for some objects. 00831 SelectScan::Change eChange; 00832 if (KeyPress::IsGalleryCtrlPressed()) 00833 eChange = SelectScan::TOGGLE; 00834 else if (IsAllSelected()) 00835 eChange = SelectScan::DESELECT; 00836 else 00837 eChange = SelectScan::SELECT; 00838 00839 // Change the selection state of the objects within this set item and 00840 // claim the event. 00841 OpDescriptor* pDesc = 00842 OpDescriptor::FindOpDescriptor(OPTOKEN_SELECT_SET); 00843 ERROR3IF(pDesc == 0, "SGNameItem::HandleEvent: no descriptor"); 00844 00845 OpParam param( this, INT32(eChange) ); 00846 pDesc->Invoke( ¶m ); 00847 return TRUE; 00848 } 00849 } 00850 00851 else if (m_nObjects > 0 && m_rProp.ContainsCoord(pMouseInfo->Position)) 00852 { 00853 TRACEUSER( "matt", _T("m_rToggle DOES NOT contain MouseCoords, m_rProp DOES\n")); 00854 00855 PORTNOTE("other", "Removed SuperGallery related stuff" ) 00856 #if !defined(EXCLUDE_FROM_XARALX) 00857 // It's a click on the property UI. Pass it on and claim it. 00858 SGNameProp* pProp = GetProperty(); 00859 if (pProp != 0 && !pProp->HandleMouse(this, pMouseInfo, pMiscInfo)) 00860 { 00861 InformError(); 00862 return FALSE; 00863 } 00864 #endif 00865 return TRUE; 00866 } 00867 00868 else if (m_rText.ContainsCoord(pMouseInfo->Position) || 00869 (m_nObjects == 0 && m_rProp.ContainsCoord(pMouseInfo->Position))) 00870 { 00871 TRACEUSER( "matt", _T("m_rText contains MouseCoords OR m_rProp DOES\n")); 00872 00873 // It's a click on the text label. If a name is clicked then (always) 00874 // start dragging it. If the click isn't really a drag then 00875 // DragWasReallyAClick will be called when the drag is cancelled. 00876 DefaultPreDragHandler(pMouseInfo, pMiscInfo); 00877 PORTNOTE("other", "Removed bitmap drag handling BitmapDragInformation"); 00878 #ifndef EXCLUDE_FROM_XARALX 00879 if (GetParent() == NameGallery::Instance()->GetUsedNames()) 00880 { 00881 // It's a name (ie. a child of the 'Used Names' group), so create and run 00882 // a drag operation. 00883 SGNameDrag* pDragInfo = new SGNameDrag(this, pMouseInfo, pMiscInfo); 00884 ERRORIF(pDragInfo == 0, _R(IDE_NOMORE_MEMORY), FALSE); 00885 DragManagerOp::StartDrag(pDragInfo, GetListWindow()); 00886 } 00887 else 00888 #endif 00889 // Not a name so just do the default, but don't close on 00890 // adjust-double-click. 00891 DefaultClickHandler(pMouseInfo, pMiscInfo, FALSE); 00892 00893 TRACEUSER("JustinF", 00894 _T("%s \"%s\" at 0x%p --- %d nodes, %d objects, %d selected\n"), 00895 (LPCTSTR) String(((SGNameGroup*) GetParent())->GetTypeID()), 00896 (LPCTSTR) m_strName, (LPVOID) this, 00897 m_nNodes, m_nObjects, m_nSelected); 00898 00899 // Claim this click. 00900 return TRUE; 00901 } 00902 00903 TRACEUSER( "matt", _T("Click outside bounds of item's UI\n")); 00904 // The click was outside the bounds of the item's UI gadgets. 00905 break; 00906 } 00907 /* 00908 // Matt - 15/09/2000 - Added for tooltip help over properties 00909 case SGEVENT_CLAIMPOINT: 00910 { 00911 // Work out which UI item is hovered over, if any... 00912 SGClaimPointInfo *pMouseInfo = GetClaimPointInfo(nEventType, pEventInfo); 00913 if (!m_rToggle.ContainsCoord(pMouseInfo->Position) && m_nObjects > 0 && m_rProp.ContainsCoord(pMouseInfo->Position)) 00914 { 00915 //Then we're hovering over the properties section... 00916 SGNameProp* pProp = GetProperty(); 00917 00918 if (pProp->GetIndex() == 0) 00919 { 00920 //Then it's an EXPORT property 00921 TRACEUSER( "matt", _T("...EXPORTY...\n")); 00922 } 00923 else if (pProp->GetIndex() == 1) 00924 { 00925 //Then it's a SLICE tickbox 00926 TRACEUSER( "matt", _T("SLICEY...\n")); 00927 } 00928 else if (pProp->GetIndex() == 2) 00929 { 00930 //Then it's a STRETCH tickbox 00931 TRACEUSER( "matt", _T("...STRETCHY...\n")); 00932 } 00933 00934 // if (pProp != 0 && !pProp->HandleMouse(this, pMouseInfo, pMiscInfo)) 00935 // { 00936 // InformError(); 00937 // return FALSE; 00938 // } 00939 return true; 00940 } 00941 break; 00942 } 00943 */ 00944 default: 00945 // Let the base class handle any events we don't know about. 00946 // This includes things like hit testing (CLAIMPOINT) etc 00947 return SGDisplayItem::HandleEvent(nEventType, pEventInfo, pMiscInfo); 00948 } 00949 00950 // Default return value: we do not claim this event, so it will be passed on to others. 00951 return FALSE; 00952 }
|
|
|
|
SGNameItem item redraw method - removed from the main HandleEvent method merely to make the code tidier. Notes: Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item.
Definition at line 694 of file ngitem.cpp. 00695 { 00696 // Set the foreground and background colours according to whether this item is 00697 // gallery selected or not. 00698 DocColour dcolForegnd, dcolBackgnd; 00699 if (Flags.Selected) 00700 { 00701 dcolForegnd = pRedrawInfo->SelForeground; 00702 dcolBackgnd = pRedrawInfo->SelBackground; 00703 } 00704 else 00705 { 00706 // Unselected items are in the 'selected' colour if the user selection includes 00707 // any of their members. 00708 dcolBackgnd = pRedrawInfo->Background; 00709 dcolForegnd = pRedrawInfo->Foreground; 00710 } 00711 00712 // Render the unhighlighted background. 00713 pRedrawInfo->Renderer->SetFillColour(pRedrawInfo->Background); 00714 pRedrawInfo->Renderer->SetLineColour(pRedrawInfo->Transparent); 00715 pRedrawInfo->Renderer->SetLineWidth(0); 00716 pRedrawInfo->Renderer->DrawRect(&m_rToggle); 00717 pRedrawInfo->Renderer->DrawRect(&m_rProp); 00718 00719 // Render highlighted background. 00720 pRedrawInfo->Renderer->SetFillColour(dcolBackgnd); 00721 pRedrawInfo->Renderer->DrawRect(&m_rText); 00722 00723 // Render the selection toggle gadget, on the left, if the set isn't empty. 00724 if (!IsEmpty()) 00725 { 00726 UINT32 idBmp; 00727 if (IsNoneSelected()) 00728 idBmp = _R(IDB_NAMEGAL_NONESEL); 00729 else if (IsAllSelected()) 00730 idBmp = _R(IDB_NAMEGAL_ALLSEL); 00731 else 00732 idBmp = _R(IDB_NAMEGAL_SOMESEL); 00733 00734 pRedrawInfo->Renderer->DrawBitmap(m_rToggle.lo, idBmp); 00735 } 00736 00737 // Render the label of the item, in the middle. 00738 pRedrawInfo->Renderer->SetFixedSystemTextColours(&dcolForegnd, &dcolBackgnd); 00739 DrawLabel(pRedrawInfo, pMiscInfo); 00740 00741 // Render the property, on the right. 00742 if (m_nObjects > 0) 00743 { 00744 PORTNOTE("other", "Removed SuperGallery related stuff" ) 00745 #if !defined(EXCLUDE_FROM_XARALX) 00746 SGNameProp* pProp = GetProperty(); 00747 if (pProp != 0) pProp->HandleRedraw(this, pRedrawInfo, pMiscInfo, m_rProp); 00748 #endif 00749 } 00750 }
|
|
Definition at line 205 of file ngitem.h. 00206 { return m_rSetBounds != m_rOldSetBounds; }
|
|
Called by the CreateScan::Do when a node is discovered that is a member of this set item. Updates the running totals of member objects and selected member objects.
Definition at line 291 of file ngitem.cpp. 00292 { 00293 // Count nodes, including the sentinel. 00294 ++m_nNodes; 00295 if (pNode->IsNodeRenderableClass()) 00296 { 00297 // Count selectable (renderable) nodes. 00298 ++m_nObjects; 00299 BOOL fSelect = (pNode->IsSelected() || pNode->IsChildOfSelected()) || (pNode->IsCompound() && pNode->IsParentOfSelected()); 00300 if (fSelect) ++m_nSelected; 00301 00302 // Accumulate bounds of objects, and just those selected. 00303 if (pNode->IsBounded()) 00304 { 00305 DocRect rBounds = SliceHelper::BoundingNodeSize(pNode); 00306 m_rSetBounds = m_rSetBounds.Union(rBounds); 00307 if (fSelect) m_rSelectBounds = m_rSelectBounds.Union(rBounds); 00308 } 00309 } 00310 }
|
|
Definition at line 955 of file ngitem.cpp. 00956 { 00957 String_256 SubName = m_strName; 00958 *(((TCHAR *)SubName) + 7) = 0; 00959 return ( SubName == _T("BackBar") ); 00960 }
|
|
Definition at line 485 of file ngitem.h. 00486 { 00487 return m_nObjects > 0 && m_nSelected == m_nObjects; 00488 }
|
|
Definition at line 470 of file ngitem.h. 00471 { 00472 return m_nObjects == 0; 00473 }
|
|
Definition at line 531 of file ngitem.h. 00532 { 00533 return m_strName == strOther; 00534 }
|
|
Definition at line 515 of file ngitem.h. 00516 { 00517 return IsAllSelected() && m_nObjects == (INT32) GetApplication()->FindSelection()->Count(); 00518 }
|
|
Definition at line 193 of file ngitem.h. 00194 { return ((SGNameGroup*) GetParent())->IsMember(pNode, m_strName); }
|
|
Definition at line 500 of file ngitem.h. 00501 { 00502 return m_nSelected == 0; 00503 }
|
|
Resets the state of the object in preparation for a refresh.
Definition at line 250 of file ngitem.cpp. 00251 { 00252 // Remember the old bounds of the set and reset all running totals. 00253 if (fPropagateChanges) m_rOldSetBounds = m_rSetBounds; 00254 m_rSetBounds.MakeEmpty(); 00255 m_rSelectBounds.MakeEmpty(); 00256 m_nNodes = m_nObjects = m_nSelected = 0; 00257 m_pCachedPropertyNode = 0; 00258 }
|
|
Definition at line 184 of file ngitem.h. 00184 { m_pCachedPropertyNode = 0; }
|
|
Definition at line 209 of file ngitem.h. 00209 { m_rSetBounds = r; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|