virtual void SetEditable(bool enable = true);
virtual bool IsEditable();
+ //Selection
+ virtual void DeleteSelection();
+ virtual bool HasSelection();
+ virtual void SelectAll();
+
/** FIXME: hack to work around signals being received too early */
bool m_ready;
virtual void SetEditable(bool enable = true);
virtual bool IsEditable();
+ //Selection
+ virtual void SelectAll();
+ virtual bool HasSelection();
+ virtual void DeleteSelection();
+
+
// ---- IE-specific methods
// FIXME: I seem to be able to access remote webpages even in offline mode...
virtual void Paste();
//Editing functions
- void SetEditable(bool enable = true);
- bool IsEditable();
+ virtual void SetEditable(bool enable = true);
+ virtual bool IsEditable();
+
+ //Selection
+ virtual void DeleteSelection();
+ virtual bool HasSelection() { return false };
+ virtual void SelectAll() {};
// ---- methods not from the parent (common) interface
wxString GetSelectedText();
virtual void SetEditable(bool enable = true) = 0;
virtual bool IsEditable() = 0;
+ virtual void SelectAll() = 0;
+ virtual bool HasSelection() = 0;
+ virtual void DeleteSelection() = 0;
+
// TODO:
// wxString GetSelection(); // maybe?
// void SetSelection(...); // maybe?
Loads a history item.
*/
virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item) = 0;
+
+ /**
+ @name Selection
+ */
+
+ /**
+ Deletes the current selection. Note that for @c wxWEB_VIEW_BACKEND_WEBKIT
+ the selection must be editable, either through SetEditable or the
+ correct HTML attribute.
+ */
+ virtual void DeleteSelection() = 0;
+
+ /**
+ Returns @true if there is a current selection.
+ */
+ virtual bool HasSelection = 0;
+
+ /**
+ Selects the entire page.
+ */
+ virtual void SelectAll() = 0;
/**
@name Undo / Redo
return webkit_web_view_get_editable(WEBKIT_WEB_VIEW(web_view));
}
+void wxWebViewWebKit::DeleteSelection()
+{
+ webkit_web_view_delete_selection(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::HasSelection()
+{
+ return webkit_web_view_has_selection(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::SelectAll()
+{
+ webkit_web_view_select_all(WEBKIT_WEB_VIEW(web_view));
+}
+
+
// static
wxVisualAttributes
wxWebViewWebKit::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return false;
}
+void wxWebViewIE::SelectAll()
+{
+ ExecCommand("SelectAll");
+}
+
+bool wxWebViewIE::HasSelection()
+{
+ IHTMLDocument2* document = GetDocument();
+ IHTMLSelectionObject* selection;
+ document->get_selection(&selection);
+ BSTR type;
+ selection->get_type(&type);
+ return wxString(type) != "None";
+}
+
+void wxWebViewIE::DeleteSelection()
+{
+ ExecCommand("Delete");
+}
+
bool wxWebViewIE::CanExecCommand(wxString command)
{
IHTMLDocument2* document = GetDocument();
[(WebView*)m_webView paste];
}
+void wxWebViewWebKit::DeleteSelection()
+{
+ if ( !m_webView )
+ return;
+
+ [(WebView*)m_webView deleteSelection];
+}
+
//------------------------------------------------------------
// Listener interfaces
//------------------------------------------------------------