Event

Enum Event 

Source
pub enum Event {
Show 82 variants Device(DeviceEvent), Gesture(GestureEvent), Keyboard(KeyboardEvent), Key(KeyKind), Open(Box<Info>), OpenHtml(String, Option<String>), LoadPixmap(usize), Update(UpdateMode), RefreshBookPreview(PathBuf), Invalid(PathBuf), Notification(NotificationEvent), Page(CycleDir), ResultsPage(CycleDir), GoTo(usize), GoToLocation(Location), ResultsGoTo(usize), CropMargins(Box<Margin>), Chapter(CycleDir), SelectDirectory(PathBuf), ToggleSelectDirectory(PathBuf), NavigationBarResized(i32), Focus(Option<ViewId>), Select(EntryId), PropagateSelect(EntryId), EditLanguages, Define(String), Submit(ViewId, String), Slider(SliderId, f32, FingerStatus), ToggleNear(ViewId, Rectangle), ToggleInputHistoryMenu(ViewId, Rectangle), ToggleBookMenu(Rectangle, usize), TogglePresetMenu(Rectangle, usize), SubMenu(Rectangle, Vec<EntryKind>), OpenSettingsCategory(Category), SelectSettingsCategory(Category), UpdateSettings(Box<Settings>), EditLibrary(usize), UpdateLibrary(usize, Box<LibrarySettings>), AddLibrary, DeleteLibrary(usize), ProcessLine(LineOrigin, String), History(CycleDir, bool), Toggle(ToggleEvent), Show(ViewId), Close(ViewId), CloseSub(ViewId), Search(String), SearchResult(usize, Vec<Boundary>), FetcherAddDocument(u32, Box<Info>), FetcherRemoveDocument(u32, PathBuf), FetcherSearch { id: u32, path: Option<PathBuf>, query: Option<String>, sort_by: Option<(SortMethod, bool)>, }, CheckFetcher(u32), EndOfSearch, Finished, ClockTick, BatteryTick, ToggleFrontlight, Load(PathBuf), LoadPreset(usize), Scroll(i32), Save, Guess, CheckBattery, SetWifi(bool), MightSuspend, PrepareSuspend, Suspend, Share, PrepareShare, Validate, Cancel, Reseed, Back, Quit, WakeUp, Hold(EntryId), FileChooserClosed(Option<PathBuf>), Github(GithubEvent), Settings(SettingsEvent), OpenNamedInput { view_id: ViewId, label: String, max_chars: usize, initial_text: String, }, OtaDownloadProgress { label: String, percent: u8, }, StartStableReleaseDownload,
}

Variants§

§

Device(DeviceEvent)

§

Gesture(GestureEvent)

§

Keyboard(KeyboardEvent)

§

Key(KeyKind)

§

Open(Box<Info>)

§

OpenHtml(String, Option<String>)

§

LoadPixmap(usize)

§

Update(UpdateMode)

§

RefreshBookPreview(PathBuf)

§

Invalid(PathBuf)

§

Notification(NotificationEvent)

§

Page(CycleDir)

§

ResultsPage(CycleDir)

§

GoTo(usize)

§

GoToLocation(Location)

§

ResultsGoTo(usize)

§

CropMargins(Box<Margin>)

§

Chapter(CycleDir)

§

SelectDirectory(PathBuf)

§

ToggleSelectDirectory(PathBuf)

§

NavigationBarResized(i32)

§

Focus(Option<ViewId>)

Manages input focus state for focusable views like InputField.

This event controls which view currently receives keyboard input. It is not a navigation event — use Event::Show to transition between screens or display new UI components.

§Variants

  • Focus(Some(view_id)) — Grants focus to the view matching view_id. The focused view will receive Event::Keyboard events. Parent views typically use this to show the on-screen keyboard.
  • Focus(None) — Clears focus from all views. Parent views typically use this to hide the on-screen keyboard.

§Dispatch behavior

Focus events are broadcast: InputField returns false after handling this event so that all input fields in the hierarchy can update their focused/unfocused state.

§Sending

Typically sent through the hub (hub.send(...)) by:

  • An InputField when tapped while unfocused
  • A parent view after building a screen that contains an input field
  • A keyboard’s hide method to clear focus

§Example

use cadmus_core::view::{Event, ViewId};
use cadmus_core::view::ota::OtaViewId;

// Focus the PR input field (e.g. after building the PR input screen).
// Note: `hub` is provided by the application's event loop.
hub.send(Event::Focus(Some(ViewId::Ota(OtaViewId::PrInput)))).ok();

// Clear focus from all views.
hub.send(Event::Focus(None)).ok();
§

Select(EntryId)

§

PropagateSelect(EntryId)

§

EditLanguages

§

Define(String)

§

Submit(ViewId, String)

§

Slider(SliderId, f32, FingerStatus)

§

ToggleNear(ViewId, Rectangle)

§

ToggleInputHistoryMenu(ViewId, Rectangle)

§

ToggleBookMenu(Rectangle, usize)

§

TogglePresetMenu(Rectangle, usize)

§

SubMenu(Rectangle, Vec<EntryKind>)

§

OpenSettingsCategory(Category)

§

SelectSettingsCategory(Category)

§

UpdateSettings(Box<Settings>)

§

EditLibrary(usize)

§

UpdateLibrary(usize, Box<LibrarySettings>)

§

AddLibrary

§

DeleteLibrary(usize)

§

ProcessLine(LineOrigin, String)

§

History(CycleDir, bool)

§

Toggle(ToggleEvent)

§

Show(ViewId)

§

Close(ViewId)

§

CloseSub(ViewId)

§

Search(String)

§

SearchResult(usize, Vec<Boundary>)

§

FetcherAddDocument(u32, Box<Info>)

§

FetcherRemoveDocument(u32, PathBuf)

§

FetcherSearch

Fields

§id: u32
§sort_by: Option<(SortMethod, bool)>
§

CheckFetcher(u32)

§

EndOfSearch

§

Finished

§

ClockTick

§

BatteryTick

§

ToggleFrontlight

§

Load(PathBuf)

§

LoadPreset(usize)

§

Scroll(i32)

§

Save

§

Guess

§

CheckBattery

§

SetWifi(bool)

§

MightSuspend

§

PrepareSuspend

§

Suspend

§

Share

§

PrepareShare

§

Validate

§

Cancel

§

Reseed

§

Back

§

Quit

§

WakeUp

§

Hold(EntryId)

§

FileChooserClosed(Option<PathBuf>)

The file chooser was closed. The Option<PathBuf> contains the selected path, if any.

§

Github(GithubEvent)

GitHub authentication and API interaction events.

§

Settings(SettingsEvent)

Settings-specific events

§

OpenNamedInput

Request to open a NamedInput text overlay.

The handler is responsible for creating the overlay and placing it at the correct position in the view hierarchy so it sits at the top of the z-order.

Fields

§view_id: ViewId

The ViewId used for both the overlay and the resulting Submit event.

§label: String

Label text displayed inside the input dialog.

§max_chars: usize

Maximum number of characters the input field accepts.

§initial_text: String

Current value pre-populated into the input field.

§

OtaDownloadProgress

Progress update from a background OTA download thread.

OtaView handles this by updating the status label text and the progress bar fill to reflect the current download state.

Fields

§label: String
§percent: u8
§

StartStableReleaseDownload

Signal to start downloading the stable release after version check.

This event is sent from the version check thread when the remote version is newer than the current version, triggering the actual download to begin.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more