[][src]Trait uniui_gui::ui_page_context::UiPageContext

pub trait UiPageContext {
    pub fn get_env_var(&self, var_name: &str) -> Option<String>;
pub fn set_title(&self, title: &str);
pub fn set_main_widget(&mut self, widget: Box<dyn Widget + 'static>);
pub fn get_resource_path(&self, link: &str) -> String;
pub fn add_data_processor_shared(
        &mut self,
        dp: Arc<RwLock<dyn DataProcessor>>
    );
pub fn widget_generator(&mut self) -> &mut dyn WidgetGenerator;
pub fn open(&self, path: &str, data: &str) -> Result<(), CallError>;
pub fn get_launch_string(&self) -> Result<String, CallError>; pub fn get_host(&self) -> String { ... } }

The trait represents cross platform abstraction of a UiPage

For the most cases it'll represent a highest level UI element such as window for desktop, activity for Android, tab for browser, etc.

Required methods

pub fn get_env_var(&self, var_name: &str) -> Option<String>[src]

Get value for environment vairable by variable name

pub fn set_title(&self, title: &str)[src]

Set title for the related window/activity/tab/etc.

pub fn set_main_widget(&mut self, widget: Box<dyn Widget + 'static>)[src]

Set main widget. The widget will take the whole space of the UiPage.

pub fn get_resource_path(&self, link: &str) -> String[src]

Get path to the resource. Will be changed soon, please don't use.

pub fn add_data_processor_shared(&mut self, dp: Arc<RwLock<dyn DataProcessor>>)[src]

Add data processor to the UiPageContext.

It's better to use [UiPageContext::add_data_processor] instead.

pub fn widget_generator(&mut self) -> &mut dyn WidgetGenerator[src]

Returns reference to WidgetGenerator

pub fn open(&self, path: &str, data: &str) -> Result<(), CallError>[src]

pub fn get_launch_string(&self) -> Result<String, CallError>[src]

Loading content...

Provided methods

pub fn get_host(&self) -> String[src]

Temporary. Will be removed soon.

Loading content...

Implementations

impl dyn UiPageContext[src]

pub fn add_data_processor<T>(
    context: &mut dyn UiPageContext,
    processor: T
) -> Weak<RwLock<T>> where
    T: 'static + DataProcessor
[src]

Add data processor to the UiPaqeContext.

The processor will be called to process pending data each tick.

pub fn open_page<T>(
    context: &dyn UiPageContext,
    target: &dyn UiPage<Data = T>
) -> Result<(), CallError> where
    T: 'static + DeserializeOwned + Serialize
[src]

pub fn open_page_with_data<T>(
    context: &dyn UiPageContext,
    target: &dyn UiPage<Data = T>,
    data: &T
) -> Result<(), CallError> where
    T: 'static + DeserializeOwned + Serialize
[src]

pub fn get_launch_parameter<T>(
    context: &dyn UiPageContext,
    page: &dyn UiPage<Data = T>
) -> Result<T, CallError> where
    T: 'static + DeserializeOwned + Serialize
[src]

Implementors

Loading content...