summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-21 12:25:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-21 12:28:20 +0900
commit849813fb84749eec0e864928b2afdd61c9e80806 (patch)
treeec00414463c16f458309667407907005946dc5f4 /src/lib/elementary
parent419f3935c613850f0b1e61ee7246c951ccd258dc (diff)
layout: Fix slider label using proper part type
This relies on the new edje API that gives us the exact type of a part. This fixes the shortcomings of edje_edit_part_type_get() and returns a proper Text part type for efl_part(slider, "elm.units.max"). See previous commits: "edje: Add part_type_get API" "elm: Split off text and content for efl_part"
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_layout.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 4db5e363a4..04d8956685 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -11,9 +11,6 @@
11#include "elm_widget_layout.h" 11#include "elm_widget_layout.h"
12#include "elm_part_helper.h" 12#include "elm_part_helper.h"
13 13
14#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
15#include <Edje_Edit.h>
16
17#define MY_CLASS EFL_UI_LAYOUT_CLASS 14#define MY_CLASS EFL_UI_LAYOUT_CLASS
18#define MY_CLASS_PFX efl_ui_layout 15#define MY_CLASS_PFX efl_ui_layout
19 16
@@ -2474,27 +2471,39 @@ elm_layout_theme_set(Evas_Object *obj, const char *klass, const char *group, con
2474/* Efl.Part implementation */ 2471/* Efl.Part implementation */
2475 2472
2476EOLIAN static Eo * 2473EOLIAN static Eo *
2477_efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, 2474_efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *part)
2478 const char *part)
2479{ 2475{
2480 Edje_Part_Type type; 2476 Efl_Canvas_Layout_Part_Type type;
2481 2477
2482 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); 2478 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
2483 ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL); 2479 ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL);
2484 2480
2485 // Check part type with edje_edit, as edje_object_part_object_get() 2481 // Check part type without using edje_object_part_object_get(), as this
2486 // has side effects (it calls recalc, which may be really bad). 2482 // can cause recalc, which has side effects... and could be slow.
2487 type = edje_edit_part_type_get(wd->resize_obj, part); 2483 type = efl_canvas_layout_part_type_get(efl_part(wd->resize_obj, part));
2488 if ((type == EDJE_PART_TYPE_BOX) || (type == EDJE_PART_TYPE_TABLE))
2489 return _efl_ui_layout_pack_proxy_get((Eo *) obj, type, part);
2490
2491 if ((type == EDJE_PART_TYPE_TEXT) || (type == EDJE_PART_TYPE_TEXTBLOCK))
2492 return ELM_PART_OVERRIDE_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS);
2493 2484
2494 if (type == EDJE_PART_TYPE_SWALLOW) 2485 if (type >= EFL_CANVAS_LAYOUT_PART_TYPE_LAST)
2495 return ELM_PART_OVERRIDE_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS); 2486 {
2487 ERR("Invalid type found for part '%s' in group '%s'", part, sd->group);
2488 return NULL;
2489 }
2496 2490
2497 return ELM_PART_OVERRIDE_IMPLEMENT(EFL_UI_LAYOUT_PART_CLASS); 2491 switch (type)
2492 {
2493 case EFL_CANVAS_LAYOUT_PART_TYPE_BOX:
2494 case EFL_CANVAS_LAYOUT_PART_TYPE_TABLE:
2495 return _efl_ui_layout_pack_proxy_get((Eo *) obj, type, part);
2496 case EFL_CANVAS_LAYOUT_PART_TYPE_TEXT:
2497 case EFL_CANVAS_LAYOUT_PART_TYPE_TEXTBLOCK:
2498 return ELM_PART_OVERRIDE_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS);
2499 case EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW:
2500 return ELM_PART_OVERRIDE_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS);
2501 case EFL_CANVAS_LAYOUT_PART_TYPE_NONE:
2502 DBG("No such part '%s' in group '%s'", part, sd->group);
2503 return NULL;
2504 default:
2505 return ELM_PART_OVERRIDE_IMPLEMENT(EFL_UI_LAYOUT_PART_CLASS);
2506 }
2498} 2507}
2499 2508
2500static const char * 2509static const char *