コード例 #1
0
        EvasObject CreateCard2(EvasObject parent)
        {
            var card = new MCard(parent)
            {
                MinimumWidth  = 344.ToPixel(),
                MinimumHeight = 382.ToPixel(),
                BorderColor   = Color.Red
            };

            card.Show();

            var iconBox   = new Box(parent);
            var titleBox  = new Box(parent);
            var imgBox    = new Box(parent);
            var descBox   = new Box(parent);
            var actionBox = new Box(parent)
            {
                MinimumHeight = 36.ToPixel(),
                IsHorizontal  = true
            };

            actionBox.SetPadding(8, 0);

            iconBox.BackgroundColor   = Color.Gray;
            titleBox.BackgroundColor  = Color.Aqua;
            imgBox.BackgroundColor    = Color.Yellow;
            descBox.BackgroundColor   = Color.Pink;
            actionBox.BackgroundColor = Color.Lime;

            card.PackEnd(iconBox);
            card.PackEnd(titleBox);
            card.PackEnd(imgBox);
            card.PackEnd(descBox);
            card.PackEnd(actionBox);

            card.SetLayoutCallback(() =>
            {
                var g = card.Geometry;

                // TODO : card.Chlidren will be used for layouting
                foreach (var child in card.Children)
                {
                    child.Show();
                }

                iconBox.Geometry = new Rect(
                    g.X + 16.ToPixel(),
                    g.Y + 16.ToPixel(),
                    40.ToPixel(),
                    40.ToPixel());
                titleBox.Geometry = new Rect(
                    iconBox.Geometry.X + iconBox.Geometry.Width + 16.ToPixel(),
                    g.Y + 16.ToPixel(),
                    g.Width - 88.ToPixel(),
                    40.ToPixel());
                imgBox.Geometry = new Rect(
                    g.X,
                    g.Y + 72.ToPixel(),
                    g.Width,
                    194.ToPixel());
                descBox.Geometry = new Rect(
                    g.X + 16.ToPixel(),
                    imgBox.Geometry.Y + imgBox.Geometry.Height + 16.ToPixel(),
                    g.Width - 32.ToPixel(),
                    g.Height - imgBox.Geometry.Height - 72.ToPixel() - 68.ToPixel());
                actionBox.Geometry = new Rect(
                    g.X + 16.ToPixel(),
                    descBox.Geometry.Y + descBox.Geometry.Height + 8.ToPixel(),
                    g.Width / 2,
                    36.ToPixel());
            });

            return(card);
        }
コード例 #2
0
ファイル: ShellItemRenderer.cs プロジェクト: terrajobst/maui
 void SetCurrentItem(EvasObject item)
 {
     _currentItem = item;
     _currentItem.Show();
     _mainLayout.PackEnd(_currentItem);
 }
コード例 #3
0
ファイル: CircleGenList.cs プロジェクト: prjung/TizenFX
 public CircleGenList(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent))
 {
     ((IRotaryActionWidget)this).Activate();
 }
コード例 #4
0
 public View GetTemplatedView(EvasObject evasObject)
 {
     return(_nativeFormsTable[evasObject]);
 }
コード例 #5
0
 internal virtual void SendVisualElementInitialized(VisualElement element, EvasObject nativeView)
 {
     element.SendViewInitialized(nativeView);
 }
コード例 #6
0
ファイル: AccessibleObject.cs プロジェクト: prjung/TizenFX
 /// <summary>
 /// Creates and initializes a new instance of the AccessibleObject class with parent EvasObject class parameter.
 /// </summary>
 /// <param name="parent">Parent EvasObject class </param>
 /// <since_tizen> preview </since_tizen>
 public AccessibleObject(EvasObject parent) : base(parent)
 {
 }
コード例 #7
0
 protected override Native.CarouselView CreateNativeControl(EvasObject parent)
 {
     return(new Native.CarouselView(parent));
 }
コード例 #8
0
 public CircleProgressBar(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent))
 {
 }
 public static EvasObject CreateEvasObject(this ContentPage page, EvasObject parent, bool hasAlpha = false)
 {
     return(Xamarin.Forms.PageExtensions.CreateEvasObject(page, parent, hasAlpha));
 }
コード例 #10
0
ファイル: CellRenderer.cs プロジェクト: wbhsm/Xamarin.Forms
 protected virtual EvasObject OnReusableContent(Cell cell, string part, EvasObject old)
 {
     return(null);
 }
コード例 #11
0
 public Task <IScreenshotResult> CaptureAsync(EvasObject view) =>
 throw ExceptionUtils.NotSupportedOrImplementedException;
コード例 #12
0
ファイル: MaterialShellTabs.cs プロジェクト: zmtzawqlp/maui
 public MaterialShellTabs(EvasObject parent) : base(parent)
 {
 }
コード例 #13
0
 public IndicatorView(EvasObject parent) : base(parent)
 {
     AutoHide     = false;
     IsHorizontal = true;
     this.SetStyledIndex();
 }
コード例 #14
0
        EvasObject CreateCard1(EvasObject parent)
        {
            //Set Layout
            var card = new MCard(parent)
            {
                MinimumWidth  = 344.ToPixel(),
                MinimumHeight = 148.ToPixel(),
            };

            var iconBox = new Box(parent)
            {
                MinimumWidth  = 80.ToPixel(),
                MinimumHeight = 80.ToPixel()
            };

            var textBox = new Box(parent)
            {
                MinimumWidth  = 216.ToPixel(),
                MinimumHeight = 80.ToPixel()
            };

            textBox.SetPadding(0, 10);


            var actionBox = new Box(parent)
            {
                MinimumHeight = 36.ToPixel(),
                IsHorizontal  = true
            };

            actionBox.SetPadding(8, 0);

            card.Show();
            iconBox.Show();
            textBox.Show();
            actionBox.Show();

            card.PackEnd(iconBox);
            card.PackEnd(textBox);
            card.PackEnd(actionBox);

            card.SetLayoutCallback(() =>
            {
                var g = card.Geometry;

                textBox.Geometry = new Rect(
                    g.X + 16.ToPixel(),
                    g.Y + 16.ToPixel(),
                    textBox.MinimumWidth,
                    textBox.MinimumHeight);

                iconBox.Geometry = new Rect(
                    textBox.Geometry.X + textBox.Geometry.Width + 16.ToPixel(),
                    textBox.Geometry.Y,
                    iconBox.MinimumWidth,
                    iconBox.MinimumHeight);

                actionBox.Geometry = new Rect(
                    g.X + 8.ToPixel(),
                    iconBox.Geometry.Y + iconBox.Geometry.Height + 8.ToPixel(),
                    g.Width - 32.ToPixel(),
                    actionBox.MinimumHeight);
            });

            //Fill the contents
            var icon = new Image(parent)
            {
                AlignmentX    = -1,
                AlignmentY    = -1,
                WeightX       = 1,
                WeightY       = 1,
                IsFixedAspect = false
            };

            icon.Load(Path.Combine(MaterialGallery.ResourceDir, "image.png"));
            icon.Show();
            iconBox.PackEnd(icon);

            var title = new Label(parent)
            {
                Text       = $"<span font_size={25.ToPixel()}>Title goes here</span>",
                AlignmentX = 0,
                AlignmentY = 0
            };
            var sub = new Label(parent)
            {
                Text          = $"<span font_size={15.ToPixel()} color=#666666>Secondary line text Lorem ipsum dolor sit amet</span>",
                LineWrapType  = WrapType.Word,
                LineWrapWidth = textBox.MinimumWidth,
                AlignmentX    = 0,
                AlignmentY    = 0,
            };

            title.Show();
            sub.Show();
            textBox.PackEnd(title);
            textBox.PackEnd(sub);

            var action1 = new MButton(parent)
            {
                //ButtonStyle = MButtonStyle.TextButton,
                //Text = "Action 1",
                Text            = $"<span font_size={18.ToPixel()} color=#6200ee>Action 1</span>",
                BackgroundColor = Color.White,
                AlignmentX      = 0,
                MinimumWidth    = 100.ToPixel()
            };

            var action2 = new MButton(parent)
            {
                //ButtonStyle = MButtonStyle.TextButton,
                //Text = "Action 2",
                Text            = $"<span font_size={18.ToPixel()} color=#6200ee>Action 2</SPAN>",
                BackgroundColor = Color.White,
                AlignmentX      = 0,
                MinimumWidth    = 100.ToPixel()
            };

            var empty = new Label(parent)
            {
                AlignmentX = 0,
                WeightX    = 1,
            };

            action1.Show();
            action2.Show();
            empty.Show();

            actionBox.PackEnd(action1);
            actionBox.PackEnd(action2);
            actionBox.PackEnd(empty);

            return(card);
        }
コード例 #15
0
ファイル: MauiShapeView.cs プロジェクト: sung-su/maui
 public MauiShapeView(EvasObject parent) : base(parent)
 {
 }
コード例 #16
0
 /// <summary>
 /// Add the specified evas object to the list of children views.
 /// </summary>
 /// <param name="children">The extended class.</param>
 /// <param name="obj">Object to be added.</param>
 /// <param name="measureDelegate">Optional delegate which provides measurements for the added object.</param>
 public static void Add(this IList <View> children, EvasObject obj, MeasureDelegate measureDelegate = null)
 {
     children.Add(obj.ToView(measureDelegate));
 }
コード例 #17
0
 public NavigationView(EvasObject parent) : base(parent)
 {
     InitializeComponent();
 }
コード例 #18
0
 /// <summary>
 /// Wraps the evas object into a view which can be used by Xamarin.
 /// </summary>
 /// <returns>The Xamarin view which wraps the evas object.</returns>
 /// <param name="obj">The extended class.</param>
 /// <param name="measureDelegate">Optional delegate which provides measurements for the evas object.</param>
 public static View ToView(this EvasObject obj, MeasureDelegate measureDelegate = null)
 {
     return(new EvasObjectWrapper(obj, measureDelegate));
 }
コード例 #19
0
ファイル: Platform.cs プロジェクト: vnwonah/Xamarin.Forms
 public RootNativeViewChangedEventArgs(EvasObject view) => RootNativeView = view;
コード例 #20
0
 /// <summary>
 /// Gets the size of raw text block.
 /// </summary>
 /// <param name="textable">The <see cref="EvasObject"/> with text part.</param>
 /// <returns>Returns the size of raw text block.</returns>
 public static ESize GetRawTextBlockSize(EvasObject textable)
 {
     return(GetElmTextPart(textable)?.TextBlockNativeSize ?? new ESize(0, 0));
 }
コード例 #21
0
 public override EvasObject CreateNativeView(EvasObject parent)
 {
     return(CreateNativeView(0, parent));
 }
コード例 #22
0
 /// <summary>
 /// Gets the size of formatted text block.
 /// </summary>
 /// <param name="textable">The <see cref="ElmSharp.EvasObject"/> with text part.</param>
 /// <returns>Returns the size of formatted text block.</returns>
 public static ESize GetFormattedTextBlockSize(EvasObject textable)
 {
     return(GetElmTextPart(textable)?.TextBlockFormattedSize ?? new ESize(0, 0));
 }
コード例 #23
0
ファイル: Box.cs プロジェクト: zmtzawqlp/maui
 public Box(EvasObject parent) : base(parent)
 {
     SetLayoutCallback(() => { NotifyOnLayout(); });
 }
コード例 #24
0
 /// <summary>
 /// Constructor of ListView native control.
 /// </summary>
 /// <param name="parent">ElmSharp object which is parent of particular list view</param>
 public ListView(EvasObject parent)
     : base(parent)
 {
     Scroller           = new ScrollerExtension(this);
     Scroller.Scrolled += OnScrolled;
 }
 public MaterialNavigationView(EvasObject parent) : base(parent)
 {
     MenuItemSelected += OnSelectedItemChanged;
 }
コード例 #26
0
 public TVNavigationDrawer(EvasObject parent) : base(parent)
 {
     Initialize(parent);
 }
コード例 #27
0
ファイル: CircleGenList.cs プロジェクト: prjung/TizenFX
 /// <summary>
 /// Creates and initializes a new instance of the Circle GenList class
 /// </summary>
 /// <param name="parent">The parent of new Circle GenList instance</param>
 /// <param name="surface">The surface for drawing circle features for this widget.</param>
 /// <since_tizen> preview </since_tizen>
 public CircleGenList(EvasObject parent, CircleSurface surface) : base()
 {
     Debug.Assert(parent == null || surface == null || parent.IsRealized);
     _surface = surface;
     Realize(parent);
 }
コード例 #28
0
ファイル: EditorWindow.cs プロジェクト: yourina/TizenFX
 /// <summary>
 /// This API creates a handle for the editor window.
 /// </summary>
 /// <since_tizen> 4 </since_tizen>
 protected override IntPtr CreateHandle(EvasObject parent)
 {
     return(_handle);
 }
コード例 #29
0
        void Initialize(EvasObject parent)
        {
            _box = new Native.Box(parent)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };
            SetContent(_box);

            _menu = new GenList(parent)
            {
                BackgroundColor = EColor.Transparent,
                Style           = "solid/default",
            };

            _menu.ItemSelected += (s, e) =>
            {
                _flyoutMenu.TryGetValue(e.Item.Data as Item, out Element element);

                SelectedItemChanged?.Invoke(this, new SelectedItemChangedEventArgs(element, -1));
            };

            _menu.Show();
            _box.PackEnd(_menu);

            _defaultClass = new GenItemClass("double_label")
            {
                GetTextHandler = (obj, part) =>
                {
                    if (part == "elm.text")
                    {
                        return(((Item)obj).Title);
                    }
                    else
                    {
                        return(null);
                    }
                },
                GetContentHandler = (obj, part) =>
                {
                    if (part == "elm.swallow.icon")
                    {
                        var icon = ((Item)obj).Icon;
                        if (icon != null)
                        {
                            var image = new Native.Image(parent)
                            {
                                MinimumWidth  = Forms.ConvertToScaledPixel(24),
                                MinimumHeight = Forms.ConvertToScaledPixel(24)
                            };
                            var result = image.LoadFromImageSourceAsync(icon);
                            return(image);
                        }
                        else
                        {
                            return(null);
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
            };
        }
コード例 #30
0
ファイル: ShellTabs.cs プロジェクト: terrajobst/maui
 public ShellTabs(EvasObject parent) : base(parent)
 {
     Style         = ThemeConstants.Toolbar.Styles.Material;
     SelectionMode = ToolbarSelectionMode.Always;
 }