Skip to main content

CommandBar

Struct CommandBar 

Source
pub struct CommandBar {
Show 18 fields pub is_open: bool, pub changed: CommandBarOpenChangedHandler, pub primary_commands: Vec<CommandBarElement>, pub secondary_commands: Vec<CommandBarElement>, pub content: Option<WidgetRef>, pub default_label_position: CommandBarDefaultLabelPosition, pub overflow_button_visibility: CommandBarOverflowButtonVisibility, pub is_dynamic_overflow_enabled: bool, pub closed_display_mode: AppBarClosedDisplayMode, pub is_sticky: bool, pub light_dismiss_overlay_mode: LightDismissOverlayMode, pub background: Option<Brush>, pub opening: Option<Listener>, pub opened: Option<Listener>, pub closing: Option<Listener>, pub closed: Option<Listener>, pub dynamic_overflow_items_changing: Option<DynamicOverflowItemsChangingHandler>, pub key: Option<KeyRef>,
}
Expand description

XAML CommandBar.

Fields§

§is_open: bool

IsOpen.

§changed: CommandBarOpenChangedHandler

Asked for a new IsOpen by the MoreButton, a command, light dismiss and the keyboard; the bar opens and closes as is_open follows.

§primary_commands: Vec<CommandBarElement>

PrimaryCommands: the commands in the bar.

§secondary_commands: Vec<CommandBarElement>

SecondaryCommands: the commands in the overflow menu.

§content: Option<WidgetRef>

Content: shown at the bar’s start.

§default_label_position: CommandBarDefaultLabelPosition

DefaultLabelPosition.

§overflow_button_visibility: CommandBarOverflowButtonVisibility

OverflowButtonVisibility.

§is_dynamic_overflow_enabled: bool

IsDynamicOverflowEnabled: primary commands that do not fit move into the overflow.

§closed_display_mode: AppBarClosedDisplayMode

ClosedDisplayMode.

§is_sticky: bool

IsSticky: the open bar keeps the focus where it is and ignores light dismiss.

§light_dismiss_overlay_mode: LightDismissOverlayMode

LightDismissOverlayMode: whether the layer under the open bar dims the window.

§background: Option<Brush>

Background, while the bar is closed; the theme’s CommandBarBackground when None.

§opening: Option<Listener>

Opening.

§opened: Option<Listener>

Opened.

§closing: Option<Listener>

Closing.

§closed: Option<Listener>

Closed.

§dynamic_overflow_items_changing: Option<DynamicOverflowItemsChangingHandler>

DynamicOverflowItemsChanging.

§key: Option<KeyRef>

Identity retained across parent rebuilds.

Implementations§

Source§

impl CommandBar

Source

pub fn new(is_open: bool, changed: impl Fn(&mut App, bool) + 'static) -> Self

Creates a bar with its IsOpen and the callback asked for a new one.

Source

pub fn primary_commands(self, commands: Vec<CommandBarElement>) -> Self

Sets the XAML PrimaryCommands.

Source

pub fn secondary_commands(self, commands: Vec<CommandBarElement>) -> Self

Sets the XAML SecondaryCommands.

Source

pub fn content<K>(self, content: impl IntoWidget<K>) -> Self

Sets the XAML Content.

Source

pub fn default_label_position( self, position: CommandBarDefaultLabelPosition, ) -> Self

Sets the XAML DefaultLabelPosition.

Source

pub fn overflow_button_visibility( self, visibility: CommandBarOverflowButtonVisibility, ) -> Self

Sets the XAML OverflowButtonVisibility.

Source

pub fn is_dynamic_overflow_enabled(self, value: bool) -> Self

Sets the XAML IsDynamicOverflowEnabled.

Source

pub fn closed_display_mode(self, mode: AppBarClosedDisplayMode) -> Self

Sets the XAML ClosedDisplayMode.

Source

pub fn is_sticky(self, value: bool) -> Self

Sets the XAML IsSticky.

Source

pub fn light_dismiss_overlay_mode(self, mode: LightDismissOverlayMode) -> Self

Sets the XAML LightDismissOverlayMode.

Source

pub fn background(self, brush: Brush) -> Self

Sets the XAML Background.

Source

pub fn opening(self, listener: Listener) -> Self

Sets the XAML Opening handler.

Source

pub fn opened(self, listener: Listener) -> Self

Sets the XAML Opened handler.

Source

pub fn closing(self, listener: Listener) -> Self

Sets the XAML Closing handler.

Source

pub fn closed(self, listener: Listener) -> Self

Sets the XAML Closed handler.

Source

pub fn dynamic_overflow_items_changing( self, handler: impl Fn(&mut App, &DynamicOverflowItemsChangingEventArgs) + 'static, ) -> Self

Sets the XAML DynamicOverflowItemsChanging handler.

Source

pub fn key(self, key: KeyRef) -> Self

Sets the identity retained across rebuilds.

Trait Implementations§

Source§

impl Clone for CommandBar

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CommandBar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for CommandBar

Source§

type State = CommandBarState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> CommandBarState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for CommandBar

§

impl !Send for CommandBar

§

impl !Sync for CommandBar

§

impl !UnwindSafe for CommandBar

§

impl Forget for CommandBar

§

impl Freeze for CommandBar
where *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze, *const u8 is !null: Freeze, PhantomData<CommandBarElement>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, *const RcInner<dyn Fn(&mut App, &DynamicOverflowItemsChangingEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &DynamicOverflowItemsChangingEventArgs)>>: Freeze, *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze,

§

impl Move for CommandBar

§

impl Unpin for CommandBar
where Rc<dyn Fn(&mut App, bool)>: Unpin, *const u8 is !null: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<dyn Widget>: Unpin, Rc<Keep>: Unpin, &'static FocusNodeVTable: Unpin, Rc<dyn Key>: Unpin, Rc<dyn Fn(&mut App, Option<bool>)>: Unpin, Rc<dyn Fn(&mut App, &DynamicOverflowItemsChangingEventArgs)>: Unpin,

§

impl UnsafeUnpin for CommandBar
where *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<CommandBarElement>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &DynamicOverflowItemsChangingEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &DynamicOverflowItemsChangingEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin,

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
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>