diff options
author | Yeongjong Lee <yj34.lee@samsung.com> | 2019-06-19 15:59:54 +0900 |
---|---|---|
committer | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2019-06-19 15:59:54 +0900 |
commit | e712261e14c1b823c1766be56ac2d78baad6cdfc (patch) | |
tree | b27f269f014c4a88aa72547dd4c2e46dc88b8abb | |
parent | 0a4beb291d83c392a4b8e0928ae901a5d7826a31 (diff) | |
download | efl-e712261e14c1b823c1766be56ac2d78baad6cdfc.tar.gz |
efl_mono: support multilevel inheritance of NativeClass
Summary:
When it creates multilevel class of NativeClass, internal c function is not
called because eo vtables aren't created
Test Plan:
Check "MyBox2 UpdateLayout" printed.
```
//mcs test_box.cs -out:test_box.exe `pkg-config --libs efl-mono`
//mono test_box.exe
using System;
public class MyBox2 : MyBox
{
public MyBox2(Efl.Object parent, string style = null) : base(parent, style)
{
}
public override void UpdateLayout()
{
Eina.Log.Error("MyBox2 UpdateLayout");
base.UpdateLayout();
}
}
public class MyBox : Efl.Ui.Box
{
public MyBox(Efl.Object parent, string style = null) : base(parent, style)
{
}
public override void UpdateLayout()
{
Eina.Log.Error("MyBox UpdateLayout");
base.UpdateLayout();
}
}
public class Example : Efl.Csharp.Application
{
protected override void OnInitialize(Eina.Array<System.String> args)
{
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
var box = new MyBox(win);
box.SetHintSizeMin(new Eina.Size2D(360, 240));
win.SetContent(box);
var box2 = new MyBox2(win);
box2.SetHintSizeMin(new Eina.Size2D(360, 240));
box2.Pack(box);
var button = new Efl.Ui.Button(box);
button.SetText("Click");
button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) =>
{
box.CalculateGroup();
box2.CalculateGroup();
};
box.Pack(button);
}
public static void Main()
{
var example = new Example();
example.Launch();
}
}
```
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, lauromoura, woohyun, Jaehyun_Cho
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9079
-rw-r--r-- | src/bindings/mono/eo_mono/iwrapper.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index 9e73ca4687..5fe1daae91 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -334,7 +334,16 @@ public class Globals public static byte class_initializer_call(IntPtr klass, System.Type type) { Eina.Log.Debug($"called with 0x{klass.ToInt64():x} {type}"); - Efl.Eo.NativeClass nativeClass = GetNativeClass(type.BaseType); + var derived = type.BaseType; + Efl.Eo.NativeClass nativeClass = GetNativeClass(derived); + + while (nativeClass == null) + { + derived = derived.BaseType; + if (derived == null) + break; + nativeClass = GetNativeClass(derived); + } if (nativeClass != null) { |