skrypton-api / com.waicool20.skrypton.jni.objects / SKryptonWebView

SKryptonWebView

class SKryptonWebView : SKryptonWidget

A browser window that can be used to view and edit web documents.

Constructors

<init>

SKryptonWebView(url: String)

A browser window that can be used to view and edit web documents.

Properties

cursorX

val cursorX: Int

x coordinate of the virtual cursor.

cursorY

val cursorY: Int

y coordinate of the virtual cursor.

handle

val handle: CPointer

Native pointer

profile

val profile: SKryptonWebProfile

SKryptonWebProfile instance used by this web view. Can be changed without affecting profile of other web view instances.

settings

val settings: SKryptonWebSettings

SKryptonWebSettings instance used by this web view. Can be changed without affecting settings of other web view instances.

showCursor

var showCursor: Boolean

Whether or not to show the virtual cursor in the web view, useful for when you need to debug mouse events.

url

val url: String

URL of the web page currently viewed.

zoomFactor

var zoomFactor: Double

Current zoom factor of the web view, valid values are 0.25 to 5.0.

Inherited Properties

geometry

var geometry: Rectangle

The geometry of the widget. (x-y coordinates, width and height)

size

var size: Dimension

Dimension of the widget. (Width and height only)

Functions

addOnLoadFinishedListener

fun addOnLoadFinishedListener(listener: (ok: Boolean) -> Unit): Unit

Adds a listener for when the web view is done loading a page.

addOnLoadProgressListener

fun addOnLoadProgressListener(listener: (progress: Int) -> Unit): Unit

Adds a listener for the progress of loading a new page.

addOnLoadStartedListener

fun addOnLoadStartedListener(listener: () -> Unit): Unit

Adds a listener for when the web view starts loading a new page.

back

fun back(): Unit

Go back to previous page.

forward

fun forward(): Unit

Go to next page.

isLoading

fun isLoading(): Boolean

Returns true if the current page is still loading.

load

fun load(url: URL): Unit
fun load(url: String): Unit

Loads the given url.

loadHtml

fun loadHtml(content: String, baseUrl: String): Unit

Loads raw HTML content into the web view.

reload

fun reload(): Unit

Reloads the current page.

removeOnLoadFinishedListener

fun removeOnLoadFinishedListener(listener: (ok: Boolean) -> Unit): Unit

Removes given onLoadFinished listener.

removeOnLoadProgressListener

fun removeOnLoadProgressListener(listener: (progress: Int) -> Unit): Unit

Removes given onLoadProgress listener.

removeOnLoadStartedListener

fun removeOnLoadStartedListener(listener: () -> Unit): Unit

Removes given onLoadStarted listener.

runJavaScript

fun runJavaScript(content: String, callback: () -> Unit = {}): Unit

Runs JavaScript content on this web view.

sendEvent

fun sendEvent(event: SKryptonEvent): Unit

Sends the given event to the web view

stop

fun stop(): Unit

Stops loading the current page, if it is loading.

takeScreenshot

fun takeScreenshot(): BufferedImage

Takes a screenshot of the web views contents.

Inherited Functions

addOnKeyEventListener

fun addOnKeyEventListener(type: KeyEventType, listener: (event: SKryptonKeyEvent) -> Unit): Unit

Adds a listener for when a key event occurs on this widget.

addOnMouseEventListener

fun addOnMouseEventListener(type: MouseEventType, listener: (event: SKryptonMouseEvent) -> Unit): Unit

Adds a listener for when a mouse event occurs on this widget.

addOnResizeEventListener

fun addOnResizeEventListener(listener: (event: SKryptonResizeEvent) -> Unit): Unit

Adds a listener for when a resize event occurs on this widget.

addOnWheelEventListener

fun addOnWheelEventListener(listener: (event: SKryptonWheelEvent) -> Unit): Unit

Adds a listener for when a mouse wheel event occurs on this widget.

close

open fun close(): Unit

Hides and closes this widget.

hide

fun hide(): Unit

Hides the widget.

isHidden

fun isHidden(): Boolean

Returns true if the widget is hidden.

move

fun move(x: Int, y: Int): Unit

Moves the widget to the given coordinates.

removeOnKeyEventListener

fun removeOnKeyEventListener(type: KeyEventType, listener: (event: SKryptonKeyEvent) -> Unit): Unit

Removes given onKeyEvent listener.

removeOnMouseEventListener

fun removeOnMouseEventListener(type: MouseEventType, listener: (event: SKryptonMouseEvent) -> Unit): Unit

Removes given onMouseEvent listener.

removeOnResizeEventListener

fun removeOnResizeEventListener(listener: (event: SKryptonResizeEvent) -> Unit): Unit

Removes given onResizeEvent listener.

removeOnWheelEventListener

fun removeOnWheelEventListener(listener: (event: SKryptonWheelEvent) -> Unit): Unit

Removes given onWheelEvent listener.

resize

fun resize(width: Int, height: Int): Unit

Resizes the widget.

show

fun show(): Unit

Makes the widget visible.

Extension Functions

screen

fun SKryptonWebView.screen(action: SKryptonScreen.() -> Unit = {}): SKryptonScreen

Creates a SKryptonScreen under this SKryptonWebView instance