Struct sciter::window::Window[][src]

pub struct Window { /* fields omitted */ }

Sciter window.

Implementations

impl Window[src]

pub fn new() -> Window[src]

Create a new main window.

pub fn create(rect: RECT, flags: Flags, parent: Option<HWINDOW>) -> Window[src]

Create a new window with the specified position, flags and an optional parent window.

pub fn attach(hwnd: HWINDOW) -> Window[src]

Attach Sciter to an existing native window.

Most likely, there is no need for run_app or run_loop after that. However, to get UI working, you have to route window events to Sciter - see the blog article.

pub fn get_host(&self) -> Rc<Host>[src]

Obtain a reference to Host which offers some advanced control over the Sciter engine instance.

pub fn sciter_handler<Callback: HostHandler + Sized>(
    &mut self,
    handler: Callback
)
[src]

Set a callback for Sciter engine events.

pub fn event_handler<Handler: EventHandler>(&mut self, handler: Handler)[src]

Attach dom::EventHandler to the Sciter window.

You should install a window event handler only once - it will survive all document reloads. Also it can be registered on an empty window before the document is loaded.

pub fn archive_handler(&mut self, resource: &[u8]) -> Result<(), ()>[src]

Register an archive produced by packfolder tool.

The resources can be accessed via the this://app/ URL.

See documentation of the Archive.

pub fn register_behavior<Factory>(&mut self, name: &str, factory: Factory) where
    Factory: Fn() -> Box<dyn EventHandler> + 'static, 
[src]

Register a native event handler for the specified behavior name.

Behavior is a named event handler which is created for a particular DOM element. In Sciter’s sense, it is a function that is called for different UI events on the DOM element. Essentially it is an analog of the WindowProc in Windows.

In HTML, there is a behavior CSS property that defines the name of a native module that is responsible for the initialization and event handling on the element. For example, by defining div { behavior:button; } you are asking all <div> elements in your markup to behave as buttons: generate BUTTON_CLICK DOM events when the user clicks on that element, and be focusable.

When the engine discovers an element having behavior: xyz; defined in its style, it sends the SC_ATTACH_BEHAVIOR host notification with the name "xyz" and an element handle to the application. You can consume the notification and respond to it yourself, or the default handler walks through the list of registered behavior factories and creates an instance of the corresponding dom::EventHandler.

Example:

struct Button;

impl sciter::EventHandler for Button {}

let mut frame = sciter::Window::new();

// register a factory method that creates a new event handler
// for each element that has "custom-button" behavior:
frame.register_behavior("custom-button", || { Box::new(Button) });

And in HTML it can be used as:

<button style="behavior: custom-button">Rusty button</button>

pub fn load_file(&mut self, uri: &str) -> bool[src]

Load an HTML document from file.

The specified uri should be either an absolute file path or a full URL to the HTML to load.

Supported URL schemes are: http://, file://; this://app/ (when used with archive_handler).

ZIP archives are also supported.

pub fn load_html(&mut self, html: &[u8], uri: Option<&str>) -> bool[src]

Load an HTML document from memory.

For example, HTML can be loaded from a file in compile time via include_bytes!.

pub fn get_hwnd(&self) -> HWINDOW[src]

Get a native window handle.

pub fn collapse(&self, hide: bool)[src]

Minimize or hide the window.

pub fn expand(&self, maximize: bool)[src]

Show or maximize the window.

pub fn dismiss(&self)[src]

Close the window.

pub fn set_title(&mut self, title: &str)[src]

Set a new window title.

pub fn get_title(&self) -> String[src]

Get the native window title.

pub fn set_options(&self, options: Options) -> Result<(), ()>[src]

Set various Sciter engine options, see the Options.

pub fn set_variable(&self, path: &str, value: Value) -> Result<(), ()>[src]

Set a window variable by its path.

See the global sciter::set_variable.

pub fn get_variable(&self, path: &str) -> Result<Value, ()>[src]

Get a window variable by its path.

See the global sciter::get_variable.

pub fn run_app(self)[src]

Show window and run the main app message loop until the main window is closed.

pub fn run_loop(self)[src]

Run the main app message loop with the already shown window.

pub fn quit_app(&self)[src]

Post a quit message for the app.

Auto Trait Implementations

impl !RefUnwindSafe for Window

impl !Send for Window

impl !Sync for Window

impl Unpin for Window

impl !UnwindSafe for Window

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.