summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/struct_definition.hh
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-04-05 19:53:37 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-05 19:56:42 -0300
commit1e22db1150049e313bcba7906fc5ffc9a745eaf0 (patch)
tree3dd72d0486e2e03d90e10e5f96554176326aa783 /src/bin/eolian_mono/eolian/mono/struct_definition.hh
parent4edf8036e05c8e70f54abf6513e0df165a725a18 (diff)
csharp: Make classes abstract and rework casting
Summary: Abstract Eo classes are now proper C# abstract classes. As a side effect, returning Eo instances from native code was reworked to return instances of their actual Eo classes instead of previous behavior of returning a generic Efl.Object and using static_cast. Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());` Use `var window = widget.GetParent() as Efl.Ui.Win;` Another side effect was that `efl_constructor` was removed from the list of supported `Efl.Object` overrides. It is invoked inside `efl_add_internal_start`, before the bindings makes the association of the newly created EoId with the C# instance that created it, making the managed delegate meaningless. C# users then can use regular C# constructors to initialize fields. Also changed to set the private data of C#-inherited classes before the call to constructing methods (aka constructor parameters) so C# classes can override them correctly. Fixes T7778 Fixes T7757 Reviewers: vitor.sousa, felipealmeida, segfaultxavi Reviewed By: vitor.sousa, segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7778, T7757, T7702 Differential Revision: https://phab.enlightenment.org/D8550
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/struct_definition.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index 35f772554f..c059dd9cbe 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -159,10 +159,8 @@ struct to_external_field_convert_generator
159 if (!as_generator( 159 if (!as_generator(
160 "\n" 160 "\n"
161 << indent << scope_tab << scope_tab << "_external_struct." << string 161 << indent << scope_tab << scope_tab << "_external_struct." << string
162 << " = (" << concrete_name << ") System.Activator.CreateInstance(typeof(" 162 << " = (" << concrete_name << ") Efl.Eo.Globals.CreateWrapperFor(_internal_struct." << string << ");\n"
163 << concrete_name << "), new System.Object[] {_internal_struct." << string << "});\n" 163 ).generate(sink, std::make_tuple(field_name, field_name), context))
164 << indent << scope_tab << scope_tab << "Efl.Eo.Globals.efl_ref(_internal_struct." << string << ");\n")
165 .generate(sink, std::make_tuple(field_name, field_name, field_name), context))
166 return false; 164 return false;
167 } 165 }
168 else if (field.type.c_type == "Eina_Binbuf *" || field.type.c_type == "const Eina_Binbuf *") 166 else if (field.type.c_type == "Eina_Binbuf *" || field.type.c_type == "const Eina_Binbuf *")