pub struct ChatRef(/* private fields */);Implementations§
Source§impl ChatRef
impl ChatRef
pub fn has_widget(&self, widget: &WidgetRef) -> ChatRef
pub fn borrow(&self) -> Option<Ref<'_, Chat>>
pub fn borrow_mut(&self) -> Option<RefMut<'_, Chat>>
pub fn borrow_if_eq(&self, widget: &WidgetRef) -> Option<Ref<'_, Chat>>
pub fn borrow_mut_if_eq(&self, widget: &WidgetRef) -> Option<RefMut<'_, Chat>>
Source§impl ChatRef
impl ChatRef
Sourcepub fn read(&self) -> Ref<'_, Chat>
pub fn read(&self) -> Ref<'_, Chat>
Immutable access to the underlying Chat.
Panics if the widget reference is empty or if it’s already borrowed.
Sourcepub fn write(&mut self) -> RefMut<'_, Chat>
pub fn write(&mut self) -> RefMut<'_, Chat>
Mutable access to the underlying Chat.
Panics if the widget reference is empty or if it’s already borrowed.
Sourcepub fn read_with<R>(&self, f: impl FnOnce(&Chat) -> R) -> R
pub fn read_with<R>(&self, f: impl FnOnce(&Chat) -> R) -> R
Immutable reader to the underlying Chat.
Panics if the widget reference is empty or if it’s already borrowed.
Sourcepub fn write_with<R>(&mut self, f: impl FnOnce(&mut Chat) -> R) -> R
pub fn write_with<R>(&mut self, f: impl FnOnce(&mut Chat) -> R) -> R
Mutable writer to the underlying Chat.
Panics if the widget reference is empty or if it’s already borrowed.
Methods from Deref<Target = WidgetRef>§
pub fn is_empty(&self) -> bool
pub fn downgrade(&self) -> WidgetWeakRef
pub fn handle_event_with(
&self,
cx: &mut Cx,
event: &Event,
scope: &mut Scope<'_, '_>,
sweep_area: Area,
)
pub fn handle_event_with( &self, cx: &mut Cx, event: &Event, scope: &mut Scope<'_, '_>, sweep_area: Area, )
§handle event with a sweep area
this is used for the sweep event, this fn can help to pass the event into popup,
the widget should implement the handle_event_with fn in impl Widget for $Widget
§Example
ⓘ
impl Widget for Button {
fn handle_event_with(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope, sweep_area: Area) {
let uid = self.widget_uid();
if self.animator_handle_event(cx, event).must_redraw() {
self.draw_button.redraw(cx);
}
match event.hits_with_options(cx, self.draw_button.area(), HitOptions::new().with_sweep_area(sweep_area) ) {
Hit::FingerDown(f_down) => {
if self.grab_key_focus {
cx.set_key_focus(self.sweep_area);
}
cx.widget_action(uid, &scope.path, GButtonEvent::Pressed(f_down.modifiers));
self.animator_play(cx, ids!(hover.pressed));
}
_ =>()
}
}§Details
See Flexible Popup
pub fn handle_event( &self, cx: &mut Cx, event: &Event, scope: &mut Scope<'_, '_>, )
pub fn script_call( &self, vm: &mut ScriptVm<'_>, method: LiveId, args: ScriptValue, ) -> ScriptAsyncResult
pub fn script_result( &self, vm: &mut ScriptVm<'_>, id: ScriptAsyncId, result: ScriptValue, )
pub fn widget_uid(&self) -> WidgetUid
pub fn widget_uid(&self) -> WidgetUid
Returns the unique ID (UID) of this widget.
Returns WidgetUid(0) if the widget is currently borrowed or is empty.
pub fn try_widget_uid(&self) -> Option<WidgetUid>
pub fn widget_type_id(&self) -> Option<TypeId>
pub fn area(&self) -> Area
pub fn set_action_data<T>(&self, data: T)where
T: ActionTrait + PartialEq,
pub fn set_action_data_always<T>(&self, data: T)where
T: ActionTrait,
pub fn children(&self, visit: &mut dyn FnMut(LiveId, WidgetRef))
pub fn register_as_ui_root(&self, vm: &mut ScriptVm<'_>)
pub fn try_children(&self, visit: &mut dyn FnMut(LiveId, WidgetRef)) -> bool
pub fn skip_widget_tree_search(&self) -> bool
pub fn find_widgets_from_point( &self, cx: &Cx, point: Vec2d, found: &mut dyn FnMut(&WidgetRef), )
pub fn point_hits_area(&self, cx: &Cx, point: Vec2d) -> bool
pub fn find_interactive_widget_from_point( &self, cx: &Cx, point: Vec2d, ) -> Option<WidgetRef>
pub fn is_interactive(&self) -> bool
pub fn selection_text_len(&self) -> usize
pub fn selection_point_to_char_index( &self, cx: &Cx, abs: Vec2d, ) -> Option<usize>
pub fn selection_set(&self, anchor: usize, cursor: usize)
pub fn selection_clear(&self)
pub fn selection_select_all(&self)
pub fn selection_get_text_for_range(&self, start: usize, end: usize) -> String
pub fn selection_get_full_text(&self) -> String
pub fn child_by_path(&self, path: &[LiveId]) -> WidgetRef
pub fn child(&self, id: LiveId) -> WidgetRef
pub fn widget(&self, cx: &Cx, path: &[LiveId]) -> WidgetRef
pub fn widgets(&self, cx: &Cx, paths: &[&[LiveId]]) -> WidgetSet
pub fn widget_set(&self, cx: &Cx, paths: &[&[LiveId]]) -> WidgetSet
pub fn widget_flood(&self, cx: &Cx, path: &[LiveId]) -> WidgetRef
pub fn widgets_flood(&self, cx: &Cx, paths: &[&[LiveId]]) -> WidgetSet
pub fn draw_walk( &self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>, walk: Walk, ) -> Result<(), WidgetRef>
pub fn draw_walk_all( &self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>, walk: Walk, )
pub fn draw_3d_all(&self, cx: &mut Cx3d<'_, '_>, scope: &mut Scope<'_, '_>)
pub fn draw_3d( &mut self, cx: &mut Cx3d<'_, '_>, scope: &mut Scope<'_, '_>, ) -> Result<(), WidgetRef>
pub fn draw( &mut self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>, ) -> Result<(), WidgetRef>
pub fn draw_unscoped(&mut self, cx: &mut Cx2d<'_, '_>) -> Result<(), WidgetRef>
pub fn walk(&self, cx: &mut Cx) -> Walk
pub fn redraw(&self, cx: &mut Cx)
pub fn set_visible(&self, cx: &mut Cx, visible: bool)
pub fn visible(&self) -> bool
pub fn text(&self) -> String
pub fn set_text(&self, cx: &mut Cx, v: &str)
pub fn key_focus(&self, cx: &Cx) -> bool
pub fn set_key_focus(&self, cx: &mut Cx)
pub fn set_disabled(&self, cx: &mut Cx, disabled: bool)
pub fn disabled(&self, cx: &Cx) -> bool
pub fn draw_all(&self, cx: &mut Cx2d<'_, '_>, scope: &mut Scope<'_, '_>)
pub fn action_data(&self) -> Option<Arc<dyn ActionTrait>>
pub fn filter_actions<'a>( &'a self, actions: &'a [Box<dyn ActionTrait>], ) -> impl Iterator<Item = &'a WidgetAction>
pub fn draw_all_unscoped(&self, cx: &mut Cx2d<'_, '_>)
pub fn borrow_mut<T>(&self) -> Option<RefMut<'_, T>>where
T: 'static + Widget,
pub fn cast_inner_mut<T>(&self) -> Option<RefMut<'_, T>>where
T: 'static,
pub fn borrow<T>(&self) -> Option<Ref<'_, T>>where
T: 'static + Widget,
pub fn cast_inner<T>(&self) -> Option<Ref<'_, T>>where
T: 'static,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChatRef
impl !RefUnwindSafe for ChatRef
impl !Send for ChatRef
impl !Sync for ChatRef
impl Unpin for ChatRef
impl !UnwindSafe for ChatRef
Blanket Implementations§
§impl<T> ActionTrait for T
impl<T> ActionTrait for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§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>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.