public override void OnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); //TODO: To support non-unified tab button size. CalculateUnifiedTabButtonSize(); }
public void CustomActorImplOnRelayout() { tlog.Debug(tag, $"CustomActorImplOnRelayout START"); using (View view = new View()) { var testingTarget = NDalic.GetImplementation(view); Assert.IsNotNull(testingTarget, "Should be not null!"); Assert.IsInstanceOf <CustomActorImpl>(testingTarget, "Should be an Instance of CustomActorImpl!"); using (Vector2 vector = new Vector2(100.0f, 20.0f)) { using (RelayoutContainer container = new RelayoutContainer(view.SwigCPtr.Handle, false)) { try { testingTarget.OnRelayout(vector, container); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } } } testingTarget.Dispose(); } tlog.Debug(tag, $"CustomActorImplOnRelayout END (OK)"); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { // Configure the transform and size of Image visual. PropertyMap imageVisualTransform = new PropertyMap(); imageVisualTransform.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(new Vector2(10.0f, 0.0f))) .Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute))) .Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute))) .Add((int)VisualTransformPropertyType.Size, new PropertyValue(new Vector2(40.0f, 40.0f))) .Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.CenterBegin)) .Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.CenterBegin)); _imageVisual.SetTransformAndSize(imageVisualTransform, size); // Configure the transform and size of Text visual. PropertyMap textVisualTransform = new PropertyMap(); textVisualTransform.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(new Vector2(0.0f, 0.0f))) .Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Relative, (int)VisualTransformPolicyType.Relative))) .Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute))) .Add((int)VisualTransformPropertyType.Size, new PropertyValue(new Vector2(size.X - 100.0f, 50.0f))) .Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.Center)) .Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.Center)); _textVisual.SetTransformAndSize(textVisualTransform, size); // Configure the transform and size of Primitive visual. PropertyMap primitiveVisualTransform = new PropertyMap(); primitiveVisualTransform.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(new Vector2(size.X - 60.0f, 0.0f))) .Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute))) .Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute))) .Add((int)VisualTransformPropertyType.Size, new PropertyValue(new Vector2(40.0f, 40.0f))) .Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.CenterBegin)) .Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.CenterBegin)); _primitiveVisual.SetTransformAndSize(primitiveVisualTransform, size); }
/// <summary> /// Overrides the method of OnRelayout() for CustomView class.<br /> /// Called after the size negotiation has been finished for this control.<br /> /// The control is expected to assign this given size to itself or its children.<br /> /// Should be overridden by derived classes if they need to layout actors differently after certain operations like add or remove actors, resize, or after changing specific properties.<br /> /// </summary> /// <remarks>As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).</remarks> /// <param name="size">The allocated size.</param> /// <param name="container">The control should add actors to this container that it is not able to allocate a size for.</param> /// <since_tizen> 3 </since_tizen> public override void OnRelayout(Vector2 size, RelayoutContainer container) { foreach (var item in visualDictionary) { item.Value.SetTransformAndSize(tranformDictionary[item.Key], size); EnableVisual(item.Key, true); } }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { View view = new View(); view.Size = new Size(100, 100); container.Add(view, new Size2D(100, 100)); _flagAdd = true; base.OnRelayout(size, container); }
/// <inheritdoc/> /// <since_tizen> 9 </since_tizen> public override void OnRelayout(Vector2 size, RelayoutContainer container) { //Console.WriteLine("[NUI] On ReLayout [{0} {0}]", size.X, size.Y); base.OnRelayout(size, container); if (InternalItemsLayouter != null && ItemsSource != null && ItemTemplate != null) { InternalItemsLayouter.Initialize(this); InternalItemsLayouter.RequestLayout(ScrollingDirection == Direction.Horizontal ? ContentContainer.CurrentPosition.X : ContentContainer.CurrentPosition.Y, true); } }
/// <summary> /// Called after the size negotiation has been finished for this ScrollMenu. /// The control is expected to assign this given size to itself or its children. /// </summary> /// <param name="size">The allocated size.</param> /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param> public override void OnRelayout(Vector2 size, RelayoutContainer container) { _width = size.X; // Only setup initial scroll position on first layout. if (_firstActive) { _firstActive = false; if (_focusCenter) { // We chose a sensible first item to focus. // To do this we work out how many items would be visible so we can position the 1st one on the left, and focus the item in the middle of the screen. // w = item-width | c = container-width | g = gap between items | x = number of items to the left of the center selected one. // So: w/2 + x(w + g) + g = c/2 // Solving for x: x = (c/2 - g - w/2) / (w + g) // We omit the extra gap on the left as it is better to show an item if possible. _itemToFocus = (int)Math.Floor((double)(((_width / 2.0f) - (ItemDimensions.Width / 2.0f)) / (ItemDimensions.Width + _gap))); // We align the items to the left to fit as many on screen as possible, but if there are less items than will fit on the screen, // we shouldn't move them past left of centered. So focus the center item (of all items) in this case. if (_itemToFocus > (_items.Count / 2)) { _itemToFocus = _items.Count / 2; } } else { // We ensure the 1st item is always on the far left of the container. _currentScrollPosition += ((_itemDimensions.Width - _width) * 0.5f) - GetItemPosition(0, _currentScrollPosition, false).X; // Check if the number of items we have is less than can fit in the container width. // If so, offset the items so they appear centered rather than far left aligned. float itemsLength = ((float)_items.Count * (ItemDimensions.Width + _gap)) + _gap; float itemsTotalLength = itemsLength + (_scrollEndMargin * 2.0f); if (itemsTotalLength < _width) { // Add the offset. _currentScrollPosition += ((_width - itemsLength) / 2.0f) + _scrollEndMargin; } } // Scroll to the position of the focused item. The last "true" forces this to happen instantly so there is no visible animation initially. ScrollTo(_itemToFocus, true, true); if (!_startActive) { SetActive(false); } } }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { if (size == null) { return; } if (size.Equals(this.size)) { return; } this.size = new Vector2(size); UpdateSizeAndSpacing(); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); if (prevSize != Size) { prevSize = Size; if (itemSeperator) { var margin = itemSeperator.Margin; itemSeperator.SizeWidth = SizeWidth - margin.Start - margin.End; itemSeperator.SizeHeight = itemSeperator.HeightSpecification; itemSeperator.Position = new Position(margin.Start, SizeHeight - margin.Bottom - itemSeperator.SizeHeight); } } }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { if (mAdapter == null) { return; } if (mLayout == null) { return; } DispatchLayoutStep1(); mLayout.OnLayoutChildren(mRecycler); RemoveAndRecycleScrapInt(); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { if (size == null) { return; } if (size.Equals(this.size)) { return; } this.size = new Vector2(size); if (pickerScroller != null && itemList != null) { pickerScroller.ScrollAvailableArea = new Vector2(0, (itemList.Count * itemHeight) - size.Height); } }
/// <summary> /// Called after the size negotiation has been finished for this control.<br /> /// The control is expected to assign this given size to itself or its children.<br /> /// Should be overridden by derived classes if they need to layout views differently after certain operations like add or remove views, resize, or after changing specific properties.<br /> /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br /> /// </summary> /// <param name="size">The allocated size.</param> /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param> /// <since_tizen> 3 </since_tizen> public virtual void OnRelayout(Vector2 size, RelayoutContainer container) { }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); OnUpdate(); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { visualView.OnRelayout(size, container); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); CalculateSizeAndPosition(); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); LayoutItems(); }
public void MyOnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); }
public override void OnRelayout(Vector2 size, RelayoutContainer container) { base.OnRelayout(size, container); UpdateSizeAndSpacing(); }