예제 #1
0
        ELayout CreateEditFieldLayout(EvasObject parent)
        {
            var layout = new ELayout(parent);

            layout.SetTheme("layout", "editfield", "singleline");
            layout.AllowFocus(true);
            layout.Unfocused += (s, e) =>
            {
                SetFocusOnTextBlock(false);
            };
            layout.Focused += (s, e) =>
            {
                AllowFocus(false);
            };

            layout.KeyDown += (s, e) =>
            {
                if (e.KeyName == "Return")
                {
                    if (!_isTexstBlockFocused)
                    {
                        SetFocusOnTextBlock(true);
                        e.Flags |= EvasEventFlag.OnHold;
                    }
                }
            };
            Clicked += (s, e) => SetFocusOnTextBlock(true);

            return(layout);
        }
 public EditfieldEntry(EvasObject parent, string style) : base(parent)
 {
     if (!string.IsNullOrEmpty(style))
     {
         _editfieldLayout.SetTheme("layout", "editfield", style);
     }
 }
예제 #3
0
        protected override IntPtr CreateHandle(EvasObject parent)
        {
            var bg = new ELayout(parent);

            bg.SetTheme("layout", "background", "default");
            _editfieldLayout = new ELayout(parent);
            _editfieldLayout.SetTheme("layout", "editfield", "singleline");

            var handle = base.CreateHandle(parent);

            // If true, It means, there is no extra layout on the widget handle
            // We need to set RealHandle, becuase we replace Handle to Layout
            if (RealHandle == IntPtr.Zero)
            {
                RealHandle = handle;
            }
            Handle = handle;

            _editfieldLayout.SetPartContent("elm.swallow.content", this);
            bg.SetPartContent("elm.swallow.content", _editfieldLayout);

            // The minimun size for the Content area of an Editfield. This is used to calculate the size when layouting.
            _heightPadding = _editfieldLayout.EdjeObject["elm.swallow.content"].Geometry.Height;
            return(bg);
        }
        protected override IntPtr CreateHandle(EvasObject parent)
        {
            var handle = base.CreateHandle(parent);

            AllowFocus(false);
            _editfieldLayout = CreateEditFieldLayout(parent);

            // If true, It means, there is no extra layout on the widget handle
            // We need to set RealHandle, becuase we replace Handle to Layout
            if (RealHandle == IntPtr.Zero)
            {
                RealHandle = handle;
            }
            Handle = handle;

            if (!_editfieldLayout.SetPartContent("elm.swallow.content", this))
            {
                // Restore theme to default if editfield style is not available
                _editfieldLayout.SetTheme("layout", "application", "default");
                _editfieldLayout.SetPartContent("elm.swallow.content", this);
            }

            _heightPadding = _editfieldLayout.EdjeObject["elm.swallow.content"].Geometry.Height;
            return(_editfieldLayout);
        }
예제 #5
0
        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(OnLayout);
            _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();
                    }
                }
            };
        }
예제 #7
0
        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);
        }
예제 #8
0
        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;
        }
예제 #9
0
        protected virtual ELayout CreateEditFieldLayout(EvasObject parent)
        {
            var layout = new ELayout(parent);

            layout.SetTheme("layout", "editfield", "singleline");
            layout.AllowFocus(true);
            layout.Unfocused += (s, e) =>
            {
                SetFocusOnTextBlock(false);
                layout.SignalEmit("elm,state,unfocused", "");
                LayoutUnfocused?.Invoke(this, EventArgs.Empty);
            };
            layout.Focused += (s, e) =>
            {
                AllowFocus(false);
                layout.SignalEmit("elm,state,focused", "");
                LayoutFocused?.Invoke(this, EventArgs.Empty);
            };

            layout.KeyDown += (s, e) =>
            {
                if (e.KeyName == "Return")
                {
                    if (!_isTexstBlockFocused)
                    {
                        SetFocusOnTextBlock(true);
                        e.Flags |= EvasEventFlag.OnHold;
                    }
                }
            };
            Clicked += (s, e) => SetFocusOnTextBlock(true);

            Focused += (s, e) =>
            {
                layout.RaiseTop();
                layout.SignalEmit("elm,state,focused", "");
            };

            Unfocused += (s, e) =>
            {
                layout.SignalEmit("elm,state,unfocused", "");
            };

            return(layout);
        }
예제 #10
0
        public ProgressbarPopupRenderer()
        {
            _popUp = new Popup(Forms.NativeParent)
            {
                Style       = "circle",
                Orientation = PopupOrientation.Center,
            };
            _popUp.BackButtonPressed     += BackButtonPressedHandler;
            _popUp.TimedOut              += ProgressbarPopup_TimedOutHandler;
            _popUp.Dismissed             += _popUp_Dismissed;
            _popUp.ShowAnimationFinished += _popUp_ShowAnimationFinished;

            _layout = new ElmSharp.Layout(_popUp);
            _layout.SetTheme("layout", "popup", "content/circle");
            _popUp.SetContent(_layout);

            _progressbar = new ElmSharp.ProgressBar(Forms.NativeParent)
            {
                Color = ElmSharp.Color.FromRgb(77, 207, 255),
                //BackgroundColor = Color.FromRgb(100, 255, 0),
                //SpanSize = 50,
                Style       = "process",
                IsPulseMode = true,
            };
            _progressbar.Deleted += _progressbar_Deleted;
            _popUp.SetPartContent("elm.swallow.progress", _progressbar);

            ///////////////
            _popUp2 = new Popup(Forms.NativeParent)
            {
                Style       = "toast/circle/check",
                Orientation = PopupOrientation.Bottom,
                //Timeout = Duration,
            };
            //_popUp2.SetPartText("elm.text", Text);
            _popUp2.TimedOut  += TimedOutHandler;
            _popUp2.Dismissed += _popUp2_Dismissed;
        }
        /// <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);
        }