![]() |
![]() |
![]() |
WebKitGTK+ Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum WebKitNavigationResponse; enum WebKitWebViewTargetInfo; WebKitWebView; gboolean webkit_web_view_can_copy_clipboard (WebKitWebView *web_view
); gboolean webkit_web_view_can_cut_clipboard (WebKitWebView *web_view
); gboolean webkit_web_view_can_go_back (WebKitWebView *web_view
); gboolean webkit_web_view_can_go_back_or_forward (WebKitWebView *web_view
,gint steps
); gboolean webkit_web_view_can_go_forward (WebKitWebView *web_view
); gboolean webkit_web_view_can_paste_clipboard (WebKitWebView *web_view
); gboolean webkit_web_view_can_redo (WebKitWebView *webView
); gboolean webkit_web_view_can_show_mime_type (WebKitWebView *web_view
,const gchar *mime_type
); gboolean webkit_web_view_can_undo (WebKitWebView *webView
); void webkit_web_view_copy_clipboard (WebKitWebView *web_view
); void webkit_web_view_cut_clipboard (WebKitWebView *web_view
); void webkit_web_view_delete_selection (WebKitWebView *web_view
); void webkit_web_view_execute_script (WebKitWebView *web_view
,const gchar *script
); WebKitWebBackForwardList * webkit_web_view_get_back_forward_list (WebKitWebView *web_view
); GtkTargetList * webkit_web_view_get_copy_target_list (WebKitWebView *web_view
); const char * webkit_web_view_get_custom_encoding (WebKitWebView *webView
); gboolean webkit_web_view_get_editable (WebKitWebView *web_view
); const gchar * webkit_web_view_get_encoding (WebKitWebView *webView
); WebKitWebFrame * webkit_web_view_get_focused_frame (WebKitWebView *web_view
); gboolean webkit_web_view_get_full_content_zoom (WebKitWebView *web_view
); WebKitHitTestResult * webkit_web_view_get_hit_test_result (WebKitWebView *webView
,GdkEventButton *event
); const gchar * webkit_web_view_get_icon_uri (WebKitWebView *webView
); WebKitWebInspector * webkit_web_view_get_inspector (WebKitWebView *web_view
); WebKitLoadStatus webkit_web_view_get_load_status (WebKitWebView *web_view
); WebKitWebFrame * webkit_web_view_get_main_frame (WebKitWebView *web_view
); GtkTargetList * webkit_web_view_get_paste_target_list (WebKitWebView *web_view
); gdouble webkit_web_view_get_progress (WebKitWebView *web_view
); WebKitWebSettings * webkit_web_view_get_settings (WebKitWebView *web_view
); const gchar * webkit_web_view_get_title (WebKitWebView *web_view
); gboolean webkit_web_view_get_transparent (WebKitWebView *web_view
); const gchar * webkit_web_view_get_uri (WebKitWebView *web_view
); gboolean webkit_web_view_get_view_source_mode (WebKitWebView *web_view
); gfloat webkit_web_view_get_zoom_level (WebKitWebView *web_view
); void webkit_web_view_go_back (WebKitWebView *web_view
); void webkit_web_view_go_back_or_forward (WebKitWebView *web_view
,gint steps
); void webkit_web_view_go_forward (WebKitWebView *web_view
); gboolean webkit_web_view_go_to_back_forward_item (WebKitWebView *web_view
,WebKitWebHistoryItem *item
); gboolean webkit_web_view_has_selection (WebKitWebView *web_view
); void webkit_web_view_load_html_string (WebKitWebView *web_view
,const gchar *content
,const gchar *base_uri
); void webkit_web_view_load_request (WebKitWebView *web_view
,WebKitNetworkRequest *request
); void webkit_web_view_load_string (WebKitWebView *web_view
,const gchar *content
,const gchar *mime_type
,const gchar *encoding
,const gchar *base_uri
); void webkit_web_view_load_uri (WebKitWebView *web_view
,const gchar *uri
); guint webkit_web_view_mark_text_matches (WebKitWebView *web_view
,const gchar *string
,gboolean case_sensitive
,guint limit
); void webkit_web_view_move_cursor (WebKitWebView *webView
,GtkMovementStep step
,gint count
); GtkWidget * webkit_web_view_new (void
); void webkit_web_view_open (WebKitWebView *web_view
,const gchar *uri
); void webkit_web_view_paste_clipboard (WebKitWebView *web_view
); void webkit_web_view_redo (WebKitWebView *webView
); void webkit_web_view_reload (WebKitWebView *web_view
); void webkit_web_view_reload_bypass_cache (WebKitWebView *web_view
); gboolean webkit_web_view_search_text (WebKitWebView *web_view
,const gchar *text
,gboolean case_sensitive
,gboolean forward
,gboolean wrap
); void webkit_web_view_select_all (WebKitWebView *web_view
); void webkit_web_view_set_custom_encoding (WebKitWebView *webView
,const gchar *encoding
); void webkit_web_view_set_editable (WebKitWebView *web_view
,gboolean flag
); void webkit_web_view_set_full_content_zoom (WebKitWebView *web_view
,gboolean full_content_zoom
); void webkit_web_view_set_highlight_text_matches (WebKitWebView *web_view
,gboolean highlight
); void webkit_web_view_set_maintains_back_forward_list (WebKitWebView *web_view
,gboolean flag
); void webkit_web_view_set_settings (WebKitWebView *web_view
,WebKitWebSettings *settings
); void webkit_web_view_set_transparent (WebKitWebView *web_view
,gboolean flag
); void webkit_web_view_set_view_source_mode (WebKitWebView *web_view
,gboolean view_source_mode
); void webkit_web_view_set_zoom_level (WebKitWebView *web_view
,gfloat zoom_level
); void webkit_web_view_stop_loading (WebKitWebView *web_view
); GType webkit_web_view_target_info_get_type (void
); void webkit_web_view_undo (WebKitWebView *webView
); void webkit_web_view_unmark_text_matches (WebKitWebView *web_view
); void webkit_web_view_zoom_in (WebKitWebView *web_view
); void webkit_web_view_zoom_out (WebKitWebView *web_view
); WebKitWebWindowFeatures * webkit_web_view_get_window_features (WebKitWebView *web_view
);
WebKitWebView is the central class of the WebKitGTK+ API. It is a GtkWidget implementing the scrolling interface which means you can embed in a GtkScrolledWindow. It is responsible for managing the drawing of the content, forwarding of events. You can load any URI into the WebKitWebView or any kind of data string. With WebKitWebSettings you can control various aspects of the rendering and loading of the content. Each WebKitWebView has exactly one WebKitWebFrame as main frame. A WebKitWebFrame can have n children.
/* Create the widgets */ GtkWidget *main_window = gtk_window_new (GTK_WIDGET_TOPLEVEL); GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); GtkWidget *web_view = webkit_web_view_new (); /* Place the WebKitWebView in the GtkScrolledWindow */ gtk_container_add (GTK_CONTAINER (scrolled_window), web_view); gtk_container_add (GTK_CONTAINER (main_window), scrolled_window); /* Open a webpage */ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org"); /* Show the result */ gtk_window_set_default_size (GTK_WINDOW (main_window), 800, 600); gtk_widget_show_all (main_window);
typedef enum { WEBKIT_NAVIGATION_RESPONSE_ACCEPT, WEBKIT_NAVIGATION_RESPONSE_IGNORE, WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD } WebKitNavigationResponse;
typedef enum { WEBKIT_WEB_VIEW_TARGET_INFO_HTML, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT, WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE, WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST, WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL } WebKitWebViewTargetInfo;
gboolean webkit_web_view_can_copy_clipboard (WebKitWebView *web_view
);
|
|
Returns : |
gboolean webkit_web_view_can_cut_clipboard (WebKitWebView *web_view
);
|
|
Returns : |
gboolean webkit_web_view_can_go_back (WebKitWebView *web_view
);
Determines whether web_view has a previous history item.
|
a WebKitWebView |
Returns : |
TRUE if able to move back, FALSE otherwise
|
gboolean webkit_web_view_can_go_back_or_forward (WebKitWebView *web_view
,gint steps
);
Determines whether web_view has a history item of steps
. Negative values
represent steps backward while positive values represent steps forward.
|
a WebKitWebView |
|
the number of steps |
Returns : |
TRUE if able to move back or forward the given number of
steps, FALSE otherwise
|
gboolean webkit_web_view_can_go_forward (WebKitWebView *web_view
);
Determines whether web_view has a next history item.
|
a WebKitWebView |
Returns : |
TRUE if able to move forward, FALSE otherwise
|
gboolean webkit_web_view_can_paste_clipboard (WebKitWebView *web_view
);
|
|
Returns : |
gboolean webkit_web_view_can_redo (WebKitWebView *webView
);
Determines whether or not it is currently possible to redo the last editing command in the view.
|
|
Returns : |
TRUE if a redo can be done, FALSE if not
|
Since 1.1.14
gboolean webkit_web_view_can_show_mime_type (WebKitWebView *web_view
,const gchar *mime_type
);
This functions returns whether or not a MIME type can be displayed using this view.
|
a WebKitWebView |
|
a MIME type |
Returns : |
a gboolean indicating if the MIME type can be displayed |
Since 1.0.3
gboolean webkit_web_view_can_undo (WebKitWebView *webView
);
Determines whether or not it is currently possible to undo the last editing command in the view.
|
|
Returns : |
TRUE if a undo can be done, FALSE if not
|
Since 1.1.14
void webkit_web_view_copy_clipboard (WebKitWebView *web_view
);
Copies the current selection inside the web_view
to the clipboard.
|
a WebKitWebView |
void webkit_web_view_cut_clipboard (WebKitWebView *web_view
);
Cuts the current selection inside the web_view
to the clipboard.
|
a WebKitWebView |
void webkit_web_view_delete_selection (WebKitWebView *web_view
);
Deletes the current selection inside the web_view
.
|
a WebKitWebView |
void webkit_web_view_execute_script (WebKitWebView *web_view
,const gchar *script
);
|
|
|
WebKitWebBackForwardList * webkit_web_view_get_back_forward_list
(WebKitWebView *web_view
);
Returns a WebKitWebBackForwardList
|
a WebKitWebView |
Returns : |
the WebKitWebBackForwardList |
GtkTargetList * webkit_web_view_get_copy_target_list
(WebKitWebView *web_view
);
This function returns the list of targets this WebKitWebView can
provide for clipboard copying and as DND source. The targets in the list are
added with values from the WebKitWebViewTargetInfo enum,
using gtk_target_list_add()
and
gtk_target_list_add_text_targets()
.
|
a WebKitWebView |
Returns : |
the GtkTargetList |
const char * webkit_web_view_get_custom_encoding (WebKitWebView *webView
);
Returns the current encoding of the WebKitWebView, not the default-encoding of WebKitWebSettings.
|
|
Returns : |
a string containing the current custom encoding for web_view , or NULL if there's none set.
|
Since 1.1.1
gboolean webkit_web_view_get_editable (WebKitWebView *web_view
);
Returns whether the user is allowed to edit the document.
Returns TRUE
if web_view
allows the user to edit the HTML document, FALSE
if
it doesn't. You can change web_view
's document programmatically regardless of
this setting.
|
a WebKitWebView |
Returns : |
a gboolean indicating the editable state |
const gchar * webkit_web_view_get_encoding (WebKitWebView *webView
);
Returns the default encoding of the WebKitWebView.
|
|
Returns : |
the default encoding |
Since 1.1.1
WebKitWebFrame * webkit_web_view_get_focused_frame (WebKitWebView *web_view
);
Returns the frame that has focus or an active text selection.
|
a WebKitWebView |
Returns : |
The focused WebKitWebFrame or NULL if no frame is focused
|
gboolean webkit_web_view_get_full_content_zoom
(WebKitWebView *web_view
);
Returns whether the zoom level affects only text or all elements.
|
a WebKitWebView |
Returns : |
FALSE if only text should be scaled (the default),
TRUE if the full content of the view should be scaled.
|
Since 1.0.1
WebKitHitTestResult * webkit_web_view_get_hit_test_result (WebKitWebView *webView
,GdkEventButton *event
);
Does a 'hit test' in the coordinates specified by event
to figure
out context information about that position in the webView
.
|
a WebKitWebView |
|
a GdkEventButton |
Returns : |
a newly created WebKitHitTestResult with the context of the specified position. |
Since 1.1.15
const gchar * webkit_web_view_get_icon_uri (WebKitWebView *webView
);
Obtains the URI for the favicon for the given WebKitWebView, or
NULL
if there is none.
|
|
Returns : |
the URI for the favicon, or NULL
|
Since 1.1.18
WebKitWebInspector * webkit_web_view_get_inspector (WebKitWebView *web_view
);
Obtains the WebKitWebInspector associated with the WebKitWebView. Every WebKitWebView object has a WebKitWebInspector object attached to it as soon as it is created, so this function will only return NULL if the argument is not a valid WebKitWebView.
|
a WebKitWebView |
Returns : |
the WebKitWebInspector instance associated with the
WebKitWebView; NULL is only returned if the argument is not a
valid WebKitWebView.
|
Since 1.0.3
WebKitLoadStatus webkit_web_view_get_load_status (WebKitWebView *web_view
);
Determines the current status of the load.
|
a WebKitWebView |
Returns : |
Since 1.1.7
WebKitWebFrame * webkit_web_view_get_main_frame (WebKitWebView *web_view
);
|
|
Returns : |
GtkTargetList * webkit_web_view_get_paste_target_list
(WebKitWebView *web_view
);
This function returns the list of targets this WebKitWebView can
provide for clipboard pasting and as DND destination. The targets in the list are
added with values from the WebKitWebViewTargetInfo enum,
using gtk_target_list_add()
and
gtk_target_list_add_text_targets()
.
|
a WebKitWebView |
Returns : |
the GtkTargetList |
gdouble webkit_web_view_get_progress (WebKitWebView *web_view
);
Determines the current progress of the load.
|
a WebKitWebView |
Returns : |
Since 1.1.7
WebKitWebSettings * webkit_web_view_get_settings (WebKitWebView *web_view
);
|
|
Returns : |
const gchar * webkit_web_view_get_title (WebKitWebView *web_view
);
Returns the web_view
's document title
|
a WebKitWebView |
Returns : |
the title of web_view
|
Since 1.1.4
gboolean webkit_web_view_get_transparent (WebKitWebView *web_view
);
Returns whether the WebKitWebView has a transparent background.
|
a WebKitWebView |
Returns : |
FALSE when the WebKitWebView draws a solid background
(the default), otherwise TRUE .
|
const gchar * webkit_web_view_get_uri (WebKitWebView *web_view
);
Returns the current URI of the contents displayed by the web_view
|
a WebKitWebView |
Returns : |
the URI of web_view
|
Since 1.1.4
gboolean webkit_web_view_get_view_source_mode
(WebKitWebView *web_view
);
|
a WebKitWebView |
Returns : |
TRUE if web_view is in view source mode, FALSE otherwise.
|
Since 1.1.14
gfloat webkit_web_view_get_zoom_level (WebKitWebView *web_view
);
Returns the zoom level of web_view
, i.e. the factor by which elements in
the page are scaled with respect to their original size.
If the "full-content-zoom" property is set to FALSE
(the default)
the zoom level changes the text size, or if TRUE
, scales all
elements in the page.
|
a WebKitWebView |
Returns : |
the zoom level of web_view
|
Since 1.0.1
void webkit_web_view_go_back (WebKitWebView *web_view
);
Loads the previous history item.
|
a WebKitWebView |
void webkit_web_view_go_back_or_forward (WebKitWebView *web_view
,gint steps
);
Loads the history item that is the number of steps
away from the current
item. Negative values represent steps backward while positive values
represent steps forward.
|
a WebKitWebView |
|
the number of steps |
void webkit_web_view_go_forward (WebKitWebView *web_view
);
Loads the next history item.
|
a WebKitWebView |
gboolean webkit_web_view_go_to_back_forward_item (WebKitWebView *web_view
,WebKitWebHistoryItem *item
);
Go to the specified WebKitWebHistoryItem
|
a WebKitWebView |
|
a WebKitWebHistoryItem* |
Returns : |
TRUE if loading of item is successful, FALSE if not
|
gboolean webkit_web_view_has_selection (WebKitWebView *web_view
);
Determines whether text was selected.
|
a WebKitWebView |
Returns : |
TRUE if there is selected text, FALSE if not
|
void webkit_web_view_load_html_string (WebKitWebView *web_view
,const gchar *content
,const gchar *base_uri
);
webkit_web_view_load_html_string
has been deprecated since version 1.1.1 and should not be used in newly-written code. Use webkit_web_view_load_string()
instead.
Requests loading of the given content
with the specified base_uri
.
|
a WebKitWebView |
|
an URI string |
|
the base URI for relative locations |
void webkit_web_view_load_request (WebKitWebView *web_view
,WebKitNetworkRequest *request
);
Requests loading of the specified asynchronous client request.
Creates a provisional data source that will transition to a committed data
source once any data has been received. Use webkit_web_view_stop_loading()
to
stop the load.
|
a WebKitWebView |
|
a WebKitNetworkRequest |
Since 1.1.1
void webkit_web_view_load_string (WebKitWebView *web_view
,const gchar *content
,const gchar *mime_type
,const gchar *encoding
,const gchar *base_uri
);
|
|
|
|
|
|
|
|
|
void webkit_web_view_load_uri (WebKitWebView *web_view
,const gchar *uri
);
Requests loading of the specified URI string.
|
a WebKitWebView |
|
an URI string |
Since 1.1.1
guint webkit_web_view_mark_text_matches (WebKitWebView *web_view
,const gchar *string
,gboolean case_sensitive
,guint limit
);
Attempts to highlight all occurances of string inside web_view.
|
a WebKitWebView |
|
a string to look for |
|
whether to respect the case of text |
|
the maximum number of strings to look for or 0 for all |
Returns : |
the number of strings highlighted |
void webkit_web_view_move_cursor (WebKitWebView *webView
,GtkMovementStep step
,gint count
);
Move the cursor in view
as described by step
and count
.
|
|
|
a GtkMovementStep |
|
integer describing the direction of the movement. 1 for forward, -1 for backwards. |
Since 1.1.4
void webkit_web_view_open (WebKitWebView *web_view
,const gchar *uri
);
webkit_web_view_open
has been deprecated since version 1.1.1 and should not be used in newly-written code. Use webkit_web_view_load_uri()
instead.
Requests loading of the specified URI string.
|
a WebKitWebView |
|
an URI |
void webkit_web_view_paste_clipboard (WebKitWebView *web_view
);
Pastes the current contents of the clipboard to the web_view
.
|
a WebKitWebView |
void webkit_web_view_redo (WebKitWebView *webView
);
Redoes the last editing command in the view, if possible.
|
Since 1.1.14
void webkit_web_view_reload_bypass_cache (WebKitWebView *web_view
);
Reloads the web_view
without using any cached data.
|
a WebKitWebView |
Since 1.0.3
gboolean webkit_web_view_search_text (WebKitWebView *web_view
,const gchar *text
,gboolean case_sensitive
,gboolean forward
,gboolean wrap
);
Looks for a specified string inside web_view.
|
a WebKitWebView |
|
a string to look for |
|
whether to respect the case of text |
|
whether to find forward or not |
|
whether to continue looking at the beginning after reaching the end |
Returns : |
TRUE on success or FALSE on failure
|
void webkit_web_view_select_all (WebKitWebView *web_view
);
Attempts to select everything inside the web_view
.
|
a WebKitWebView |
void webkit_web_view_set_custom_encoding (WebKitWebView *webView
,const gchar *encoding
);
Sets the current WebKitWebView encoding, without modifying the default one, and reloads the page.
|
|
|
the new encoding, or NULL to restore the default encoding
|
Since 1.1.1
void webkit_web_view_set_editable (WebKitWebView *web_view
,gboolean flag
);
Sets whether web_view
allows the user to edit its HTML document.
If flag
is TRUE
, web_view
allows the user to edit the document. If flag
is
FALSE
, an element in web_view
's document can only be edited if the
CONTENTEDITABLE attribute has been set on the element or one of its parent
elements. You can change web_view
's document programmatically regardless of
this setting. By default a WebKitWebView is not editable.
Normally, an HTML document is not editable unless the elements within the document are editable. This function provides a low-level way to make the contents of a WebKitWebView editable without altering the document or DOM structure.
|
a WebKitWebView |
|
a gboolean indicating the editable state |
void webkit_web_view_set_full_content_zoom (WebKitWebView *web_view
,gboolean full_content_zoom
);
Sets whether the zoom level affects only text or all elements.
|
a WebKitWebView |
|
FALSE if only text should be scaled (the default),
TRUE if the full content of the view should be scaled.
|
Since 1.0.1
void webkit_web_view_set_highlight_text_matches (WebKitWebView *web_view
,gboolean highlight
);
Highlights text matches previously marked by webkit_web_view_mark_text_matches.
|
a WebKitWebView |
|
whether to highlight text matches |
void webkit_web_view_set_maintains_back_forward_list (WebKitWebView *web_view
,gboolean flag
);
Set the view to maintain a back or forward list of history items.
|
a WebKitWebView |
|
to tell the view to maintain a back or forward list |
void webkit_web_view_set_settings (WebKitWebView *web_view
,WebKitWebSettings *settings
);
|
|
|
void webkit_web_view_set_transparent (WebKitWebView *web_view
,gboolean flag
);
Sets whether the WebKitWebView has a transparent background.
Pass FALSE
to have the WebKitWebView draw a solid background
(the default), otherwise TRUE
.
|
a WebKitWebView |
|
void webkit_web_view_set_view_source_mode (WebKitWebView *web_view
,gboolean view_source_mode
);
Set whether the view should be in view source mode. Setting this mode to
TRUE
before loading a URI will display the source of the web page in a
nice and readable format.
|
a WebKitWebView |
|
the mode to turn on or off view source mode |
Since 1.1.14
void webkit_web_view_set_zoom_level (WebKitWebView *web_view
,gfloat zoom_level
);
Sets the zoom level of web_view
, i.e. the factor by which elements in
the page are scaled with respect to their original size.
If the "full-content-zoom" property is set to FALSE
(the default)
the zoom level changes the text size, or if TRUE
, scales all
elements in the page.
|
a WebKitWebView |
|
the new zoom level |
Since 1.0.1
void webkit_web_view_stop_loading (WebKitWebView *web_view
);
Stops any ongoing load in the webView
.
|
GType webkit_web_view_target_info_get_type
(void
);
Returns : |
void webkit_web_view_undo (WebKitWebView *webView
);
Undoes the last editing command in the view, if possible.
|
Since 1.1.14
void webkit_web_view_unmark_text_matches (WebKitWebView *web_view
);
Removes highlighting previously set by webkit_web_view_mark_text_matches.
|
a WebKitWebView |
void webkit_web_view_zoom_in (WebKitWebView *web_view
);
Increases the zoom level of web_view
. The current zoom
level is incremented by the value of the "zoom-step"
property of the WebKitWebSettings associated with web_view
.
|
a WebKitWebView |
Since 1.0.1
void webkit_web_view_zoom_out (WebKitWebView *web_view
);
Decreases the zoom level of web_view
. The current zoom
level is decremented by the value of the "zoom-step"
property of the WebKitWebSettings associated with web_view
.
|
a WebKitWebView |
Since 1.0.1
WebKitWebWindowFeatures * webkit_web_view_get_window_features
(WebKitWebView *web_view
);
Returns the instance of WebKitWebWindowFeatures held by the given WebKitWebView.
|
a WebKitWebView |
Returns : |
the WebKitWebWindowFeatures |
Since 1.0.3