#include <ngdrag.h>
Inheritance diagram for SGNameDrag:
Public Member Functions | |
SGNameDrag () | |
Default constructor, required for dynamic creation. | |
SGNameDrag (SGNameItem *pSourceItem, SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo) | |
virtual | ~SGNameDrag () |
Destroys a SGNameDrag 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. | |
virtual BOOL | OnDrawSolidDrag (wxPoint ptOrigin, wxDC *pDC) |
allows the drag to draw into a Device Context - DragManager will look after painting the background etc. | |
SGNameItem * | GetDraggedNameAttr () |
Protected Member Functions | |
virtual KernelBitmap * | MakeImage (UINT32 nDepth=0) |
Protected Attributes | |
SGNameItem * | m_pSourceItem |
SGMouseInfo | m_MouseInfo |
SGMiscInfo | m_MiscInfo |
Private Member Functions | |
CC_DECLARE_DYNCREATE (SGNameDrag) |
Definition at line 124 of file ngdrag.h.
|
Default constructor, required for dynamic creation.
Definition at line 157 of file ngdrag.cpp. 00158 : m_pSourceItem(0) 00159 { 00160 // Empty. 00161 }
|
|
Definition at line 177 of file ngdrag.cpp. 00179 : BitmapDragInformation( 00180 0, 00181 SG_DefaultNameText, 00182 SG_DefaultSmallIcon * NameGallery::Instance()->GetSelectedItemCount(), 00183 0, 0, pMouseInfo->MenuClick), 00184 m_pSourceItem(pSourceItem), 00185 m_MouseInfo(*pMouseInfo), 00186 m_MiscInfo(*pMiscInfo) 00187 { 00188 // Empty. 00189 }
|
|
Destroys a SGNameDrag object.
Definition at line 201 of file ngdrag.cpp. 00202 { 00203 // Tidy up (why doesn't the base class do this?) 00204 delete TheBitmap; 00205 TheBitmap = 0; 00206 }
|
|
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 309 of file ngdrag.cpp. 00310 { 00311 return TRUE; 00312 }
|
|
|
|
Set cursor over this target.
Reimplemented from BitmapDragInformation. Definition at line 239 of file ngdrag.cpp. 00240 { 00241 // Only allow drops on the document view. 00242 if (pDragTarget == 0 || !pDragTarget->IS_KIND_OF(ViewDragTarget)) 00243 return _R(IDC_CANTDROP); 00244 00245 // If there's an object below the cursor then show the "can drop" cursor, otherwise 00246 // show the "can't drop" cursor. 00247 PageDropInfo pdInfo; 00248 ((ViewDragTarget*) pDragTarget)->GetDropInfo(&pdInfo); 00249 return (pdInfo.pObjectHit != 0) ? _R(IDC_CANDROPONPAGE) : _R(IDC_CANTDROP); 00250 }
|
|
Definition at line 480 of file ngdrag.cpp. 00481 { 00482 return m_pSourceItem; 00483 }
|
|
Specifies how transparent a drag should be.
Reimplemented from BitmapDragInformation. Definition at line 354 of file ngdrag.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 374 of file ngdrag.cpp. 00375 { 00376 // If the mask already exists then return it else else make it by rendering the 00377 // dragged item into a 1 bpp bitmap, and then return it. 00378 return (DragMask != 0) ? DragMask : DragMask = MakeImage(1); 00379 }
|
|
provide status line text for this drag
Reimplemented from BitmapDragInformation. Definition at line 265 of file ngdrag.cpp. 00266 { 00267 // Validate outputs and object state. 00268 ERROR3IF(pText == 0, "SGNameDrag::GetStatusLineText: no output parameter"); 00269 if (TheBitmap == 0 || TheBitmap->ActualBitmap == 0) return FALSE; 00270 00271 // Only provide status-line help for drops on the document view. 00272 if (pDragTarget == 0 || !pDragTarget->IS_KIND_OF(ViewDragTarget)) 00273 return FALSE; 00274 00275 // Get the name and type of the item being dragged. 00276 String_256 strName; 00277 m_pSourceItem->GetNameText(&strName); 00278 String strTypeDesc(((SGNameGroup*) m_pSourceItem->GetParent())->GetTypeID()); 00279 00280 // Describe the object the mouse is over, if any. 00281 PageDropInfo pdInfo; 00282 ((ViewDragTarget*) pDragTarget)->GetDropInfo(&pdInfo); 00283 NodeRenderableInk* pObjectHit = pdInfo.pObjectHit; 00284 if (pObjectHit == 0) 00285 pText->MakeMsg(_R(IDST_NAMEOP_CANT_DROP), &strName, &strTypeDesc); 00286 else 00287 { 00288 String_64 strObjectDesc; 00289 strObjectDesc = pObjectHit->Describe(FALSE); 00290 pText->MakeMsg(_R(IDST_NAMEOP_DROP_TO_APPLY), 00291 &strName, &strTypeDesc, &strObjectDesc, &strTypeDesc, &strName); 00292 } 00293 00294 return TRUE; 00295 }
|
|
Definition at line 415 of file ngdrag.cpp. 00416 { 00417 // If there's no current View, or no Spread, then fail. 00418 DocView* pView = DocView::GetCurrent(); 00419 if (pView == 0) return 0; 00420 Spread* pSpread = pView->FindEnclosingSpread(OilCoord(0, 0)); 00421 if (pSpread == 0) return 0; 00422 00423 // Create a device context for the display. 00424 CDC sdc; 00425 sdc.CreateDC("DISPLAY", 0, 0, 0); 00426 00427 // Calculate the size of the rendering and set up the rendering matrix etc. 00428 Matrix matConvert; 00429 FIXED16 fxScale = 1; 00430 INT32 nSel = NameGallery::Instance()->GetSelectedItemCount(); 00431 DocRect drClip(0, 0, SG_DefaultNameText, nSel * SG_DefaultSmallIcon); 00432 00433 // Work out the destination bitmap's characteristics. 00434 double dpi = (double) GetDeviceCaps(sdc.m_hDC, LOGPIXELSX); 00435 if (nDepth == 0) 00436 nDepth = GetDeviceCaps(sdc.m_hDC, BITSPIXEL) * GetDeviceCaps(sdc.m_hDC, PLANES); 00437 00438 // Create a render region with the given properties of the display etc. 00439 GRenderBitmap* pRenderer = new GRenderBitmap(drClip, matConvert, fxScale, nDepth, dpi); 00440 ERRORIF(pRenderer == 0, _R(IDE_NOMORE_MEMORY), 0); 00441 pRenderer->AttachDevice(pView, &sdc, pSpread); 00442 pRenderer->StartRender(); 00443 pRenderer->SaveContext(); 00444 00445 // Blank the background. 00446 pRenderer->SetLineWidth(0); 00447 pRenderer->SetLineColour(COLOUR_WHITE); 00448 pRenderer->SetFillColour(COLOUR_WHITE); 00449 pRenderer->DrawRect(&drClip); 00450 00451 // Render the item's name. 00452 DocColour dcText(COLOUR_BLACK), dcBack(COLOUR_WHITE); 00453 pRenderer->SetFixedSystemTextColours(&dcText, &dcBack); 00454 00455 String_256 strName; 00456 m_pSourceItem->GetNameText(&strName); 00457 pRenderer->DrawFixedSystemText(&strName, drClip); 00458 00459 // Create a kernel bitmap from the OIL bitmap and return it. 00460 pRenderer->RestoreContext(); 00461 pRenderer->StopRender(); 00462 OILBitmap* pOilMaskBmp = pRenderer->ExtractBitmap(); 00463 delete pRenderer; 00464 00465 KernelBitmap* pkb = new KernelBitmap(pOilMaskBmp, TRUE); 00466 ERRORIF(pkb == 0, _R(IDE_NOMORE_MEMORY), 0); 00467 return pkb; 00468 }
|
|
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 222 of file ngdrag.cpp. 00223 { 00224 if (m_pSourceItem != 0) 00225 m_pSourceItem->DragWasReallyAClick(&m_MouseInfo, &m_MiscInfo); 00226 }
|
|
allows the drag to draw into a Device Context - DragManager will look after painting the background etc.
Reimplemented from BitmapDragInformation. |
|
Called when a Name gallery item is dropped onto the page.
Reimplemented from DragInformation. Definition at line 327 of file ngdrag.cpp. 00328 { 00329 // Extract the address of the object dropped on and apply the dragged name 00330 // attribute to it. 00331 PageDropInfo pdInfo; 00332 pDragTarget->GetDropInfo(&pdInfo); 00333 if (pdInfo.pObjectHit != 0) 00334 { 00335 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_APPLY_NAMES_TO_ONE); 00336 ERROR3IF(pDesc == 0, "SGNameDrag::OnPageDrop: no descriptor"); 00337 pDesc->Invoke(&OpParam((INT32) (Node*) pdInfo.pObjectHit, 0)); 00338 } 00339 00340 return TRUE; 00341 }
|
|
|
|
|
|
|