Struct widgetry::widgets::panel::Panel

source ·
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§

source§

impl Panel

source

pub fn new_builder(top_level: Widget) -> PanelBuilder

source

pub fn empty(ctx: &mut EventCtx<'_>) -> Panel

Returns an empty panel. event and draw will have no effect.

source

fn update_container_dims_for_canvas_dims(&mut self, canvas_dims: ScreenDims)

source

fn recompute_scrollbar_layout(&mut self, ctx: &EventCtx<'_>)

source

fn recompute_layout(&mut self, ctx: &EventCtx<'_>, recompute_bg: bool)

source

fn invalidate_flexbox(&mut self)

source

fn compute_flexbox(&self) -> (Taffy, Vec<Node>, ScreenDims)

source

fn recompute_layout_if_needed(&mut self, ctx: &EventCtx<'_>, recompute_bg: bool)

source

fn scroll_offset(&self) -> (f64, f64)

source

fn update_scroll_sliders( &mut self, ctx: &EventCtx<'_>, offset: (f64, f64) ) -> bool

source

fn set_scroll_offset(&mut self, ctx: &EventCtx<'_>, offset: (f64, f64))

source

pub fn event(&mut self, ctx: &mut EventCtx<'_>) -> Outcome

source

pub fn draw(&self, g: &mut GfxCtx<'_>)

source

pub fn get_all_click_actions(&self) -> HashSet<String>

source

pub fn restore(&mut self, ctx: &mut EventCtx<'_>, prev: &Panel)

source

pub fn restore_scroll(&mut self, ctx: &mut EventCtx<'_>, prev: &Panel)

source

pub fn scroll_to_member(&mut self, ctx: &EventCtx<'_>, name: String)

source

pub fn has_widget(&self, name: &str) -> bool

source

pub fn slider(&self, name: &str) -> &Slider

source

pub fn slider_mut(&mut self, name: &str) -> &mut Slider

source

pub fn take_menu_choice<T: 'static>(&mut self, name: &str) -> T

source

pub fn is_checked(&self, name: &str) -> bool

source

pub fn maybe_is_checked(&self, name: &str) -> Option<bool>

source

pub fn set_checked(&mut self, name: &str, on_off: bool)

source

pub fn text_box(&self, name: &str) -> String

source

pub fn spinner<T: 'static + SpinnerValue>(&self, name: &str) -> T

source

pub fn modify_spinner<T: 'static + SpinnerValue>( &mut self, ctx: &EventCtx<'_>, name: &str, delta: T )

source

pub fn dropdown_value<T: 'static + PartialEq + Clone, I: AsRef<str>>( &self, name: I ) -> T

source

pub fn maybe_dropdown_value<T: 'static + PartialEq + Clone, I: AsRef<str>>( &self, name: I ) -> Option<T>

source

pub fn persistent_split_value<T: 'static + PartialEq + Clone>( &self, name: &str ) -> T

source

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.

source

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.

source

pub fn clone_stashed<T: 'static + Clone>(&self, name: &str) -> T

Grab a stashed value and clone it.

source

pub fn is_button_enabled(&self, name: &str) -> bool

source

pub fn maybe_find_widget(&self, name: &str) -> Option<&Widget>

source

pub fn maybe_find<T: WidgetImpl>(&self, name: &str) -> Option<&T>

source

pub fn find<T: WidgetImpl>(&self, name: &str) -> &T

source

pub fn find_mut<T: WidgetImpl>(&mut self, name: &str) -> &mut T

source

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.

source

pub fn rect_of(&self, name: &str) -> &ScreenRectangle

source

pub fn center_of(&self, name: &str) -> ScreenPt

source

pub fn center_of_panel(&self) -> ScreenPt

source

pub fn panel_rect(&self) -> &ScreenRectangle

source

pub fn panel_dims(&self) -> ScreenDims

source

pub fn align(&mut self, horiz: HorizontalAlignment, vert: VerticalAlignment)

source

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.

source

pub fn take(&mut self, id: &str) -> Widget

Removes a widget from the panel. Does not recalculate layout!

source

pub fn clicked_outside(&self, ctx: &mut EventCtx<'_>) -> bool

source

pub fn currently_hovering(&self) -> Option<&String>

Auto Trait Implementations§

§

impl Freeze for Panel

§

impl !RefUnwindSafe for Panel

§

impl !Send for Panel

§

impl !Sync for Panel

§

impl Unpin for Panel

§

impl !UnwindSafe for Panel

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: 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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool