summaryrefslogtreecommitdiff
path: root/pages/develop/tutorials
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2018-05-25 10:25:00 -0700
committerapache <apache@e5-web1.enlightenment.org>2018-05-25 10:25:00 -0700
commite3b76d53c36c5ddb38bf03bb6ccac5e5d941098c (patch)
tree8ac6eb4a6d8a84ce5cfc8f674e341a6ebdd74ecd /pages/develop/tutorials
parent3d6083076c3655f179533c41cc95a04036a59300 (diff)
Wiki page eo-classes.md changed with summary [Updated to efl_new] by Xavi Artigas
Diffstat (limited to 'pages/develop/tutorials')
-rw-r--r--pages/develop/tutorials/c/eo-classes.md.txt20
1 files changed, 10 insertions, 10 deletions
diff --git a/pages/develop/tutorials/c/eo-classes.md.txt b/pages/develop/tutorials/c/eo-classes.md.txt
index 56b334555..4918c6439 100644
--- a/pages/develop/tutorials/c/eo-classes.md.txt
+++ b/pages/develop/tutorials/c/eo-classes.md.txt
@@ -4,7 +4,7 @@
4 4
5# Creating New Classes with Eolian # 5# Creating New Classes with Eolian #
6 6
7The [Introduction to Eo](eo-intro.md) tutorial showed you how to instantiate Eo objects of a given class using ``efl_add()``. This tutorial demonstrates how to create new classes so new kinds of objects can be instantiated. 7The [Introduction to Eo](eo-intro.md) tutorial showed you how to instantiate Eo objects of a given class using ``efl_new()``. This tutorial demonstrates how to create new classes so new kinds of objects can be instantiated.
8 8
9You'll learn how to describe classes using the Eolian language and then further customize them with class-specific code. You will also master the basics of class inheritance with Eolian. 9You'll learn how to describe classes using the Eolian language and then further customize them with class-specific code. You will also master the basics of class inheritance with Eolian.
10 10
@@ -29,11 +29,11 @@ eolian_gen -gchi my_new_class.eo
29 29
30This generates three files: 30This generates three files:
31 31
32* ``my_new_class.eo.h``: **Header file** including all the method signatures related to your class. In particular, it contains the class symbol you need to pass to ``efl_add()``, so always include this file if you want to use your class. 32* ``my_new_class.eo.h``: **Header file** including all the method signatures related to your class. In particular, it contains the class symbol you need to pass to ``efl_new()``, so this is the header file you need to include if you want to use your class.
33* ``my_new_class.eo.c``: Boilerplate code you don't usually need to worry about. It is automatically included from the implementation file (next one). 33* ``my_new_class.eo.c``: Boilerplate code you don't usually need to worry about. It is automatically included from the implementation file (next one).
34* ``my_new_class.c``: The **implementation file**. It initially contains the empty bodies for all the methods you need to implement in your class. This is the only file you need to modify and include in your builds, as you will see in this tutorial. 34* ``my_new_class.c``: The **implementation file**. It initially contains the empty bodies for all the methods you need to implement in your class. This is the only file you need to modify and include in your builds, as you will see in this tutorial.
35 35
36The ``-gchi`` parameter tells ``eolian_gen`` to generate the Source file, the Header file and the Implementation file. 36The ``-gchi`` parameter tells ``eolian_gen`` to generate the Header file, the Boilerplate file and the Implementation file.
37 37
38In summary, for each new class you create you must: 38In summary, for each new class you create you must:
39 39
@@ -49,9 +49,9 @@ The rest of the tutorial shows a practical example which will illustrate this pr
49 49
50## Step One: Creating a Simple Class Description ## 50## Step One: Creating a Simple Class Description ##
51 51
52You will now create an Eolian file for a class named ``Example.Rectangle``. The file **must** be called ``examples_rectangle.eo``. 52You will now create an Eolian file for a class named ``Example.Rectangle``. The file **must** be called ``example_rectangle.eo``.
53 53
54This class will represent a rectangle shape, so it will have two properties, the ``width`` and ``height`` of the rectangle, which can be read and written. 54This class will represent a rectangle shape, so it will have two properties, the ``width`` and ``height`` of the rectangle, which can be both read and written.
55 55
56Start with the class name and the list of its parent classes in parentheses: 56Start with the class name and the list of its parent classes in parentheses:
57 57
@@ -171,7 +171,7 @@ These are the setters and getters for your properties and method. Examine one of
171 171
172```c 172```c
173EOLIAN static int 173EOLIAN static int
174_example_rectangle_width_get(Eo *obj, Example_Rectangle_Data *pd) 174_example_rectangle_width_get(const Eo *obj, Example_Rectangle_Data *pd)
175``` 175```
176 176
177This getter receives the ``Eo *`` object whose property is being retrieved and an ``Example_Rectangle_Data *`` pointer to its private data. It returns an integer, as that's what you specified as the value for this property in the Eolian file. 177This getter receives the ``Eo *`` object whose property is being retrieved and an ``Example_Rectangle_Data *`` pointer to its private data. It returns an integer, as that's what you specified as the value for this property in the Eolian file.
@@ -195,7 +195,7 @@ _example_rectangle_width_set(Eo *obj EINA_UNUSED, Example_Rectangle_Data *pd, in
195} 195}
196 196
197EOLIAN static int 197EOLIAN static int
198_example_rectangle_width_get(Eo *obj EINA_UNUSED, Example_Rectangle_Data *pd) 198_example_rectangle_width_get(const Eo *obj EINA_UNUSED, Example_Rectangle_Data *pd)
199{ 199{
200 return pd->width; 200 return pd->width;
201} 201}
@@ -207,7 +207,7 @@ _example_rectangle_height_set(Eo *obj EINA_UNUSED, Example_Rectangle_Data *pd, i
207} 207}
208 208
209EOLIAN static int 209EOLIAN static int
210_example_rectangle_height_get(Eo *obj EINA_UNUSED, Example_Rectangle_Data *pd) 210_example_rectangle_height_get(const Eo *obj EINA_UNUSED, Example_Rectangle_Data *pd)
211{ 211{
212 return pd->height; 212 return pd->height;
213} 213}
@@ -276,7 +276,7 @@ Finally, instantiate a new object of your shiny new class from within ``_rect_cr
276```c 276```c
277 Example_Rectangle *rectangle; 277 Example_Rectangle *rectangle;
278 278
279 rectangle = efl_add(EXAMPLE_RECTANGLE_CLASS, NULL, 279 rectangle = efl_new(EXAMPLE_RECTANGLE_CLASS,
280 efl_name_set(efl_added, "Rectangle"), 280 efl_name_set(efl_added, "Rectangle"),
281 example_rectangle_width_set(efl_added, 5), 281 example_rectangle_width_set(efl_added, 5),
282 example_rectangle_height_set(efl_added, 10)); 282 example_rectangle_height_set(efl_added, 10));
@@ -316,7 +316,7 @@ _rect_create()
316{ 316{
317 Example_Rectangle *rectangle; 317 Example_Rectangle *rectangle;
318 318
319 rectangle = efl_add(EXAMPLE_RECTANGLE_CLASS, NULL, 319 rectangle = efl_new(EXAMPLE_RECTANGLE_CLASS,
320 efl_name_set(efl_added, "Rectangle"), 320 efl_name_set(efl_added, "Rectangle"),
321 example_rectangle_width_set(efl_added, 5), 321 example_rectangle_width_set(efl_added, 5),
322 example_rectangle_height_set(efl_added, 10)); 322 example_rectangle_height_set(efl_added, 10));