pub struct InspectorContext {
pub stack_panel: Handle<StackPanel>,
pub menu: Menu,
pub entries: Vec<ContextEntry>,
pub property_definitions: Arc<PropertyEditorDefinitionContainer>,
pub environment: Option<Arc<dyn InspectorEnvironment>>,
pub object_type_id: TypeId,
pub name_column_width: f32,
pub has_parent_object: bool,
}Expand description
The widget handle and associated information that represents what an Inspector is currently displaying.
Fields§
§stack_panel: Handle<StackPanel>The handle of a UI node containing property editor widgets. This would usually be a vertical Stack widget, but any widget will sever the same purpose so long as it produces messages that are recognized by the PropertyEditorDefinitions contained in InspectorContext::property_definitions.
To ensure this, the widget should be composed of widgets produced by PropertyEditorDefinition::create_instance.
The context menu that opens when right-clicking on the inspector.
entries: Vec<ContextEntry>List of the editors in this inspector, in order, with each entry giving the editor widget handle, the name of the field being edited, and so on.
property_definitions: Arc<PropertyEditorDefinitionContainer>List if property definitions that are by sync to update the widgets of stack_panel, with the current values of properties that may have changed.
environment: Option<Arc<dyn InspectorEnvironment>>Untyped information from the application that is using the inspector. This can be used by editors that may be supplied by that application, if those editors know the actual type of this value to be able to successfully cast it.
object_type_id: TypeIdType id of the object for which the context was created.
name_column_width: f32A width of the property name column.
has_parent_object: boolA flag, that defines whether the inspectable object has a parent object from which it can
obtain initial property values when clicking on “Revert” button. This flag is used only for
crate::core::variable::InheritableVariable properties, primarily to hide “Revert” button
when it does nothing (when there’s no parent object).
Implementations§
Source§impl InspectorContext
impl InspectorContext
Sourcepub fn from_object(
context: InspectorContextArgs<'_, '_, '_>,
) -> InspectorContext
pub fn from_object( context: InspectorContextArgs<'_, '_, '_>, ) -> InspectorContext
Build the widgets for an Inspector to represent the given object by accessing the object’s fields through reflection.
- object: The object to inspect.
- ctx: The general context for widget creation.
- definition_container: The list of property editor definitions that will create the editors based on the type of each field.
- environment: Untyped optional generic information about the application using the inspector, which may be useful to some editors. Often this will be Fyroxed’s EditorEnvironment.
- layer_index: Inspectors can be nested within the editors of other inspectors. The layer_index is the count of how deeply nested this inspector will be.
- generate_property_string_values: Should we use
format!("{:?}", field)to construct string representations for each property? - filter: A filter function that controls whether each field will be included in the inspector.
Sourcepub fn sync(
&self,
object: &(dyn Reflect + 'static),
ui: &mut UserInterface,
layer_index: usize,
generate_property_string_values: bool,
filter: PropertyFilter,
base_path: String,
) -> Result<(), Vec<InspectorError>>
pub fn sync( &self, object: &(dyn Reflect + 'static), ui: &mut UserInterface, layer_index: usize, generate_property_string_values: bool, filter: PropertyFilter, base_path: String, ) -> Result<(), Vec<InspectorError>>
Update the widgets to reflect the value of the given object. We will iterate through the fields and find the appropriate PropertyEditorDefinition for each field. We call create_message to get each property editor definition to generate the appropriate message to get the editor widget to update itself.
- object: The object to take the property values from.
- ui: The UserInterface to include in the PropertyEditorMessageContext.
- layer_index: The depth of the nesting of this inspector.
- generator_property_string_values: if any editors within this inspector contain inner inspectors, should those inspectors generate strings for their properties?
- filter: filter function for the fields of
objectand for any inspectors within the editors of this inspector.
Sourcepub fn property_editors(&self) -> impl Iterator<Item = &ContextEntry>
pub fn property_editors(&self) -> impl Iterator<Item = &ContextEntry>
Iterates through every property.
Sourcepub fn find_property_editor(&self, name: &str) -> Option<&ContextEntry>
pub fn find_property_editor(&self, name: &str) -> Option<&ContextEntry>
Return the entry for the property with the given name.
Sourcepub fn find_property_editor_by_tag(&self, tag: &str) -> Option<&ContextEntry>
pub fn find_property_editor_by_tag(&self, tag: &str) -> Option<&ContextEntry>
Return the entry for the property with the given tag.
Sourcepub fn find_property_editor_widget(&self, name: &str) -> Handle<UiNode>
pub fn find_property_editor_widget(&self, name: &str) -> Handle<UiNode>
Shortcut for getting the editor widget from the property with the given name.
Returns Handle::NONE if there is no property with that name.
Trait Implementations§
Source§impl Clone for InspectorContext
impl Clone for InspectorContext
Source§fn clone(&self) -> InspectorContext
fn clone(&self) -> InspectorContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InspectorContext
impl Debug for InspectorContext
Source§impl Default for InspectorContext
impl Default for InspectorContext
Source§fn default() -> InspectorContext
fn default() -> InspectorContext
Source§impl PartialEq for InspectorContext
impl PartialEq for InspectorContext
Auto Trait Implementations§
impl Freeze for InspectorContext
impl !RefUnwindSafe for InspectorContext
impl Send for InspectorContext
impl Sync for InspectorContext
impl Unpin for InspectorContext
impl UnsafeUnpin for InspectorContext
impl !UnwindSafe for InspectorContext
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.