-%define DEV_VERSION beta-023
+%define DEV_VERSION beta-024
Name: elm-sharp
Summary: C# Binding for Elementary
<Compile Include="ElmSharp\IAccessibleObject.cs" />
<Compile Include="ElmSharp\ItemObjectExtension.cs" />
<Compile Include="ElmSharp\ReadingInfoType.cs" />
+ <Compile Include="Interop\Interop.Eext.Event.cs" />
<Compile Include="Interop\Interop.Elementary.Accessibility.cs" />
<Compile Include="ElmSharp\Background.cs" />
<Compile Include="ElmSharp\Box.cs" />
public abstract class EvasObject
{
private IntPtr _realHandle = IntPtr.Zero;
+ private event EventHandler _backButtonPressed;
+ private event EventHandler _moreButtonPressed;
+ private Interop.Eext.EextEventCallback _backButtonHandler;
+ private Interop.Eext.EextEventCallback _moreButtonHandler;
+
internal IntPtr Handle { get; set; }
internal EvasObject Parent { get; set; }
internal IntPtr RealHandle
/// </summary>
protected EvasObject()
{
+ _backButtonHandler = new Interop.Eext.EextEventCallback((d, o, i) => { _backButtonPressed?.Invoke(this, EventArgs.Empty); });
+ _moreButtonHandler = new Interop.Eext.EextEventCallback((d, o, i) => { _moreButtonPressed?.Invoke(this, EventArgs.Empty); });
+
OnInstantiated();
}
/// KeyDown will be triggered when key is preesd down
/// </summary>
public event EventHandler<EvasKeyEventArgs> KeyDown;
+
+ /// <summary>
+ /// BackButtonPressed will be triggered when Back button is pressed
+ /// </summary>
+ public event EventHandler BackButtonPressed
+ {
+ add
+ {
+ if (_backButtonPressed == null)
+ {
+ Interop.Eext.eext_object_event_callback_add(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_BACK, _backButtonHandler, IntPtr.Zero);
+ }
+ _backButtonPressed += value;
+ }
+ remove
+ {
+ _backButtonPressed -= value;
+ if (_backButtonPressed == null)
+ {
+ Interop.Eext.eext_object_event_callback_del(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_BACK, _backButtonHandler);
+ }
+ }
+ }
+
+ /// <summary>
+ /// MoreButtonPressed will be triggered when More button is pressed
+ /// </summary>
+ public event EventHandler MoreButtonPressed
+ {
+ add
+ {
+ if (_moreButtonPressed == null)
+ {
+ Interop.Eext.eext_object_event_callback_add(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_MORE, _moreButtonHandler, IntPtr.Zero);
+ }
+ _moreButtonPressed += value;
+ }
+ remove
+ {
+ _moreButtonPressed -= value;
+ if (_moreButtonPressed == null)
+ {
+ Interop.Eext.eext_object_event_callback_del(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_MORE, _moreButtonHandler);
+ }
+ }
+ }
+
+
/// <summary>
/// Moved will be triggered when widght is moved
/// </summary>
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal static partial class Eext
+ {
+ public enum EextCallbackType
+ {
+ EEXT_CALLBACK_BACK, // H/W Back Key Event
+ EEXT_CALLBACK_MORE, // H/W More Key Event
+ }
+ internal delegate void EextEventCallback(IntPtr data, IntPtr obj, IntPtr info);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern void eext_object_event_callback_add(IntPtr obj, EextCallbackType type, EextEventCallback callback, IntPtr data);
+
+
+ [DllImport(Libraries.Eext)]
+ internal static extern void eext_object_event_callback_del(IntPtr obj, EextCallbackType type, EextEventCallback callback);
+ }
+}
popup.TimedOut += (s, e) =>
{
Console.WriteLine("Popup time out");
- popup.Show();
};
popup.Append("Label1");
popup.Append("Label2");
popup.Append("Label3");
+ popup.BackButtonPressed += (s, e) =>
+ {
+ Console.WriteLine("!!! BackButtonPressed Event on Popup!!");
+ popup.Hide();
+ };
+
btn.Clicked += (s, e) =>
{
popup.Show();
window.Show();
if (isSecond)
{
- window.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, true);
- window.KeyUp += (s, e) =>
+ window.BackButtonPressed += (s, e) =>
{
- if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
- {
- window.Hide();
- window.Unrealize();
- GC.Collect();
- GC.WaitForPendingFinalizers();
- }
+ window.Hide();
+ window.Unrealize();
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
};
}
else
{
- window.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, false);
- window.KeyUp += (s, e) =>
+ window.BackButtonPressed += (s, e) =>
{
- if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
- {
- UIExit();
- }
+ UIExit();
};
}
return window;
WeightY = 1,
};
box.Show();
- conformant.SetContent(box);
+ var bg = new Background(_firstPageWindow);
+ bg.Color = Color.White;
+ bg.SetContent(box);
+ conformant.SetContent(bg);
GenList list = new GenList(_firstPageWindow)
{