virtual void SelectAll();
virtual wxString GetSelectedText();
virtual wxString GetSelectedSource();
+ virtual void ClearSelection();
/** FIXME: hack to work around signals being received too early */
bool m_ready;
virtual void DeleteSelection();
virtual wxString GetSelectedText();
virtual wxString GetSelectedSource();
+ virtual void ClearSelection();
// ---- IE-specific methods
virtual void SelectAll() {};
virtual wxString GetSelectedText();
virtual wxString GetSelectedSource() { return ""; }
+ virtual void ClearSelection() {}
// ---- methods not from the parent (common) interface
wxString RunScript(const wxString& javascript);
virtual void DeleteSelection() = 0;
virtual wxString GetSelectedText() = 0;
virtual wxString GetSelectedSource() = 0;
+ virtual void ClearSelection() = 0;
// TODO:
// void EnableJavascript(bool enabled); // maybe?
@name Selection
*/
+ /**
+ Clears the current selection.
+ */
+ virtual void ClearSelection() = 0;
+
/**
Deletes the current selection. Note that for @c wxWEB_VIEW_BACKEND_WEBKIT
the selection must be editable, either through SetEditable or the
wxConvUTF8);
}
+void wxWebViewWebKit::ClearSelection()
+{
+ WebKitDOMDocument* doc;
+ WebKitDOMDOMWindow* win;
+ WebKitDOMDOMSelection* sel;
+
+ doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view));
+ win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+ sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+ webkit_dom_dom_selection_remove_all_ranges(WEBKIT_DOM_DOM_SELECTION(sel));
+
+}
+
wxString wxWebViewWebKit::GetPageText()
{
WebKitDOMDocument* doc;
return selected;
}
+void wxWebViewIE::ClearSelection()
+{
+ IHTMLDocument2* document = GetDocument();
+ IHTMLSelectionObject* selection;
+ wxString selected;
+ HRESULT hr = document->get_selection(&selection);
+ if(SUCCEEDED(hr))
+ {
+ selection->empty();
+ selection->Release();
+ }
+ document->Release();
+}
+
wxString wxWebViewIE::GetPageText()
{
IHTMLDocument2* document = GetDocument();
//We lower case the result as ie returns tags in uppercase
CPPUNIT_ASSERT_EQUAL("some <strong>strong</strong> text",
m_browser->GetSelectedSource().Lower());
+
+ m_browser->ClearSelection();
+ CPPUNIT_ASSERT(!m_browser->HasSelection());
}
void WebTestCase::Zoom()