Struct darwin_webkit::helpers::dwk_app::DarwinWKApp
source · pub struct DarwinWKApp { /* private fields */ }
Expand description
Wraps an NSApplication instance with a main window that contains WebView.
See DarwinWKWebView
as well.
Example
use darwin_webkit::helpers::dwk_app::DarwinWKApp;
use std::rc::Rc;
unsafe {
let app = DarwinWKApp::new("Host an app");
let webview = Rc::new(app.create_webview());
// add handlers, load HTML, etc...
app.set_webview(&webview);
app.run();
}
Implementations§
source§impl DarwinWKApp
impl DarwinWKApp
sourcepub unsafe fn new(windowTitle: &str) -> DarwinWKApp
pub unsafe fn new(windowTitle: &str) -> DarwinWKApp
sourcepub fn get_app_native_handle(&self) -> id
pub fn get_app_native_handle(&self) -> id
Get the NSApplication handle
sourcepub fn get_window_native_handle(&self) -> id
pub fn get_window_native_handle(&self) -> id
Get the NSWindow handle
sourcepub unsafe fn run(&self)
pub unsafe fn run(&self)
Start the NSApplication and activate it ignoring other apps so it comes to front.
Safety
All the FFI functions are unsafe.
sourcepub unsafe fn create_webview(&self) -> DarwinWKWebView
pub unsafe fn create_webview(&self) -> DarwinWKWebView
sourcepub unsafe fn set_webview<'a>(&'a self, webview: &'a DarwinWKWebView)
pub unsafe fn set_webview<'a>(&'a self, webview: &'a DarwinWKWebView)
Set the content view of the main window to a certain webview
Safety
All the FFI functions are unsafe.
Trait Implementations§
impl Send for DarwinWKApp
impl Sync for DarwinWKApp
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more