summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-16 09:05:24 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-21 07:50:44 +0200
commit185659669837011a092c0328fa8d05b0b808d828 (patch)
tree7f6c7f6e9a7deb560203afbdfff164a8b0e88580
parent8c1354aef9466a5afb79ecfb3719d8fd2ea96790 (diff)
introduce default item
default item is used as base class for all "normal style" efl items. A "normal style" efl item does have a text,content & extra part. - The text part is usally used to express some text in the item - Content part is the *main* content part where the user attention is on. - Extra can be used to display some elements that are not directly getting the attention of the user, it can be seen as something more than the decoration item field. ref T8115 Differential Revision: https://phab.enlightenment.org/D9629
-rw-r--r--src/lib/elementary/Efl_Ui.h1
-rw-r--r--src/lib/elementary/efl_ui_default_item.c43
-rw-r--r--src/lib/elementary/efl_ui_default_item.eo30
-rw-r--r--src/lib/elementary/efl_ui_grid_default_item.c44
-rw-r--r--src/lib/elementary/efl_ui_grid_default_item.eo30
-rw-r--r--src/lib/elementary/efl_ui_list_default_item.c42
-rw-r--r--src/lib/elementary/efl_ui_list_default_item.eo27
-rw-r--r--src/lib/elementary/meson.build2
8 files changed, 92 insertions, 127 deletions
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index 9683ee7..35747e2 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -182,6 +182,7 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
182# include <efl_ui_layout_part_text.eo.h> 182# include <efl_ui_layout_part_text.eo.h>
183# include <efl_ui_layout_part_table.eo.h> 183# include <efl_ui_layout_part_table.eo.h>
184# include <efl_ui_item.eo.h> 184# include <efl_ui_item.eo.h>
185# include <efl_ui_default_item.eo.h>
185# include <efl_ui_win_part.eo.h> 186# include <efl_ui_win_part.eo.h>
186# include <efl_ui_bg.eo.h> 187# include <efl_ui_bg.eo.h>
187# include <efl_ui_box.eo.h> 188# include <efl_ui_box.eo.h>
diff --git a/src/lib/elementary/efl_ui_default_item.c b/src/lib/elementary/efl_ui_default_item.c
new file mode 100644
index 0000000..4911a7a
--- /dev/null
+++ b/src/lib/elementary/efl_ui_default_item.c
@@ -0,0 +1,43 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_UI_LIST_DEFAULT_ITEM_PROTECTED
6#define EFL_PART_PROTECTED
7
8#include <Elementary.h>
9
10#include "elm_priv.h"
11#include "elm_part_helper.h"
12
13#define MY_CLASS EFL_UI_DEFAULT_ITEM_CLASS
14#define MY_CLASS_PFX efl_ui_default_item
15
16#define MY_CLASS_NAME "Efl.Ui.Default_Item"
17
18ELM_PART_TEXT_DEFAULT_GET(efl_ui_default_item, "efl.text")
19ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_default_item, void)
20ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_default_item, void)
21ELM_PART_CONTENT_DEFAULT_GET(efl_ui_default_item, "efl.icon")
22ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_default_item, void)
23
24EOLIAN static Efl_Object *
25_efl_ui_default_item_efl_part_part_get(const Eo *obj, void *pd EINA_UNUSED, const char *part)
26{
27 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
28 if (eina_streq(part, "text"))
29 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_TEXT_CLASS, obj, "efl.text");
30 else if (eina_streq(part, "icon"))
31 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_ICON_CLASS, obj, "efl.icon");
32 else if (eina_streq(part, "extra"))
33 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_EXTRA_CLASS, obj, "efl.extra");
34
35 return efl_part_get(efl_super(obj, MY_CLASS), part);
36}
37
38
39#define EFL_UI_DEFAULT_ITEM_EXTRA_OPS \
40 ELM_PART_TEXT_DEFAULT_OPS(efl_ui_default_item), \
41 ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_default_item)
42
43#include "efl_ui_default_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_default_item.eo b/src/lib/elementary/efl_ui_default_item.eo
new file mode 100644
index 0000000..9604f9b
--- /dev/null
+++ b/src/lib/elementary/efl_ui_default_item.eo
@@ -0,0 +1,30 @@
1abstract @beta Efl.Ui.Default_Item extends Efl.Ui.Item implements
2 Efl.Text,
3 Efl.Text_Markup,
4 Efl.Ui.L10n,
5 Efl.Content
6{
7 [[Default Item Class.
8
9 This class defines the standard parts of casual efl items.
10 The details about placement or item layout preferences are left to the extending classes.
11 Every text property related changes are mirrored to the text part. Content changes are mirrored to the content part.
12
13 ]]
14 data: null;
15 parts {
16 text: Efl.Ui.Item_Part_Text; [[The text part for default item.
17 text part is the caption of the item.]]
18 icon: Efl.Ui.Item_Part_Icon; [[The icon content part for default item.
19 icon part is the main content of item.]]
20 extra : Efl.Ui.Item_Part_Extra; [[The extra content part for default item.]]
21 }
22 implements {
23 Efl.Text.text { get; set; }
24 Efl.Text_Markup.markup { get; set; }
25 Efl.Ui.L10n.l10n_text { get; set; }
26 Efl.Content.content { get; set; }
27 Efl.Content.content_unset;
28 Efl.Part.part_get;
29 }
30}
diff --git a/src/lib/elementary/efl_ui_grid_default_item.c b/src/lib/elementary/efl_ui_grid_default_item.c
index 65d2c24..4d28cbc 100644
--- a/src/lib/elementary/efl_ui_grid_default_item.c
+++ b/src/lib/elementary/efl_ui_grid_default_item.c
@@ -16,50 +16,16 @@
16#define MY_CLASS_NAME "Efl.Ui.Grid_Default_Item" 16#define MY_CLASS_NAME "Efl.Ui.Grid_Default_Item"
17 17
18EOLIAN static Efl_Object * 18EOLIAN static Efl_Object *
19_efl_ui_grid_default_item_efl_object_finalize(Eo *obj, void *pd EINA_UNUSED) 19_efl_ui_grid_default_item_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
20{ 20{
21 Eo *eo; 21 Eo *eo;
22 eo = efl_finalize(efl_super(obj, MY_CLASS));
23 ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
24 Eina_Error theme_apply = efl_ui_layout_theme_set(obj, "grid_item", NULL, NULL);
25 22
26 if (theme_apply == EFL_UI_THEME_APPLY_ERROR_GENERIC) 23 eo = efl_constructor(efl_super(obj, MY_CLASS));
27 CRI("Default Item(%p) failed to set theme [efl/grid_item]!", eo);
28 return eo;
29}
30
31EOLIAN static void
32_efl_ui_grid_default_item_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED)
33{
34 efl_destructor(efl_super(obj, MY_CLASS));
35}
36
37/* Efl.Part */
38 24
39ELM_PART_TEXT_DEFAULT_GET(efl_ui_grid_default_item, "efl.text") 25 if (!elm_widget_theme_klass_get(obj))
40ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_grid_default_item, void) 26 elm_widget_theme_klass_set(obj, "grid_item");
41ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_grid_default_item, void)
42ELM_PART_CONTENT_DEFAULT_GET(efl_ui_grid_default_item, "efl.icon")
43ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_grid_default_item, void)
44 27
45EOLIAN static Efl_Object * 28 return eo;
46_efl_ui_grid_default_item_efl_part_part_get(const Eo *obj, void *wd EINA_UNUSED, const char *part)
47{
48 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
49 if (eina_streq(part, "text"))
50 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_TEXT_CLASS, obj, "efl.text");
51 else if (eina_streq(part, "icon"))
52 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_ICON_CLASS, obj, "efl.icon");
53 else if (eina_streq(part, "extra"))
54 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_EXTRA_CLASS, obj, "efl.extra");
55
56 return efl_part_get(efl_super(obj, MY_CLASS), part);
57} 29}
58/* Efl.Part end */
59
60/* Internal EO APIs and hidden overrides */
61#define EFL_UI_GRID_DEFAULT_ITEM_EXTRA_OPS \
62 ELM_PART_TEXT_DEFAULT_OPS(efl_ui_grid_default_item), \
63 ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_grid_default_item)
64 30
65#include "efl_ui_grid_default_item.eo.c" 31#include "efl_ui_grid_default_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_grid_default_item.eo b/src/lib/elementary/efl_ui_grid_default_item.eo
index 90461b0..d5c588e 100644
--- a/src/lib/elementary/efl_ui_grid_default_item.eo
+++ b/src/lib/elementary/efl_ui_grid_default_item.eo
@@ -1,33 +1,9 @@
1 1
2class @beta Efl.Ui.Grid_Default_Item extends Efl.Ui.Item implements 2class @beta Efl.Ui.Grid_Default_Item extends Efl.Ui.Default_Item
3 Efl.Text,
4 Efl.Text_Markup,
5 Efl.Ui.L10n,
6 Efl.Content
7{ 3{
8 [[Grid Default Item class. 4 [[Grid Default Item class.]]
9 This class need to be sub object of list widget.
10 Text and contents can be set using @Efl.Text,
11 @Efl.Content or @Efl.Part.]]
12 data: null; 5 data: null;
13 parts {
14 text: Efl.Ui.Item_Part_Text; [[The text part for grid default item.
15 text part is the caption of grid item.]]
16 icon: Efl.Ui.Item_Part_Icon; [[The icon content part for grid default item.
17 icon part is the main content of grid item.]]
18 end: Efl.Ui.Item_Part_Extra; [[The extra content part for grid default item.
19 extra part is the spare content of grid item.
20 you can swallow small badge widget such as check, radio.]]
21 }
22 implements { 6 implements {
23 //Efl.Object 7 Efl.Object.constructor;
24 Efl.Object.finalize;
25 Efl.Object.destructor;
26 Efl.Text.text { get; set; }
27 Efl.Text_Markup.markup { get; set; }
28 Efl.Ui.L10n.l10n_text { get; set; }
29 Efl.Content.content { get; set; }
30 Efl.Content.content_unset;
31 Efl.Part.part_get;
32 } 8 }
33} 9}
diff --git a/src/lib/elementary/efl_ui_list_default_item.c b/src/lib/elementary/efl_ui_list_default_item.c
index d95f988..ff2ce75 100644
--- a/src/lib/elementary/efl_ui_list_default_item.c
+++ b/src/lib/elementary/efl_ui_list_default_item.c
@@ -16,47 +16,15 @@
16#define MY_CLASS_NAME "Efl.Ui.List_Default_Item" 16#define MY_CLASS_NAME "Efl.Ui.List_Default_Item"
17 17
18EOLIAN static Efl_Object * 18EOLIAN static Efl_Object *
19_efl_ui_list_default_item_efl_object_finalize(Eo *obj, void *pd EINA_UNUSED) 19_efl_ui_list_default_item_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
20{ 20{
21 Eo *eo; 21 Eo *eo;
22 eo = efl_finalize(efl_super(obj, MY_CLASS));
23 ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
24 Eina_Error theme_apply_ret = efl_ui_layout_theme_set(obj, "list_item", NULL, NULL);
25 22
26 if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) 23 eo = efl_constructor(efl_super(obj, MY_CLASS));
27 CRI("Default Item(%p) failed to set theme [efl/list_item]!", eo);
28 return eo;
29}
30
31EOLIAN static void
32_efl_ui_list_default_item_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED)
33{
34 efl_destructor(efl_super(obj, MY_CLASS));
35}
36 24
37ELM_PART_TEXT_DEFAULT_GET(efl_ui_list_default_item, "efl.text") 25 if (!elm_widget_theme_klass_get(obj))
38ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_list_default_item, void) 26 elm_widget_theme_klass_set(obj, "list_item");
39ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_list_default_item, void)
40ELM_PART_CONTENT_DEFAULT_GET(efl_ui_list_default_item, "efl.icon")
41ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_list_default_item, void)
42 27
43EOLIAN static Efl_Object * 28 return eo;
44_efl_ui_list_default_item_efl_part_part_get(const Eo *obj, void *wd EINA_UNUSED, const char *part)
45{
46 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
47 if (eina_streq(part, "text"))
48 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_TEXT_CLASS, obj, "efl.text");
49 else if (eina_streq(part, "icon"))
50 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_ICON_CLASS, obj, "efl.icon");
51 else if (eina_streq(part, "extra"))
52 return ELM_PART_IMPLEMENT(EFL_UI_ITEM_PART_EXTRA_CLASS, obj, "efl.extra");
53
54 return efl_part_get(efl_super(obj, MY_CLASS), part);
55} 29}
56
57/* Internal EO APIs and hidden overrides */
58#define EFL_UI_LIST_DEFAULT_ITEM_EXTRA_OPS \
59 ELM_PART_TEXT_DEFAULT_OPS(efl_ui_list_default_item), \
60 ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_list_default_item)
61
62#include "efl_ui_list_default_item.eo.c" 30#include "efl_ui_list_default_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_list_default_item.eo b/src/lib/elementary/efl_ui_list_default_item.eo
index 90cc024..3b0c768 100644
--- a/src/lib/elementary/efl_ui_list_default_item.eo
+++ b/src/lib/elementary/efl_ui_list_default_item.eo
@@ -1,30 +1,9 @@
1 1
2class @beta Efl.Ui.List_Default_Item extends Efl.Ui.Item implements 2class @beta Efl.Ui.List_Default_Item extends Efl.Ui.Default_Item
3 Efl.Text,
4 Efl.Text_Markup,
5 Efl.Content
6{ 3{
7 [[List Default Item class. 4 [[List Default Item class.]]
8 This class need to be sub object of list widget.
9 text and contents can be appliable by efl_text,
10 efl_content or efl_part APIs.]]
11 data: null; 5 data: null;
12 parts {
13 text: Efl.Ui.Item_Part_Text; [[The text part for list default item.]]
14 icon: Efl.Ui.Item_Part_Icon; [[The icon content part for list default item.
15 icon part is the left-side content of list item.]]
16 extra: Efl.Ui.Item_Part_Extra; [[The extra content part for list default item.
17 extra part is the right-side content of list item.]]
18 }
19 implements { 6 implements {
20 //Efl.Object 7 Efl.Object.constructor;
21 Efl.Object.finalize;
22 Efl.Object.destructor;
23 Efl.Text.text { get; set; }
24 Efl.Text_Markup.markup { get; set; }
25 Efl.Ui.L10n.l10n_text { get; set; }
26 Efl.Content.content { get; set; }
27 Efl.Content.content_unset;
28 Efl.Part.part_get;
29 } 8 }
30} 9}
diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build
index 4ab0c20..a7c9fca 100644
--- a/src/lib/elementary/meson.build
+++ b/src/lib/elementary/meson.build
@@ -121,6 +121,7 @@ pub_eo_files = [
121 'efl_ui_item_part_extra.eo', 121 'efl_ui_item_part_extra.eo',
122 'efl_ui_item_part_content.eo', 122 'efl_ui_item_part_content.eo',
123 'efl_ui_item.eo', 123 'efl_ui_item.eo',
124 'efl_ui_default_item.eo',
124 'efl_ui_list_default_item.eo', 125 'efl_ui_list_default_item.eo',
125 'efl_ui_list_placeholder_item.eo', 126 'efl_ui_list_placeholder_item.eo',
126 'efl_ui_list.eo', 127 'efl_ui_list.eo',
@@ -895,6 +896,7 @@ elementary_src = [
895 'efl_ui_focus_util.c', 896 'efl_ui_focus_util.c',
896 'elm_widget_item_static_focus.c', 897 'elm_widget_item_static_focus.c',
897 'efl_ui_item.c', 898 'efl_ui_item.c',
899 'efl_ui_default_item.c',
898 'efl_ui_list_default_item.c', 900 'efl_ui_list_default_item.c',
899 'efl_ui_list_placeholder_item.c', 901 'efl_ui_list_placeholder_item.c',
900 'efl_ui_list.c', 902 'efl_ui_list.c',