protected void Initialize(EvasObject parent) { SetLayoutCallback(OnLayout); _background = new ERectangle(parent) { Color = EColor.Transparent }; _background.Show(); _focusArea = new Button(parent); _focusArea.Color = EColor.Transparent; _focusArea.BackgroundColor = EColor.Transparent; _focusArea.SetPartColor("effect", EColor.Transparent); _focusArea.Clicked += OnClicked; _focusArea.Focused += OnFocused; _focusArea.Unfocused += OnFocused; _focusArea.KeyUp += OnKeyUp; _focusArea.RepeatEvents = true; _focusArea.Show(); PackEnd(_background); PackEnd(_focusArea); FocusedColor = EColor.Default; Show(); }
EvasObject GetDefaultIcon(EvasObject parent) { if (!string.IsNullOrEmpty(s_currentDragStateData.DataPackage.Text)) { var label = new Native.Label(parent); label.Text = s_currentDragStateData.DataPackage.Text; if (Renderer.Element is Label lb) { label.FontSize = lb.FontSize; } else if (Renderer.Element is Entry et) { label.FontSize = et.FontSize; } else if (Renderer.Element is Editor ed) { label.FontSize = ed.FontSize; } return(label); } else { var box = new ElmSharp.Rectangle(parent); box.Color = new ElmSharp.Color(128, 128, 128, 128); return(box); } }
/// <summary> /// Initializes a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.Native.SearchBar"/> class. /// </summary> /// <param name="parent">Parent evas object.</param> public SearchBar(EvasObject parent) : base(parent) { _entry = new Entry(parent) { IsSingleLine = true, }; _entry.SetInputPanelReturnKeyType(InputPanelReturnKeyType.Search); _entry.TextChanged += EntryTextChanged; _entry.Activated += EntryActivated; _entry.Focused += EntryFocused; _entry.Unfocused += EntryUnfocused; _entry.Show(); _cancelButton = new Button(parent); _cancelButton.Style = CancelButtonLayoutStyle; _cancelButton.Clicked += CancelButtonClicked; _underlineRectangle = new ERectangle(parent) { Color = IsEnabled ? s_underlineColor : s_underlineDimColor, }; _underlineRectangle.Show(); Children.Add(_entry); Children.Add(_cancelButton); Children.Add(_underlineRectangle); Show(); this.LayoutUpdated += SearchBarLayoutUpdated; }
public EvasBox(EvasObject parent) : base(parent) { _rectangle = new Lazy <ERectangle>(() => { var rectangle = new ERectangle(this) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1 }; Interop.evas_object_box_insert_at(Handle, rectangle, 0); rectangle.Lower(); rectangle.Show(); return(rectangle); }); SetLayoutCallback(() => { NotifyOnLayout(); }); }
EvasObject GetDefaultIcon(EvasObject parent) { if (!string.IsNullOrEmpty(s_currentDragStateData.DataPackage.Text)) { var label = new TLabel(parent); label.Text = s_currentDragStateData.DataPackage.Text; if (Element is IFontElement fe) { label.FontSize = fe.FontSize; } return(label); } else { var box = new ElmSharp.Rectangle(parent); box.Color = new ElmSharp.Color(128, 128, 128, 128); return(box); } }
void OnRealized() { _box = new ObservableBox(Xamarin.Forms.Platform.Tizen.Forms.NativeParent); _box.SetLayoutCallback(OnLayout); _bgColorObject = new ElmSharp.Rectangle(_box) { Color = ElmSharp.Color.Transparent }; _bgImageObject = new EvasImage(_box); _surfaceLayout = new ElmSharp.Layout(_box); _surface = new ElmSharp.Wearable.CircleSurface(_surfaceLayout); _toolbarItemMap = new Dictionary <XToolbarItem, ElmSharp.Wearable.MoreOptionItem>(); _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>(); _box.PackEnd(_bgColorObject); _box.PackEnd(_bgImageObject); _box.PackEnd(_surfaceLayout); _bgColorObject.Show(); _bgImageObject.Hide(); _surfaceLayout.Show(); if (Element.ToolbarItems.Count > 0) { Device.BeginInvokeOnMainThread(() => { SetVisibleMoreOption(true); foreach (var item in Element.ToolbarItems) { AddToolbarItem(item); } }); } SetNativeView(_box); }
public ElmSharp.EvasObject GetContent(object data, string part) { var minimumHeight = PageHeight > 800 ? 96 : 76; if (part == "elm.swallow.content") { DataSource2 itemSource = (DataSource2)data; ElmSharp.Box mainBox = new ElmSharp.Box(Forms.NativeParent); mainBox.BackgroundColor = Xamarin.Forms.Color.LightYellow.ToNative(); mainBox.MinimumHeight = minimumHeight; mainBox.IsHorizontal = false; mainBox.SetAlignment(-1, -1); mainBox.Show(); ElmSharp.Box contentBox = new ElmSharp.Box(Forms.NativeParent); contentBox.MinimumHeight = minimumHeight; contentBox.IsHorizontal = true; contentBox.SetAlignment(-1, -1); contentBox.Show(); ElmSharp.Box left = new ElmSharp.Box(Forms.NativeParent); left.IsHorizontal = false; left.Show(); left.SetWeight(4.0, 1); left.SetAlignment(-1, -1); contentBox.PackEnd(left); ElmSharp.Label titleName = new ElmSharp.Label(Forms.NativeParent); left.PackEnd(titleName); titleName.Show(); titleName.Text = $"<span font_size=34 font_style=italic color=#7F3300> {itemSource.Name}</span>"; titleName.MinimumWidth = 250; titleName.SetAlignment(-1, -1); ElmSharp.Label titleCategory = new ElmSharp.Label(Forms.NativeParent); left.PackEnd(titleCategory); titleCategory.Show(); titleCategory.Text = $"<span align=center font_size=24 color=#008000>{itemSource.Category}</span>"; titleCategory.SetAlignment(-1, -1); ElmSharp.Box right = new ElmSharp.Box(Forms.NativeParent); right.Show(); right.MinimumWidth = 96; right.MinimumHeight = minimumHeight; right.SetWeight(1, 1); right.SetAlignment(-1, 0); ElmSharp.Image image; if (itemSource.ImageFilename != "") { image = new ElmSharp.Image(right); image.Load(global::Tizen.Applications.Application.Current.DirectoryInfo.Resource + itemSource.ImageFilename + ".jpg"); image.SetAlignment(0.5, 0.5); image.MinimumHeight = minimumHeight; image.MinimumWidth = minimumHeight; image.Show(); right.PackEnd(image); } ElmSharp.Rectangle rec = new ElmSharp.Rectangle(left); rec.MinimumHeight = 1; rec.MinimumWidth = 400; rec.AlignmentX = -1; rec.Color = ElmSharp.Color.Gray; rec.Show(); contentBox.PackEnd(right); mainBox.PackEnd(contentBox); mainBox.PackEnd(rec); return(mainBox); } return(null); }
void InitView() { topLabel = new Label(this) { Text = "", TextStyle = "DEFAULT = 'font_size=30 align=center valign=bottom'", AlignmentX = -1.0, AlignmentY = -1.0, WeightX = 1.0, WeightY = 0.2, BackgroundColor = Color.FromRgba(256, 256, 256, 200), }; topLabel.Show(); PackEnd(topLabel); var blankAbove = new ElmSharp.Rectangle(this) { AlignmentX = -1.0, AlignmentY = -1.0, WeightX = 1.0, WeightY = 0.3, Color = Color.Transparent, }; blankAbove.Show(); PackEnd(blankAbove); var middleBar = new ElmSharp.Rectangle(this) { AlignmentX = -1.0, AlignmentY = -1.0, WeightX = 1.0, WeightY = 0.001, Color = Color.Red, }; middleBar.Show(); PackEnd(middleBar); var blankBelow = new ElmSharp.Rectangle(this) { AlignmentX = -1.0, AlignmentY = -1.0, WeightX = 1.0, WeightY = 0.3, Color = Color.Transparent, }; blankBelow.Show(); PackEnd(blankBelow); bottomLabel = new Label(this) { Text = "", TextStyle = "DEFAULT = 'font_size=30 align=center valign=bottom'", AlignmentX = -1.0, AlignmentY = -1.0, WeightX = 1.0, WeightY = 0.2, BackgroundColor = Color.FromRgba(256, 256, 256, 200), }; bottomLabel.Show(); PackEnd(bottomLabel); }
/// <summary> /// Initialize ThumbnailIndex View /// </summary> private void Initialize() { Console.WriteLine("Initialize"); _isFirstItem = true; _pbox = new PaddingBox(Forms.NativeParent) { Padding = new Thickness { Left = 0, Right = 0, Top = 22, Bottom = 0 }, HeaderSize = new ElmSharp.Size(200, 19), HeaderGap = 38 }; _pbox.Show(); _index = new ElmSharp.Index(_pbox) { Style = "thumbnail", AutoHide = false, IsHorizontal = true, AlignmentX = 0.5, AlignmentY = 0.5, }; _index.Show(); _pbox.Header = _index; //index.Geometry = new Rect(0, 22, 200, 19); _scroller = new ElmSharp.Scroller(_pbox) { HorizontalLoop = false, VerticalLoop = false, HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, HorizontalPageScrollLimit = 1, VerticalPageScrollLimit = 0, }; _scroller.PageScrolled += (s, e) => { Console.WriteLine($" _scroller PageScrolled"); var pageIndex = _scroller.HorizontalPageIndex; _items[pageIndex].Select(true); }; _scroller.Show(); _pbox.Content = _scroller; //_scroller.Geometry = new Rect(0, 79, 360, 281); var box = new ElmSharp.Box(_scroller) { IsHorizontal = true, AlignmentX = 0.5, AlignmentY = 0.5, }; _scroller.SetContent(box); box.Show(); // Create Rectangle for layout center align in Box var padder = new ElmSharp.Rectangle(box); box.PackEnd(padder); _items.Clear(); // Initialize ThumbnailItems foreach (var item in Element.ThumbnailItems) { // create layout var page = new ElmSharp.Layout(box) { WeightX = 1.0, WeightY = 1.0, AlignmentX = -1.0, AlignmentY = 0.5 }; page.SetTheme("layout", "body_thumbnail", "default"); page.Show(); // set icon var img = new ElmSharp.Image(page); var icon = item.Image; Console.WriteLine($"item.Image File:{icon.File}"); img.LoadAsync(ResourcePath.GetPath(icon.File)); page.SetPartContent("elm.icon", img); var indexItem = _index.Append(null); _items.Add(indexItem); // first item case if (_isFirstItem) { Console.WriteLine($"_isFirstItem is true"); page.Resized += (s, e) => { var g = _scroller.Geometry; var pg = page.Geometry; padder.MinimumWidth = (g.Width - pg.Width) / 2; padder.MinimumHeight = g.Height / 2; _scroller.SetPageSize(pg.Width, pg.Height); }; indexItem.Select(true); } _isFirstItem = false; box.PackEnd(page); } box.PackEnd(padder); _index.Update(0); }