Function gemgui::window_application

source ·
pub fn window_application<CB, Fut, OptionalMenu>(
    filemap: Filemap,
    index_html: &str,
    port: u16,
    application_cb: CB,
    title: &str,
    width: u32,
    height: u32,
    parameters: &[(&str, &str)],
    flags: u32,
    menu: OptionalMenu
) -> Result<()>where
    CB: FnMut(UiRef) -> Fut + Send + Clone + 'static,
    Fut: Future<Output = ()> + Send + 'static,
    OptionalMenu: Into<Option<Menu>>,
Expand description

Convenience to create a windowed UI application

Arguments

filemap- resources

index_html- UI document

port - port used to connect in this application session

application_cb: Callback called when UI is ready

title- window title

width - window width

height - window height

parameters - list of key - value pairs to be passed to UI backend.

flags - bit flags be passed to UI backend

  • NORESIZE
  • FULLSCREEN
  • HIDDEN
  • FRAMELESS
  • MINIMIZED
  • ONTOP
  • CONFIRMCLOSE
  • TEXTSELECT
  • EASYDRAG
  • TRANSPARENT

Return

Application exit result

Example

fn main() -> Result<()> {
   let fm = gemgui::filemap_from(RESOURCES);
   gemgui::window_application(fm,
      "index.html",
       gemgui::next_free_port(30000u16),
       |ui| async {my_main(ui).await},
       "My application",
       900,
       500,
       &[("debug", "True")],
       0,
       None)
   }
 
async fn my_main(ui: UiRef) {
    // ...
}