Esempio n. 1
0
 private void DisposeAssetEditor()
 {
     if (this.assetEditor == null)
     {
         return;
     }
     this.RemovePropertyEditor(this.assetEditor);
     this.assetEditor.Dispose();
     this.assetEditor = null;
 }
Esempio n. 2
0
        private void SetupChildEditors()
        {
            this.BeginUpdate();

            // Remove the old Resource editor if it doesn't match
            if (this.resourceEditor != null && this.resourceType != this.EditedType)
            {
                this.DisposeResourceEditor();
            }

            // Add a new Resource editor if we don't have one yet
            if (this.resourceEditor == null)
            {
                this.resourceType          = this.EditedType;
                this.resourceEditor        = this.ParentGrid.CreateEditor(this.EditedType, this);
                this.resourceEditor.Getter = this.GetValue;
                this.resourceEditor.Setter = v => {};
                this.ParentGrid.ConfigureEditor(this.resourceEditor);
                this.AddPropertyEditor(this.resourceEditor);

                // If the child editor is a grouped one, expand it immediately after adding
                // and hide the expand / collapse checkbox. We don't want to expose our wrapper
                // structure after all.
                GroupedPropertyEditor group = this.resourceEditor as GroupedPropertyEditor;
                if (group != null)
                {
                    group.Expanded = true;
                    group.Hints   &= ~HintFlags.HasExpandCheck;
                }
            }

            // Set up a shared Asset editor that will be added or removed on demand
            if (this.assetEditor == null)
            {
                this.assetEditor            = new ResourceAssetPropertyEditor();
                this.assetEditor.EditedType = this.EditedType;                 // Needs to match so the forwarded getter's safety check passes
                this.assetEditor.Getter     = this.GetValue;
                this.assetEditor.Setter     = v => {};
                this.ParentGrid.ConfigureEditor(this.assetEditor);
            }

            this.EndUpdate();
        }
        private void SetupChildEditors()
        {
            this.BeginUpdate();

            // Remove the old Resource editor if it doesn't match
            if (this.resourceEditor != null && this.resourceType != this.EditedType)
                this.DisposeResourceEditor();

            // Add a new Resource editor if we don't have one yet
            if (this.resourceEditor == null)
            {
                this.resourceType = this.EditedType;
                this.resourceEditor = this.ParentGrid.CreateEditor(this.EditedType, this);
                this.resourceEditor.Getter = this.GetValue;
                this.resourceEditor.Setter = v => {};
                this.ParentGrid.ConfigureEditor(this.resourceEditor);
                this.AddPropertyEditor(this.resourceEditor);

                // If the child editor is a grouped one, expand it immediately after adding
                // and hide the expand / collapse checkbox. We don't want to expose our wrapper
                // structure after all.
                GroupedPropertyEditor group = this.resourceEditor as GroupedPropertyEditor;
                if (group != null)
                {
                    group.Expanded = true;
                    group.Hints &= ~HintFlags.HasExpandCheck;
                }
            }

            // Set up a shared Asset editor that will be added or removed on demand
            if (this.assetEditor == null)
            {
                this.assetEditor = new ResourceAssetPropertyEditor();
                this.assetEditor.EditedType = this.EditedType; // Needs to match so the forwarded getter's safety check passes
                this.assetEditor.Getter = this.GetValue;
                this.assetEditor.Setter = v => {};
                this.ParentGrid.ConfigureEditor(this.assetEditor);
            }

            this.EndUpdate();
        }
 private void DisposeAssetEditor()
 {
     if (this.assetEditor == null) return;
     this.RemovePropertyEditor(this.assetEditor);
     this.assetEditor.Dispose();
     this.assetEditor = null;
 }