コード例 #1
0
ファイル: TabDialog.cs プロジェクト: piwi1263/Tinkr
        protected override void ButtonPressedMessage(int buttonId, ref bool handled)
        {
            if (buttonId == (int)ButtonIDs.Left)
            {
                int newSel = _selIndex - 1;
                if (newSel < 0)
                {
                    newSel = Children.Length - 1;
                }
                SelectedIndex = newSel;

                handled = true;
                return;
            }
            if (buttonId == (int)ButtonIDs.Right)
            {
                int newSel = _selIndex + 1;
                if (newSel > Children.Length - 1)
                {
                    newSel = 0;
                }
                SelectedIndex = newSel;

                handled = true;
                return;
            }

            if (Children != null)
            {
                if (ActiveChild != null)
                {
                    ActiveChild.SendButtonEvent(buttonId, true);
                }
                else
                {
                    for (int i = 0; i < Children.Length; i++)
                    {
                        if (Children[i].ScreenBounds.Contains(Core.MousePosition))
                        {
                            handled = true;
                            Children[i].SendButtonEvent(buttonId, true);
                            break;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: TabDialog.cs プロジェクト: piwi1263/Tinkr
 protected override void ButtonReleasedMessage(int buttonId, ref bool handled)
 {
     if (Children != null)
     {
         if (ActiveChild != null)
         {
             ActiveChild.SendButtonEvent(buttonId, false);
         }
         else
         {
             for (int i = 0; i < Children.Length; i++)
             {
                 if (Children[i].ScreenBounds.Contains(Core.MousePosition))
                 {
                     handled = true;
                     Children[i].SendButtonEvent(buttonId, false);
                     break;
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Panel.cs プロジェクト: valoni/Tinkr
 /// <summary>
 /// Override this message to handle button released events internally.
 /// </summary>
 /// <param name="buttonId">Integer ID corresponding to the affected button</param>
 /// <param name="handled">true if the event is handled. Set to true if handled.</param>
 /// <remarks>
 /// Forwards the message to <see cref="Container.ActiveChild"/> or if null, to the child under <see cref="Core.MousePosition"/>
 /// </remarks>
 protected override void ButtonReleasedMessage(int buttonId, ref bool handled)
 {
     //TODO: check if this code shouldn't go to Container
     if (Children != null)
     {
         if (ActiveChild != null)
         {
             ActiveChild.SendButtonEvent(buttonId, false);
             //TODO: check if handled should be set true
         }
         else
         {
             for (int i = 0; i < Children.Length; i++)
             {
                 if (Children[i].ScreenBounds.Contains(Core.MousePosition))
                 {
                     handled = true;
                     Children[i].SendButtonEvent(buttonId, false);
                     break;
                 }
             }
         }
     }
 }