Пример #1
0
 internal static string AssertControlInformation(bool condition, Control control)
 {
     if (condition)
     {
         return(string.Empty);
     }
     return(WindowsFormsUtils.GetControlInformation(control.Handle));
 }
Пример #2
0
        protected virtual string GetMnemonicText(string text)
        {
            char mnemonic = WindowsFormsUtils.GetMnemonic(text, false);

            if (mnemonic != char.MinValue)
            {
                return("Alt+" + (object)mnemonic);
            }
            return((string)null);
        }
Пример #3
0
        //internal protected bool ProcessMnemonic(char charCode)
        //{
        //    if (!TelerikHelper.CanProcessMnemonic(this.ownerControl))
        //    {
        //        return false;
        //    }
        //    ArrayList mnemonicList = new ArrayList();
        //    if (this.ownerControl is IComponentTreeHandler)
        //    {

        //    }
        //    this.GetChildControlsMnemonicList(this.ownerControl, mnemonicList);

        //    RadItem selectedItem = null;// this.GetSelectedItem();
        //    int index = 0;
        //    if (selectedItem != null)
        //    {
        //        index = mnemonicList.IndexOf(selectedItem);
        //    }
        //    index = Math.Max(0, index);
        //    RadItem item = null;
        //    bool flag = false;
        //    int num2 = index;

        //    for (int i = 0; i < mnemonicList.Count; i++)
        //    {
        //        RadItem item3 = mnemonicList[num2] as RadItem;
        //        num2 = (num2 + 1) % mnemonicList.Count;
        //        if ((!string.IsNullOrEmpty(item3.Text) && item3.Enabled))
        //        {
        //            //flag = flag || (item3 is ToolStripMenuItem);
        //            if (item3.ContainsMnemonic && Control.IsMnemonic(charCode, item3.Text))
        //            {
        //                if (item == null)
        //                {
        //                    item = item3;
        //                }
        //                else
        //                {
        //                    if (item == selectedItem)
        //                    {
        //                        this.ProcessItemMnemonic(item3, charCode);
        //                    }
        //                    else
        //                    {
        //                        this.ProcessItemMnemonic(item, charCode);
        //                    }
        //                    return true;
        //                }
        //            }
        //        }
        //    }
        //    if (item != null)
        //    {
        //        return item.ProcessMnemonic(charCode);
        //    }
        //    if (!flag)
        //    {
        //        return false;
        //    }
        //    num2 = index;
        //    for (int j = 0; j < mnemonicList.Count; j++)
        //    {
        //        RadItem item4 = mnemonicList[num2] as RadItem;
        //        num2 = (num2 + 1) % mnemonicList.Count;
        //        if (((!string.IsNullOrEmpty(item4.Text)) &&
        //            (item4.Enabled)) && TelerikHelper.IsPseudoMnemonic(charCode, item4.Text))
        //        {
        //            if (item != null)
        //            {
        //                if (item == selectedItem)
        //                {
        //                    this.ProcessItemMnemonic(item4, charCode);
        //                }
        //                else
        //                {
        //                    this.ProcessItemMnemonic(item, charCode);
        //                }
        //                return true;
        //            }
        //            item = item4;
        //        }
        //    }
        //    return ((item != null) && item.ProcessMnemonic(charCode));
        //}
        //protected virtual void GetChildControlsMnemonicList(Control control, ArrayList mnemonicList)
        //{
        //    char ch1 = WindowsFormsUtils.GetMnemonic(control.Text, true);
        //    if (ch1 != '\0')
        //    {
        //        mnemonicList.Add(ch1);
        //    }
        //    foreach (Control control1 in control.Controls)
        //    {
        //        if (control1 != null)
        //        {
        //            this.GetChildControlsMnemonicList(control1, mnemonicList);
        //        }
        //    }
        //}

        protected virtual string GetMnemonicText(string text)
        {
            char ch1 = WindowsFormsUtils.GetMnemonic(text, false);

            if (ch1 != '\0')
            {
                return("Alt+" + ch1);
            }
            return(null);
        }
Пример #4
0
 protected virtual void GetChildMnemonicList(ArrayList mnemonicList)
 {
     foreach (RadItem activeItem in (RadItemCollection)this.ActiveItems)
     {
         char mnemonic = WindowsFormsUtils.GetMnemonic(activeItem.Text, true);
         if (mnemonic != char.MinValue)
         {
             mnemonicList.Add((object)mnemonic);
         }
     }
 }
Пример #5
0
 protected virtual void GetChildMnemonicList(ArrayList mnemonicList)
 {
     foreach (RadItem item in this.ActiveItems)
     {
         char ch1 = WindowsFormsUtils.GetMnemonic(item.Text, true);
         if (ch1 != '\0')
         {
             mnemonicList.Add(ch1);
         }
     }
 }
Пример #6
0
        internal void UpdateToolTip(RadItem item, Size offset)
        {
            if (this.ShowItemToolTips && item != this.currentlyActiveTooltipItem && this.ToolTip != null)
            {
                if (item == null)
                {
                    this.ToolTip.Hide(this.ownerControl);
                }

                this.ToolTip.Active             = false;
                this.currentlyActiveTooltipItem = item;
                Cursor mouseCursor = Cursor.Current;

                if (this.currentlyActiveTooltipItem != null && mouseCursor != null)
                {
                    this.ToolTip.Active = true;
                    Point mousePosition = Cursor.Position;
                    mousePosition.X += offset.Width;
                    mousePosition.Y += offset.Height;
                    Rectangle rectangle = WindowsFormsUtils.ConstrainToScreenBounds(new Rectangle(mousePosition, onePixel));
                    mousePosition = this.ownerControl.PointToClient(rectangle.Location);
                    string toolTipText = this.currentlyActiveTooltipItem.ToolTipText;


                    Form ownerForm = this.ownerControl.FindForm();
                    if (ownerForm == null)
                    {
                        ITooltipOwner owner = this.ownerControl as ITooltipOwner;
                        while (owner != null)
                        {
                            Control control = owner as Control;
                            if (control != null && owner.Owner == null)
                            {
                                mousePosition = control.PointToClient(rectangle.Location);
                                this.ToolTip.SetToolTip(control, toolTipText);
                                this.ToolTip.Show(toolTipText, control, mousePosition, this.ToolTip.AutoPopDelay);
                                break;
                            }

                            if (owner.Owner == null)
                            {
                                break;
                            }

                            owner = owner.Owner as ITooltipOwner;
                        }
                    }
                    else
                    {
                        this.ToolTip.Show(toolTipText, this.ownerControl, mousePosition, this.ToolTip.AutoPopDelay);
                    }
                }
            }
        }
Пример #7
0
 protected internal static bool IsPseudoMnemonic(char charCode, string text)
 {
     if (!string.IsNullOrEmpty(text) && !WindowsFormsUtils.ContainsMnemonic(text))
     {
         char upper = char.ToUpper(charCode, CultureInfo.CurrentCulture);
         if ((int)char.ToUpper(text[0], CultureInfo.CurrentCulture) == (int)upper || (int)char.ToLower(charCode, CultureInfo.CurrentCulture) == (int)char.ToLower(text[0], CultureInfo.CurrentCulture))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #8
0
 protected virtual Control GetValidChildControlByMnemonic(List <Control> mnemonicList, char charCode)
 {
     if (mnemonicList.Count > 0)
     {
         return(null);
     }
     for (int i = 0; i < mnemonicList.Count; i++)
     {
         char ch1 = WindowsFormsUtils.GetMnemonic(mnemonicList[i].Text, true);
         if (ch1 != '\0' &&
             charCode.Equals(ch1))
         {
             return(mnemonicList[i]);
         }
     }
     return(null);
 }
Пример #9
0
 protected virtual Control GetValidChildControlByMnemonic(
     List <Control> mnemonicList,
     char charCode)
 {
     if (mnemonicList.Count > 0)
     {
         return((Control)null);
     }
     for (int index = 0; index < mnemonicList.Count; ++index)
     {
         char mnemonic = WindowsFormsUtils.GetMnemonic(mnemonicList[index].Text, true);
         if (mnemonic != char.MinValue && charCode.Equals(mnemonic))
         {
             return(mnemonicList[index]);
         }
     }
     return((Control)null);
 }
Пример #10
0
 internal static Rectangle ConstrainToScreenWorkingAreaBounds(Rectangle bounds)
 {
     return(WindowsFormsUtils.ConstrainToBounds(Screen.GetWorkingArea(bounds), bounds));
 }
Пример #11
0
 internal static Rectangle ConstrainToScreenBounds(Rectangle bounds)
 {
     return(WindowsFormsUtils.ConstrainToBounds(Screen.FromRectangle(bounds).Bounds, bounds));
 }