djnativeswing-clj.core
The core namespace of the DJ Native Swing wrapper of seesaw. Holds functions
for creating and manipulating DJ Native Swing widgets.
browser
(browser & {:keys [runtime options url decorator-factory], :as opts})
Creates a web browser widget. It supports the following options in addition
to the standard seesaw widget options.
:bars-visible? controls the visibility of the browser bars
:button-bar-visible? controls/queries the visibility of the button bar
:menu-bar-visible? controls/queries the visibility of the menu bar
:location-bar-visible? controls/queries the visibility of the location bar
:status-bar-visible? controls/queries the visibility of the status bar
:title queries the title of the web page
:authentication-handler sets the authentication handler of the widget
:html sets/queries the HTML content of the widget
:url sets/queries the URL of the current resource
:back-nav-enabled? queries whether the back navigation is enabled
:forward-nav-enabled? queries whether the forward navigation is enabled
:progress queries the loading percentage of the resource
The :authentication-handler option accepts either an instance of
chrriis.dj.nativeswing.swtimpl.components.WebBrowserAuthenticationHandler or
a function like (fn [browser location] ["username" "password"]) returning
the user credentials for the protected location accessed by the browser widget
or nil if the authentication is to be aborted.
Additionally, when constructing widgets with this function you can also
specify the following options:
:runtime the browser's runtime
:url the URL to be initially loaded by the widget
:decorator-factory the decorator factory for the supplementary GUI
:options additional options for DJ Native Swing
The :runtime option can take the values:
:xulrunner the component will use the XULRunner runtime
:webkit the component will use the WebKit runtime
To use XULRunner you need to install the XULRunner SDK (obtainable at
https://developer.mozilla.org/en-US/docs/Gecko_SDK#Downloading) and specify
the path to it. For this, you can either set the environment variable
XULRUNNER_HOME or the system property nativeswing.webbrowser.xulrunner.home.
See the documentation of the djnativeswing-clj.browser/load! and
djnativeswing-clj.browser/set-decorator-factory! functions for the values
accepted by the :url and :decorator-factory options respectively.
To configure the widget's native backend, you can pass a sequence of
chrriis.dj.nativeswing.NSOption instances through the :options option.
Browser widget support the following events:
:loading-progress
:status-change
:title-change
:location a common listener for :location-xyz events
:location-change-cancelled
:location-changing
:location-change
:window-closing
:window-opening
:window-will-open
See the documentation of the JWebBrowser class for the semantics of these events.
The native interface must be opened via open-native-interface! before browser
widgets are used.
Examples:
(browser)
(browser :runtime :xulrunner :url "http://www.google.com")
(browser :bars-visible? false
:html "<html><head><title>X</title></head><body></body>Y</html>")
See:
(djnativeswing-clj.core/open-native-interface!)
http://djproject.sourceforge.net/ns/documentation/javadoc/chrriis.dj.nativeswing.swtimpl.components.JWebBrowser
http://djproject.sourceforge.net/ns/documentation/javadoc/chrriis.dj.nativeswing.NSOption
http://djproject.sourceforge.net/ns/documentation/javadoc/chrriis.dj.nativeswing.swtimpl.components.WebBrowserAuthenticationHandler
browser-window
(browser-window target & opts)
Creates a new popup window for the specified browser widget. For example, a
popup window is automatically created when the user clicks the "Open in a new
window" context menu option. The window itself is not a widget, but is
configurable as one and supports the following options:
:browser queries the browser widget of the window
:visible controls the visibility of the window
:bars-visible? controls the visibility of the browser bars
:button-bar-visible? controls/queries the visibility of the button bar
:menu-bar-visible? controls/queries the visibility of the menu bar
:location-bar-visible? controls/queries the visibility of the location bar
:status-bar-visible? controls/queries the visibility of the status bar
:title controls/queries the title of the window's title
:size controls/queries the dimensions of the window
:location controls the screen location of the window
:icon-image controls the icon image of the window
Examples:
(browser-window browser :visible true :bars-visible? false)
See:
http://djproject.sourceforge.net/ns/documentation/javadoc/chrriis/dj/nativeswing/swtimpl/components/JWebBrowserWindow.html
close-native-interface!
Alias of djnativeswing-clj.native-interface/close!:
Closes the native interface. Prefer the alias
djnativeswing-clj.core/close-native-interface!.
open-native-interface!
Alias of djnativeswing-clj.native-interface/open!:
Opens the native interface and initializes it if not already done. The native
interface should be initialized and opened before any widgets are created and
used. Prefer the alias djnativeswing-clj.core/open-native-interface!.
See:
(djnativeswing-clj.native-interface/initialize!)
(djnativeswing-clj.native-interface/close!)
run-event-pump!
Alias of djnativeswing-clj.native-interface/run-event-pump!:
Runs the native event pump which is required for the correct operation of the
DJ Native Swing widgets on some platforms. It should always be called after
the native interface is initialized.