Struct thyme::Context [−][src]
The main Thyme Context that holds internal PersistentState
and is responsible for creating Frames
.
This is created by build
on
ContextBuilder
after resource registration is complete.
Implementations
impl Context
[src]
pub fn wants_mouse(&self) -> bool
[src]
Returns true if thyme wants to use the mouse in the current frame, generally because the mouse is over a Thyme widget. If this returns true, you probably want Thyme to handle input this frame, while if it returns false, your application or game logic should handle input.
pub fn wants_keyboard(&self) -> bool
[src]
Returns true if thyme wants to use keyboard input in the current frame, generally because a widget that accepts text input is keyboard focused. If this returns true, you probably don’t want to handle keyboard events in your own application code.
pub fn set_scale_factor(&mut self, scale: f32)
[src]
Sets the scale factor, sometimes referred to as HiDPI factor for the monitor.
This is normally handled by the IO
backend, which will set
the scale factor based on a scale factor changed event. User code should
not need to call this.
pub fn set_display_size(&mut self, size: Point)
[src]
Set the display size in logical pixels (physical pixels divided by the scale factor).
This is normally handled by the IO
backend, which will set
this in response to a window resize event. User code should
not need to call this.
pub fn add_mouse_wheel(&mut self, delta: Point)
[src]
Add mouse wheel event, with delta
being the amount of device-dependant logical scrolling.
This is normally handled by the IO
backend, which will set
this in response to a window resize event. User code should
not need to call this.
pub fn set_input_modifiers(&mut self, input_modifiers: InputModifiers)
[src]
Set the input modifiers - the status of keys such as ctrl
and shift
.
This is normally handled by the IO
backend, which will set
this in response to a window resize event. User code should
not need to call this.
pub fn set_mouse_pressed(&mut self, pressed: bool, index: usize)
[src]
Set the mouse pressed state for a given mouse button.
Inputs:
- button
pressed
state - index: 0 = LeftClick, 1 = Right Click, 2 = Middle Click
This is normally handled by the
IO
backend, which will set this in response to a window resize event. User code should not need to call this.
pub fn push_character(&mut self, c: char)
[src]
Pushes a character (that was received from the keyboard) to thyme, to be
dispatched to the appropriate widget based on keyboard focus in the next Frame.
This is normally handled by the IO
backend, which will set
this in response to a window resize event. User code should
not need to call this.
pub fn set_mouse_pos(&mut self, pos: Point)
[src]
Set mouse position, based on mouse cursor movement. The scale factor must
be taken into account to convert physical pixels to the logical pixels used by
this.
This is normally handled by the IO
backend, which will set
this in response to a window resize event. User code should
not need to call this.
pub fn add_theme_file<P: Into<PathBuf>>(&mut self, path: P)
[src]
Adds the specified path as a source file for the resources being used
by the theme for this context. This will only work if the theme was
set up to read source data from files, i.e. using
ContextBuilder#register_theme_from_files
This does not rebuild the theme; you will
need to call rebuild_all
for that.
pub fn remove_theme_file<P: Into<PathBuf>>(&mut self, path: P)
[src]
Removes the theme source file with the specified path from the resources
being used by the theme for this context, if it is present. If it is not
present, does nothing. This does not rebuild the theme; you will
need to call rebuild_all
for that.
pub fn rebuild_all<R: Renderer>(
&mut self,
renderer: &mut R
) -> Result<(), Error>
[src]
&mut self,
renderer: &mut R
) -> Result<(), Error>
Rebuilds this context, reloading all asset data. Notably, files on disk
that were used in building
the context
are re-read. If any errors are encountered in reading or parsing files, this
will return Err
and no changes are made to the context.
pub fn check_live_reload<R: Renderer>(
&mut self,
renderer: &mut R
) -> Result<(), Error>
[src]
&mut self,
renderer: &mut R
) -> Result<(), Error>
Checks the internal live reload thread to see if any file notifications have occurred
since the last check. If so, will fully rebuild the theme. If any errors are encountered
in the process of rebuilding the theme, will return the Err
and no changes are made to
the current theme. Note that if you built the context with live reload disabled
(see BuildOptions
), this function will do nothing.
pub fn create_frame(&mut self) -> Frame
[src]
Creates a Frame
, the main object that should pass through
your UI building functions and is responsible for constructing the widget tree.
This method should be called each frame you want to draw / interact with the UI.
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast<T> for T
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.