# MenuBase

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-menubase/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct MenuBase
```

Base class for menu controls.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L23)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`close`](#function-close)
- [`open`](#function-open)
- [`on_submenu_opened`](#function-on_submenu_opened)
- [`is_open_property`](#function-is_open_property)
- [`opened_event`](#function-opened_event)
- [`closed_event`](#function-closed_event)
- [`construct`](#function-construct)
- [`is_open`](#function-is_open)
- [`set_is_open`](#function-set_is_open)
- [`opened`](#function-opened)
- [`closed`](#function-closed)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L29)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<MenuBase>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L29)

<a id="function-close"></a>

### close

```rust
fn close(self: &Self)
```

Closes the menu.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L29)

<a id="function-open"></a>

### open

```rust
fn open(self: &Self)
```

Opens the menu.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L29)

<a id="function-on_submenu_opened"></a>

### on_submenu_opened

```rust
fn on_submenu_opened(self: &Self, e: &RoutedEventArgs)
```

Called when a submenu opens somewhere in the menu.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L29)

<a id="function-is_open_property"></a>

### is_open_property

```rust
fn is_open_property() -> &'static DirectProperty<MenuBase, bool>
```

Defines the `IsOpen` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L188)

<a id="function-opened_event"></a>

### opened_event

```rust
fn opened_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `Opened` event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L198)

<a id="function-closed_event"></a>

### closed_event

```rust
fn closed_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `Closed` event.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L205)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data of a menu that uses the default menu
interaction handler; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L220)

<a id="function-is_open"></a>

### is_open

```rust
fn is_open(self: &Self) -> bool
```

Gets a value indicating whether the menu is open.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L230)

<a id="function-set_is_open"></a>

### set_is_open

```rust
fn set_is_open(self: &Self, value: bool)
```

Sets a value indicating whether the menu is open. For deriving
classes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L236)

<a id="function-opened"></a>

### opened

```rust
fn opened(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs when a menu is opened.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L246)

<a id="function-closed"></a>

### closed

```rust
fn closed(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs when a menu is closed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/menu_base.rs#L251)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`SelectingItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-selectingitemscontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`MenuBaseImplExt`](/docs/0.5.0/api/ferroui-controls/trait-menubaseimplext/)
- [`ItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<MenuBase>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`SelectingItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-selectingitemscontrolimpl/)
- [`IFocusScope`](/docs/0.5.0/api/ferroui-base/input/trait-ifocusscope/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimpl/)
- [`MenuBaseImpl`](/docs/0.5.0/api/ferroui-controls/trait-menubaseimpl/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
