コード例 #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;
            }
コード例 #2
0
ファイル: ArrayEditor.cs プロジェクト: vincenthamm/ATF
        /// <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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
ファイル: ArrayEditingControl.cs プロジェクト: brobits/ATF
        /// <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;
            }
        }
コード例 #6
0
ファイル: LongEnumEditor.cs プロジェクト: blue3k/ATFClone
            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();
            }
コード例 #7
0
ファイル: NumericTupleEditor.cs プロジェクト: zparr/ATF
            public NumericTupleControl(Type type, string[] names, PropertyEditorControlContext context)
                : base(type, names)
            {
                m_context = context;

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

                RefreshValue();
            }
コード例 #9
0
ファイル: UniformArrayEditor.cs プロジェクト: zoombapup/ATF
        /// <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);
        }
コード例 #10
0
ファイル: NumericEditor.cs プロジェクト: BeRo1985/LevelEditor
 /// <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;            
 }
コード例 #11
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)
        {
            if (context.LastSelectedObject == null)
                return null;

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

                BorderStyle = BorderStyle.None;
                RefreshValue();
            }
コード例 #13
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);
        }
コード例 #14
0
ファイル: NumericEditor.cs プロジェクト: BeRo1985/LevelEditor
            public NumericTextBox(Type numericType, PropertyEditorControlContext context)
                : base(numericType)
            {
                m_context = context;

                BorderStyle = BorderStyle.None;               
                RefreshValue();               
            }
コード例 #15
0
ファイル: UniformArrayEditor.cs プロジェクト: zoombapup/ATF
            /// <summary>
            /// Constructor</summary>
            /// <param name="context">PropertyEditorControlContext</param>
            public UniformArrayTextBox(PropertyEditorControlContext context)
                : base(typeof(T))
            {
                m_context = context;

                BorderStyle = BorderStyle.None;

                RefreshValue();
            }
コード例 #16
0
ファイル: BoundedIntEditor.cs プロジェクト: zoombapup/ATF
        /// <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);
        }
コード例 #17
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 StringArrayEditingControl(context);
            Sce.Atf.Applications.SkinService.ApplyActiveSkin(control);
            return control;


        }
コード例 #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);
        }
コード例 #19
0
ファイル: BoundedIntEditor.cs プロジェクト: zoombapup/ATF
            /// <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();
            }
コード例 #20
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;

            return result;
        }
コード例 #21
0
        /// <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();
        }
コード例 #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);
        }
コード例 #23
0
        /// <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();
        }
コード例 #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);
        }
コード例 #25
0
ファイル: NumericTupleEditor.cs プロジェクト: zparr/ATF
        /// <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);
        }
コード例 #26
0
ファイル: LongEnumEditor.cs プロジェクト: blue3k/ATFClone
        /// <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);
        }
コード例 #27
0
ファイル: BoolEditor.cs プロジェクト: vincenthamm/ATF
            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();
            }
コード例 #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);
                };
            }
コード例 #29
0
ファイル: BoolEditor.cs プロジェクト: zparr/ATF
            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();
            }
コード例 #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;
            }
        }
コード例 #31
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;
            }
        }
コード例 #32
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();
            }
コード例 #33
0
ファイル: CollectionEditor.cs プロジェクト: vincenthamm/ATF
 /// <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);
 }
コード例 #34
0
            /// <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;
            }
コード例 #35
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;
 }
コード例 #36
0
ファイル: BoundedIntEditor.cs プロジェクト: vincenthamm/ATF
 /// <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);          
 }
コード例 #37
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;
 }
コード例 #38
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);
     return control;
 }
コード例 #39
0
            public NumericMatrixControl(Type type, int rows, int columns, PropertyEditorControlContext context)
                : base(type, rows, columns)
            {
                m_context = context;

                RefreshValue();
            }
コード例 #40
0
ファイル: LongEnumEditor.cs プロジェクト: vincenthamm/ATF
            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;
            }
コード例 #41
0
ファイル: LongEnumEditor.cs プロジェクト: vincenthamm/ATF
 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);
         };
    
 }
コード例 #42
0
ファイル: BoolEditor.cs プロジェクト: vincenthamm/ATF
 /// <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;
 }
コード例 #43
0
ファイル: BoolEditor.cs プロジェクト: JanDeHud/LevelEditor
 /// <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;
 }
コード例 #44
0
ファイル: NestedCollectionEditor.cs プロジェクト: zparr/ATF
 /// <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);
 }
コード例 #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();
            }
        }
コード例 #46
0
ファイル: LongEnumEditor.cs プロジェクト: vincenthamm/ATF
 /// <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;            
 }
コード例 #47
0
ファイル: BoolEditor.cs プロジェクト: zparr/ATF
 /// <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);
 }
コード例 #48
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;
 }
コード例 #49
0
ファイル: BoundedIntEditor.cs プロジェクト: vincenthamm/ATF
            /// <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();
            }
コード例 #50
0
ファイル: NumericTupleEditor.cs プロジェクト: vincenthamm/ATF
        /// <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;            
        }
コード例 #51
0
ファイル: NumericEditor.cs プロジェクト: vincenthamm/ATF
 /// <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;            
 }
コード例 #52
0
ファイル: NumericTupleEditor.cs プロジェクト: vincenthamm/ATF
            public NumericTupleControl(Type type, string[] names, PropertyEditorControlContext context)
                : base(type, names)
            {
                m_context = context;

                RefreshValue();
            }
コード例 #53
0
ファイル: BoundedFloatEditor.cs プロジェクト: jethac/ATF
            /// <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();
            }
コード例 #54
0
ファイル: PropertyEditingControl.cs プロジェクト: GeertVL/ATF
        /// <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();
            }
        }