Struct sciter::window::Window
[−]
[src]
pub struct Window { /* fields omitted */ }
Sciter window.
Methods
impl Window
[src]
pub fn new() -> Window
[src]
Create a new main window.
pub fn create(
rect: (i32, i32, i32, i32),
flags: SCITER_CREATE_WINDOW_FLAGS,
parent: Option<HWINDOW>
) -> Window
[src]
rect: (i32, i32, i32, i32),
flags: SCITER_CREATE_WINDOW_FLAGS,
parent: Option<HWINDOW>
) -> Window
Create a new window with the specified position as rect(x, y, width, height)
, flags and an optional parent window.
pub fn attach(hwnd: HWINDOW) -> Window
[src]
Attach Sciter to an existing native window.
pub fn get_host(&self) -> Rc<Host>
[src]
Obtain reference to Host
which allows you to control sciter engine and windows.
pub fn sciter_handler<Callback: HostHandler + Sized>(
&mut self,
handler: Callback
)
[src]
&mut self,
handler: Callback
)
Set callback for sciter engine events.
pub fn event_handler<Handler: EventHandler>(&mut self, handler: Handler)
[src]
Attach dom::EventHandler
to the Sciter window.
You can install Window EventHandler only once - it will survive all document reloads.
pub fn register_behavior<Factory>(&mut self, name: &str, factory: Factory) where
Factory: Fn() -> Box<EventHandler> + 'static,
[src]
Factory: Fn() -> Box<EventHandler> + 'static,
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 name of a native module
that is responsible for 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 clicks on that element and be focusable.
When the engine discovers element having behavior: xyz;
defined in its style,
it sends the SC_ATTACH_BEHAVIOR
host notification
with the name "xyz"
and 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 the instance of the corresponding dom::EventHandler
.
Example:
struct Button; impl sciter::EventHandler for Button {} let mut frame = sciter::Window::new(); 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)
[src]
Load HTML document from file.
pub fn load_html(&mut self, html: &[u8], uri: Option<&str>)
[src]
Load HTML document from memory.
pub fn get_hwnd(&self) -> HWINDOW
[src]
Get native window handle.
pub fn collapse(&self, hide: bool)
[src]
Minimize or hide window.
pub fn expand(&self, maximize: bool)
[src]
Show or maximize window.
pub fn dismiss(&self)
[src]
Close window.
pub fn set_title(&mut self, title: &str)
[src]
Set title of native window.
pub fn get_title(&self) -> String
[src]
Get native window title.
pub fn set_options(&self, options: Options) -> Result<(), ()>
[src]
Set various sciter engine options, see the Options
.
pub fn run_app(self)
[src]
Show window and run the main app message loop until window been closed.
pub fn run_loop(&self)
[src]
Run the main app message loop with already configured window.
pub fn quit_app(&self)
[src]
Post app quit message.