pub struct Panel {
top_level: Widget,
cached_flexbox: Option<(Taffy, Vec<Node>, ScreenDims)>,
horiz: HorizontalAlignment,
vert: VerticalAlignment,
dims_x: PanelDims,
dims_y: PanelDims,
scrollable_x: bool,
scrollable_y: bool,
contents_dims: ScreenDims,
container_dims: ScreenDims,
clip_rect: Option<ScreenRectangle>,
}
Fields
top_level: Widget
cached_flexbox: Option<(Taffy, Vec<Node>, ScreenDims)>
horiz: HorizontalAlignment
vert: VerticalAlignment
dims_x: PanelDims
dims_y: PanelDims
scrollable_x: bool
scrollable_y: bool
contents_dims: ScreenDims
container_dims: ScreenDims
clip_rect: Option<ScreenRectangle>
Implementations
sourceimpl Panel
impl Panel
pub fn new_builder(top_level: Widget) -> PanelBuilder
sourcepub fn empty(ctx: &mut EventCtx<'_>) -> Panel
pub fn empty(ctx: &mut EventCtx<'_>) -> Panel
Returns an empty panel. event
and draw
will have no effect.
fn update_container_dims_for_canvas_dims(&mut self, canvas_dims: ScreenDims)
fn recompute_scrollbar_layout(&mut self, ctx: &EventCtx<'_>)
fn recompute_layout(&mut self, ctx: &EventCtx<'_>, recompute_bg: bool)
fn invalidate_flexbox(&mut self)
fn compute_flexbox(&self) -> (Taffy, Vec<Node>, ScreenDims)
fn recompute_layout_if_needed(&mut self, ctx: &EventCtx<'_>, recompute_bg: bool)
fn scroll_offset(&self) -> (f64, f64)
fn update_scroll_sliders(
&mut self,
ctx: &EventCtx<'_>,
offset: (f64, f64)
) -> bool
fn set_scroll_offset(&mut self, ctx: &EventCtx<'_>, offset: (f64, f64))
pub fn event(&mut self, ctx: &mut EventCtx<'_>) -> Outcome
pub fn draw(&self, g: &mut GfxCtx<'_>)
pub fn get_all_click_actions(&self) -> HashSet<String>
pub fn restore(&mut self, ctx: &mut EventCtx<'_>, prev: &Panel)
pub fn restore_scroll(&mut self, ctx: &mut EventCtx<'_>, prev: &Panel)
pub fn scroll_to_member(&mut self, ctx: &EventCtx<'_>, name: String)
pub fn has_widget(&self, name: &str) -> bool
pub fn slider(&self, name: &str) -> &Slider
pub fn slider_mut(&mut self, name: &str) -> &mut Slider
pub fn is_checked(&self, name: &str) -> bool
pub fn maybe_is_checked(&self, name: &str) -> Option<bool>
pub fn set_checked(&mut self, name: &str, on_off: bool)
pub fn text_box(&self, name: &str) -> String
pub fn spinner<T: 'static + SpinnerValue>(&self, name: &str) -> T
pub fn modify_spinner<T: 'static + SpinnerValue>(
&mut self,
ctx: &EventCtx<'_>,
name: &str,
delta: T
)
pub fn dropdown_value<T: 'static + PartialEq + Clone, I: AsRef<str>>(
&self,
name: I
) -> T
pub fn maybe_dropdown_value<T: 'static + PartialEq + Clone, I: AsRef<str>>(
&self,
name: I
) -> Option<T>
pub fn persistent_split_value<T: 'static + PartialEq + Clone>(
&self,
name: &str
) -> T
sourcepub fn autocomplete_done<T: 'static + Clone>(
&mut self,
name: &str
) -> Option<Vec<T>>
pub fn autocomplete_done<T: 'static + Clone>(
&mut self,
name: &str
) -> Option<Vec<T>>
Consumes the autocomplete widget. It’s fine if the panel survives past this event; the autocomplete just needs to be interacted with again to produce more values.
sourcepub fn stash<T: 'static>(&self, name: &str) -> Rc<RefCell<T>>
pub fn stash<T: 'static>(&self, name: &str) -> Rc<RefCell<T>>
Grab a stashed value, with the ability to pass it around and modify it.
sourcepub fn clone_stashed<T: 'static + Clone>(&self, name: &str) -> T
pub fn clone_stashed<T: 'static + Clone>(&self, name: &str) -> T
Grab a stashed value and clone it.
pub fn maybe_find_widget(&self, name: &str) -> Option<&Widget>
pub fn maybe_find<T: WidgetImpl>(&self, name: &str) -> Option<&T>
pub fn find<T: WidgetImpl>(&self, name: &str) -> &T
pub fn find_mut<T: WidgetImpl>(&mut self, name: &str) -> &mut T
sourcepub(crate) fn swap_inner_content(
&mut self,
ctx: &EventCtx<'_>,
container_name: &str,
new_inner_content: &mut Widget
)
pub(crate) fn swap_inner_content(
&mut self,
ctx: &EventCtx<'_>,
container_name: &str,
new_inner_content: &mut Widget
)
Swap the inner content of a container
widget with new_inner_content
.
pub fn rect_of(&self, name: &str) -> &ScreenRectangle
pub fn center_of(&self, name: &str) -> ScreenPt
pub fn center_of_panel(&self) -> ScreenPt
pub fn panel_dims(&self) -> ScreenDims
pub fn align(&mut self, horiz: HorizontalAlignment, vert: VerticalAlignment)
sourcepub fn replace(&mut self, ctx: &mut EventCtx<'_>, id: &str, new: Widget)
pub fn replace(&mut self, ctx: &mut EventCtx<'_>, id: &str, new: Widget)
All margins/padding/etc from the previous widget are retained. The ID is set on the new widget; no need to do that yourself.
sourcepub fn take(&mut self, id: &str) -> Widget
pub fn take(&mut self, id: &str) -> Widget
Removes a widget from the panel. Does not recalculate layout!
pub fn clicked_outside(&self, ctx: &mut EventCtx<'_>) -> bool
pub fn currently_hovering(&self) -> Option<&String>
Auto Trait Implementations
impl !RefUnwindSafe for Panel
impl !Send for Panel
impl !Sync for Panel
impl Unpin for Panel
impl !UnwindSafe for Panel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
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. Read more
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. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more