Struct libremarkable::appctx::ApplicationContext
source · pub struct ApplicationContext<'a> { /* private fields */ }
Implementations§
source§impl<'a> ApplicationContext<'a>
impl<'a> ApplicationContext<'a>
pub fn get_framebuffer_ref(&mut self) -> &'static mut Framebuffer
sourcepub fn upgrade_ref(&mut self) -> &'static mut ApplicationContext<'static>
pub fn upgrade_ref(&mut self) -> &'static mut ApplicationContext<'static>
Perhaps this is bad practice but we know that the ApplicationContext, just like the Framebuffer will have a static lifetime. We are doing this so that we can have the event handlers call into the ApplicationContext.
pub fn get_lua_ref(&mut self) -> &'a mut Lua<'static>
pub fn get_dimensions(&self) -> (u32, u32)
pub fn execute_lua(&mut self, code: &str)
pub fn display_text(
&mut self,
position: Point2<f32>,
c: color,
scale: f32,
border_px: u32,
border_padding: u32,
text: &str,
refresh: UIConstraintRefresh
) -> mxcfb_rect
pub fn display_rect(
&mut self,
position: Point2<i32>,
size: Vector2<u32>,
border_px: u32,
border_color: color,
refresh: UIConstraintRefresh
) -> mxcfb_rect
pub fn display_image(
&mut self,
img: &DynamicImage,
position: Point2<i32>,
refresh: UIConstraintRefresh
) -> mxcfb_rect
pub fn add_element(
&mut self,
name: &str,
element: UIElementWrapper
) -> Option<UIElementHandle>
pub fn remove_element(&mut self, name: &str) -> bool
pub fn remove_elements(&mut self)
pub fn draw_element(&mut self, name: &str) -> bool
pub fn get_element_by_name(&mut self, name: &str) -> Option<UIElementHandle>
pub fn draw_elements(&mut self)
sourcepub fn flash_element(&mut self, name: &str)
pub fn flash_element(&mut self, name: &str)
Briefly flash the element’s last_drawn_rect
pub fn clear(&mut self, deep: bool)
sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Sets an atomic flag to disable event dispatch. Exiting event dispatch loop will cause dispatch_events(..) function to reach completion.
sourcepub fn deactivate_input_device(&mut self, t: InputDevice) -> bool
pub fn deactivate_input_device(&mut self, t: InputDevice) -> bool
Returns true if the device is now signalled to be disabled.
If it was disabled prior to calling this function, this function
will immediately return true
.
This function does not block until teardown is completed.
It will simply return after signalling the epoller, which is
guaranteed to exit completely, and can be verified by
calling exited()
.
sourcepub fn activate_input_device(&mut self, t: InputDevice) -> bool
pub fn activate_input_device(&mut self, t: InputDevice) -> bool
Returns true if the device is now enabled. If it was enabled prior
to calling this function, this function will return true
.
sourcepub fn is_input_device_active(&self, t: InputDevice) -> bool
pub fn is_input_device_active(&self, t: InputDevice) -> bool
Returns true if the given InputDevice
is active, as in
there is an EvDevContext
for it and that context has a
currently running epoll
thread
pub fn event_receiver(&self) -> &Receiver<InputEvent>
pub fn start_event_loop<F: FnMut(&mut ApplicationContext<'_>, InputEvent)>(
&mut self,
activate_wacom: bool,
activate_multitouch: bool,
activate_buttons: bool,
callback: F
)
pub fn handle_event(&mut self, event: InputEvent)
pub fn find_active_region(
&self,
y: u16,
x: u16
) -> Option<(&ActiveRegionHandler, ItemId)>
pub fn remove_active_region_at_point(&mut self, y: u16, x: u16) -> bool
pub fn create_active_region(
&mut self,
y: u16,
x: u16,
height: u16,
width: u16,
handler: ActiveRegionFunction,
element: UIElementHandle
)
Trait Implementations§
source§impl Default for ApplicationContext<'static>
impl Default for ApplicationContext<'static>
source§fn default() -> ApplicationContext<'static>
fn default() -> ApplicationContext<'static>
impl<'a> Send for ApplicationContext<'a>
impl<'a> Sync for ApplicationContext<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ApplicationContext<'a>
impl<'a> Unpin for ApplicationContext<'a>
impl<'a> UnwindSafe for ApplicationContext<'a>
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more