JBoolean TestWidget::WillAcceptDrop ( const JArray<Atom>& typeList, Atom* action, const Time time, const JXWidget* source ) { JXDNDManager* dndMgr = GetDNDManager(); if (typeList.GetFirstElement() == (GetSelectionManager())->GetURLXAtom()) { cout << endl; cout << "Accepting the drop of type text/uri-list" << endl; cout << endl; *action = dndMgr->GetDNDActionPrivateXAtom(); return kJTrue; } else if (*action == dndMgr->GetDNDActionCopyXAtom()) { cout << endl; cout << "Accepting the drop" << endl; cout << endl; PrintSelectionText(dndMgr->GetDNDSelectionName(), time, (GetSelectionManager())->GetMimePlainTextXAtom()); return kJTrue; } else { JXDisplay* display = GetDisplay(); cout << endl; cout << "Not accepting the drop because the action isn't copy" << endl; cout << "Action: " << XGetAtomName(*display, *action) << endl; cout << endl; cout << "Data types available from DND source:" << endl; cout << endl; const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { const Atom type = typeList.GetElement(i); cout << XGetAtomName(*display, type) << endl; } cout << endl; PrintSelectionText(dndMgr->GetDNDSelectionName(), time, (GetSelectionManager())->GetMimePlainTextXAtom()); return kJFalse; } }
void GMMessageDragSource::GetDNDAskActions ( const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers, JArray<Atom>* askActionList, JPtrArray<JString>* askDescriptionList ) { JXDNDManager* dndMgr = GetDNDManager(); askActionList->AppendElement(dndMgr->GetDNDActionCopyXAtom()); askActionList->AppendElement(dndMgr->GetDNDActionMoveXAtom()); JString* s = new JString(kDNDActionCopyDescrip); assert( s != NULL ); askDescriptionList->Append(s); s = new JString(kDNDActionMoveDescrip); assert( s != NULL ); askDescriptionList->Append(s); }
void SyGGetDNDAskActions ( JArray<Atom>* actionList, JPtrArray<JString>* descriptionList ) { JXDNDManager* dndMgr = ((JXGetApplication())->GetCurrentDisplay())->GetDNDManager(); actionList->AppendElement(dndMgr->GetDNDActionCopyXAtom()); actionList->AppendElement(dndMgr->GetDNDActionMoveXAtom()); actionList->AppendElement(dndMgr->GetDNDActionLinkXAtom()); JString* s = new JString(JGetString(kDNDCopyDescriptionID)); assert( s != NULL ); descriptionList->Append(s); s = new JString(JGetString(kDNDMoveDescriptionID)); assert( s != NULL ); descriptionList->Append(s); s = new JString(JGetString(kDNDLinkDescriptionID)); assert( s != NULL ); descriptionList->Append(s); }