pub trait App {
Show 22 methods
// Required methods
fn name(&self) -> &str;
fn draw(
&mut self,
screen: &Screen,
win_x: u32,
win_y: u32,
win_w: u32,
win_h: u32,
);
fn on_mouse(
&mut self,
local_x: i32,
local_y: i32,
btn_left: bool,
btn_right: bool,
wheel: i32,
);
fn on_key(&mut self, keycode: u8, pressed: bool, ascii: Option<char>);
// Provided methods
fn is_proxy(&self) -> bool { ... }
fn get_shared_buffer(&self) -> Option<Arc<Mutex<Vec<u32>>>> { ... }
fn instance_info(&self) -> String { ... }
fn tabs(&self) -> Vec<String> { ... }
fn active_tab(&self) -> usize { ... }
fn switch_tab(&mut self, _idx: usize) { ... }
fn add_tab(&mut self) { ... }
fn close_tab(&mut self, _idx: usize) -> bool { ... }
fn open_file_dialog(&mut self) { ... }
fn save_file(&mut self) { ... }
fn tab_thread_fn(&self) -> Option<fn()> { ... }
fn get_dom_value(&self, _id: &str) -> Option<String> { ... }
fn set_dom_value(&mut self, _id: &str, _val: &str) { ... }
fn needs_timer_redraw(&self) -> bool { ... }
fn get_buffer_updated_flag(&self) -> Option<Arc<AtomicBool>> { ... }
fn get_dom_content(&self, _id: &str) -> Option<String> { ... }
fn set_dom_content(&mut self, _id: &str, _val: &str) { ... }
fn on_resize(&mut self, _width: u32, _height: u32) { ... }
}Expand description
アプリケーションが実装すべきトレイト
Required Methods§
fn name(&self) -> &str
Sourcefn draw(
&mut self,
screen: &Screen,
win_x: u32,
win_y: u32,
win_w: u32,
win_h: u32,
)
fn draw( &mut self, screen: &Screen, win_x: u32, win_y: u32, win_w: u32, win_h: u32, )
ウィンドウ内の描画要求
Provided Methods§
共有されるバックバッファを返す
Sourcefn instance_info(&self) -> String
fn instance_info(&self) -> String
インスタンス特有の情報(ファイル名やURLなど)を返す
fn active_tab(&self) -> usize
fn switch_tab(&mut self, _idx: usize)
fn add_tab(&mut self)
Sourcefn open_file_dialog(&mut self)
fn open_file_dialog(&mut self)
Alt+O: ファイルオープンダイアログを開く(未実装アプリはno-op)
Sourcefn tab_thread_fn(&self) -> Option<fn()>
fn tab_thread_fn(&self) -> Option<fn()>
このアプリの各タブ用バックグラウンドスレッド関数を返す。 Some(fn) を返したアプリはタブ追加時にスケジューラでスレッドを起動する。 スレッド関数は引数なしの fn() で、グローバル Mutex 経由でアプリ状態と通信する。
fn get_dom_value(&self, _id: &str) -> Option<String>
fn set_dom_value(&mut self, _id: &str, _val: &str)
fn needs_timer_redraw(&self) -> bool
Sourcefn get_buffer_updated_flag(&self) -> Option<Arc<AtomicBool>>
fn get_buffer_updated_flag(&self) -> Option<Arc<AtomicBool>>
ProxyApp の shared_buffer が更新されたことを通知する AtomicBool を返す。 ProxyApp でない通常のアプリは None を返す(デフォルト実装)。 Core 0 の dirty 判定がこのフラグを読んで矩形を登録する。
fn get_dom_content(&self, _id: &str) -> Option<String>
fn set_dom_content(&mut self, _id: &str, _val: &str)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".