Esempio n. 1
0
        public override bool ControlDefinesThemeForElement(RadElement element)
        {
            Type elementType = element.GetType();

            if (elementType == typeof(RadButtonElement) ||
                elementType == typeof(RadRibbonBarButtonGroup) ||
                elementType == typeof(RadRibbonBarElement) ||
                elementType == typeof(RadScrollViewer) ||
                elementType == typeof(RadCheckBoxElement) ||
                elementType == typeof(RadToggleButtonElement) ||
                elementType == typeof(RadDropDownButtonElement) ||
                elementType == typeof(RadRepeatButtonElement)
                )
            {
                return(true);
            }

            if (elementType.Equals(typeof(RadTextBoxElement)))
            {
                if (element.FindAncestorByThemeEffectiveType(typeof(RadComboBoxElement)) != null)
                {
                    return(true);
                }
            }
            else if (elementType.Equals(typeof(RadMaskedEditBoxElement)))
            {
                if (element.FindAncestor <RadDateTimePickerElement>() != null)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
 public override bool ControlDefinesThemeForElement(RadElement element)
 {
     if (this.OwnerElement != null && this.ownerElement.ElementTree != null)
     {
         RadControl control = this.OwnerElement.ElementTree.Control as RadControl;
         if (control != null && this.OwnerElement is IDropDownMenuOwner)
         {
             if (((IDropDownMenuOwner)this.OwnerElement).DropDownInheritsThemeClassName)
             {
                 return(control.ControlDefinesThemeForElement(element));
             }
             return(((IDropDownMenuOwner)this.OwnerElement).ControlDefinesThemeForElement(element));
         }
     }
     System.Type type = element.GetType();
     if (type.Equals(typeof(RadTextBoxElement)))
     {
         if (element.FindAncestorByThemeEffectiveType(typeof(RadDropDownListElement)) != null)
         {
             return(true);
         }
     }
     else if (type.Equals(typeof(RadMaskedEditBoxElement)) && element.FindAncestor <RadDateTimePickerElement>() != null)
     {
         return(true);
     }
     return(base.ControlDefinesThemeForElement(element));
 }
Esempio n. 3
0
        /// <summary>
        /// Close the popup upon mouse click unless
        /// the user has clicked on a RadElement
        /// that opens another popup.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseUp(e);

            RadElement elementUnderMouse = this.RootElement.ElementTree.GetElementAtPoint(e.Location);

            if (elementUnderMouse != null)
            {
                if (elementUnderMouse.FindAncestor <PopupEditorBaseElement>() == null &&
                    elementUnderMouse.FindAncestor <RadGalleryElement>() == null &&
                    !(elementUnderMouse is RadGalleryElement) &&
                    elementUnderMouse.FindAncestor <RadDropDownButtonElement>() == null &&
                    !(elementUnderMouse is RadDropDownButtonElement) &&
                    !(elementUnderMouse is ActionButtonElement))
                {
                    this.ClosePopup(RadPopupCloseReason.Mouse);
                }
            }
        }
Esempio n. 4
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            RadElement elementAtPoint = this.RootElement.ElementTree.GetElementAtPoint(e.Location);

            if (elementAtPoint == null || elementAtPoint.FindAncestor <PopupEditorBaseElement>() != null || (elementAtPoint.FindAncestor <RadGalleryElement>() != null || elementAtPoint is RadGalleryElement) || (elementAtPoint.FindAncestor <RadDropDownButtonElement>() != null || elementAtPoint is RadDropDownButtonElement || elementAtPoint is ActionButtonElement))
            {
                return;
            }
            this.ClosePopup(RadPopupCloseReason.Mouse);
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            RadElement elementAtPoint = this.ElementTree.GetElementAtPoint(e.Location);

            if (!(elementAtPoint is RadScrollBarElement) && elementAtPoint.FindAncestor <RadScrollBarElement>() == null)
            {
                return;
            }
            this.GanttViewElement.EndEdit();
        }
        public override AccessibleObject HitTest(int x, int y)
        {
            RadElement elementAtPoint = this.Control.RootElement.ElementTree.GetElementAtPoint(this.Control.PointToClient(new Point(x, y)));

            if (elementAtPoint == null)
            {
                return(base.HitTest(x, y));
            }
            PropertyGridTextElement ancestor1 = elementAtPoint.FindAncestor <PropertyGridTextElement>();

            if (ancestor1 != null)
            {
                return((AccessibleObject) new PropertyGridCellAccessibleObject(ancestor1.Text, (PropertyGridItemBaseAccessibleObject)this));
            }
            PropertyGridValueElement ancestor2 = elementAtPoint.FindAncestor <PropertyGridValueElement>();

            if (ancestor2 != null)
            {
                return((AccessibleObject) new PropertyGridCellAccessibleObject(((PropertyGridItem)ancestor2.VisualItem.Data).FormattedValue, (PropertyGridItemBaseAccessibleObject)this));
            }
            return(base.HitTest(x, y));
        }
        public override AccessibleObject HitTest(int x, int y)
        {
            RadElement      elementAtPoint  = this.owner.ElementTree.GetElementAtPoint(this.owner.PointToClient(new Point(x, y)));
            RadMenuItemBase radMenuItemBase = (RadMenuItemBase)null;

            if (elementAtPoint != null)
            {
                radMenuItemBase = elementAtPoint.FindAncestor <RadMenuItemBase>();
            }
            if (radMenuItemBase != null)
            {
                return((AccessibleObject)radMenuItemBase.AccessibleObject);
            }
            return(base.HitTest(x, y));
        }
Esempio n. 8
0
        private void radGanttView1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
        {
            Point      mousePosition     = this.radGanttView1.PointToClient(Control.MousePosition);
            RadElement elementUnderMouse = this.radGanttView1.ElementTree.GetElementAtPoint(mousePosition);

            if (elementUnderMouse == null)
            {
                return;
            }

            GanttGraphicalViewBaseItemElement itemElement = elementUnderMouse as GanttGraphicalViewBaseItemElement;

            if (itemElement == null)
            {
                itemElement = elementUnderMouse.FindAncestor <GanttGraphicalViewBaseItemElement>();
            }

            if (itemElement == null)
            {
                return;
            }

            if (elementUnderMouse is DrivingToPickUpLocationElement)
            {
                e.ToolTipText = string.Format("Driving to site: {0}", ((DataRowView)itemElement.Data.DataBoundItem)["DrivingToPickUpLocation"]);
            }
            else if (elementUnderMouse is LoadingElement)
            {
                e.ToolTipText = string.Format("Loading time: {0}", ((DataRowView)itemElement.Data.DataBoundItem)["Loading"]);
            }
            else if (elementUnderMouse is DrivingElement)
            {
                e.ToolTipText = string.Format("Driving: {0}", ((DataRowView)itemElement.Data.DataBoundItem)["Driving"]);
            }
            else if (elementUnderMouse is DriverRestElement)
            {
                e.ToolTipText = string.Format("Driver rest: {0}", ((DataRowView)itemElement.Data.DataBoundItem)["DriverRest"]);
            }
            else if (elementUnderMouse is WaitingElement)
            {
                e.ToolTipText = string.Format("Waiting: {0}", ((DataRowView)itemElement.Data.DataBoundItem)["Waiting"]);
            }
            else if (elementUnderMouse is UnloadingElement)
            {
                e.ToolTipText = string.Format("Unloading: {0}", ((DataRowView)itemElement.Data.DataBoundItem)["Unloading"]);
            }
        }
Esempio n. 9
0
        public override bool ControlDefinesThemeForElement(RadElement element)
        {
            Type elementType = element.GetType();

            if (elementType == typeof(RadButtonElement))
            {
                return(true);
            }

            if (elementType == typeof(RadMenuElement))
            {
                return(true);
            }

            if (elementType == typeof(RadToolStripManager))
            {
                return(true);
            }

            if (elementType.Equals(typeof(RadTextBoxElement)))
            {
                if (element.FindAncestorByThemeEffectiveType(typeof(RadComboBoxElement)) != null)
                {
                    return(true);
                }
            }
            else if (elementType.Equals(typeof(RadMaskedEditBoxElement)))
            {
                if (element.FindAncestor <RadDateTimePickerElement>() != null)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 10
0
        public override bool OnMouseWheel(MouseEventArgs e)
        {
            HandledMouseEventArgs handledMouseEventArgs = e as HandledMouseEventArgs;

            if (handledMouseEventArgs != null && handledMouseEventArgs.Handled)
            {
                return(false);
            }
            int        num1           = Math.Max(1, e.Delta / SystemInformation.MouseWheelScrollDelta);
            int        num2           = Math.Sign(e.Delta) * num1 * SystemInformation.MouseWheelScrollLines;
            bool       flag           = Control.ModifierKeys == Keys.Shift;
            RadElement elementAtPoint = this.GridControl.ElementTree.GetElementAtPoint(e.Location);

            if (elementAtPoint != null)
            {
                GroupPanelElement ancestor = elementAtPoint.FindAncestor <GroupPanelElement>();
                if (ancestor != null)
                {
                    RadScrollBarElement scrollBarElement = !flag ? ancestor.ScrollView.VScrollBar : ancestor.ScrollView.HScrollBar;
                    int num3 = scrollBarElement.Value - num2 * scrollBarElement.SmallChange;
                    if (num3 > scrollBarElement.Maximum - scrollBarElement.LargeChange + 1)
                    {
                        num3 = scrollBarElement.Maximum - scrollBarElement.LargeChange + 1;
                    }
                    if (num3 < scrollBarElement.Minimum)
                    {
                        num3 = scrollBarElement.Minimum;
                    }
                    scrollBarElement.Value = num3;
                    return(true);
                }
            }
            IGridBehavior rowBehaviorAtPoint = this.GetRowBehaviorAtPoint(e.Location);

            if (rowBehaviorAtPoint != null && rowBehaviorAtPoint.OnMouseWheel(e))
            {
                return(true);
            }
            this.tableElement = (GridTableElement)null;
            if (this.GridViewElement.UseScrollbarsInHierarchy)
            {
                this.tableElement = this.ScrollableTableElement(e.Delta < 0);
            }
            else if (this.GridViewElement.SplitMode != RadGridViewSplitMode.None)
            {
                this.tableElement = this.GetGridTableElementAtPoint(e.Location);
            }
            if (this.tableElement == null)
            {
                this.tableElement = this.GridViewElement.TableElement;
            }
            if (this.tableElement != null && (!this.GridViewElement.IsInEditMode || this.GridViewElement.EndEdit()))
            {
                RadScrollBarElement scrollBarElement = !flag ? this.tableElement.VScrollBar : this.tableElement.HScrollBar;
                int num3 = scrollBarElement.Value - num2 * scrollBarElement.SmallChange;
                if (num3 > scrollBarElement.Maximum - scrollBarElement.LargeChange + 1)
                {
                    num3 = scrollBarElement.Maximum - scrollBarElement.LargeChange + 1;
                }
                if (num3 < scrollBarElement.Minimum)
                {
                    num3 = 0;
                }
                else if (num3 > scrollBarElement.Maximum)
                {
                    num3 = scrollBarElement.Maximum;
                }
                if (num3 != scrollBarElement.Value)
                {
                    if (this.scrollDelta == 0)
                    {
                        this.scrollTimer.Start();
                    }
                    this.scrollDelta += num3 - scrollBarElement.Value;
                    if (handledMouseEventArgs != null)
                    {
                        handledMouseEventArgs.Handled = true;
                    }
                }
            }
            return(false);
        }