Beispiel #1
0
 private void SetSelectionGUI(bool isChecked)
 {
     // sets the GUI into the selected (or not) state.  Does not update
     if (this.DesignMode)
     {
         return;
     }
     if (isChecked == m_Checked)
     {
         return;
     }
     m_Checked = isChecked;
     if (!Animate || Utilities.Low_Graphics_Safe())
     {
         m_SelectionDisplayPercentage = m_Checked ? 100 : 0;
     }
     else
     {
         AnimationController.EnsureNoAnimation(this);
         if (isChecked)
         {
             AnimationLinear.CreateStart(this, 100, SELECTANIMATIONSTEP, 0);
         }
         else
         {
             AnimationLinear.CreateStart(this, 0, -SELECTANIMATIONSTEP, 0);
         }
     }
 }
Beispiel #2
0
 protected virtual void SetSelectionGUI(bool selected)
 {
     // sets the GUI into the selected (or not) state.  Does not update
     if (selected == m_Selected)
     {
         return;
     }
     AnimationController.EnsureNoAnimation(this);
     m_Selected = selected;
     if (Utilities.Low_Graphics_Safe() || !Visible)
     {
         m_SelectionDisplayFraction = m_Selected ? 255 : 0;
         Invalidate();
     }
     else
     {
         if (selected)
         {
             AnimationLinear.CreateStart(this, 255, SELECTANIMATIONSTEP);
         }
         else
         {
             AnimationLinear.CreateStart(this, 0, -SELECTANIMATIONSTEP);
         }
     }
 }
Beispiel #3
0
        internal static void CreateStart(ILinearAnimated target, int maximum, int step, int repeats = 0)
        {
            if (Exists(target))
            {
                return;
            }
            AnimationLinear linear = new AnimationLinear(maximum, step, repeats)
            {
                m_Target = target
            };

            Add(linear);
            linear.Start();
        }
Beispiel #4
0
        internal static AnimationController Create(ILinearAnimated target, int maximum, int step, int repeats = 0)
        {
            if (Exists(target))
            {
                return(Item(target));
            }
            AnimationLinear animation = new AnimationLinear(maximum, step, repeats)
            {
                m_Target = target
            };

            Add(animation);
            return(animation);
        }
Beispiel #5
0
        private void Search()
        {
            if (txtSearch.TextLength == 0)
            {
                m_CurrentSearchControl = null;
                return;
            }
            if (txtSearch.TextLength < m_LastSearchText.Length)
            {
                m_CurrentSearchControl = null;                 // if the user backspaces the search always restarts from the beginning
            }
            m_LastSearchText = txtSearch.Text;
            bool reachedCurrent = m_CurrentSearchControl == null;             // true when we have passed the current item, and the next one should be selected

            for (int section = 0; section <= m_SectionPanels.Count - 1; section++)
            {
                if (!pnlSections.Controls[section].Visible)
                {
                    continue;                     // Checks that the panel is applicable
                }
                foreach (Control ctr in m_SectionPanels[section].Controls)
                {
                    var ctrMatches = ControlMatchesSearch(ctr, ref reachedCurrent);
                    if (ctrMatches != null)
                    {
                        //	intFound += 1
                        pnlSections.SelectedIndex = section;                         // NB this will likely clear m_ctrCurrentSearch
                        m_CurrentSearchControl    = ctrMatches;
                        Debug.WriteLine("Search found: " + ctrMatches.GetType() + "/" + ctrMatches.Name);
                        Rectangle rct = new Rectangle(ctrMatches.PointToScreen(Point.Empty), ctrMatches.Size);                         // Me.PointToClient
                        m_frmHightlight.Owner = this;
                        m_frmHightlight.Display();
                        m_frmHightlight.SetBounds(rct.X, rct.Y, rct.Width, rct.Height);
                        AnimationLinear.CreateStart(m_frmHightlight, 80, 2, 1);
                        return;
                    }
                }
            }
            if (m_CurrentSearchControl != null)             // AndAlso intFound > 1 Then
            {
                // The currently highlighted item must be in the last one; need to start again from the beginning
                m_CurrentSearchControl = null;
                Search();
            }
            else
            {
                Console.Beep();
                m_CurrentSearchControl = null;                 // will allow re-find if there was a single item already found
            }
        }
Beispiel #6
0
 private void AnimateTo(int index)
 {
     if (SelectionIndex == index)
     {
         return;
     }
     // if we were still partway through fading out something else, then it needs to be refreshed without any highlight
     if (m_OldSelection >= 0)
     {
         Invalidate(ColourRectangleIncludingSelection(m_OldSelection));
     }
     m_OldSelection     = SelectionIndex;
     SelectionIndex     = index;
     m_SelectionBalance = 0;
     AnimationLinear.CreateStart(this, 100, 10);
 }