public TwoButtonPageWidget(EvasObject parent) : base(parent) { _frame = new ElmSharp.Layout(parent); _frame.SetTheme("popup", "base", "circle"); SetPartContent("overlay", _frame); _frame.Show(); _buttonLayer = new ElmSharp.Layout(_frame); _buttonLayer.SetTheme("popup", "buttons2", "popup/circle"); _frame.SetPartContent("elm.swallow.action_area", _buttonLayer); _buttonLayer.Show(); _outbox = new ObservableBox(parent); _outbox.SetAlignment(NamedHint.Fill, NamedHint.Fill); _outbox.SetWeight(NamedHint.Expand, NamedHint.Expand); _outbox.SetLayoutCallback(() => { }); _frame.SetPartContent("elm.swallow.content", _outbox); _outbox.Show(); _canvas = new Canvas(_outbox); EcoreMainloop.Post(() => _canvas.Geometry = _outbox.Geometry); _outbox.PackEnd(_canvas); _canvas.Show(); _buttons = new ElmSharp.Button[2]; _overlap = false; }
void InitializeWindow() { Debug.Assert(MainWindow != null, "Window cannot be null"); MainWindow.Active(); MainWindow.Show(); var conformant = new Conformant(MainWindow); conformant.Show(); // Create the base (default) layout for the application var layout = new ELayout(conformant); layout.SetTheme("layout", "application", "default"); layout.Show(); BaseLayout = layout; conformant.SetContent(BaseLayout); MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270; MainWindow.Deleted += (s, e) => { Exit(); }; MainWindow.RotationChanged += (sender, e) => { switch (MainWindow.Rotation) { case 0: Device.Info.CurrentOrientation = Internals.DeviceOrientation.PortraitUp; break; case 90: Device.Info.CurrentOrientation = Internals.DeviceOrientation.LandscapeLeft; break; case 180: Device.Info.CurrentOrientation = Internals.DeviceOrientation.PortraitDown; break; case 270: Device.Info.CurrentOrientation = Internals.DeviceOrientation.LandscapeRight; break; } }; MainWindow.BackButtonPressed += (sender, e) => { if (_platform != null) { if (!_platform.SendBackButtonPressed()) { Exit(); } } }; }
void InitializeComponent() { Control.LayoutUpdated += OnLayoutUpdated; _surfaceLayout = new ElmSharp.Layout(XForms.NativeParent); _circleSurface = new CircleSurface(_surfaceLayout); Control.Children.Add(_surfaceLayout); _surfaceLayout.Show(); _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>(); }
void InitializeWindow() { Debug.Assert(MainWindow != null, "Window cannot be null"); MainWindow.Active(); MainWindow.Show(); // in case of no use of preloaded window if (BaseLayout == null) { var conformant = new Conformant(MainWindow); conformant.Show(); var layout = new ELayout(conformant); layout.SetTheme("layout", "application", "default"); layout.Show(); BaseLayout = layout; if (Device.Idiom == TargetIdiom.Watch) { BaseCircleSurface = new CircleSurface(conformant); Forms.CircleSurface = BaseCircleSurface; } conformant.SetContent(BaseLayout); } MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270; MainWindow.Deleted += (s, e) => { Exit(); }; Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); MainWindow.RotationChanged += (sender, e) => { Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); }; MainWindow.BackButtonPressed += (sender, e) => { if (_platform != null) { if (!_platform.SendBackButtonPressed()) { Exit(); } } }; _platform = Platform.CreatePlatform(BaseLayout); BaseLayout.SetContent(_platform.GetRootNativeView()); _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView); }
void InitializeWindow() { Debug.Assert(MainWindow != null, "Window cannot be null"); MainWindow.Active(); MainWindow.Show(); if (MainWindow is PreloadedWindow precreated) { BaseLayout = precreated.BaseLayout; } else { var conformant = new Conformant(MainWindow); conformant.Show(); var layout = new ELayout(conformant); layout.SetTheme("layout", "application", "default"); layout.Show(); BaseLayout = layout; conformant.SetContent(BaseLayout); } MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270; MainWindow.Deleted += (s, e) => { Exit(); }; Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); MainWindow.RotationChanged += (sender, e) => { Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation(); }; MainWindow.BackButtonPressed += (sender, e) => { if (_platform != null) { if (!_platform.SendBackButtonPressed()) { Exit(); } } }; _platform = Platform.CreatePlatform(BaseLayout); BaseLayout.SetContent(_platform.GetRootNativeView()); _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView); }
protected void Initialize() { var conformant = new Conformant(this); conformant.Show(); var layout = new ELayout(conformant); layout.SetTheme("layout", "application", "default"); layout.Show(); BaseLayout = layout; conformant.SetContent(BaseLayout); }
/// <summary> /// Creates a dialog window for watch /// </summary> public WatchDialog(EvasObject parent, bool hasAcceptButton) : base(parent) { this.SetWatchCircleStyle(); _hasAcceptButton = hasAcceptButton; _popupLayout = new PopupLayout(this, hasAcceptButton ? PopupLayout.Styles.Buttons2 : PopupLayout.Styles.Circle) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1 }; _popupLayout.Show(); SetContent(_popupLayout); }
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; }
protected override void OnAttached() { var rect = Control.Geometry; _surfaceLayout = new ElmSharp.Layout(Container); _surfaceLayout.Show(); _surface = new ElmSharp.Wearable.CircleSurface(_surfaceLayout); _surfaceLayout.Geometry = rect; _surfaceLayout.StackAbove(Control); CircleSurfaceEffectBehavior.SetSurface(Element, _surface); _showEvent = new EvasObjectEvent(Control, EvasObjectCallbackType.Show); _hideEvent = new EvasObjectEvent(Control, EvasObjectCallbackType.Hide); _restackEvent = new EvasObjectEvent(Control, EvasObjectCallbackType.Restack); _moveEvent = new EvasObjectEvent(Control, EvasObjectCallbackType.Move); _resizeEvent = new EvasObjectEvent(Control, EvasObjectCallbackType.Resize); _showEvent.On += ControlShowed; _hideEvent.On += ControlHided; _restackEvent.On += ControlRestacked; _moveEvent.On += ControlChanged; _resizeEvent.On += ControlChanged; Element.PropertyChanging += ElementPropertyChanging; Element.PropertyChanged += ElementPropertyChanged; if (Element is Page) { (Element as Page).Appearing += (s, e) => { var obj = CircleSurfaceEffectBehavior.GetRotaryFocusObject(Element); ActivateRotaryFocusable(obj); }; } else { EcoreMainloop.Post(() => { var obj = CircleSurfaceEffectBehavior.GetRotaryFocusObject(Element); ActivateRotaryFocusable(obj); }); } }
private void Initialize() { _outterLayout = new ElmSharp.Layout(TForms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _outterLayout.Show(); _outterLayout.SetTheme("layout", "application", "default"); _index = new Index(_outterLayout) { IsHorizontal = true, AutoHide = false, }; _index.Show(); _outterLayout.SetPartContent("elm.swallow.content", _index); _scroller = new Scroller(_outterLayout); _scroller.PageScrolled += OnPageScrolled; // Disables the visibility of the scrollbar in both directions: _scroller.HorizontalScrollBarVisiblePolicy = ElmSharp.ScrollBarVisiblePolicy.Invisible; _scroller.VerticalScrollBarVisiblePolicy = ElmSharp.ScrollBarVisiblePolicy.Invisible; // Sets the limit of scroll to one page maximum: _scroller.HorizontalPageScrollLimit = 1; _scroller.SetPageSize(1.0, 1.0); _scroller.SetAlignment(-1, -1); _scroller.SetWeight(1.0, 1.0); _scroller.Show(); _innerContainer = new Box(_outterLayout); _innerContainer.SetLayoutCallback(OnInnerLayoutUpdate); _innerContainer.SetAlignment(-1, -1); _innerContainer.SetWeight(1.0, 1.0); _innerContainer.Show(); _scroller.SetContent(_innerContainer); _outterLayout.SetPartContent("elm.swallow.bg", _scroller); }
void CreatePopup() { var rect = Xamarin.Forms.Platform.Tizen.Forms.NativeParent.Geometry; var root = FindWindow(Xamarin.Forms.Platform.Tizen.Forms.NativeParent); _editorPopup = new ElmSharp.Background(root) { Geometry = rect }; var layout = new ElmSharp.Layout(_editorPopup); layout.SetTheme("layout", "entry", "default"); layout.Show(); _editorPopup.SetPartContent("overlay", layout); _editorPopup.Color = Control.BackgroundColor; _editor = new Xamarin.Forms.Platform.Tizen.Native.Entry(layout); _editor.IsSingleLine = true; _editor.Scrollable = true; _editor.SetInputPanelEnabled(false); _editor.AllowFocus(true); _editor.Show(); _editor.SetInputPanelReturnKeyType(ElmSharp.InputPanelReturnKeyType.Done); _editor.UpdateKeyboard(Element.Keyboard, Element.IsSpellCheckEnabled, Element.IsTextPredictionEnabled); _editorPopup.BackButtonPressed += (s, e) => HidePopup(); _editor.Activated += (s, e) => HidePopup(); IntPtr entryHandle = Interop.EFL.elm_entry_imf_context_get(_editor.RealHandle); _editorStateChanged = EditorStateChanged; Interop.EFL.ecore_imf_context_input_panel_event_callback_add(entryHandle, Interop.EFL.InputPanelEventType.State, _editorStateChanged, IntPtr.Zero); layout.SetPartContent("elm.swallow.content", _editor); }
/// <summary> /// Creates a dialog window for watch /// </summary> public WatchDialog(EvasObject parent, bool hasAcceptButton) : base(parent) { Style = "circle"; _popupLayout = new ELayout(this) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1 }; _hasAcceptButton = hasAcceptButton; var style = hasAcceptButton ? "content/circle/buttons2" : "content/circle"; _popupLayout.SetTheme("layout", "popup", style); _popupLayout.Show(); SetContent(_popupLayout); }
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); }
protected override void OnElementChanged(ElementChangedEventArgs <CircleSurfaceView> e) { if (Control == null) { var box = new Box(XForms.NativeParent); box.SetLayoutCallback(OnLayout); _surfaceLayout = new ELayout(box); _circleSurface = new CircleSurface(_surfaceLayout); _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>(); box.PackEnd(_surfaceLayout); _surfaceLayout.Show(); SetNativeControl(box); } if (e.NewElement != null) { e.NewElement.CircleSurface = _circleSurface; var items = e.NewElement.CircleSurfaceItems as ObservableCollection <ICircleSurfaceItem>; items.CollectionChanged += OnCircleSurfaceItemsChanged; foreach (var item in items) { AddCircleSurfaceItem(item); } } if (e.OldElement != null) { var items = e.OldElement.CircleSurfaceItems as ObservableCollection <ICircleSurfaceItem>; foreach (var item in items) { RemoveCircleSurfaceItem(item); } items.CollectionChanged -= OnCircleSurfaceItemsChanged; } base.OnElementChanged(e); }
protected override void OnElementChanged(ElementChangedEventArgs <CarouselPage> e) { if (NativeView == null) { _outterLayout = new Native.ApplicationLayout(Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _outterLayout.Show(); _index = new Index(Forms.NativeParent) { IsHorizontal = true, AutoHide = false, }; _index.Changed += OnIndexChanged; _index.Show(); _outterLayout.SetContentPart(_index); _scroller = new Scroller(Forms.NativeParent) { HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, HorizontalPageScrollLimit = 1, PageWidth = 1, PageHeight = 1, AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _scroller.PageScrolled += OnPageScrolled; _scroller.Show(); _innerContainer = new Box(Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _innerContainer.SetLayoutCallback(OnInnerLayoutUpdate); _innerContainer.Show(); _scroller.SetContent(_innerContainer); _outterLayout.SetBackgroundPart(_scroller); SetNativeView(_outterLayout); } if (e.OldElement != null) { e.OldElement.CurrentPageChanged -= OnCurrentPageChanged; e.OldElement.PagesChanged -= OnPagesChanged; _isInitalized = false; } if (e.NewElement != null) { Element.CurrentPageChanged += OnCurrentPageChanged; Element.PagesChanged += OnPagesChanged; } base.OnElementChanged(e); }
void ControlShowed(object sender, EventArgs e) { _surfaceLayout.Show(); }
/// <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); }
void InitializeComponent() { _outterBox.SetLayoutCallback(OnLayout); _surfaceLayout = new ELayout(this); _surfaceLayout.Show(); _surface = new CircleSurface(_surfaceLayout); _naviMenu = new CircleGenList(this, _surface) { Homogeneous = true, BackgroundColor = ElmSharp.Color.Gray }; _naviMenu.Show(); _draggedUpCallback = new SmartEvent(_naviMenu, "drag,start,up"); _draggedUpCallback.On += (s, e) => { if (_footer.TrackObject.IsVisible) { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.EdgeBottom)); } else { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.Up)); } }; _draggedDownCallback = new SmartEvent(_naviMenu, "drag,start,down"); _draggedDownCallback.On += (s, e) => { if (_header.TrackObject.IsVisible) { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.EdgeTop)); } else { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.Down)); } }; _outterBox.PackEnd(_naviMenu); _outterBox.PackEnd(_surfaceLayout); _surfaceLayout.StackAbove(_naviMenu); _defaultClass = new GenItemClass("1icon_1text") { GetTextHandler = (obj, part) => { if (part == "elm.text") { return((obj as Item).Text); } return(null); }, GetContentHandler = (obj, part) => { if (part == "elm.swallow.icon" && obj is Item menuItem && !string.IsNullOrEmpty(menuItem.Icon)) { var icon = new ElmSharp.Image(Xamarin.Forms.Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1.0, WeightY = 1.0, MinimumWidth = _dafaultIconSize, MinimumHeight = _dafaultIconSize, }; icon.Show(); icon.Load(menuItem.Icon); return(icon); } return(null); } }; _naviMenu.ItemSelected += OnItemSelected; } void OnItemSelected(object sender, GenListItemEventArgs e) { ItemSelected?.Invoke(this, new SelectedItemChangedEventArgs((e.Item.Data as Item).Source, -1)); } void OnLayout() { _surfaceLayout.Geometry = Geometry; _naviMenu.Geometry = Geometry; } bool IsUpdated(List <List <Element> > items) { if (_itemCache == null) { return(true); } if (_itemCache.Count != items.Count) { return(true); } for (int i = 0; i < items.Count; i++) { if (_itemCache[i].Count != items[i].Count) { return(true); } for (int j = 0; j < items[i].Count; j++) { if (_itemCache[i][j] != items[i][j]) { return(true); } } } return(false); } }