C# Class Steamworks.SteamHTMLSurface

Show file Open project: rlabrecque/Steamworks.NET

Public Methods

Method Description
AddHeader ( HHTMLBrowser unBrowserHandle, string pchKey, string pchValue ) : void

add this header to any url requests from this browser

AllowStartRequest ( HHTMLBrowser unBrowserHandle, bool bAllowed ) : void

CALLBACKS

These set of functions are used as responses to callback requests

You MUST call this in response to a HTML_StartRequest_t callback

Set bAllowed to true to allow this navigation, false to cancel it and stay

on the current page. You can use this feature to limit the valid pages

allowed in your HTML surface.

CopyToClipboard ( HHTMLBrowser unBrowserHandle ) : void

copy the currently selected text on the html page to the local clipboard

CreateBrowser ( string pchUserAgent, string pchUserCSS ) : SteamAPICall_t

Create a browser object for display of a html page, when creation is complete the call handle

will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser.

The user agent string is a substring to be added to the general user agent string so you can

identify your client on web servers.

The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if

you do not require this functionality.

YOU MUST HAVE IMPLEMENTED HANDLERS FOR HTML_BrowserReady_t, HTML_StartRequest_t,

HTML_JSAlert_t, HTML_JSConfirm_t, and HTML_FileOpenDialog_t! See the CALLBACKS

section of this interface (AllowStartRequest, etc) for more details. If you do

not implement these callback handlers, the browser may appear to hang instead of

navigating to new pages or triggering javascript popups.

ExecuteJavascript ( HHTMLBrowser unBrowserHandle, string pchScript ) : void

run this javascript script in the currently loaded page

FileLoadDialogResponse ( HHTMLBrowser unBrowserHandle, IntPtr pchSelectedFiles ) : void

You MUST call this in response to a HTML_FileOpenDialog_t callback

Find ( HHTMLBrowser unBrowserHandle, string pchSearchStr, bool bCurrentlyInFind, bool bReverse ) : void

find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element

GetLinkAtPosition ( HHTMLBrowser unBrowserHandle, int x, int y ) : void

return details about the link at position x,y on the current page

GoBack ( HHTMLBrowser unBrowserHandle ) : void

navigate back in the page history

GoForward ( HHTMLBrowser unBrowserHandle ) : void

navigate forward in the page history

Init ( ) : bool

Must call init and shutdown when starting/ending use of the interface

JSDialogResponse ( HHTMLBrowser unBrowserHandle, bool bResult ) : void

You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback

Set bResult to true for the OK option of a confirm, use false otherwise

KeyChar ( HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) : void

cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)

KeyDown ( HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) : void

keyboard interactions, native keycode is the virtual key code value from your OS

KeyUp ( HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) : void
LoadURL ( HHTMLBrowser unBrowserHandle, string pchURL, string pchPostData ) : void

Navigate to this URL, results in a HTML_StartRequest_t as the request commences

MouseDoubleClick ( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) : void
MouseDown ( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) : void
MouseMove ( HHTMLBrowser unBrowserHandle, int x, int y ) : void

x and y are relative to the HTML bounds

MouseUp ( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) : void

Mouse click and mouse movement commands

MouseWheel ( HHTMLBrowser unBrowserHandle, int nDelta ) : void

nDelta is pixels of scroll

PasteFromClipboard ( HHTMLBrowser unBrowserHandle ) : void

paste from the local clipboard to the current html page

Reload ( HHTMLBrowser unBrowserHandle ) : void

Reload (most likely from local cache) the current page

RemoveBrowser ( HHTMLBrowser unBrowserHandle ) : void

Call this when you are done with a html surface, this lets us free the resources being used by it

SetBackgroundMode ( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) : void

Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are

more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled,

all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1".

When background mode is disabled, any video or audio objects with that property will resume with ".play()".

SetCookie ( string pchHostname, string pchKey, string pchValue, string pchPath = "/", uint nExpires, bool bSecure = false, bool bHTTPOnly = false ) : void

set a webcookie for the hostname in question

SetHorizontalScroll ( HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll ) : void

programmatically scroll this many pixels on the page

SetKeyFocus ( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) : void

tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things

SetPageScaleFactor ( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) : void

Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)

SetSize ( HHTMLBrowser unBrowserHandle, uint unWidth, uint unHeight ) : void

Tells the surface the size in pixels to display the surface

SetVerticalScroll ( HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll ) : void
Shutdown ( ) : bool
StopFind ( HHTMLBrowser unBrowserHandle ) : void

cancel a currently running find

StopLoad ( HHTMLBrowser unBrowserHandle ) : void

Stop the load of the current html page

ViewSource ( HHTMLBrowser unBrowserHandle ) : void

open the current pages html code in the local editor of choice, used for debugging

Method Details

AddHeader() public static method

add this header to any url requests from this browser

public static AddHeader ( HHTMLBrowser unBrowserHandle, string pchKey, string pchValue ) : void
unBrowserHandle HHTMLBrowser
pchKey string
pchValue string
return void

AllowStartRequest() public static method

CALLBACKS

These set of functions are used as responses to callback requests

You MUST call this in response to a HTML_StartRequest_t callback

Set bAllowed to true to allow this navigation, false to cancel it and stay

on the current page. You can use this feature to limit the valid pages

allowed in your HTML surface.

public static AllowStartRequest ( HHTMLBrowser unBrowserHandle, bool bAllowed ) : void
unBrowserHandle HHTMLBrowser
bAllowed bool
return void

CopyToClipboard() public static method

copy the currently selected text on the html page to the local clipboard

public static CopyToClipboard ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

CreateBrowser() public static method

Create a browser object for display of a html page, when creation is complete the call handle

will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser.

The user agent string is a substring to be added to the general user agent string so you can

identify your client on web servers.

The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if

you do not require this functionality.

YOU MUST HAVE IMPLEMENTED HANDLERS FOR HTML_BrowserReady_t, HTML_StartRequest_t,

HTML_JSAlert_t, HTML_JSConfirm_t, and HTML_FileOpenDialog_t! See the CALLBACKS

section of this interface (AllowStartRequest, etc) for more details. If you do

not implement these callback handlers, the browser may appear to hang instead of

navigating to new pages or triggering javascript popups.

public static CreateBrowser ( string pchUserAgent, string pchUserCSS ) : SteamAPICall_t
pchUserAgent string
pchUserCSS string
return SteamAPICall_t

ExecuteJavascript() public static method

run this javascript script in the currently loaded page

public static ExecuteJavascript ( HHTMLBrowser unBrowserHandle, string pchScript ) : void
unBrowserHandle HHTMLBrowser
pchScript string
return void

FileLoadDialogResponse() public static method

You MUST call this in response to a HTML_FileOpenDialog_t callback

public static FileLoadDialogResponse ( HHTMLBrowser unBrowserHandle, IntPtr pchSelectedFiles ) : void
unBrowserHandle HHTMLBrowser
pchSelectedFiles System.IntPtr
return void

Find() public static method

find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element

public static Find ( HHTMLBrowser unBrowserHandle, string pchSearchStr, bool bCurrentlyInFind, bool bReverse ) : void
unBrowserHandle HHTMLBrowser
pchSearchStr string
bCurrentlyInFind bool
bReverse bool
return void

GetLinkAtPosition() public static method

return details about the link at position x,y on the current page

public static GetLinkAtPosition ( HHTMLBrowser unBrowserHandle, int x, int y ) : void
unBrowserHandle HHTMLBrowser
x int
y int
return void

GoBack() public static method

navigate back in the page history

public static GoBack ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

GoForward() public static method

navigate forward in the page history

public static GoForward ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

Init() public static method

Must call init and shutdown when starting/ending use of the interface

public static Init ( ) : bool
return bool

JSDialogResponse() public static method

You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback

Set bResult to true for the OK option of a confirm, use false otherwise

public static JSDialogResponse ( HHTMLBrowser unBrowserHandle, bool bResult ) : void
unBrowserHandle HHTMLBrowser
bResult bool
return void

KeyChar() public static method

cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)

public static KeyChar ( HHTMLBrowser unBrowserHandle, uint cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) : void
unBrowserHandle HHTMLBrowser
cUnicodeChar uint
eHTMLKeyModifiers EHTMLKeyModifiers
return void

KeyDown() public static method

keyboard interactions, native keycode is the virtual key code value from your OS

public static KeyDown ( HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) : void
unBrowserHandle HHTMLBrowser
nNativeKeyCode uint
eHTMLKeyModifiers EHTMLKeyModifiers
return void

KeyUp() public static method

public static KeyUp ( HHTMLBrowser unBrowserHandle, uint nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) : void
unBrowserHandle HHTMLBrowser
nNativeKeyCode uint
eHTMLKeyModifiers EHTMLKeyModifiers
return void

LoadURL() public static method

Navigate to this URL, results in a HTML_StartRequest_t as the request commences

public static LoadURL ( HHTMLBrowser unBrowserHandle, string pchURL, string pchPostData ) : void
unBrowserHandle HHTMLBrowser
pchURL string
pchPostData string
return void

MouseDoubleClick() public static method

public static MouseDoubleClick ( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) : void
unBrowserHandle HHTMLBrowser
eMouseButton EHTMLMouseButton
return void

MouseDown() public static method

public static MouseDown ( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) : void
unBrowserHandle HHTMLBrowser
eMouseButton EHTMLMouseButton
return void

MouseMove() public static method

x and y are relative to the HTML bounds

public static MouseMove ( HHTMLBrowser unBrowserHandle, int x, int y ) : void
unBrowserHandle HHTMLBrowser
x int
y int
return void

MouseUp() public static method

Mouse click and mouse movement commands

public static MouseUp ( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) : void
unBrowserHandle HHTMLBrowser
eMouseButton EHTMLMouseButton
return void

MouseWheel() public static method

nDelta is pixels of scroll

public static MouseWheel ( HHTMLBrowser unBrowserHandle, int nDelta ) : void
unBrowserHandle HHTMLBrowser
nDelta int
return void

PasteFromClipboard() public static method

paste from the local clipboard to the current html page

public static PasteFromClipboard ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

Reload() public static method

Reload (most likely from local cache) the current page

public static Reload ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

RemoveBrowser() public static method

Call this when you are done with a html surface, this lets us free the resources being used by it

public static RemoveBrowser ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

SetBackgroundMode() public static method

Enable/disable low-resource background mode, where javascript and repaint timers are throttled, resources are

more aggressively purged from memory, and audio/video elements are paused. When background mode is enabled,

all HTML5 video and audio objects will execute ".pause()" and gain the property "._steam_background_paused = 1".

When background mode is disabled, any video or audio objects with that property will resume with ".play()".

public static SetBackgroundMode ( HHTMLBrowser unBrowserHandle, bool bBackgroundMode ) : void
unBrowserHandle HHTMLBrowser
bBackgroundMode bool
return void

SetCookie() public static method

set a webcookie for the hostname in question

public static SetCookie ( string pchHostname, string pchKey, string pchValue, string pchPath = "/", uint nExpires, bool bSecure = false, bool bHTTPOnly = false ) : void
pchHostname string
pchKey string
pchValue string
pchPath string
nExpires uint
bSecure bool
bHTTPOnly bool
return void

SetHorizontalScroll() public static method

programmatically scroll this many pixels on the page

public static SetHorizontalScroll ( HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll ) : void
unBrowserHandle HHTMLBrowser
nAbsolutePixelScroll uint
return void

SetKeyFocus() public static method

tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things

public static SetKeyFocus ( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) : void
unBrowserHandle HHTMLBrowser
bHasKeyFocus bool
return void

SetPageScaleFactor() public static method

Zoom the current page by flZoom ( from 0.0 to 2.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)

public static SetPageScaleFactor ( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) : void
unBrowserHandle HHTMLBrowser
flZoom float
nPointX int
nPointY int
return void

SetSize() public static method

Tells the surface the size in pixels to display the surface

public static SetSize ( HHTMLBrowser unBrowserHandle, uint unWidth, uint unHeight ) : void
unBrowserHandle HHTMLBrowser
unWidth uint
unHeight uint
return void

SetVerticalScroll() public static method

public static SetVerticalScroll ( HHTMLBrowser unBrowserHandle, uint nAbsolutePixelScroll ) : void
unBrowserHandle HHTMLBrowser
nAbsolutePixelScroll uint
return void

Shutdown() public static method

public static Shutdown ( ) : bool
return bool

StopFind() public static method

cancel a currently running find

public static StopFind ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

StopLoad() public static method

Stop the load of the current html page

public static StopLoad ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void

ViewSource() public static method

open the current pages html code in the local editor of choice, used for debugging

public static ViewSource ( HHTMLBrowser unBrowserHandle ) : void
unBrowserHandle HHTMLBrowser
return void