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(); }
/// <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(); }); }
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); }