Exemple #1
0
            public LongEnumControl(PropertyEditorControlContext context, int dropDownHeight)
            {
                m_listBox = new ListBox();
                m_listBox.PreviewKeyDown += listBox_PreviewKeyDown;
                if (dropDownHeight > 0)
                {
                    m_listBox.Height = dropDownHeight;
                }
                m_listBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
                DropDownControl         = m_listBox;
                DoubleBuffered          = true;
                this.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                this.AutoCompleteSource = AutoCompleteSource.CustomSource;
                this.FormattingEnabled  = true;
                m_context = context;


                //this.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
                this.SelectedIndexChanged += comboBox_SelectedIndexChanged;

                m_defaultFont = new Font(Font, FontStyle.Regular);
                m_boldFont    = new Font(Font, FontStyle.Bold);
                // m_defaultColor = this.ForeColor;
                // ForeColorChanged += (sender, e) => m_defaultColor = ForeColor;
            }
Exemple #2
0
        /// <summary>
        /// Obtains a control to edit a given property. Changes to the selection set
        /// cause this method to be called again (and passed a new 'context'),
        /// unless ICacheablePropertyControl is implemented on the control. For
        /// performance reasons, it is highly recommended that the control implement
        /// the ICacheablePropertyControl interface.</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            if (context.LastSelectedObject == null)
                return null;

            return new ArrayEditingControl(context);
        }
Exemple #3
0
        /// <summary>
        /// Obtains a control to edit a given property. Changes to the selection set
        /// cause this method to be called again (and passed a new 'context'),
        /// unless ICacheablePropertyControl is implemented on the control. For
        /// performance reasons, it is highly recommended that the control implement
        /// the ICacheablePropertyControl interface.</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            var control = new CollectionEditingControl(context);

            SkinService.ApplyActiveSkin(control);
            return(control);
        }
Exemple #4
0
        /// <summary>
        /// Obtains a control to edit a given property. Changes to the selection set
        /// cause this method to be called again (and passed a new 'context'),
        /// unless ICacheablePropertyControl is implemented on the control. For
        /// performance reasons, it is highly recommended that the control implement
        /// the ICacheablePropertyControl interface.</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public virtual Control GetEditingControl(PropertyEditorControlContext context)
        {
            var control = new BoundedFloatControl(context, m_min, m_max);

            SkinService.ApplyActiveSkin(control);
            return(control);
        }
Exemple #5
0
        /// <summary>
        /// Constructor</summary>
        /// <param name="context">Property editor control context</param>
        public ArrayEditingControl(PropertyEditorControlContext context)
        {
            m_context = context;
            m_initialSelectedObject = m_context.LastSelectedObject.As <DomNodeAdapter>().DomNode;
            m_initialSelectedObject.AttributeChanged += DomNode_AttributeChanged;
            m_toolStrip = new ToolStrip {
                Dock = DockStyle.Top
            };
            InitToolStrip();
            Controls.Add(m_toolStrip);
            Height = m_toolStrip.Height;
            m_toolStrip.SizeChanged += toolStrip_SizeChanged;

            // Get active contexts and subscribe to ContextChanged event
            IContextRegistry contextRegistry = m_context.ContextRegistry;

            if (contextRegistry != null)
            {
                contextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged;
                TransactionContext = contextRegistry.GetActiveContext <ITransactionContext>();
            }
            else if (context.TransactionContext != null)
            {
                TransactionContext = context.TransactionContext;
            }
        }
Exemple #6
0
            public EnumEditorControl(PropertyEditorControlContext context,
                                     string[] names, string[] displayNames, Image[] images)
            {
                m_images       = images;
                m_context      = context;
                m_displayNames = displayNames;
                m_names        = names;
                if (m_images != null && m_images.Length > 0)
                {
                    DrawMode = DrawMode.OwnerDrawFixed;
                }
                IntegralHeight = false;

                var enums = displayNames ?? names;

                BeginUpdate();
                Items.AddRange(enums);
                EndUpdate();

                FlatStyle             = FlatStyle.Standard;
                MaxDropDownItems      = 6;
                DrawMode              = DrawMode.OwnerDrawFixed;
                AutoCompleteMode      = AutoCompleteMode.Suggest;
                AutoCompleteSource    = AutoCompleteSource.ListItems;
                SelectedIndexChanged += ComboboxSelectedIndexChanged;

                SetDropDownWidth();
                FontChanged += (sender, e) => SetDropDownWidth();
                RefreshValue();
            }
Exemple #7
0
            public NumericTupleControl(Type type, string[] names, PropertyEditorControlContext context)
                : base(type, names)
            {
                m_context = context;

                RefreshValue();
            }
Exemple #8
0
            public NumericMatrixControl(Type type, int rows, int columns, PropertyEditorControlContext context)
                : base(type, rows, columns)
            {
                m_context = context;

                RefreshValue();
            }
Exemple #9
0
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public override Control GetEditingControl(PropertyEditorControlContext context)
        {
            UniformArrayTextBox editingControl = new UniformArrayTextBox(context);

            editingControl.ScaleFactor = ScaleFactor;
            return(editingControl);
        }
Exemple #10
0
 /// <summary>
 /// Gets a control to edit the given property</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public virtual Control GetEditingControl(PropertyEditorControlContext context)
 {
     NumericTextBox editingControl = new NumericTextBox(m_numericType, context);
     editingControl.ScaleFactor = m_scaleFactor;
     SkinService.ApplyActiveSkin(editingControl);
     return editingControl;            
 }
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            if (context.LastSelectedObject == null)
                return null;

            bool toolStripLabelEnabled = (Parameters != null && Parameters.Length > 2 && Boolean.Parse(Parameters[2]));
            return new CollectionControl(this, context, toolStripLabelEnabled);
        }
            public NumericTextBox(Type numericType, PropertyEditorControlContext context)
                : base(numericType)
            {
                m_context = context;

                BorderStyle = BorderStyle.None;
                RefreshValue();
            }
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public virtual Control GetEditingControl(PropertyEditorControlContext context)
        {
            NumericTextBox editingControl = new NumericTextBox(m_numericType, context);

            editingControl.ScaleFactor = m_scaleFactor;
            SkinService.ApplyActiveSkin(editingControl);
            return(editingControl);
        }
Exemple #14
0
            public NumericTextBox(Type numericType, PropertyEditorControlContext context)
                : base(numericType)
            {
                m_context = context;

                BorderStyle = BorderStyle.None;               
                RefreshValue();               
            }
Exemple #15
0
            /// <summary>
            /// Constructor</summary>
            /// <param name="context">PropertyEditorControlContext</param>
            public UniformArrayTextBox(PropertyEditorControlContext context)
                : base(typeof(T))
            {
                m_context = context;

                BorderStyle = BorderStyle.None;

                RefreshValue();
            }
Exemple #16
0
        /// <summary>
        /// Obtains a control to edit a given property. Changes to the selection set
        /// cause this method to be called again (and passed a new 'context'),
        /// unless ICacheablePropertyControl is implemented on the control. For
        /// performance reasons, it is highly recommended that the control implement
        /// the ICacheablePropertyControl interface.</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public virtual Control GetEditingControl(PropertyEditorControlContext context)
        {
            var control = new BoundedIntControl(context, m_min, m_max);

            SkinService.ApplyActiveSkin(control);
            m_controlRefList.RemoveAll(item => !item.IsAlive);
            m_controlRefList.Add(new WeakReference(control));
            return(control);
        }
        /// <summary>
        /// Obtains a control to edit a given property. Changes to the selection set
        /// cause this method to be called again (and passed a new 'context'),
        /// unless ICacheablePropertyControl is implemented on the control. For
        /// performance reasons, it is highly recommended that the control implement
        /// the ICacheablePropertyControl interface.</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            if (context.LastSelectedObject == null)
                return null;
            var control = new StringArrayEditingControl(context);
            Sce.Atf.Applications.SkinService.ApplyActiveSkin(control);
            return control;


        }
Exemple #18
0
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public virtual Control GetEditingControl(PropertyEditorControlContext context)
        {
            LongEnumControlWrapper wrapper = new LongEnumControlWrapper(context, m_dropDownHeight);

            wrapper.EnumControl.ConvertIdToDisplayCallback = ConvertIdToDisplay;
            wrapper.EnumControl.ConvertDisplayToIdCallback = ConvertDisplayToId;
            UpdateEnumControl(wrapper.EnumControl);
            Sce.Atf.Applications.SkinService.ApplyActiveSkin(wrapper);
            return(wrapper);
        }
Exemple #19
0
            /// <summary>
            /// Constructor</summary>
            /// <param name="context">Context for property editing control</param>
            /// <param name="min">Minimum value</param>
            /// <param name="max">Maximum value</param>
            public BoundedIntControl(PropertyEditorControlContext context, int min, int max)

                : base(min, min, max)
            {
                m_context = context;

                DrawBorder     = false;
                DoubleBuffered = true;
                RefreshValue();
            }
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            NumericMatrixControl result =
                new NumericMatrixControl(m_numericType, m_rows, m_columns, context);

            // Controls[0] is the 1st TextBox for 1st matrix element
           // result.Height = result.Controls[0].Font.Height * m_rows + result.Margin.Top + result.Margin.Bottom + 2;
            result.ScaleFactor = m_scaleFactor;

            return result;
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="context">Context in which properties are edited</param>
        public CollectionEditingControl(PropertyEditorControlContext context)
        {
            m_context = context;

            AllowDrop      = true;              // allow drag and drop
            SelectionMode  = SelectionMode.One; // restrict selection
            BorderStyle    = BorderStyle.None;
            DoubleBuffered = true;

            RefreshList();
        }
Exemple #22
0
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            NumericMatrixControl result =
                new NumericMatrixControl(m_numericType, m_rows, m_columns, context);

            // Controls[0] is the 1st TextBox for 1st matrix element
            // result.Height = result.Controls[0].Font.Height * m_rows + result.Margin.Top + result.Margin.Bottom + 2;
            result.ScaleFactor = m_scaleFactor;
            SkinService.ApplyActiveSkin(result);
            return(result);
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="context">Context in which properties are edited</param>
        public CollectionEditingControl(PropertyEditorControlContext context)
        {
            m_context = context;

            AllowDrop = true; // allow drag and drop
            SelectionMode = SelectionMode.One; // restrict selection
            BorderStyle = BorderStyle.None;
            DoubleBuffered = true;

            RefreshList();
        }
Exemple #24
0
        /// <summary>
        /// Obtains a control to edit a given property. Changes to the selection set
        /// cause this method to be called again (and passed a new 'context'),
        /// unless ICacheablePropertyControl is implemented on the control. For
        /// performance reasons, it is highly recommended that the control implement
        /// the ICacheablePropertyControl interface.</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            if (context.LastSelectedObject == null)
            {
                return(null);
            }
            var control = new ArrayEditingControl(context);

            Sce.Atf.Applications.SkinService.ApplyActiveSkin(control);
            return(control);
        }
Exemple #25
0
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            NumericTupleControl editingControl =
                new NumericTupleControl(m_numericType, m_names, context);

            editingControl.Height        = editingControl.Font.Height + 2;
            editingControl.ScaleFactor   = m_scaleFactor;
            editingControl.HideAxisLabel = HideAxisLabel;
            editingControl.SetLabelBackColors(m_labelColors);
            SkinService.ApplyActiveSkin(editingControl);
            return(editingControl);
        }
Exemple #26
0
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public virtual Control GetEditingControl(PropertyEditorControlContext context)
        {
            var ctrl = new EnumEditorControl(context, m_names, m_displayNames, m_images);

            ctrl.DropDownStyle =
                (context == null || context.Descriptor.Converter == null) && TextEditEnabled
                ? ComboBoxStyle.DropDown
                : ComboBoxStyle.DropDownList;
            ctrl.MaxDropDownItems = MaxDropDownItems;
            Atf.Applications.SkinService.ApplyActiveSkin(ctrl);
            return(ctrl);
        }
Exemple #27
0
            public BoolControl(PropertyEditorControlContext context)
            {
                m_context = context;

                m_checkBox = new CheckBox();
                m_checkBox.Size = m_checkBox.PreferredSize;
                m_checkBox.CheckAlign = ContentAlignment.MiddleLeft;
                m_checkBox.CheckedChanged += checkBox_CheckedChanged;

                Controls.Add(m_checkBox);
                Height = m_checkBox.Height + m_topAndLeftMargin;

                RefreshValue();
            }
Exemple #28
0
            public LongEnumControlWrapper(PropertyEditorControlContext context, int dropDownHeight)
            {
                DoubleBuffered    = true;
                m_longEnumControl = new LongEnumControl(context, dropDownHeight);

                Controls.Add(m_longEnumControl);
                m_longEnumControl.SizeChanged += (sender, e) => Height = m_longEnumControl.Height + 2;

                SizeChanged += (sender, e) =>
                {
                    m_longEnumControl.Location = new Point(1, 1);
                    m_longEnumControl.Size     = new Size(Width - 1, Height - 1);
                };
            }
Exemple #29
0
            public BoolControl(PropertyEditorControlContext context)
            {
                m_context = context;

                m_checkBox                 = new CheckBox();
                m_checkBox.Size            = m_checkBox.PreferredSize;
                m_checkBox.CheckAlign      = ContentAlignment.MiddleLeft;
                m_checkBox.CheckedChanged += checkBox_CheckedChanged;

                Controls.Add(m_checkBox);
                Height = m_checkBox.Height + m_topAndLeftMargin;

                RefreshValue();
            }
Exemple #30
0
        private void OpenDropDownEditor()
        {
            try
            {
                m_isEditing = true;

                PropertyEditorControlContext oldContext = m_context;
                object oldValue, value;
                try
                {
                    // Certain property editing controls like the FlagsUITypeEditor's private CheckedListBox will
                    //  not lose focus until the user clicks away, and the user's click may change the
                    //  PropertyEditorControlContext's selection, so let's temporarily freeze the selection.
                    oldContext.CacheSelection();

                    oldValue = m_context.GetValue();
                    UITypeEditor editor = WinFormsPropertyUtils.GetUITypeEditor(m_descriptor, this);

                    // Bring up the editor which can cause Bind() to be called, so make sure that we use the
                    //  correct context and selection after this EditValue call.
                    value = editor.EditValue(this, this, oldValue);

                    oldContext.SetValue(value);
                }
                finally
                {
                    oldContext.ClearCachedSelection();
                }

                // notify that we just changed a value
                NotifyPropertyEdit(oldValue, value);

                // Refresh text box, paint rect
                if (oldContext == m_context)
                {
                    SetTextBoxFromProperty();
                    EnableTextBox();
                }

                Invalidate();
            }
            finally
            {
                m_isEditing = false;
            }
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="context">Property editor control context</param>
        public ArrayEditingControl(PropertyEditorControlContext context)
        {
            m_context = context;
            m_initialSelectedObject = m_context.LastSelectedObject.As<DomNodeAdapter>().DomNode;
            m_initialSelectedObject.AttributeChanged += DomNode_AttributeChanged;
            m_toolStrip = new ToolStrip { Dock = DockStyle.Top };
            InitToolStrip();
            Controls.Add(m_toolStrip);
            Height = m_toolStrip.Height;
            m_toolStrip.SizeChanged += toolStrip_SizeChanged;

            // Get active contexts and subscribe to ContextChanged event
            IContextRegistry contextRegistry = m_context.ContextRegistry;
            if (contextRegistry != null)
            {
                contextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged;
                TransactionContext = contextRegistry.GetActiveContext<ITransactionContext>();
            }
            else if (context.TransactionContext != null)
            {
                TransactionContext = context.TransactionContext;
            }
        }
            public EnumEditorControl(PropertyEditorControlContext context,
                string[] names, string[] displayNames, Image[] images)
            {
                m_images = images;
                m_context = context;
                m_displayNames = displayNames;
                m_names = names;
                if (m_images != null && m_images.Length > 0)
                    DrawMode = DrawMode.OwnerDrawFixed;
                IntegralHeight = false;

                var enums = displayNames ?? names;
                BeginUpdate();
                Items.AddRange(enums);
                EndUpdate();

                FlatStyle = FlatStyle.Standard;
                MaxDropDownItems = 6;
                DrawMode = DrawMode.OwnerDrawFixed;
                AutoCompleteMode = AutoCompleteMode.Suggest;
                AutoCompleteSource = AutoCompleteSource.ListItems;
                SelectedIndexChanged += ComboboxSelectedIndexChanged;

                SetDropDownWidth();
                FontChanged += (sender, e) => SetDropDownWidth();
                RefreshValue();
            }
Exemple #33
0
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     return new CollectionEditingControl(context);
 }
            /// <summary>
            /// Constructor</summary>
            /// <param name="editor">Embedded property editor</param>
            /// <param name="context">Context for embedded property editing controls</param>
            /// <param name="toolStripLabelsEnabled">Whether toolstrip labels are enabled or not</param>
            public CollectionControl(EmbeddedCollectionEditor editor, PropertyEditorControlContext context, bool toolStripLabelsEnabled)
            {
                m_editor = editor;
                m_context = context;

                // Get active contexts and subscribe to ContextChanged event
                IContextRegistry contextRegistry = m_context.ContextRegistry;
                if (contextRegistry != null)
                {
                    contextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged;
                    ObservableContext = contextRegistry.GetActiveContext<IObservableContext>();
                    ValidationContext = contextRegistry.GetActiveContext<IValidationContext>();
                    TransactionContext = contextRegistry.GetActiveContext<ITransactionContext>();
                }
                else if (context.TransactionContext != null)
                {
                    ObservableContext = context.TransactionContext.As<IObservableContext>();
                    ValidationContext = context.TransactionContext.As<IValidationContext>();
                    TransactionContext = context.TransactionContext;
                }

                // Initialize Controls

                m_toolStrip = new ToolStrip { Dock = DockStyle.Top };
                
                m_addButton = new ToolStripButton
                {
                    Text = "Add".Localize(),
                    Image = s_addImage,
                    Enabled = false,
                    DisplayStyle = ToolStripItemDisplayStyle.Image
                };
                m_addButton.Click += addButton_Click;
                m_toolStrip.Items.Add(m_addButton);

                m_addSplitButton = new ToolStripSplitButton { Image = s_addImage, Visible = false };
                m_addSplitButton.ButtonClick += addButton_Click;
                m_toolStrip.Items.Add(m_addSplitButton);

                m_deleteButton = new ToolStripButton
                {
                    Text = "Delete".Localize(),
                    Image = s_removeImage,
                    DisplayStyle = ToolStripItemDisplayStyle.Image
                };
                UpdateDeleteButton(false);
                m_deleteButton.Click += deleteButton_Click;
                m_toolStrip.Items.Add(m_deleteButton);

                m_upButton = new ToolStripButton
                {
                    Text = "Up".Localize("this is the name of a button that causes the selected item to be moved up in a list"),
                    Image = s_upImage,
                    DisplayStyle = ToolStripItemDisplayStyle.Image
                };
                m_upButton.Click += upButton_Click;
                m_toolStrip.Items.Add(m_upButton);

                m_downButton = new ToolStripButton
                {
                    Text = "Down".Localize("this is the name of a button that causes the selected item to be moved down in a list"),
                    Image = s_downImage,
                    DisplayStyle = ToolStripItemDisplayStyle.Image
                };
                m_downButton.Click += downButton_Click;
                m_toolStrip.Items.Add(m_downButton);

                UpdateMoveButtons(false);

                m_itemsCountLabel = new ToolStripStatusLabel
                {
                    Text = "[0 items]",
                    DisplayStyle = ToolStripItemDisplayStyle.Text
                };
                m_toolStrip.Items.Add(m_itemsCountLabel);

                Controls.Add(m_toolStrip);
                Height = m_toolStrip.Height;
                m_toolStrip.GripStyle = ToolStripGripStyle.Hidden;

                if (toolStripLabelsEnabled)
                    m_toolStrip.SizeChanged += toolStrip_SizeChanged;
            }
 /// <summary>
 /// Gets a control to edit the given property</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     // try to hold selection context here for transaction support in property editing
     m_selectionContext = context.TransactionContext.As<ISelectionContext>(); 
     return null;
 }
Exemple #36
0
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public virtual Control GetEditingControl(PropertyEditorControlContext context)
 { 
     return new BoundedIntControl(context, m_min, m_max);          
 }
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     var control = new CollectionEditingControl(context);
     SkinService.ApplyActiveSkin(control);
     return control;
 }
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public virtual Control GetEditingControl(PropertyEditorControlContext context)
 { 
     var control = new BoundedIntControl(context, m_min, m_max);          
     SkinService.ApplyActiveSkin(control);
     return control;
 }
            public NumericMatrixControl(Type type, int rows, int columns, PropertyEditorControlContext context)
                : base(type, rows, columns)
            {
                m_context = context;

                RefreshValue();
            }
Exemple #40
0
            public LongEnumControl(PropertyEditorControlContext context, int dropDownHeight)
            {
                m_listBox = new ListBox();
                m_listBox.PreviewKeyDown += listBox_PreviewKeyDown;
                if (dropDownHeight > 0)
                    m_listBox.Height = dropDownHeight;
                m_listBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
                DropDownControl = m_listBox;
                DoubleBuffered = true;
                this.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                this.AutoCompleteSource = AutoCompleteSource.CustomSource;
                this.FormattingEnabled = true;
                m_context = context;

                this.FlatStyle = System.Windows.Forms.FlatStyle.System;
                this.SelectedIndexChanged += comboBox_SelectedIndexChanged;

                m_defaultFont = new Font(Font, FontStyle.Regular);
                m_boldFont = new Font(Font, FontStyle.Bold);
                m_defaultColor = this.ForeColor;
            }
Exemple #41
0
 public LongEnumControlWrapper(PropertyEditorControlContext context, int dropDownHeight)
 {
     DoubleBuffered = true;
     m_longEnumControl = new LongEnumControl(context, dropDownHeight);
     
     Controls.Add(m_longEnumControl);
     m_longEnumControl.SizeChanged += (sender, e) => Height = m_longEnumControl.Height + 2;
     
     SizeChanged += (sender, e) =>
         {
             m_longEnumControl.Location = new Point(1, 1);
             m_longEnumControl.Size = new Size(Width - 1, Height - 1);
         };
    
 }
Exemple #42
0
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     m_boolControl = new BoolControl(context);
     return m_boolControl;
 }
Exemple #43
0
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     m_boolControl = new BoolControl(context);
     SkinService.ApplyActiveSkin(m_boolControl);
     return m_boolControl;
 }
Exemple #44
0
 /// <summary>
 /// Gets a control to edit the given property</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     // try to hold selection context here for transaction support in property editing
     m_selectionContext = context.TransactionContext.As <ISelectionContext>();
     return(null);
 }
Exemple #45
0
        /// <summary>
        /// Binds the control to a property and owner</summary>
        /// <param name="context">Context for property editing control</param>
        public void Bind(PropertyEditorControlContext context)
        {
            if (m_textBox.Focused)
            {
                Flush();
            }

            m_context    = context;
            m_descriptor = m_context.Descriptor;

            bool visible = m_context != null;

            base.Visible = visible;

            if (visible)
            {
                SetTextBoxFromProperty();

                bool editButtonVisible = false;
                if (!m_context.IsReadOnly)
                {
                    UITypeEditor editor = WinFormsPropertyUtils.GetUITypeEditor(m_descriptor, this);
                    if (editor != null)
                    {
                        editButtonVisible  = true;
                        m_editButton.Modal = (editor.GetEditStyle(this) == UITypeEditorEditStyle.Modal);
                    }
                }

                m_editButton.Visible = editButtonVisible;

                // a standard set of values that can be picked from a list, like enum (but only if we're not readonly)
                if (!m_context.IsReadOnly && (m_descriptor.Converter != null))
                {
                    TypeDescriptorContext tdcontext = new TypeDescriptorContext(m_context.LastSelectedObject, m_descriptor, null);
                    if (m_descriptor.Converter.GetStandardValuesExclusive(tdcontext))
                    {
                        // this will redraw the control before we get to the invalidate below
                        m_textBox.AutoCompleteMode = AutoCompleteMode.None;

                        m_textBox.AutoCompleteCustomSource.Clear();
                        AutoCompleteStringCollection standardVals = new AutoCompleteStringCollection();
                        ICollection values = m_descriptor.Converter.GetStandardValues(tdcontext);
                        foreach (object item in values)
                        {
                            standardVals.Add(item.ToString());
                        }
                        m_textBox.AutoCompleteCustomSource = standardVals;

                        // this will redraw the control before we get to the invalidate below
                        m_textBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                        m_textBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                    }
                    else
                    {
                        // this will redraw the control before we get to the invalidate below
                        m_textBox.AutoCompleteMode   = AutoCompleteMode.None;
                        m_textBox.AutoCompleteSource = AutoCompleteSource.None;
                        m_textBox.AutoCompleteCustomSource.Clear();
                    }
                }
                else
                {
                    // this will redraw the control before we get to the invalidate below
                    m_textBox.AutoCompleteMode   = AutoCompleteMode.None;
                    m_textBox.AutoCompleteSource = AutoCompleteSource.None;
                    m_textBox.AutoCompleteCustomSource.Clear();
                }

                PerformLayout();
                Invalidate();
            }
        }
Exemple #46
0
 /// <summary>
 /// Gets a control to edit the given property</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public virtual Control GetEditingControl(PropertyEditorControlContext context)
 {
     LongEnumControlWrapper wrapper = new LongEnumControlWrapper(context, m_dropDownHeight);
     wrapper.EnumControl.ConvertIdToDisplayCallback = ConvertIdToDisplay;
     wrapper.EnumControl.ConvertDisplayToIdCallback = ConvertDisplayToId;
     UpdateEnumControl(wrapper.EnumControl);
     return wrapper;            
 }
Exemple #47
0
 /// <summary>
 /// Obtains a control to edit a given property. Changes to the selection set
 /// cause this method to be called again (and passed a new 'context'),
 /// unless ICacheablePropertyControl is implemented on the control. For
 /// performance reasons, it is highly recommended that the control implement
 /// the ICacheablePropertyControl interface.</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public Control GetEditingControl(PropertyEditorControlContext context)
 {
     m_boolControl = new BoolControl(context);
     SkinService.ApplyActiveSkin(m_boolControl);
     return(m_boolControl);
 }
 /// <summary>
 /// Gets a control to edit the given property</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public virtual Control GetEditingControl(PropertyEditorControlContext context)
 {
     var ctrl = new EnumEditorControl(context, m_names, m_displayNames, m_images);
     ctrl.DropDownStyle =
         (context == null || context.Descriptor.Converter == null) && TextEditEnabled
         ? ComboBoxStyle.DropDown
         : ComboBoxStyle.DropDownList;
     ctrl.MaxDropDownItems = MaxDropDownItems;
     Atf.Applications.SkinService.ApplyActiveSkin(ctrl);
     return ctrl;
 }
Exemple #49
0
            /// <summary>
            /// Constructor</summary>
            /// <param name="context">Context for property editing control</param>
            /// <param name="min">Minimum value</param>
            /// <param name="max">Maximum value</param>
            public BoundedIntControl(PropertyEditorControlContext context, int min, int max)

                : base(min, min, max)
            {
                m_context = context;

                DrawBorder = false;
                DoubleBuffered = true;
                BackColor = SystemColors.Window;

                RefreshValue();
            }
Exemple #50
0
        /// <summary>
        /// Gets a control to edit the given property</summary>
        /// <param name="context">Context for property editing control</param>
        /// <returns>Control to edit the given context</returns>
        public Control GetEditingControl(PropertyEditorControlContext context)
        {
            NumericTupleControl editingControl =
                new NumericTupleControl(m_numericType, m_names, context);

            editingControl.Height = editingControl.Font.Height + 2;
            editingControl.ScaleFactor = m_scaleFactor;
            editingControl.HideAxisLabel = HideAxisLabel;
            editingControl.SetLabelBackColors(m_labelColors);
            return editingControl;            
        }
Exemple #51
0
 /// <summary>
 /// Gets a control to edit the given property</summary>
 /// <param name="context">Context for property editing control</param>
 /// <returns>Control to edit the given context</returns>
 public virtual Control GetEditingControl(PropertyEditorControlContext context)
 {
     NumericTextBox editingControl = new NumericTextBox(m_numericType, context);
     editingControl.ScaleFactor = m_scaleFactor;
     return editingControl;            
 }
Exemple #52
0
            public NumericTupleControl(Type type, string[] names, PropertyEditorControlContext context)
                : base(type, names)
            {
                m_context = context;

                RefreshValue();
            }
Exemple #53
0
            /// <summary>
            /// Constructor</summary>
            /// <param name="context">Context for property editing control</param>
            /// <param name="min">Minimum value</param>
            /// <param name="max">Maximum value</param>
            public BoundedFloatControl(PropertyEditorControlContext context, float min, float max)

                : base(min, min, max)
            {
                m_context = context;

                DrawBorder = false;
                DoubleBuffered = true;                
                RefreshValue();
            }
Exemple #54
0
        /// <summary>
        /// Binds the control to a property and owner</summary>
        /// <param name="context">Context for property editing control</param>
        public void Bind(PropertyEditorControlContext context)
        {
            if (m_textBox.Focused)
                Flush();

            m_context = context;
            m_descriptor = m_context.Descriptor;

            bool visible = m_context != null;
            base.Visible = visible;

            if (visible)
            {
                SetTextBoxFromProperty();

                bool editButtonVisible = false;
                if (!m_context.IsReadOnly)
                {
                    UITypeEditor editor = WinFormsPropertyUtils.GetUITypeEditor(m_descriptor, this);
                    if (editor != null)
                    {
                        editButtonVisible = true;
                        m_editButton.Modal = (editor.GetEditStyle(this) == UITypeEditorEditStyle.Modal);
                    }
                }

                m_editButton.Visible = editButtonVisible;

                // a standard set of values that can be picked from a list, like enum (but only if we're not readonly)
                if (!m_context.IsReadOnly && (m_descriptor.Converter != null))
                {
                    TypeDescriptorContext tdcontext = new TypeDescriptorContext(m_context.LastSelectedObject, m_descriptor, null);
                    if (m_descriptor.Converter.GetStandardValuesExclusive(tdcontext))
                    {
                        // this will redraw the control before we get to the invalidate below
                        m_textBox.AutoCompleteMode = AutoCompleteMode.None;

                        m_textBox.AutoCompleteCustomSource.Clear();
                        AutoCompleteStringCollection standardVals = new AutoCompleteStringCollection();
                        ICollection values = m_descriptor.Converter.GetStandardValues(tdcontext);
                        foreach (object item in values)
                            standardVals.Add(item.ToString());
                        m_textBox.AutoCompleteCustomSource = standardVals;

                        // this will redraw the control before we get to the invalidate below
                        m_textBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                        m_textBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                    }
                    else
                    {
                        // this will redraw the control before we get to the invalidate below
                        m_textBox.AutoCompleteMode = AutoCompleteMode.None;
                        m_textBox.AutoCompleteSource = AutoCompleteSource.None;
                        m_textBox.AutoCompleteCustomSource.Clear();
                    }
                }
                else
                {
                    // this will redraw the control before we get to the invalidate below
                    m_textBox.AutoCompleteMode = AutoCompleteMode.None;
                    m_textBox.AutoCompleteSource = AutoCompleteSource.None;
                    m_textBox.AutoCompleteCustomSource.Clear();
                }

                PerformLayout();
                Invalidate();
            }
        }