Trait PropertyEditorDefinition

Source
pub trait PropertyEditorDefinition:
    Debug
    + Send
    + Sync {
    // Required methods
    fn value_type_id(&self) -> TypeId;
    fn create_instance(
        &self,
        ctx: PropertyEditorBuildContext<'_, '_, '_, '_>,
    ) -> Result<PropertyEditorInstance, InspectorError>;
    fn create_message(
        &self,
        ctx: PropertyEditorMessageContext<'_, '_, '_>,
    ) -> Result<Option<UiMessage>, InspectorError>;
    fn translate_message(
        &self,
        ctx: PropertyEditorTranslationContext<'_, '_>,
    ) -> Option<PropertyChanged>;
}
Expand description

The trait for all property editor definitions which are capable of providing and editor widget to an Inspector and helping the inspector handle the necessary messages to and from that widget.

Required Methods§

Source

fn value_type_id(&self) -> TypeId

The type of property that the editor will edit.

Source

fn create_instance( &self, ctx: PropertyEditorBuildContext<'_, '_, '_, '_>, ) -> Result<PropertyEditorInstance, InspectorError>

Build a widget that an Inspector can use to edit this property. The returned value is either a simple property editor instance which contains just a UiNode handle, or else it is a custom editor instance that contains both the handle of the editor and the handle of the container.

Source

fn create_message( &self, ctx: PropertyEditorMessageContext<'_, '_, '_>, ) -> Result<Option<UiMessage>, InspectorError>

Create a message that will tell the editor widget to update itself with the current value of the property. This is called by InspectorContext::sync.

Despite the name, this method is also permitted to send messages directly to the widget instead of returning anything. If messages are sent directly, they should have their UiMessage::flags set to PropertyEditorMessageContext::sync_flag, as this is required to identify the message a sync message and prevent potential infinite message loops.

If a message is returned, the caller is responsible for setting flags and sending the message.

Source

fn translate_message( &self, ctx: PropertyEditorTranslationContext<'_, '_>, ) -> Option<PropertyChanged>

Translate messages from the editor widget created by PropertyEditorDefinition::create_message into PropertyChanged messages that the Inspector widget can use to apply updates. The given PropertyEditorTranslationContext contains all the relevant details of the message to be translated.

Implementors§

Source§

impl PropertyEditorDefinition for BoolPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for ColorGradientPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for ColorPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for CurvePropertyEditorDefinition

Source§

impl PropertyEditorDefinition for ImmutableStringPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for HotKeyPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for KeyBindingPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for PathPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for StringPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for TextureSlicePropertyEditorDefinition

Source§

impl PropertyEditorDefinition for Utf32StringPropertyEditorDefinition

Source§

impl PropertyEditorDefinition for UuidPropertyEditorDefinition

Source§

impl<T> PropertyEditorDefinition for BitFieldPropertyEditorDefinition<T>
where T: BitContainer,

Source§

impl<T> PropertyEditorDefinition for VecCollectionPropertyEditorDefinition<T>
where T: CollectionItem,

Source§

impl<T> PropertyEditorDefinition for EnumPropertyEditorDefinition<T>
where T: InspectableEnum,

Source§

impl<T> PropertyEditorDefinition for InheritablePropertyEditorDefinition<T>
where T: Reflect + FieldValue,

Source§

impl<T> PropertyEditorDefinition for InspectablePropertyEditorDefinition<T>
where T: Reflect + 'static,

Source§

impl<T> PropertyEditorDefinition for NumericPropertyEditorDefinition<T>
where T: NumericType,

Source§

impl<T> PropertyEditorDefinition for QuatPropertyEditorDefinition<T>

Source§

impl<T> PropertyEditorDefinition for RangePropertyEditorDefinition<T>
where T: NumericType,

Source§

impl<T> PropertyEditorDefinition for RectPropertyEditorDefinition<T>
where T: NumericType,

Source§

impl<T> PropertyEditorDefinition for RefCellPropertyEditorDefinition<T>
where T: Reflect + FieldValue,

Source§

impl<T, const D: usize> PropertyEditorDefinition for VecPropertyEditorDefinition<T, D>
where T: NumericType,

Source§

impl<T, const N: usize> PropertyEditorDefinition for ArrayPropertyEditorDefinition<T, N>
where T: Reflect + Debug + 'static,

Source§

impl<const R: usize, const C: usize, T> PropertyEditorDefinition for MatrixPropertyEditorDefinition<R, C, T>
where T: NumericType,