browser_window_core/
application.rs1pub mod c;
2
3
4pub use c::ApplicationImpl;
5
6use crate::error::CbwResult;
7
8use std::{
9 path::PathBuf,
10 os::raw::{c_char, c_int},
11 time::Duration
12};
13
14
15
16pub trait ApplicationExt: Copy {
17 fn assert_correct_thread( &self );
19 fn dispatch( &self, work: unsafe fn(ApplicationImpl, *mut ()), data: *mut () ) -> bool;
21 fn dispatch_delayed(&self, work: unsafe fn(ApplicationImpl, *mut ()), data: *mut (), delay: Duration ) -> bool;
23 fn exit( &self, exit_code: i32 );
25 fn exit_threadsafe( self: &Self, exit_code: i32 );
27 fn finish( &self ) {}
29 fn initialize( argc: c_int, argv: *mut *mut c_char, settings: &ApplicationSettings ) -> CbwResult<ApplicationImpl>;
30 fn mark_as_done(&self);
32 fn run( &self, on_ready: unsafe fn(ApplicationImpl, *mut ()), data: *mut () ) -> i32;
35}
36
37pub struct ApplicationSettings {
38 pub engine_seperate_executable_path: Option<PathBuf>,
39 pub resource_dir: Option<String>
40}
41
42
43
44impl Default for ApplicationSettings {
45 fn default() -> Self {
46 Self {
47 engine_seperate_executable_path: None,
48 resource_dir: None
49 }
50 }
51}