Add support for retrieving the currently selected text. Implement on all backends, document and unit test.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -584,6 +584,35 @@ void wxWebViewIE::DeleteSelection()
|
||||
ExecCommand("Delete");
|
||||
}
|
||||
|
||||
wxString wxWebViewIE::GetSelectedText()
|
||||
{
|
||||
IHTMLDocument2* document = GetDocument();
|
||||
IHTMLSelectionObject* selection;
|
||||
wxString selected;
|
||||
HRESULT hr = document->get_selection(&selection);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
IDispatch* disrange;
|
||||
hr = selection->createRange(&disrange);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
IHTMLTxtRange* range;
|
||||
hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
BSTR text;
|
||||
range->get_text(&text);
|
||||
selected = wxString(text);
|
||||
range->Release();
|
||||
}
|
||||
disrange->Release();
|
||||
}
|
||||
selection->Release();
|
||||
}
|
||||
document->Release();
|
||||
return selected;
|
||||
}
|
||||
|
||||
bool wxWebViewIE::CanExecCommand(wxString command)
|
||||
{
|
||||
IHTMLDocument2* document = GetDocument();
|
||||
|
||||
Reference in New Issue
Block a user