2 * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using Tizen.Wearable.CircularUI.Forms;
19 using Tizen.Wearable.CircularUI.Forms.Renderer;
21 using Xamarin.Forms.Platform.Tizen;
22 using Xamarin.Forms.Platform.Tizen.Native;
23 using XForms = Xamarin.Forms.Forms;
24 using XFLayout = Xamarin.Forms.Layout;
25 using EButton = ElmSharp.Button;
26 using EColor = ElmSharp.Color;
27 using System.ComponentModel;
29 [assembly: ExportRenderer(typeof(ContentButton), typeof(ContentButtonRenderer))]
31 namespace Tizen.Wearable.CircularUI.Forms.Renderer
33 public class ContentButtonRenderer : LayoutRenderer
37 ContentButton Button => Element as ContentButton;
39 protected override void OnElementChanged(ElementChangedEventArgs<XFLayout> e)
41 base.OnElementChanged(e);
49 _button = new EButton(XForms.NativeParent);
50 _button.BackgroundColor = EColor.Transparent;
51 _button.SetPartColor("effect", EColor.Transparent);
52 _button.SetPartColor("effect_pressed", EColor.Transparent);
55 _button.Pressed += OnPressed;
56 _button.Released += OnReleased;
57 _button.Clicked += OnClicked;
59 Control.PackEnd(_button);
63 protected override void UpdateLayout()
67 _button.Geometry = Control.Geometry;
71 void OnPressed(object sender, EventArgs args)
73 Button?.SendPressed();
76 void OnReleased(object sender, EventArgs args)
78 Button?.SendReleased();
81 void OnClicked(object sender, EventArgs args)
83 Button?.SendClicked();