To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 8681
8680  |  8682
Subject: 
Re: dragNdrop (Was: Ldglite must be faster)
Newsgroups: 
lugnet.cad
Date: 
Tue, 10 Sep 2002 18:45:15 GMT
Viewed: 
1160 times
  
In lugnet.cad, Don Heyse writes:

Are you still keeping the SourceForge CVS archive up to date?  I'm
curious what the dragNDrop code looks like on MacOS.  I suppose it's
different for OSX though.

No, it's not up to date because I don't have broadband without firewall.

Here's all I had to write. Mac Drag Manager calls are the ones with ::
global scope. A lot of magic is hidden in the base class constructor
(LDragAndDrop) and more magic in LDragTask.

void
CPartView::ClickSelf( const SMouseDownEvent & inMouseDown )
{
if (mPart && ::WaitMouseMoved(inMouseDown.macEvent.where))
{
Rect myBounds;

CalcPortFrameRect(myBounds);
string id = mPart->Id();

long theLen = id.length();
const char *theStr = id.c_str();

// mouse is dragging
LDragTask theDragTask( inMouseDown.macEvent, myBounds,
1, FOUR_CHAR_CODE('TEXT'), (void*)theStr, theLen, 0 );

// try to restore things
FocusDraw();
}
}

Boolean
CPartView::ItemIsAcceptable( DragReference inDragRef, ItemReference inItemRef )
{
// We will accept TEXT flavor
FlavorFlags theFlags;
OSErr err;
err = ::GetFlavorFlags(inDragRef, inItemRef, 'TEXT', &theFlags);
if (err == noErr) return true;

return false;
}

void
CPartView::ReceiveDragItem( DragReference inDragRef, DragAttributes
inDragAttrs, ItemReference inItemRef, Rect & inItemBounds )
{

long textlen;
char buf[256];

::GetFlavorDataSize(inDragRef, inItemRef, 'TEXT', &textlen);
if (textlen>0 && textlen<sizeof(buf)) {
::GetFlavorData(inDragRef, inItemRef, 'TEXT', &buf[0], &textlen, 0);
string id( &buf[0], textlen);
SetPartID(id);
Refresh();
}
}



Message is in Reply To:
  Re: dragNdrop (Was: Ldglite must be faster)
 
(...) Are you still keeping the SourceForge CVS archive up to date? I'm curious what the dragNDrop code looks like on MacOS. I suppose it's different for OSX though. (...) I take a bunch of different drop/paste 'protocols' on the Windows version and (...) (22 years ago, 10-Sep-02, to lugnet.cad)

39 Messages in This Thread:















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR