pub struct TrayRoot {Show 16 fields
tray_ui: DynamicUiRef<SystemTray>,
no_parent: ParentCapture,
pub window: TrayWindow,
pub icon: Icon,
pub tray: TrayNotification,
last_tray_key_event: Cell<Option<Instant>>,
last_left_click: Cell<Option<Instant>>,
pub tray_menu: Menu,
selected_tray_menu_item: Cell<Option<ControlHandle>>,
last_menu_pos: Cell<Option<(i32, i32)>>,
reshow_tray_menu: Cell<Option<(Instant, MenuPosition)>>,
reshow_tray_menu_delay: FastTimerControl,
rebuild_at_startup: FastTimerControl,
first_created_at: Option<Instant>,
recheck_virtual_desktop_init: FastTimerControl,
need_rebuild: Cell<bool>,
}
Expand description
Basic state used by the program.
Fields§
§tray_ui: DynamicUiRef<SystemTray>
§no_parent: ParentCapture
§window: TrayWindow
§icon: Icon
The initial icon for the tray.
tray: TrayNotification
§last_tray_key_event: Cell<Option<Instant>>
§last_left_click: Cell<Option<Instant>>
The location where we last showed the context menu.
rebuild_at_startup: FastTimerControl
If the app is auto started with Windows then the taskbar might not exist when the program is started and if so we need to re-register our tray icon.
first_created_at: Option<Instant>
The program was started at approximately this time.
recheck_virtual_desktop_init: FastTimerControl
Initial virtual desktop count might be incorrect if program is started with Windows.
need_rebuild: Cell<bool>
Implementations§
Source§impl TrayRoot
impl TrayRoot
pub fn notify_that_tray_icon_exists(&self)
fn notify_tray_left_click(&self)
fn notify_startup_rebuild(&self)
fn notify_check_desktop_count(&self)
pub fn update_tray_icon(&self, tray_ui: &Rc<SystemTray>, new_ix: u32)
Trait Implementations§
Source§impl DynamicUiHooks<SystemTray> for TrayRoot
impl DynamicUiHooks<SystemTray> for TrayRoot
Source§fn before_partial_build(
&mut self,
_dynamic_ui: &Rc<SystemTray>,
_should_build: &mut bool,
) -> Option<(ControlHandle, TypeId)>
fn before_partial_build( &mut self, _dynamic_ui: &Rc<SystemTray>, _should_build: &mut bool, ) -> Option<(ControlHandle, TypeId)>
Called before the item has been built. The returned parent will be
passed to [
nwg::PartialUi::build_partial
] and used by controls in
structs that make use of the [nwd::NwgPartial
] derive macro. Read moreSource§fn after_partial_build(&mut self, tray_ui: &Rc<SystemTray>)
fn after_partial_build(&mut self, tray_ui: &Rc<SystemTray>)
Called right after the ui has finished building. Read more
Source§fn after_handles<'a>(
&'a self,
_dynamic_ui: &Rc<SystemTray>,
handles: &mut Vec<&'a ControlHandle>,
)
fn after_handles<'a>( &'a self, _dynamic_ui: &Rc<SystemTray>, handles: &mut Vec<&'a ControlHandle>, )
Run right after [
nwg::PartialUi::handles
] and allows modifying its
result.Source§fn after_process_events(
&self,
_dynamic_ui: &Rc<SystemTray>,
evt: Event,
_evt_data: &EventData,
handle: ControlHandle,
_window: ControlHandle,
)
fn after_process_events( &self, _dynamic_ui: &Rc<SystemTray>, evt: Event, _evt_data: &EventData, handle: ControlHandle, _window: ControlHandle, )
Run right after [
nwg::PartialUi::process_event
] and allows easily
doing some extra processing. Useful since the original method might be
implemented by a derive macro which would make it difficult to modify.Source§fn process_raw_event(
&self,
tray_ui: &Rc<SystemTray>,
_hwnd: isize,
msg: u32,
w: usize,
l: isize,
_window: ControlHandle,
) -> Option<isize>
fn process_raw_event( &self, tray_ui: &Rc<SystemTray>, _hwnd: isize, msg: u32, w: usize, l: isize, _window: ControlHandle, ) -> Option<isize>
Listen to raw window events (not filtered or processed by
[
native_windows_gui
]). The first result that returns Some
will be
used as the actual return value for the event. Read moreSource§fn need_rebuild(&self, _dynamic_ui: &Rc<SystemTray>) -> bool
fn need_rebuild(&self, _dynamic_ui: &Rc<SystemTray>) -> bool
Indicate that this item needs to be rebuilt. Maybe because its part of a
context menu and its items need to be changed. Read more
Source§fn before_rebuild(&mut self, _dynamic_ui: &Rc<SystemTray>)
fn before_rebuild(&mut self, _dynamic_ui: &Rc<SystemTray>)
Do some cleanup before the plugin is built again. By default this resets
the state to its default value.
Source§fn need_raw_events_for_children(&self) -> bool
fn need_raw_events_for_children(&self) -> bool
Called after
DynamicUiHooks::after_handles
to check if we should
bind raw event handlers for child controls as well.Source§fn is_ordered_in_parent(&self) -> bool
fn is_ordered_in_parent(&self) -> bool
Indicates if this item has a specific position relative to other items
in its parent. If this returns
true
then the item will be rebuilt
after previous siblings (items that share the same parent) are rebuilt. Read moreSource§impl PartialUi for TrayRoot
impl PartialUi for TrayRoot
Source§fn build_partial<W: Into<ControlHandle>>(
data: &mut Self,
_parent: Option<W>,
) -> Result<(), NwgError>
fn build_partial<W: Into<ControlHandle>>( data: &mut Self, _parent: Option<W>, ) -> Result<(), NwgError>
Should initialize the GUI components. Similar to
NativeUi::build_ui
except it doesn’t handle event binding. Read moreSource§fn process_event<'a>(
&self,
_evt: Event,
_evt_data: &EventData,
_handle: ControlHandle,
)
fn process_event<'a>( &self, _evt: Event, _evt_data: &EventData, _handle: ControlHandle, )
Should process the events of the partial. This method will probably be called from an event handler bound in the parent GUI structure. Read more
Source§impl TrayPlugin for TrayRoot
impl TrayPlugin for TrayRoot
fn on_windows_mode_changed(&self, tray_ui: &Rc<SystemTray>)
fn on_current_desktop_changed(&self, tray_ui: &Rc<SystemTray>, new_ix: u32)
fn on_settings_changed( &self, tray_ui: &Rc<SystemTray>, previous: &Arc<UiSettings>, new: &Arc<UiSettings>, )
Source§fn on_desktop_event(&self, _tray_ui: &Rc<SystemTray>, _event: &DesktopEvent)
fn on_desktop_event(&self, _tray_ui: &Rc<SystemTray>, _event: &DesktopEvent)
React to Virtual Desktop events.
fn on_desktop_count_changed( &self, _tray_ui: &Rc<SystemTray>, _new_desktop_count: u32, )
Handle keyboard button press on tray context menu. The first return
value that is
Some
will be used; if there is no such return value then
MenuKeyPressEffect::Ignore
will be used. Read moreAuto Trait Implementations§
impl !Freeze for TrayRoot
impl !RefUnwindSafe for TrayRoot
impl !Send for TrayRoot
impl !Sync for TrayRoot
impl Unpin for TrayRoot
impl !UnwindSafe for TrayRoot
Blanket Implementations§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
Source§impl<T> DynWithDefault for T
impl<T> DynWithDefault for T
Source§fn with_default_mut(
&mut self,
f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)),
)
fn with_default_mut( &mut self, f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)), )
Create a temporary default value of the current type and provide it in a
closure. The callback’s first argument is
self
and the second argument
is the new temporary default value. The callback can then modify the
value as needed.Source§fn clear_and_inspect_old(
&mut self,
f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)),
)
fn clear_and_inspect_old( &mut self, f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)), )
Set
self
to a new default value and inspect the previous value as the
second argument to the callback.fn clear(&mut self)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> PartialUiDyn for Twhere
T: PartialUi,
impl<T> PartialUiDyn for Twhere
T: PartialUi,
Source§fn build_partial_dyn(
&mut self,
parent: Option<ControlHandle>,
) -> Result<(), NwgError>
fn build_partial_dyn( &mut self, parent: Option<ControlHandle>, ) -> Result<(), NwgError>
Forwards calls to [
nwg::PartialUi::build_partial
].Source§fn process_event_dyn(
&self,
evt: Event,
evt_data: &EventData,
handle: ControlHandle,
)
fn process_event_dyn( &self, evt: Event, evt_data: &EventData, handle: ControlHandle, )
Forwards calls to [
nwg::PartialUi::process_event
].Source§fn handles_dyn(&self) -> Vec<&ControlHandle>
fn handles_dyn(&self) -> Vec<&ControlHandle>
Forwards calls to [
nwg::PartialUi::handles
].§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.§impl<Src> TryFrom<Src> for Src
impl<Src> TryFrom<Src> for Src
§impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
§impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
§fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.
§impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
§fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.