#include <sgname.h>
Inheritance diagram for GalleryNameDragInfo:
Public Member Functions | |
GalleryNameDragInfo () | |
Default constructor, required for dynamic creation. | |
GalleryNameDragInfo (SGNameItem *pSourceItem, SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo, TemplateAttribute *pAttrib, BOOL fIsAdjust=FALSE) | |
virtual | ~GalleryNameDragInfo () |
Destructor. Deletes the attribute associated with this object. | |
virtual void | OnClick (INT32 nFlags, POINT ptClick) |
This is called if a drag was attempted but never started because it was a click all along. It calls back the SourceItem SGDisplayLine, to get it to handle the click. | |
virtual UINT32 | GetCursorID (DragTarget *pDragTarget) |
Set cursor over this target. | |
virtual BOOL | GetStatusLineText (String_256 *pText, DragTarget *pDragTarget) |
provide status line text for this drag | |
virtual BOOL | CanDropOnPage () |
Called by the kernel dragging code to test whether a dragged name item can be dropped on a view onto a document. | |
virtual BOOL | OnPageDrop (ViewDragTarget *) |
Called when a Name gallery item is dropped onto the page. | |
virtual INT32 | GetDragTransparency () |
Specifies how transparent a drag should be. | |
virtual KernelBitmap * | GetSolidDragMask () |
Renders an image of the dragged item into monochrome bitmap to use as an XOR mask for rendering the dragged Name gallery item. | |
SGNameItem * | GetDraggedNameAttr () |
Private Attributes | |
SGNameItem * | m_pSourceItem |
SGMouseInfo | m_MouseInfo |
SGMiscInfo | m_MiscInfo |
NodeAttribute * | m_pAttrib |
Definition at line 263 of file sgname.h.
|
Default constructor, required for dynamic creation.
Definition at line 1533 of file sgname.cpp. 01534 : m_pSourceItem(0), 01535 m_pAttrib(0) 01536 { 01537 // Empty. 01538 }
|
|
Definition at line 1557 of file sgname.cpp. 01560 : BitmapDragInformation(0, 100, 50, 0, 0, fIsAdjust), 01561 m_pSourceItem(pSourceItem), 01562 m_MouseInfo(*pMouseInfo), 01563 m_MiscInfo(*pMiscInfo), 01564 m_pAttrib(pAttrib) 01565 { 01566 // Empty. 01567 }
|
|
Destructor. Deletes the attribute associated with this object.
Definition at line 1579 of file sgname.cpp. 01580 { 01581 if (m_pAttrib != 0) 01582 { 01583 delete m_pAttrib; 01584 m_pAttrib = 0; 01585 } 01586 }
|
|
Called by the kernel dragging code to test whether a dragged name item can be dropped on a view onto a document.
Reimplemented from DragInformation. Definition at line 1688 of file sgname.cpp. 01689 { 01690 return TRUE; 01691 }
|
|
Set cursor over this target.
Reimplemented from BitmapDragInformation. Definition at line 1618 of file sgname.cpp. 01619 { 01620 // Only allow drops on the document view. 01621 if (pDragTarget == 0 || !pDragTarget->IS_KIND_OF(ViewDragTarget)) 01622 return _R(IDC_CANTDROP); 01623 01624 // Get information about what's below the cursor. 01625 PageDropInfo pdInfo; 01626 ((ViewDragTarget*) pDragTarget)->GetDropInfo(&pdInfo); 01627 NodeRenderableInk* pObjectHit = pdInfo.pObjectHit; 01628 // ClickModifiers cmMods = ClickModifiers::GetClickModifiers(); 01629 01630 // If there's an object below the cursor then show the "can drop" cursor, otherwise 01631 // show the "can't drop" cursor. 01632 return (pObjectHit != 0) ? _R(IDC_CANDROPONPAGE) : _R(IDC_CANTDROP); 01633 }
|
|
Definition at line 286 of file sgname.h. 00286 { return m_pSourceItem; }
|
|
Specifies how transparent a drag should be.
Reimplemented from BitmapDragInformation. Definition at line 1733 of file sgname.cpp.
|
|
Renders an image of the dragged item into monochrome bitmap to use as an XOR mask for rendering the dragged Name gallery item.
Reimplemented from BitmapDragInformation. Definition at line 1751 of file sgname.cpp. 01752 { 01753 // If there's no current View, or no Spread, then fail. 01754 DocView* pView = DocView::GetCurrent(); 01755 if (pView == 0) return 0; 01756 Spread* pSpread = pView->FindEnclosingSpread(OilCoord(0, 0)); 01757 if (pSpread == 0) return 0; 01758 01759 // Create a device context for the display. 01760 CDC cdcDisplay; 01761 cdcDisplay.CreateDC("DISPLAY", 0, 0, 0); 01762 01763 // Calculate the size of the rendering and set up the rendering matrix etc. 01764 Matrix matConvert; 01765 FIXED16 fxScale = 1; 01766 DocRect drClip(0, 0, SG_DefaultNameText, SG_DefaultSmallIcon); 01767 01768 // Create a render region with the given properties of the display etc. 01769 double dpi = (double) GetDeviceCaps(cdcDisplay.m_hDC, LOGPIXELSX); 01770 GRenderBitmap* pMaskRegion = new GRenderBitmap(drClip, matConvert, fxScale, 1, dpi); 01771 pMaskRegion->AttachDevice(pView, &cdcDisplay, pSpread); 01772 01773 // Get the name of the item. 01774 String_256 strName; 01775 m_pSourceItem->GetNameText(&strName); 01776 01777 // Render the blank background. 01778 pMaskRegion->StartRender(); 01779 pMaskRegion->SetLineWidth(0); 01780 pMaskRegion->SetLineColour(COLOUR_BLACK); 01781 pMaskRegion->SetFillColour(COLOUR_BLACK); 01782 pMaskRegion->DrawRect(&drClip); 01783 01784 // Render the text. 01785 DocColour dcText(COLOUR_WHITE), dcBack(COLOUR_BLACK); 01786 pMaskRegion->SetFixedSystemTextColours(&dcText, &dcBack); 01787 pMaskRegion->DrawFixedSystemText(&strName, drClip); 01788 pMaskRegion->StopRender(); 01789 01790 // Create a kernel bitmap from the OIL bitmap and return it. 01791 OILBitmap* pOilMaskBmp = pMaskRegion->ExtractBitmap(); 01792 delete pMaskRegion; 01793 return new KernelBitmap(pOilMaskBmp, TRUE); 01794 }
|
|
provide status line text for this drag
Reimplemented from BitmapDragInformation. Definition at line 1648 of file sgname.cpp. 01649 { 01650 // Validate outputs and object state. 01651 ERROR3IF(pText == 0, "GalleryNameDragInfo::GetStatusLineText: no output parameter"); 01652 if (TheBitmap == 0 || TheBitmap->ActualBitmap == 0) return FALSE; 01653 01654 // Only provide status-line help for drops on the document view. 01655 if (pDragTarget == 0 || !pDragTarget->IS_KIND_OF(ViewDragTarget)) 01656 return FALSE; 01657 01658 // Get information about what the mouse is over in the document view. 01659 PageDropInfo pdInfo; 01660 ((ViewDragTarget*) pDragTarget)->GetDropInfo(&pdInfo); 01661 NodeRenderableInk* pObjectHit = pdInfo.pObjectHit; 01662 01663 // Build up the status-line help text. 01664 *pText = _R(IDST_NAMEGAL_DRAG); // "Dragging name" 01665 *pText += String_8(_R(IDS_SGDFONTS_STAT_COLON_SEP)); // " : " 01666 01667 // Try to work out the specific description of the object the mouse is over. 01668 String_256 strObjectDesc = _R(IDS_SGLDRAG_THIS_OBJECT); // " this object"; 01669 if (pObjectHit != 0) strObjectDesc = pObjectHit->Describe(FALSE); 01670 01671 *pText += String_256(_R(IDST_NAMEGAL_DROP_TO_APPLY)); // "Drop to apply this name to this "; 01672 *pText += strObjectDesc; 01673 return TRUE; 01674 }
|
|
This is called if a drag was attempted but never started because it was a click all along. It calls back the SourceItem SGDisplayLine, to get it to handle the click.
Reimplemented from BitmapDragInformation. Definition at line 1602 of file sgname.cpp. 01603 { 01604 if (m_pSourceItem != 0) m_pSourceItem->DefaultClickHandler(&m_MouseInfo, &m_MiscInfo); 01605 }
|
|
Called when a Name gallery item is dropped onto the page.
Reimplemented from DragInformation. Definition at line 1706 of file sgname.cpp. 01707 { 01708 // Extract the address of the object dropped on and apply the dragged name 01709 // attribute to it. 01710 PageDropInfo pdInfo; 01711 pDragTarget->GetDropInfo(&pdInfo); 01712 NodeRenderableInk* pObjectHit = pdInfo.pObjectHit; 01713 if (pObjectHit != 0) 01714 { 01715 // This call always deletes the passed attribute, so make sure we don't as well. 01716 AttributeManager::ApplyAttribToNode(pObjectHit, m_pAttrib); 01717 m_pAttrib = 0; 01718 } 01719 return TRUE; 01720 }
|
|
|
|
|
|
|
|
|