Table of Contents

Struct IMenusComponent

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

This type represents a pointer to an unmanaged open.mp IMenusComponent interface.

[OpenMpApi(new Type[] { typeof(IPoolComponent<IMenu>) })]
public readonly struct IMenusComponent : IEquatable<IMenusComponent>, IMenusComponent.IManagedInterface, IPoolComponent<IMenu>.IManagedInterface, IComponent.IManagedInterface, IUnmanagedInterface
Implements
Inherited Members

Constructors

IMenusComponent(nint)

Initializes a new instance of the IMenusComponent struct.

public IMenusComponent(nint handle)

Parameters

handle nint

A pointer to the unmanaged interface.

Properties

Handle

Gets the handle to the unmanaged interface instance.

public nint Handle { get; }

Property Value

nint

HasValue

Gets a value indicating whether the pointer has a value.

public bool HasValue { get; }

Property Value

bool

Methods

AsPool()

Converts this component to a pool.

public IPool<IMenu> AsPool()

Returns

IPool<IMenu>

A pool.

ComponentName()

Gets the name of the component.

public string ComponentName()

Returns

string

The component name.

ComponentVersion()

Gets the version of the component.

public SemanticVersion ComponentVersion()

Returns

SemanticVersion

The component version.

Create(string, Vector2, byte, float, float)

Creates a new menu with the specified properties.

public IMenu Create(string title, Vector2 position, byte columns, float col1Width, float col2Width)

Parameters

title string

The title of the menu.

position Vector2

The position to display the menu.

columns byte

The number of columns (1 or 2).

col1Width float

The width of the first column.

col2Width float

The width of the second column (if applicable).

Returns

IMenu

The created menu, or null if creation failed.

Equals(IMenusComponent)

public bool Equals(IMenusComponent other)

Parameters

other IMenusComponent

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetComponentType()

Gets the type of the component.

public ComponentType GetComponentType()

Returns

ComponentType

The component type.

GetEventDispatcher()

Gets the event dispatcher for menu events.

public IEventDispatcher<IMenuEventHandler> GetEventDispatcher()

Returns

IEventDispatcher<IMenuEventHandler>

An event dispatcher for IMenuEventHandler events.

GetHashCode()

public override int GetHashCode()

Returns

int

SupportedVersion()

Gets the supported version of the component.

public int SupportedVersion()

Returns

int

The supported version of the component.

Remarks

The idea is for the SDK to be totally forward compatible, so code built at any time will always work, thanks to ABI compatibility. This method is an emergency trap door, just in case that's ever not the problem. Check which major version this component was built for, if it isn't the current major version, fail to load it. Always just returns a constant, recompiling will often be enough to upgrade. virtual and final to be the vtable, but it can't be overridden because it is a constant.

Operators

operator ==(IMenusComponent, object?)

Determines whether the specified values are equal.

public static bool operator ==(IMenusComponent lhs, object? rhs)

Parameters

lhs IMenusComponent

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are equal; otherwise, false.

explicit operator IMenusComponent(IComponent)

Casts the IComponent to a IMenusComponent.

public static explicit operator IMenusComponent(IComponent value)

Parameters

value IComponent

The IComponent to cast.

Returns

IMenusComponent

The converted IMenusComponent.

explicit operator IComponent(IMenusComponent)

Casts the IMenusComponent to a IComponent.

public static explicit operator IComponent(IMenusComponent value)

Parameters

value IMenusComponent

The IMenusComponent to cast.

Returns

IComponent

The converted IComponent.

explicit operator IPoolComponent<IMenu>(IMenusComponent)

public static explicit operator IPoolComponent<IMenu>(IMenusComponent value)

Parameters

value IMenusComponent

The IMenusComponent to cast.

Returns

IPoolComponent<IMenu>

The converted IPoolComponent<T>.

explicit operator IMenusComponent(IPoolComponent<IMenu>)

public static explicit operator IMenusComponent(IPoolComponent<IMenu> value)

Parameters

value IPoolComponent<IMenu>

The IPoolComponent<T> to cast.

Returns

IMenusComponent

The converted IMenusComponent.

operator !=(IMenusComponent, object?)

Determines whether the specified values are not equal.

public static bool operator !=(IMenusComponent lhs, object? rhs)

Parameters

lhs IMenusComponent

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are not equal; otherwise, false.

Explicit Interface Implementations

ComponentId

Gets the identifier of the component type.

static UID ComponentId { get; }

Returns

UID

FromComponentHandle(nint)

Casts a handle from a IComponent handle to a handle of this type.

static nint FromComponentHandle(nint handle)

Parameters

handle nint

The IComponent handle.

Returns

nint

The handle of this type.