Added wxDragLink
Added SetURL to wxURLDataObject Fixed the Mozilla problem by reversing the order of the component DOs in the wxURLDataObject. By checking the wxTextDataObject first then it avoids the problem of how Mozilla sends the UniformResourceLocator data. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -467,6 +467,7 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString GetURL() const { return GetText(); }
|
wxString GetURL() const { return GetText(); }
|
||||||
|
void SetURL(const wxString& url) { SetText(url); }
|
||||||
};
|
};
|
||||||
#endif // __WXMSW__/!__WXMSW__
|
#endif // __WXMSW__/!__WXMSW__
|
||||||
|
|
||||||
|
@@ -34,12 +34,13 @@ enum wxDragResult
|
|||||||
wxDragNone, // drag target didn't accept the data
|
wxDragNone, // drag target didn't accept the data
|
||||||
wxDragCopy, // the data was successfully copied
|
wxDragCopy, // the data was successfully copied
|
||||||
wxDragMove, // the data was successfully moved (MSW only)
|
wxDragMove, // the data was successfully moved (MSW only)
|
||||||
|
wxDragLink, // operation is a drag-link
|
||||||
wxDragCancel // the operation was cancelled by user (not an error)
|
wxDragCancel // the operation was cancelled by user (not an error)
|
||||||
};
|
};
|
||||||
|
|
||||||
inline WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res)
|
inline WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res)
|
||||||
{
|
{
|
||||||
return res == wxDragCopy || res == wxDragMove;
|
return res == wxDragCopy || res == wxDragMove || res == wxDragLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -90,6 +90,9 @@ public:
|
|||||||
// return the URL as string
|
// return the URL as string
|
||||||
wxString GetURL() const;
|
wxString GetURL() const;
|
||||||
|
|
||||||
|
// Set a string as the URL in the data object
|
||||||
|
void SetURL(const wxString& url);
|
||||||
|
|
||||||
// override to set m_textFormat
|
// override to set m_textFormat
|
||||||
virtual bool SetData(const wxDataFormat& format,
|
virtual bool SetData(const wxDataFormat& format,
|
||||||
size_t len,
|
size_t len,
|
||||||
|
@@ -109,7 +109,10 @@ public:
|
|||||||
// URLs can't be moved, only copied
|
// URLs can't be moved, only copied
|
||||||
virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
|
virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
|
||||||
wxDragResult def)
|
wxDragResult def)
|
||||||
{ return def == wxDragMove ? wxDragCopy : def; }
|
{
|
||||||
|
return wxDragLink; // At least IE 5.x needs wxDragLink, the
|
||||||
|
// other browsers on MSW seem okay with it too.
|
||||||
|
}
|
||||||
|
|
||||||
// translate this to calls to OnDropURL() just for convenience
|
// translate this to calls to OnDropURL() just for convenience
|
||||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
|
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
|
||||||
@@ -1462,7 +1465,7 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
|
|||||||
const wxString choices[] = { wxT("None"), wxT("Triangle"),
|
const wxString choices[] = { wxT("None"), wxT("Triangle"),
|
||||||
wxT("Rectangle"), wxT("Ellipse") };
|
wxT("Rectangle"), wxT("Ellipse") };
|
||||||
|
|
||||||
m_radio = new wxRadioBox( this, -1, wxT("&Shape"),
|
m_radio = new wxRadioBox( this, -1, wxT("&Shape"),
|
||||||
wxDefaultPosition, wxDefaultSize, 4, choices, 4,
|
wxDefaultPosition, wxDefaultSize, 4, choices, 4,
|
||||||
wxRA_SPECIFY_COLS );
|
wxRA_SPECIFY_COLS );
|
||||||
shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 );
|
shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 );
|
||||||
@@ -1472,32 +1475,32 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
|
|||||||
wxStaticBox* box = new wxStaticBox( this, -1, wxT("&Attributes") );
|
wxStaticBox* box = new wxStaticBox( this, -1, wxT("&Attributes") );
|
||||||
wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL );
|
wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL );
|
||||||
wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 4, 2 );
|
wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 4, 2 );
|
||||||
|
|
||||||
wxStaticText* st;
|
wxStaticText* st;
|
||||||
|
|
||||||
st = new wxStaticText( this, -1, wxT("Position &X:") );
|
st = new wxStaticText( this, -1, wxT("Position &X:") );
|
||||||
m_textX = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
m_textX = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
||||||
wxSize( 30, 20 ) );
|
wxSize( 30, 20 ) );
|
||||||
xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
|
xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
|
||||||
xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 );
|
xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 );
|
||||||
|
|
||||||
st = new wxStaticText( this, -1, wxT("Size &width:") );
|
st = new wxStaticText( this, -1, wxT("Size &width:") );
|
||||||
m_textW = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
m_textW = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
||||||
wxSize( 30, 20 ) );
|
wxSize( 30, 20 ) );
|
||||||
xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
|
xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
|
||||||
xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 );
|
xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 );
|
||||||
|
|
||||||
st = new wxStaticText( this, -1, wxT("&Y:") );
|
st = new wxStaticText( this, -1, wxT("&Y:") );
|
||||||
m_textY = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
m_textY = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
||||||
wxSize( 30, 20 ) );
|
wxSize( 30, 20 ) );
|
||||||
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
|
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
|
||||||
xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 );
|
xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 );
|
||||||
|
|
||||||
st = new wxStaticText( this, -1, wxT("&height:") );
|
st = new wxStaticText( this, -1, wxT("&height:") );
|
||||||
m_textH = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
m_textH = new wxTextCtrl( this, -1, wxEmptyString, wxDefaultPosition,
|
||||||
wxSize( 30, 20 ) );
|
wxSize( 30, 20 ) );
|
||||||
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
|
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
|
||||||
xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 );
|
xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 );
|
||||||
|
|
||||||
wxButton* col = new wxButton( this, Button_Colour, wxT("&Colour...") );
|
wxButton* col = new wxButton( this, Button_Colour, wxT("&Colour...") );
|
||||||
attrSizer->Add( xywhSizer, 1, wxGROW );
|
attrSizer->Add( xywhSizer, 1, wxGROW );
|
||||||
|
@@ -1109,8 +1109,8 @@ wxURLDataObject::wxURLDataObject()
|
|||||||
// we support CF_TEXT and CFSTR_SHELLURL formats which are basicly the same
|
// we support CF_TEXT and CFSTR_SHELLURL formats which are basicly the same
|
||||||
// but it seems that some browsers only provide one of them so we have to
|
// but it seems that some browsers only provide one of them so we have to
|
||||||
// support both
|
// support both
|
||||||
Add(new CFSTR_SHELLURLDataObject());
|
|
||||||
Add(new wxTextDataObject);
|
Add(new wxTextDataObject);
|
||||||
|
Add(new CFSTR_SHELLURLDataObject());
|
||||||
|
|
||||||
// we don't have any data yet
|
// we don't have any data yet
|
||||||
m_dataObjectLast = NULL;
|
m_dataObjectLast = NULL;
|
||||||
@@ -1135,12 +1135,18 @@ wxString wxURLDataObject::GetURL() const
|
|||||||
|
|
||||||
size_t len = m_dataObjectLast->GetDataSize();
|
size_t len = m_dataObjectLast->GetDataSize();
|
||||||
|
|
||||||
m_dataObjectLast->GetDataHere(url.GetWriteBuf(len + 1));
|
m_dataObjectLast->GetDataHere(url.GetWriteBuf(len));
|
||||||
url.UngetWriteBuf();
|
url.UngetWriteBuf();
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxURLDataObject::SetURL(const wxString& url)
|
||||||
|
{
|
||||||
|
SetData(wxDataFormat(wxDF_TEXT), url.Length()+1, url.c_str());
|
||||||
|
SetData(wxDataFormat(CFSTR_SHELLURL), url.Length()+1, url.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private functions
|
// private functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -484,6 +484,9 @@ static wxDragResult ConvertDragEffectToResult(DWORD dwEffect)
|
|||||||
case DROPEFFECT_COPY:
|
case DROPEFFECT_COPY:
|
||||||
return wxDragCopy;
|
return wxDragCopy;
|
||||||
|
|
||||||
|
case DROPEFFECT_LINK:
|
||||||
|
return wxDragLink;
|
||||||
|
|
||||||
case DROPEFFECT_MOVE:
|
case DROPEFFECT_MOVE:
|
||||||
return wxDragMove;
|
return wxDragMove;
|
||||||
|
|
||||||
@@ -502,6 +505,9 @@ static DWORD ConvertDragResultToEffect(wxDragResult result)
|
|||||||
case wxDragCopy:
|
case wxDragCopy:
|
||||||
return DROPEFFECT_COPY;
|
return DROPEFFECT_COPY;
|
||||||
|
|
||||||
|
case wxDragLink:
|
||||||
|
return DROPEFFECT_LINK;
|
||||||
|
|
||||||
case wxDragMove:
|
case wxDragMove:
|
||||||
return DROPEFFECT_MOVE;
|
return DROPEFFECT_MOVE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user