Trait imgui::InputTextCallbackHandler

source ·
pub trait InputTextCallbackHandler {
    // Provided methods
    fn char_filter(&mut self, c: char) -> Option<char> { ... }
    fn on_completion(&mut self, _: TextCallbackData) { ... }
    fn on_edit(&mut self, _: TextCallbackData) { ... }
    fn on_history(&mut self, _: HistoryDirection, _: TextCallbackData) { ... }
    fn on_always(&mut self, _: TextCallbackData) { ... }
}
Expand description

This trait provides an interface which ImGui will call on InputText and InputTextMultiline callbacks.

Each method is called if and only if the corresponding flag for each method is passed to ImGui in the callback builder.

Each method here lists the flag required to call it, and this module begins with an example of callbacks being used.

Provided Methods§

source

fn char_filter(&mut self, c: char) -> Option<char>

Filters a char – returning a None means that the char is removed, and returning another char substitutes it out.

Because of upstream ImGui choices, you do not have access to the buffer during this callback (for some reason).

To make ImGui run this callback, use InputTextCallback::CHAR_FILTER or InputTextMultilineCallback::CHAR_FILTER.

source

fn on_completion(&mut self, _: TextCallbackData)

Allows one to perform autocompletion work when the Tab key has been pressed.

To make ImGui run this callback, use InputTextCallback::COMPLETION or InputTextMultilineCallback::COMPLETION.

source

fn on_edit(&mut self, _: TextCallbackData)

Allows one to edit the inner buffer whenever the buffer has been changed.

To make ImGui run this callback, use InputTextCallback::EDIT or InputTextMultilineCallback::EDIT.

source

fn on_history(&mut self, _: HistoryDirection, _: TextCallbackData)

A callback when one of the direction keys have been pressed.

To make ImGui run this callback, use InputTextCallback::HISTORY. It appears that this callback will not be ran in a multiline input widget at all.

source

fn on_always(&mut self, _: TextCallbackData)

A callback which will always fire, each tick.

To make ImGui run this callback, use InputTextCallback::ALWAYS or InputTextMultilineCallback::ALWAYS.

Implementors§