Artifact Content

Artifact c06d25fb4a6c9e4270a7c0f9664bd74d8fa51bd3:

Wiki page [Creating Windows] by murphy 2011-10-02 13:32:15.
D 2011-10-02T13:32:15.913
L Creating\sWindows
P 3973ed439782cea8f0ff2aa4b1aa74cb7e57d820
U murphy
W 3531
<h1>Creating Windows</h1>

A single procedure is used to control the creation and setup of windows with a WebKit view:

  (make-window URI/CONTENT
               [#:universal-access-from-file-uris? UNIVERSAL-ACCESS-FROM-FILE-URIS?]
               [#:file-access-from-file-uris? FILE-ACCESS-FROM-FILE-URIS?]
               [#:spell-checking? SPELL-CHECKING?]
               [#:clipboard-access? CLIPBOARD-ACCESS?]
               [#:developer-extras? DEVELOPER-EXTRAS?]
               [#:width WIDTH]
               [#:height HEIGHT]
               [#:scrollbar-visible? SCROLLBAR-VISIBLE?]
               [#:status-visible? STATUS-VISIBLE?]
               [#:fullscreen? FULLSCREEN?]
               [#:initialize! INITIALIZE!]
               [#:yield-interval YIELD-INTERVAL]
               [#:timeout TIMEOUT])

The procedure takes the following steps:

  #  A new Gtk+ window is created, which contains a scrolled WebKit view and a status bar.
  #  The WebKit view is initialized using the parameters <tt>UNIVERSAL-ACCESS-FROM-FILE-URIS?</tt> (default <tt>#f</tt>), <tt>FILE-ACCESS-FROM-FILE-URIS?</tt> (default <tt>#f</tt>), <tt>SPELL-CHECKING?</tt> (default <tt>#t</tt>), <tt>CLIPBOARD-ACCESS?</tt> (default <tt>#f</tt>) and <tt>DEVELOPER-EXTRAS?</tt> (default <tt>#f</tt>). The exact meaning of these parameters is documented in the [http://webkitgtk.org/reference/index.html|WebKitGTK+ Reference Manual].
  #  The window around the WebKit view is initialized using the parameters <tt>WIDTH</tt> (default <tt>-1</tt> or "natural" size), <tt>HEIGHT</tt> (default <tt>-1</tt> or "natural" size) and <tt>FULLSCREEN?</tt> (default <tt>#f</tt>), the scrollbars around the WebKit view are enabled iff <tt>SCROLLBAR-VISIBLE?</tt> is true (default <tt>#t</tt>) and the status bar below the WebKit view is shown iff <tt>STATUS-VISIBLE?</tt> is true (default <tt>#t</tt>).
  #  Content is loaded into the WebKit view as specified by <tt>URI/CONTENT</tt> — if this parameter is a string, it is used as a URI, otherwise it must be a list of the form <verbatim>(CONTENT [#:mime-type MIME-TYPE] [#:encoding ENCODING] [#:base-uri BASE-URI])</verbatim> where <tt>CONTENT</tt> is a string and the optional arguments <tt>MIME-TYPE</tt> (default <tt>#f</tt>), <tt>ENCODING</tt> (default <tt>#f</tt>) and <tt>BASE-URI</tt> (default <tt>#f</tt>) determine how the content is interpreted.
  #  It is ensured that the new window becomes visible.
  #  If <tt>INITIALIZE!</tt> is <tt>#f</tt> (the default), <tt>make-window</tt> enters the Gtk+ main loop and waits for the WebKit view to initialize a JavaScript context for its content document. If that happens, the main loop is terminated and <tt>make-window</tt> returns the wrapped DOM window object of the loaded document. If the <tt>TIMEOUT</tt> (default <tt>#f</tt>) expires before that happens, <tt>make-window</tt> returns <tt>#f</tt>. The <tt>TIMEOUT</tt> can be a number of seconds or a SRFI-18 time object. The <tt>YIELD-INTERVAL</tt> (default <tt>0.5</tt>) is passed on to the main loop.
  #  If <tt>INITIALIZE!</tt> is true, it is applied to the wrapped DOM window object of the loaded document when it becomes available and the main loop is running. <tt>make-window</tt> simply returns <tt>#f</tt> in that case without waiting for this condition.

For information how to use the wrapped window object, see [Dealing with JavaScript Objects], for information about the Gtk+ main loop see [Running the Main Loop].

Z ed9c5e0daf96af2bb826a63f55c0023e