Struct mg::Mg

source ·
pub struct Mg<COMM, SETT>where
    COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static,
    SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,{ /* private fields */ }

Implementations§

source§

impl<COMM, SETT> Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

source

pub fn default_completers() -> Completers

Get the default completers. One to complete the commands, the other to complete the settings.

source

pub fn delete_current_completion_item(&self)

Delete the current completion item.

source

pub fn show_completion(&self)

Show the completion view.

source

pub fn update_completions(&self)

Update the items of the completion view.

source§

impl<COMM, SETT> Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

source

pub fn get_foreground_color(&self) -> RGBA

Get the color of the text.

source

pub fn reset_colors(&self)

Reset the background and foreground colors of the status bar.

source

pub fn set_dark_theme(&mut self, use_dark: bool)

Use the dark variant of the theme if available.

source§

impl<COMM, SETT> Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

source

pub fn action_to_command(&self, action: &str) -> ShortcutCommand

Convert an action String to a command String.

source

pub fn command_activate(&mut self, input: String)

Handle the command entry activate event.

source

pub fn execute_commands( &mut self, parse_result: ParseResult<COMM>, activated: bool )

Execute the commands and show the errors contained in the parse result.

source

pub fn handle_command( &mut self, command: String, activated: bool, prefix: Option<u32> ) -> Option<Msg<COMM, SETT>>

Handle the command activate event.

source

pub fn handle_special_command( &mut self, activation_type: ActivationType, command: &str ) -> Option<Msg<COMM, SETT>>

Handle a special command activate or key press event.

source§

impl<COMM, SETT> Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

source

pub fn blocking_custom_dialog( &mut self, responder: Box<dyn Responder>, builder: DialogBuilder )

Ask a question to the user and block until the user provides it (or cancel).

source

pub fn blocking_input( &mut self, responder: Box<dyn Responder>, message: String, default_answer: String )

Ask a question to the user and block until the user provides it (or cancel).

source

pub fn blocking_question( &mut self, responder: Box<dyn Responder>, message: String, choices: Vec<char> )

Ask a multiple-choice question to the user and block until the user provides it (or cancel).

source

pub fn blocking_yes_no_question( &mut self, responder: Box<dyn Responder>, message: String )

Show a blocking yes/no question.

source

pub fn input( &mut self, responder: Box<dyn Responder>, message: String, default_answer: String )

Ask a question to the user.

source

pub fn question( &mut self, responder: Box<dyn Responder>, message: String, choices: &[char] )

Ask a multiple-choice question to the user.

source

pub fn set_dialog_answer(&mut self, answer: &str)

Set the answer to return to the caller of the dialog.

source

pub fn show_dialog(&mut self, dialog_builder: DialogBuilder)

Show a dialog created with a DialogBuilder.

source

pub fn show_dialog_without_shortcuts(&mut self, dialog_builder: DialogBuilder)

Show a dialog created with a DialogBuilder which does not contain shortcut.

source

pub fn yes_no_question( &mut self, responder: Box<dyn Responder>, message: String )

Show a yes/no question.

source§

impl<COMM, SETT> Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

source

pub fn inhibit_key_press( current_mode: &Rc<Cell<Mode>>, key: &EventKey ) -> Inhibit

Check if the key should be inhibitted.

source

pub fn key_press(&mut self, key: &EventKey)

Handle the key press event.

source

pub fn key_release(&mut self, key: &EventKey)

Handle the key release event.

source§

impl<COMM, SETT> Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

source

pub fn add_to_shortcut(&mut self, key: Key)

Add the key to the current shortcut.

source

pub fn clear_shortcut(&mut self)

Clear the current shortcut buffer.

source

pub fn handle_input_shortcut(&mut self, key: &EventKey) -> bool

Handle a shortcut in input mode.

source

pub fn inhibit_handle_shortcut( current_mode: &Rc<Cell<Mode>>, key: &EventKey ) -> Inhibit

Check if the key should be inhibitted for the shortcut.

source

pub fn handle_shortcut(&mut self, key: &EventKey) -> Option<Msg<COMM, SETT>>

Handle a possible input of a shortcut.

Trait Implementations§

source§

impl<COMM, SETT> Container for Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

§

type Container = Box

The type of the containing widget, i.e. where the child widgets will be added.
§

type Containers = MgContainers

Type to contain the additional container widgets.
source§

fn container(&self) -> &Self::Container

Get the containing widget, i.e. the widget where the children will be added.
source§

fn other_containers(&self) -> Self::Containers

Get additional container widgets. This is useful to create a multi-container.
source§

fn add_widget<WIDGET: Widget>( container: &ContainerComponent<Self>, widget: &Component<WIDGET> ) -> Container

Add a relm widget to this container. Return the widget that will be send to Widget::on_add().
source§

impl<COMM, SETT> Update for Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

§

type Msg = Msg<COMM, SETT>

The type of the messages sent to the update() method.
§

type Model = Model<COMM, SETT>

The type of the model.
§

type ModelParam = (&'static [Mode], Result<PathBuf, Error>, Option<PathBuf>, Vec<DefaultConfig, Global>)

The type of the parameter of the model() function used to initialize the model.
source§

fn update(&mut self, event: Msg<COMM, SETT>)

Method called when a message is received from an event.
source§

fn model( relm: &Relm<Self>, (user_modes, settings_filename, include_path, default_config): (Modes, Result<PathBuf>, Option<PathBuf>, Vec<DefaultConfig>) ) -> Model<COMM, SETT>

Create the initial model.
source§

fn subscriptions(&mut self, _relm: &Relm<Self>)

Connect the subscriptions. Subscriptions are Future/Stream that are spawn when the object is created.
source§

impl<COMM, SETT> Widget for Mg<COMM, SETT>where COMM: Clone + EnumFromStr + EnumMetaData + SpecialCommand + 'static, SETT: Default + EnumMetaData + Settings + SettingCompletion + 'static,

An Mg application window contains a status bar where the user can type a command and a central widget.

source§

fn init_view(&mut self)

Update the view after it is initially created. This method is only useful when using the #[widget] attribute, because when not using it, you can use the view() method instead.
source§

fn view(relm: &Relm<Self>, __relm_model: Self::Model) -> Self

Create the initial view.
§

type Root = Window

The type of the root widget.
source§

fn root(&self) -> Self::Root

Get the root widget of the view.
source§

fn on_add<W>(&self, _parent: W)where W: IsA<Widget> + IsA<Object>,

Method called when the widget is added to its parent. This is currently only used to set the child properties of a widget as relm widget could have child properties and we don’t know its parent when it is defined. Thus, we call on_add() when it is added to its parent to set the child properties.
source§

fn parent_id() -> Option<&'static str>

Get the parent ID. This is useful for custom Container implementation: when you implement the Container::add_widget(), you might want to insert widgets elsewhere depending of this id.
source§

fn run(model_param: Self::ModelParam) -> Result<(), BoolError>where Self: 'static,

Create the window from this widget and start the main loop.

Auto Trait Implementations§

§

impl<COMM, SETT> !RefUnwindSafe for Mg<COMM, SETT>

§

impl<COMM, SETT> !Send for Mg<COMM, SETT>

§

impl<COMM, SETT> !Sync for Mg<COMM, SETT>

§

impl<COMM, SETT> Unpin for Mg<COMM, SETT>where COMM: Unpin, SETT: Unpin,

§

impl<COMM, SETT> !UnwindSafe for Mg<COMM, SETT>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.