コード例 #1
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
        public void AssociateControl(ItemUiRole role, ToolStripItem control, ItemUiComboList listItems)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (Controls.ContainsKey(role) || Controls.ContainsValue(control))
            {
                throw new ArgumentException("Can not assign the same role or the same control more than once.");
            }

            Controls.Add(role, control);
            ControlLookup.Add(control, role);
            ControlLists.Add(control, listItems);
            GroupedControls.Add(control, new List <ToolStripItem>());

            if (control is ToolStripTextBox)
            {
                ((ToolStripTextBox)control).TextChanged += new EventHandler(OnUiTextChanged);
                ((ToolStripTextBox)control).LostFocus   += new EventHandler(OnUiTextLostFocus);
                ((ToolStripTextBox)control).KeyDown     += new KeyEventHandler(OnUiTextKeyDown);
            }
            else if (control is ToolStripButton)
            {
                ((ToolStripButton)control).Click += new EventHandler(OnUiButtonClick);
            }
            else if (control is ToolStripComboBox)
            {
                ((ToolStripComboBox)control).SelectedIndexChanged += new EventHandler(OnUiSelectedIndexChanged);
                if (listItems != null)
                {
                    listItems.SetOwner((ToolStripComboBox)control);
                }
            }
        }
コード例 #2
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
 /// <summary>
 /// Call this method to specify that another UI should refresh itself in response to an edit in this element
 /// (e.g. editing 'raw' will update an elevator's destination)
 /// </summary>
 /// <param name="element"></param>
 public void UpdateElement(ItemUiRole element)
 {
     if (_elementsToUpdate == null)
     {
         _elementsToUpdate = new List <ItemUiRole>();
     }
     _elementsToUpdate.Add(element);
 }
コード例 #3
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
        /// <summary>
        /// Returns the object that defines the behavior of a control (ItemUiElement) for the given UI role for the current scheme, or NULL if there is no element with the associated role.
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        ItemUiElement GetElementByRole(ItemUiRole role)
        {
            if (_CurrentScheme == null)
            {
                return(null);
            }
            for (int i = 0; i < _CurrentScheme.Elements.Count; i++)
            {
                if (_CurrentScheme.Elements[i].Role == role)
                {
                    return(_CurrentScheme.Elements[i]);
                }
            }

            return(null);
        }
コード例 #4
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
 public ItemUiElement(ItemUiRole role, int min, int max)
 {
     this.Role    = role;
     this.Minimum = min;
     this.Maximum = max;
 }
コード例 #5
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
 public ItemUiElement(ItemUiRole role)
 {
     this.Role = role;
 }
コード例 #6
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
        ////internal ToolStripItem GetElement(ItemUiRole element) {
        ////    return Controls[element];
        ////}

        internal void UpdateElement(ItemUiRole element)
        {
            throw new NotImplementedException();
        }
コード例 #7
0
ファイル: ItemEditUI.cs プロジェクト: snarfblam/editroid
 public void AssociateControl(ItemUiRole role, ToolStripItem control)
 {
     AssociateControl(role, control, null);
 }