public virtual void Collapse() { if (this.IsCollapsed) { return; } CancelEventArgs e = new CancelEventArgs(); this.OnCollapsing(e); if (e.Cancel) { return; } this.IsCollapsed = true; foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items) { lightVisualElement.DrawText = false; } NavigationViewDisplayModes effectiveDisplayMode = this.GetEffectiveDisplayMode((float)this.Size.Width); if (effectiveDisplayMode == NavigationViewDisplayModes.Expanded) { if (this.AllowAnimation) { Size size1 = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); Size size2 = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); AnimatedPropertySetting animatedPropertySetting = new AnimatedPropertySetting(RadElement.MinSizeProperty, (object)size1, (object)size2, this.AnimationFrames, this.AnimationInterval); animatedPropertySetting.AnimationFinished += (AnimationFinishedEventHandler)((param0, param1) => this.OnCollapsed(EventArgs.Empty)); animatedPropertySetting.ApplyValue((RadObject)this.ItemContainer); } else { this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); this.OnCollapsed(EventArgs.Empty); } } else { this.programmaticallyClosingPopup = true; this.Popup.ClosePopup(RadPopupCloseReason.Mouse); this.HamburgerButton.StretchHorizontally = false; this.programmaticallyClosingPopup = false; if (effectiveDisplayMode == NavigationViewDisplayModes.Compact) { this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); this.ItemContainer.MaxSize = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); if (!this.Children.Contains((RadElement)this.ItemContainer)) { int num = (int)this.Popup.RootElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local); this.Children.Insert(0, (RadElement)this.ItemContainer); } } if (!this.Children.Contains((RadElement)this.HamburgerButton)) { int num = (int)this.HamburgerButton.ResetValue(RadElement.AlignmentProperty, ValueResetFlags.Local); this.Children.Add((RadElement)this.HamburgerButton); } this.OnCollapsed(EventArgs.Empty); } }
private Size GetDropDownSize() { Size size = Size.Empty; SizeF scaleFactor1 = this.PopupControl == null || this.PopupControl.OwnerElement == null ? new SizeF(1f, 1f) : this.PopupControl.OwnerElement.DpiScaleFactor; int val1 = TelerikDpiHelper.ScaleInt(185, scaleFactor1); size = new Size(Math.Max(val1, this.dateTimePickerElement.ControlBoundingRectangle.Width), Math.Max(val1, TelerikDpiHelper.ScaleInt(this.dropDownHeight, scaleFactor1))); if (this.dateTimePickerElement.ElementTree != null) { if (size.Width == -1) { size.Width = this.dateTimePickerElement.ElementTree.Control.Width; } size.Height = TelerikDpiHelper.ScaleInt(this.dropDownHeight, scaleFactor1) + (this.DropDownSizingMode != SizingMode.None ? 10 : 0); if (this.dateTimePickerElement.CalendarSize != new Size(100, 156)) { size = this.dateTimePickerElement.CalendarSize; } size = new Size(size.Width, size.Height); if (this.cachedSize != Size.Empty) { size = this.cachedSize; } if (this.LastShowDpiScale != scaleFactor1) { SizeF scaleFactor2 = new SizeF(this.DateTimePickerElement.DpiScaleFactor.Width / this.LastShowDpiScale.Width, this.DateTimePickerElement.DpiScaleFactor.Height / this.LastShowDpiScale.Height); this.LastShowDpiScale = this.DateTimePickerElement.DpiScaleFactor; size = TelerikDpiHelper.ScaleSize(size, scaleFactor2); } } return(size); }
protected virtual void EnsureDisplayMode(NavigationViewDisplayModes mode) { switch (mode) { case NavigationViewDisplayModes.Minimal: this.ItemContainer.MaxSize = Size.Empty; this.HamburgerButton.StretchHorizontally = false; if (!this.PopupStack.Children.Contains((RadElement)this.ItemContainer)) { this.PopupStack.Children.Add((RadElement)this.ItemContainer); } if (this.Children.Contains((RadElement)this.HamburgerButton)) { break; } this.Children.Add((RadElement)this.HamburgerButton); break; case NavigationViewDisplayModes.Compact: foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items) { lightVisualElement.DrawText = false; } this.HamburgerButton.StretchHorizontally = false; this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); this.ItemContainer.MaxSize = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); if (!this.Children.Contains((RadElement)this.ItemContainer)) { this.Children.Insert(0, (RadElement)this.ItemContainer); } if (this.Children.Contains((RadElement)this.HamburgerButton)) { break; } this.Children.Add((RadElement)this.HamburgerButton); break; case NavigationViewDisplayModes.Expanded: foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items) { lightVisualElement.DrawText = !this.IsCollapsed; } this.ItemContainer.MaxSize = Size.Empty; this.HamburgerButton.StretchHorizontally = true; if (!this.Children.Contains((RadElement)this.ItemContainer)) { this.Children.Insert(0, (RadElement)this.ItemContainer); } if (this.Children.Contains((RadElement)this.ItemContainer)) { break; } this.Children.Add((RadElement)this.HamburgerButton); break; } }
protected virtual void PaintElements( IGraphics graphics, ISymbology symbology, IElementFactory elementFactory) { if (symbology is PDF417) { graphics.TranslateTransform((float)(((double)this.Bounds.Width - (double)elementFactory.ElementsBounds.Width) / 2.0), (float)(((double)this.Bounds.Height - (double)elementFactory.ElementsBounds.Height) / 2.0)); } else if (symbology is QRCode) { TelerikDpiHelper.ScaleInt(4, this.DpiScaleFactor); } (graphics.UnderlayGraphics as Graphics).Clear(this.BackColor); foreach (BarcodeElementBase element in elementFactory.Elements) { element.PaintElement(graphics.UnderlayGraphics as Graphics); } }
private void DoScroll(Point oldValue, Point newValue) { if (this.viewport == null) { return; } this.BitState[274877906944L] = true; if (this.UsePhysicalScrolling) { SizeF scaleFactor = new SizeF(1f / this.DpiScaleFactor.Width, 1f / this.DpiScaleFactor.Height); this.viewport.PositionOffset = new SizeF((float)-TelerikDpiHelper.ScaleInt(newValue.X, scaleFactor), (float)-TelerikDpiHelper.ScaleInt(newValue.Y, scaleFactor)); } else { ((IRadScrollViewport)this.viewport).DoScroll(oldValue, newValue); } this.BitState[274877906944L] = false; this.OnScroll(oldValue, newValue); }
protected internal override SizeF GetEditorSize( SizeF availableSize, DataFilterEditorElement editorElement) { SizeF sizeF = availableSize; bool isEditing = this.TreeViewElement.IsEditing; if (editorElement == this.fieldElement) { sizeF.Width = !isEditing || (double)this.cachedFieldElementWidth <= 0.0 ? Math.Max((float)TelerikDpiHelper.ScaleInt(DataFilterCriteriaElement.DefaultFieldWidth, this.DpiScaleFactor), availableSize.Width) : this.cachedFieldElementWidth; this.cachedFieldElementWidth = sizeF.Width; } else if (editorElement == this.operatorElement) { sizeF.Width = !isEditing || (double)this.cachedOperatorElementWidth <= 0.0 ? Math.Max((float)TelerikDpiHelper.ScaleInt(DataFilterCriteriaElement.DefaultOperatorWidth, this.DpiScaleFactor), availableSize.Width) : this.cachedOperatorElementWidth; this.cachedOperatorElementWidth = sizeF.Width; } else if (editorElement == this.valueElement) { sizeF.Width = !isEditing || (double)this.cachedValueElementWidth <= 0.0 ? Math.Max((float)TelerikDpiHelper.ScaleInt(DataFilterCriteriaElement.DefaultValueWidth, this.DpiScaleFactor), availableSize.Width) : this.cachedValueElementWidth; this.cachedValueElementWidth = sizeF.Width; } return(sizeF); }
protected override Size GetPopupSize(RadPopupControlBase popup, bool measure) { RadSizablePopupControl sizablePopupControl = popup as RadSizablePopupControl; int num1 = this.listElement.Items.Count; CheckedItemTraverser traverser = this.listElement.Scroller.Traverser as CheckedItemTraverser; if (traverser != null && traverser.CheckAll) { ++num1; } if (num1 > this.defaultItemsCountInDropDown || num1 == 0) { num1 = this.defaultItemsCountInDropDown; } if (num1 > this.maxDropDownItems && this.maxDropDownItems > 0) { num1 = this.maxDropDownItems; } int num2 = 0; if (sizablePopupControl.SizingGrip.Visibility == ElementVisibility.Visible) { RadElement sizingGrip = (RadElement)sizablePopupControl.SizingGrip; num2 = new Rectangle(sizingGrip.BoundingRectangle.Location, Size.Add(sizingGrip.BoundingRectangle.Size, sizingGrip.Margin.Size)).Height; } int num3 = 0; if (!this.listElement.AutoSizeItems) { int num4 = this.listElement.ItemHeight; for (int index = 0; index < num1 && index < this.listElement.Items.Count; ++index) { if (this.listElement.Items[index] is DescriptionTextListDataItem || this.listElement.IsDescriptionText) { num4 *= 2; break; } } if (this.ListElement.DpiScaleFactor != this.Popup.OwnerElement.DpiScaleFactor) { num4 = TelerikDpiHelper.ScaleInt(num4, this.Popup.OwnerElement.DpiScaleFactor); } int height = num1 * (num4 + this.listElement.Scroller.ItemSpacing) + num2 + (int)((double)this.listElement.BorderWidth * 2.0); if (this.DropDownHeight != 106) { height = this.DropDownHeight; } return(new Size(this.Size.Width, height)); } int height1; if (this.listElement.Items.Count > 0) { for (int index = 0; index < num1 && index < this.listElement.Items.Count; ++index) { num3 += (int)this.listElement.Items[index].MeasuredSize.Height + this.listElement.Scroller.ItemSpacing; } height1 = num3 + this.listElement.Scroller.ItemSpacing + num2 + this.listElement.HScrollBar.Size.Height + (int)((double)this.listElement.BorderWidth * 2.0); } else { height1 = num1 * (this.listElement.ItemHeight + this.listElement.Scroller.ItemSpacing) + num2 + (int)((double)this.listElement.BorderWidth * 2.0); } if (this.DropDownHeight != 106) { height1 = this.DropDownHeight; } return(new Size(this.Size.Width, height1)); }
public virtual void Expand() { if (!this.IsCollapsed) { return; } CancelEventArgs e = new CancelEventArgs(); this.OnExpanding(e); if (e.Cancel) { return; } this.IsCollapsed = false; this.ItemContainer.Visibility = ElementVisibility.Visible; if (this.GetEffectiveDisplayMode((float)this.Size.Width) == NavigationViewDisplayModes.Expanded) { if (this.AllowAnimation) { Size size1 = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); Size size2 = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); AnimatedPropertySetting animatedPropertySetting = new AnimatedPropertySetting(RadElement.MinSizeProperty, (object)size1, (object)size2, this.AnimationFrames, this.AnimationInterval); animatedPropertySetting.AnimationFinished += (AnimationFinishedEventHandler)((param0, param1) => { foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items) { lightVisualElement.DrawText = true; } this.OnExpanded(EventArgs.Empty); }); animatedPropertySetting.ApplyValue((RadObject)this.ItemContainer); } else { this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); this.OnExpanded(EventArgs.Empty); } } else { this.PopupStack.Children.Insert(0, (RadElement)this.HamburgerButton); if (!this.PopupStack.Children.Contains((RadElement)this.ItemContainer)) { this.PopupStack.Children.Add((RadElement)this.ItemContainer); } this.HamburgerButton.Alignment = this.RightToLeft ? ContentAlignment.TopRight : ContentAlignment.TopLeft; this.HamburgerButton.StretchHorizontally = true; int num1 = (int)this.ItemContainer.ItemLayout.SetValue(RadPageViewStripElement.StripAlignmentProperty, (object)StripViewAlignment.Right); int num2 = (int)this.ItemContainer.ResetValue(RadElement.MinSizeProperty, ValueResetFlags.Animation); this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0); this.ItemContainer.MaxSize = Size.Empty; foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items) { lightVisualElement.DrawText = true; } if (this.Popup.ElementTree.RootElement.ElementState != ElementState.Loaded) { this.Popup.LoadElementTree(new Size(this.ExpandedPaneWidth, (int)this.DesiredSize.Height)); } RadPageViewNavigationViewElement.ApplyThemeToPopup((RadElementTree)this.ElementTree, this.Popup); this.Popup.Size = new Size(this.ExpandedPaneWidth, (int)this.DesiredSize.Height); this.Popup.DropDownAnimationDirection = this.RightToLeft ? RadDirection.Left : RadDirection.Right; this.Popup.HorizontalPopupAlignment = this.RightToLeft ? HorizontalPopupAlignment.RightToRight : HorizontalPopupAlignment.LeftToLeft; this.Popup.VerticalPopupAlignment = VerticalPopupAlignment.TopToBottom; this.Popup.RootElement.BackColor = this.BackColor; this.Popup.Show(this.PointToScreen(this.RightToLeft ? new Point(this.Bounds.Right, this.Bounds.Top) : new Point(this.Bounds.Left, this.Bounds.Top))); this.OnExpanded(EventArgs.Empty); } }
protected internal override SizeF GetEditorSize( SizeF availableSize, DataFilterEditorElement editorElement) { SizeF sizeF = availableSize; bool isEditing = this.TreeViewElement.IsEditing; if (editorElement == this.logicalOperatorElement) { sizeF.Width = !isEditing || (double)this.cachedLogicalOperatorElementWidth <= 0.0 ? Math.Max((float)TelerikDpiHelper.ScaleInt(DataFilterGroupElement.DefaultLogicalOperatorWidth, this.DpiScaleFactor), availableSize.Width) : this.cachedLogicalOperatorElementWidth; this.cachedLogicalOperatorElementWidth = sizeF.Width; } return(sizeF); }