public static EButton SetWatchPopupRightStyle(this EButton button) { if (Device.Idiom != TargetIdiom.Watch) { Log.Error($"ToWatchPopupRightStyleButton is only supported on TargetIdiom.Watch : {0}", Device.Idiom); return(button); } button.Style = ThemeConstants.Button.Styles.Watch.PopupRight; return(button); }
public static ESize GetTextBlockNativeSize(this EButton button) { var textPart = button.EdjeObject[ThemeConstants.Common.Parts.Text]; if (textPart == null) { Log.Error("There is no elm.text part"); return(new ESize(0, 0)); } return(textPart.TextBlockNativeSize); }
public static EColor GetIconColor(this EButton button) { var ret = EColor.Default; if (button == null) { return(ret); } ret = button.GetPartColor(ThemeConstants.Button.ColorClass.Icon); return(ret); }
void AlertSignalNameHandler(Page sender, AlertArguments arguments) { // Verify that the page making the request is child of this platform if (!PageIsChildOfPlatform(sender)) { return; } Native.Dialog alert = Native.Dialog.CreateDialog(Forms.NativeParent, (arguments.Accept != null)); alert.Title = arguments.Title; var message = arguments.Message.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(Environment.NewLine, "<br>"); alert.Message = message; EButton cancel = new EButton(alert) { Text = arguments.Cancel }; alert.NegativeButton = cancel; cancel.Clicked += (s, evt) => { arguments.SetResult(false); alert.Dismiss(); }; if (arguments.Accept != null) { EButton ok = new EButton(alert) { Text = arguments.Accept }; alert.NeutralButton = ok; ok.Clicked += (s, evt) => { arguments.SetResult(true); alert.Dismiss(); }; } alert.BackButtonPressed += (s, evt) => { arguments.SetResult(false); alert.Dismiss(); }; alert.Show(); _alerts.Add(alert); alert.Dismissed += (s, e) => _alerts.Remove(alert); }
void OnAlertRequest(Page sender, AlertArguments arguments) { // Verify that the page making the request is child of this platform if (!PageIsInThisContext(sender)) { return; } var alert = Dialog.CreateDialog(MauiContext.GetPlatformParent(), (arguments.Accept != null)); alert.Title = arguments.Title; var message = arguments.Message?.Replace("&", "&", StringComparison.Ordinal).Replace("<", "<", StringComparison.Ordinal).Replace(">", ">", StringComparison.Ordinal).Replace(Environment.NewLine, "<br>", StringComparison.Ordinal); alert.Message = message; var cancel = new EButton(alert) { Text = arguments.Cancel }; alert.NegativeButton = cancel; cancel.Clicked += (s, evt) => { arguments.SetResult(false); alert.Dismiss(); }; if (arguments.Accept != null) { var ok = new EButton(alert) { Text = arguments.Accept }; alert.NeutralButton = ok; ok.Clicked += (s, evt) => { arguments.SetResult(true); alert.Dismiss(); }; } alert.BackButtonPressed += (s, evt) => { arguments.SetResult(false); alert.Dismiss(); }; alert.Show(); _alerts.Add(alert); alert.Dismissed += (s, e) => _alerts.Remove(alert); }
protected override void Dispose(bool disposing) { if (disposing) { if (_button != null) { _button.Clicked -= OnClicked; _button.Pressed -= OnPressed; _button.Released -= OnReleased; _button = null; } } base.Dispose(disposing); }
void UpdateActionButton(bool initialize) { if (Element.ActionButton != null) { if (_actionButton == null) { _actionButton = new ElmSharp.Button(_box) { Style = "bottom" }; _actionButton.Clicked += OnActionButtonClicked; _box.PackEnd(_actionButton); } SetVisibleActionButton(Element.ActionButton.IsVisible); Element.ActionButton.PropertyChanged += OnActionButtonItemChanged; _actionButton.Text = Element.ActionButton.Text?.Replace("&", "&") .Replace("<", "<") .Replace(">", ">") .Replace(Environment.NewLine, "<br>"); _actionButton.IsEnabled = Element.ActionButton.IsEnable; if (!Element.ActionButton.IconImageSource.IsNullOrEmpty()) { var imageSource = Element.ActionButton.IconImageSource as FileImageSource; var path = ResourcePath.GetPath(imageSource); var buttonImage = new ElmSharp.Image(_actionButton); buttonImage.LoadAsync(path); buttonImage.Show(); _actionButton.SetPartContent("elm.swallow.content", buttonImage); } else { _actionButton.SetPartContent("elm.swallow.content", null); } _actionButton.BackgroundColor = Element.ActionButton.BackgroundColor.ToNative(); } else { if (_actionButton != null) { _actionButton.Clicked -= OnActionButtonClicked; _box.UnPack(_actionButton); _actionButton.Unrealize(); _actionButton = null; } } }
/// <summary> /// To override OnGetContent to add button instead of a checkbox. /// </summary> /// <param name="cell">a cell element</param> /// <param name="part">a part that has to add</param> /// <returns>an EvasObject that rendered</returns> protected override EvasObject OnGetContent(Cell cell, string part) { if (part == "elm.swallow.end") { var button = new EButton(Forms.Context.MainWindow) { Text = "+", MinimumWidth = 60, MinimumHeight = 80, }; return(button); } return(base.OnGetContent(cell, part)); }
void UpdateHasBackButton(Page page, NaviItem item = null) { if (item == null) { item = GetNaviItemForPage(page); } EButton button = null; if ((bool)page.GetValue(NavigationPage.HasBackButtonProperty) && _naviFrame.NavigationStack.Count > 1) { button = CreateNavigationButton((string)page.GetValue(NavigationPage.BackButtonTitleProperty)); } item.SetPartContent(PartBackButton, button); }
protected override ElmSharp.Layout CreateEditFieldLayout(EvasObject parent) { _layout = base.CreateEditFieldLayout(parent); _clearButton = new EButton(_layout) { Style = "editfield_clear" }; _clearButton.AllowFocus(false); _clearButton.Clicked += ClearButtonClicked; _layout.SetPartContent("elm.swallow.button", _clearButton); _layout.SignalEmit("elm,action,show,button", ""); return(_layout); }
void Initialize() { Picker = CreatePicker(_parent); Picker.Show(); Content = Picker; //TODO need to add internationalization support PositiveButton = new EButton(_parent) { Text = "Set" }; PositiveButton.Clicked += (s, e) => { Confirm(); }; //TODO need to add internationalization support NegativeButton = new EButton(_parent) { Text = "Cancel" }; NegativeButton.Clicked += (s, e) => { Hide(); }; BackButtonPressed += (object s, EventArgs e) => { Hide(); }; // TODO This is Tizen TV Limitation. // UX is defined and the focus move processing is complete, it should be removed(After Tizen 5.0) if (Device.Idiom == TargetIdiom.TV) { KeyDown += (s, e) => { if (e.KeyName == "Return") { if (Picker != null && Picker.IsFocused) { Confirm(); e.Flags |= EvasEventFlag.OnHold; } } }; } }
public WatchDateTimePickerDialog(EvasObject parent) : base(parent) { AlignmentX = -1; AlignmentY = -1; WeightX = 1.0; WeightY = 1.0; Style = "circle"; _container = new Box(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1 }; _container.BackgroundColor = ElmSharp.Color.Blue; _container.SetLayoutCallback(OnContainerLayout); _datetimeLayout = new ELayout(parent); _surfaceLayout = new ELayout(parent); _container.PackEnd(_datetimeLayout); _container.PackEnd(_surfaceLayout); _datetimeLayout.SetTheme("layout", "circle", "datetime"); _surface = new CircleSurface(_surfaceLayout); _picker = new WatchDateTimePicker(parent, _surface); _picker.Show(); _datetimeLayout.SetContent(_picker); _doneButton = new Button(parent) { Text = "Set", Style = "bottom", }; _datetimeLayout.SetPartContent("elm.swallow.btn", _doneButton); _doneButton.Clicked += OnDoneClicked; ActivateRotaryInteraction(); _datetimeLayout.Show(); _surfaceLayout.Show(); _container.Show(); SetContent(_container); ShowAnimationFinished += OnShowAnimationFinished; BackButtonPressed += OnBackButtonPressed; }
void UpdateActionButton(bool initialize) { if (Element.ActionButton != null) { if (_actionButton == null) { _actionButton = new ElmSharp.Button(_box) { Style = "bottom" }; _actionButton.Clicked += OnActionButtonClicked; _box.PackEnd(_actionButton); } SetVisibleActionButton(Element.ActionButton.IsVisible); Element.ActionButton.PropertyChanged += OnActionButtonItemChanged; _actionButton.Text = Element.ActionButton.Text; _actionButton.IsEnabled = Element.ActionButton.IsEnable; if (!Element.ActionButton.IconImageSource.IsNullOrEmpty()) { var imageSource = Element.ActionButton.IconImageSource as FileImageSource; var path = ResourcePath.GetPath(imageSource); var buttonImage = new ElmSharp.Image(_actionButton); buttonImage.LoadAsync(path); buttonImage.Show(); _actionButton.SetPartContent("elm.swallow.content", buttonImage); } if (Element.ActionButton.BackgroundColor != Xamarin.Forms.Color.Default) { _actionButton.BackgroundColor = Element.ActionButton.BackgroundColor.ToNative(); } } else { if (_actionButton != null) { _actionButton.Clicked -= OnActionButtonClicked; _box.UnPack(_actionButton); _actionButton.Unrealize(); _actionButton = null; } } }
EButton CreateNavigationButton(string text) { EButton button = new EButton(Forms.NativeParent) { Text = text }; button.SetNavigationBackStyle(); button.Clicked += (sender, e) => { if (!Element.SendBackButtonPressed()) { Forms.Context.Exit(); } }; _naviItemContentPartList.Add(button); button.Deleted += NaviItemPartContentDeletedHandler; return(button); }
static void AlertSignalNameHandler(Page sender, AlertArguments arguments) { Native.Dialog alert = new Native.Dialog(Forms.Context.MainWindow); alert.Title = arguments.Title; var message = arguments.Message.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(Environment.NewLine, "<br>"); alert.Text = message; EButton cancel = new EButton(alert) { Text = arguments.Cancel }; alert.NegativeButton = cancel; cancel.Clicked += (s, evt) => { arguments.SetResult(false); alert.Dismiss(); }; if (arguments.Accept != null) { EButton ok = new EButton(alert) { Text = arguments.Accept }; alert.NeutralButton = ok; ok.Clicked += (s, evt) => { arguments.SetResult(true); alert.Dismiss(); }; } alert.BackButtonPressed += (s, evt) => { arguments.SetResult(false); alert.Dismiss(); }; alert.Show(); }
void SetVisibleActionButton(bool visible) { if (_actionButton == null) { _actionButton = new ElmSharp.Button(_box) { Style = "bottom" }; _actionButton.Clicked += OnActionButtonClicked; _box.PackEnd(_actionButton); } if (visible) { _actionButton.Show(); } else { _actionButton.Hide(); } }
EButton CreateNavigationButton(string text) { EButton button = new EButton(System.Maui.Maui.NativeParent); button.Clicked += (sender, e) => { if (!Element.SendBackButtonPressed()) { System.Maui.Maui.Context.Exit(); } }; button.Style = StyleBackButton; button.Text = text; _naviItemContentPartList.Add(button); button.Deleted += NaviItemPartContentDeletedHandler; return(button); }
void UpdateActionButton(bool initialize) { if (Element.ActionButton != null) { if (_actionButton == null) { _actionButton = new ElmSharp.Button(_box) { Style = "bottom" }; _actionButton.Clicked += OnActionButtonClicked; _box.PackEnd(_actionButton); } SetVisibleActionButton(Element.ActionButton.IsVisible); Element.ActionButton.PropertyChanged += OnActionButtonItemChanged; _actionButton.Text = Element.ActionButton.Text; _actionButton.IsEnabled = Element.ActionButton.IsEnable; if (Element.ActionButton.Icon != null) { var path = ResourcePath.GetPath(Element.ActionButton.Icon); var buttonImage = new ElmSharp.Image(_actionButton); buttonImage.LoadAsync(path); buttonImage.Show(); _actionButton.SetPartContent("elm.swallow.content", buttonImage); } } else { if (_actionButton != null) { _actionButton.Clicked -= OnActionButtonClicked; _box.UnPack(_actionButton); _actionButton.Unrealize(); _actionButton = null; } } }
/// <summary> /// Puts the button in one of the three available slots. /// </summary> /// <param name="position">The slot to be occupied by the button expressed as a <see cref="ButtonPosition"/></param> /// <param name="button">The new button.</param> protected virtual void ApplyButton(ButtonPosition position, EButton button) { if (button != null) { button.SetPopupStyle(); } switch (position) { case ButtonPosition.Positive: this.SetButton3Part(button, true); break; case ButtonPosition.Neutral: this.SetButton2Part(button, true); break; default: this.SetButton1Part(button, true); break; } }
public EvasObject CreateMainPage(Window parent) { Box box = new Box(parent); box.Show(); _showEmbedded = new EButton(parent) { Text = "Show Embedded Page", WeightX = 1, AlignmentX = -1, }; _showEmbedded.Show(); _showEmbedded.Clicked += (sender, e) => ShowHello(); _showAlertsActionSheets = new EButton(parent) { Text = "Show Alerts and ActionSheets Page", WeightX = 1, AlignmentX = -1, }; _showAlertsActionSheets.Show(); _showAlertsActionSheets.Clicked += (sender, e) => ShowAlertsAndActionSheets(); _showWebView = new EButton(parent) { Text = "Show WebView Page", WeightX = 1, AlignmentX = -1, }; _showWebView.Show(); _showWebView.Clicked += (sender, e) => ShowWebView(); box.PackEnd(_showEmbedded); box.PackEnd(_showAlertsActionSheets); box.PackEnd(_showWebView); return(box); }
protected override void OnElementChanged(ElementChangedEventArgs <ImageButton> e) { if (Control == null) { SetNativeControl(new Box(Forms.NativeParent)); Control.SetLayoutCallback(OnLayout); _round = new Native.RoundRectangle(Forms.NativeParent); _round.Show(); _border = new Native.BorderRectangle(Forms.NativeParent); _border.Show(); _image = new Native.Image(Forms.NativeParent); _image.Show(); _button = new EButton(Forms.NativeParent).SetTransparentStyle(); _button.Clicked += OnClicked; _button.Pressed += OnPressed; _button.Released += OnReleased; _button.Show(); Control.PackEnd(_round); Control.PackEnd(_image); Control.PackEnd(_border); Control.PackEnd(_button); } base.OnElementChanged(e); }
public ShellNavBar() : base(Forms.NativeParent) { SetLayoutCallback(OnLayout); _menuButton = new EButton(Forms.NativeParent); _menuButton.Clicked += OnMenuClicked; _menuIcon = new EImage(Forms.NativeParent); UpdateMenuIcon(); _title = new Native.Label(Forms.NativeParent) { FontSize = this.GetDefaultTitleFontSize(), VerticalTextAlignment = Native.TextAlignment.Center, TextColor = _titleColor, FontAttributes = FontAttributes.Bold, }; _title.Show(); BackgroundColor = _backgroudColor; _menuButton.BackgroundColor = _backgroudColor; PackEnd(_menuButton); PackEnd(_title); }
void ActionSheetSignalNameHandler(Page sender, ActionSheetArguments arguments) { // Verify that the page making the request is child of this platform if (!PageIsChildOfPlatform(sender)) { return; } Native.Dialog alert = Native.Dialog.CreateDialog(Forms.NativeParent); alert.Title = arguments.Title; Box box = new Box(alert); if (null != arguments.Destruction) { Native.Button destruction = new Native.Button(alert) { Text = arguments.Destruction, Style = ButtonStyle.Text, TextColor = EColor.Red, AlignmentX = -1 }; destruction.Clicked += (s, evt) => { arguments.SetResult(arguments.Destruction); alert.Dismiss(); }; destruction.Show(); box.PackEnd(destruction); } foreach (string buttonName in arguments.Buttons) { Native.Button button = new Native.Button(alert) { Text = buttonName, Style = ButtonStyle.Text, AlignmentX = -1 }; button.Clicked += (s, evt) => { arguments.SetResult(buttonName); alert.Dismiss(); }; button.Show(); box.PackEnd(button); } box.Show(); alert.Content = box; if (null != arguments.Cancel) { EButton cancel = new EButton(Forms.NativeParent) { Text = arguments.Cancel }; alert.NegativeButton = cancel; cancel.Clicked += (s, evt) => { alert.Dismiss(); }; } alert.BackButtonPressed += (s, evt) => { alert.Dismiss(); }; alert.Show(); _alerts.Add(alert); alert.Dismissed += (s, e) => _alerts.Remove(alert); }
public static EButton SetEditFieldClearStyle(this EButton button) { button.Style = ThemeConstants.Button.Styles.EditFieldClear; return(button); }
public static bool SetIconPart(this EButton button, EvasObject content, bool preserveOldContent = false) { return(button.SetPartContent(ThemeConstants.Button.Parts.Icon, content, preserveOldContent)); }
public static EButton SetTransparentStyle(this EButton button) { button.Style = ThemeConstants.Button.Styles.Transparent; return(button); }
public static EButton SetNavigationDrawerStyle(this EButton button) { button.Style = ThemeConstants.Button.Styles.NavigationDrawers; return(button); }
public static EButton SetNavigationTitleLeftStyle(this EButton button) { button.Style = ThemeConstants.Button.Styles.NavigationTitleLeft; return(button); }
public static EButton SetPopupStyle(this EButton button) { button.Style = ThemeConstants.Button.Styles.Popup; return(button); }
public static EButton SetBottomStyle(this EButton button) { button.Style = ThemeConstants.Button.Styles.Bottom; return(button); }