GalleryNameDragInfo Class Reference

#include <sgname.h>

Inheritance diagram for GalleryNameDragInfo:

BitmapDragInformation DragInformation CCObject SimpleCCObject List of all members.

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

Detailed Description

Definition at line 263 of file sgname.h.


Constructor & Destructor Documentation

GalleryNameDragInfo::GalleryNameDragInfo (   ) 
 

Default constructor, required for dynamic creation.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95

Definition at line 1533 of file sgname.cpp.

01534   : m_pSourceItem(0),
01535     m_pAttrib(0)
01536 {
01537     // Empty.
01538 }

GalleryNameDragInfo::GalleryNameDragInfo (  SGNameItem *  pSourceItem,
SGMouseInfo *  pMouseInfo,
SGMiscInfo *  pMiscInfo,
TemplateAttribute *  pAttrib,
BOOL  fIsAdjust = FALSE
) 
 

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 }

GalleryNameDragInfo::~GalleryNameDragInfo (   )  [virtual]
 

Destructor. Deletes the attribute associated with this object.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95

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 }


Member Function Documentation

BOOL GalleryNameDragInfo::CanDropOnPage (   )  [virtual]
 

Called by the kernel dragging code to test whether a dragged name item can be dropped on a view onto a document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Returns:
TRUE if the a name item can be dropped on a page (ie. a document view).

Reimplemented from DragInformation.

Definition at line 1688 of file sgname.cpp.

01689 {
01690     return TRUE;
01691 }

UINT32 GalleryNameDragInfo::GetCursorID (  DragTarget *  pDragTarget  )  [virtual]
 

Set cursor over this target.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
pDragTarget --- the drag target to set the cursor for [INPUTS]

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 }

SGNameItem* GalleryNameDragInfo::GetDraggedNameAttr (   )  [inline]
 

Definition at line 286 of file sgname.h.

00286 { return m_pSourceItem; }

INT32 GalleryNameDragInfo::GetDragTransparency (   )  [virtual]
 

Specifies how transparent a drag should be.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Returns:
A transparency value, in this case, 50%

Reimplemented from BitmapDragInformation.

Definition at line 1733 of file sgname.cpp.

01734 {
01735     return 50;
01736 }

KernelBitmap * GalleryNameDragInfo::GetSolidDragMask (   )  [virtual]
 

Renders an image of the dragged item into monochrome bitmap to use as an XOR mask for rendering the dragged Name gallery item.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Returns:
A pointer to a KernelBitmap to use as a 1bpp mask for the dragged item, or 0 for failure.

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 }

BOOL GalleryNameDragInfo::GetStatusLineText (  String_256 *  pText,
DragTarget *  pDragTarget
)  [virtual]
 

provide status line text for this drag

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/1/95
Parameters:
TheText - If it returns TRUE, this is filled in with status line text [OUTPUTS]
Returns:
Whether String is valid

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 }

void GalleryNameDragInfo::OnClick (  INT32  nFlags,
POINT  ptClick
)  [virtual]
 

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.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
nFlags --- which keys are depressed during the drag [INPUTS] ptClick --- the position of the mosue click

Reimplemented from BitmapDragInformation.

Definition at line 1602 of file sgname.cpp.

BOOL GalleryNameDragInfo::OnPageDrop (  ViewDragTarget *  pDragTarget  )  [virtual]
 

Called when a Name gallery item is dropped onto the page.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/95
Parameters:
pDragTarget --- the drag target representing the view onto [INPUTS] a document (the "page").
Returns:
TRUE if successful.

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 }


Member Data Documentation

SGMiscInfo GalleryNameDragInfo::m_MiscInfo [private]
 

Definition at line 291 of file sgname.h.

SGMouseInfo GalleryNameDragInfo::m_MouseInfo [private]
 

Definition at line 290 of file sgname.h.

NodeAttribute* GalleryNameDragInfo::m_pAttrib [private]
 

Definition at line 292 of file sgname.h.

SGNameItem* GalleryNameDragInfo::m_pSourceItem [private]
 

Definition at line 289 of file sgname.h.


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