diff options
author | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2018-04-12 21:30:05 +0900 |
---|---|---|
committer | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2018-04-12 22:02:29 +0900 |
commit | 92935bc3e2ab02a1b249f48efc8f00724feefa5d (patch) | |
tree | db8dbe25b2417660023d4fc8281ff3d673ed3911 | |
parent | 7fc81a4b66f57a00103cbc08aa0b6473f8c635e2 (diff) | |
download | efl-92935bc3e2ab02a1b249f48efc8f00724feefa5d.tar.gz |
efl_ui_navigation_layout: Add Efl.Ui.Navigation_Layout class
Efl.Ui.Navigation_Layout is a widget which provides a layout form useful
for navigation.
-rw-r--r-- | data/elementary/themes/Makefile.am | 1 | ||||
-rw-r--r-- | data/elementary/themes/default.edc | 1 | ||||
-rw-r--r-- | data/elementary/themes/edc/efl/navigation_layout.edc | 27 | ||||
-rw-r--r-- | src/Makefile_Elementary.am | 3 | ||||
-rw-r--r-- | src/lib/elementary/Elementary.h | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_navigation_layout.c | 59 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_navigation_layout.eo | 29 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_navigation_layout_private.h | 20 |
8 files changed, 141 insertions, 0 deletions
diff --git a/data/elementary/themes/Makefile.am b/data/elementary/themes/Makefile.am index e91113c1cc..a52bd6538f 100644 --- a/data/elementary/themes/Makefile.am +++ b/data/elementary/themes/Makefile.am @@ -1022,6 +1022,7 @@ elementary/themes/edc/efl/uiclock.edc \ elementary/themes/edc/efl/cursor.edc \ elementary/themes/edc/efl/focus.edc \ elementary/themes/edc/efl/frame.edc \ +elementary/themes/edc/efl/navigation_layout.edc \ elementary/themes/edc/efl/multibuttonentry.edc \ elementary/themes/edc/efl/nstate.edc \ elementary/themes/edc/efl/panes.edc \ diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc index 3b851409f5..29733f6d1d 100644 --- a/data/elementary/themes/default.edc +++ b/data/elementary/themes/default.edc @@ -168,6 +168,7 @@ collections { #include "edc/efl/bg.edc" #include "edc/efl/button.edc" #include "edc/efl/calendar.edc" +#include "edc/efl/navigation_layout.edc" #include "edc/efl/nstate.edc" // XXX: mobile mode needs invisible scrollers... make signals that do this #include "edc/efl/scroller.edc" diff --git a/data/elementary/themes/edc/efl/navigation_layout.edc b/data/elementary/themes/edc/efl/navigation_layout.edc new file mode 100644 index 0000000000..c3765cce9f --- /dev/null +++ b/data/elementary/themes/edc/efl/navigation_layout.edc @@ -0,0 +1,27 @@ +//Efl.Ui.Navigation_Layout Themes +group { "efl/navigation_layout"; + parts { + spacer { "base"; + desc { "default"; + } + } + swallow { "bar"; + desc { "default"; + fixed: 0 1; + min: 0 40; + rel2.relative: 1.0 0.0; + align: 0.5 0.0; + } + } + swallow { "content"; + desc { "default"; + rel1 { + to_x: "base"; + to_y: "bar"; + relative: 0.0 1.0; + } + rel2.to_x: "base"; + } + } + } +} diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 0751a36ec7..8c4f31ba76 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -17,6 +17,7 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_layout.eo \ lib/elementary/efl_ui_multibuttonentry.eo \ lib/elementary/efl_ui_nstate.eo \ + lib/elementary/efl_ui_navigation_layout.eo \ lib/elementary/efl_ui_panes.eo \ lib/elementary/efl_ui_progressbar.eo \ lib/elementary/efl_ui_radio.eo \ @@ -352,6 +353,7 @@ includesunstable_HEADERS = \ lib/elementary/elm_widget_menu.h \ lib/elementary/efl_ui_multibuttonentry_private.h \ lib/elementary/elm_widget_naviframe.h \ + lib/elementary/efl_ui_navigation_layout_private.h \ lib/elementary/elm_widget_notify.h \ lib/elementary/elm_widget_panel.h \ lib/elementary/efl_ui_panes_private.h \ @@ -628,6 +630,7 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/elc_hoversel.c \ lib/elementary/efl_ui_multibuttonentry.c \ lib/elementary/elc_naviframe.c \ + lib/elementary/efl_ui_navigation_layout.c \ lib/elementary/elc_player.c \ lib/elementary/elc_popup.c \ lib/elementary/elc_scrolled_entry.c \ diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index 4099503810..38b814c3ba 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -336,6 +336,7 @@ typedef Eo Efl_Ui_Focus_Manager; # include <efl_selection.eo.h> # include <efl_ui_dnd.eo.h> # include <efl_ui_dnd_container.eo.h> +# include <efl_ui_navigation_layout.eo.h> # include <efl_ui_stack.eo.h> #endif diff --git a/src/lib/elementary/efl_ui_navigation_layout.c b/src/lib/elementary/efl_ui_navigation_layout.c new file mode 100644 index 0000000000..8cb2f4e11f --- /dev/null +++ b/src/lib/elementary/efl_ui_navigation_layout.c @@ -0,0 +1,59 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Elementary.h> + +#include "elm_priv.h" +#include "efl_ui_navigation_layout_private.h" +#include "elm_part_helper.h" + +#define MY_CLASS EFL_UI_NAVIGATION_LAYOUT_CLASS +#define MY_CLASS_NAME "Efl.Ui.Navigation_Layout" + +EOLIAN static void +_efl_ui_navigation_layout_bar_set(Eo *obj, Efl_Ui_Navigation_Layout_Data *pd, Efl_Ui_Layout *bar) +{ + EINA_SAFETY_ON_FALSE_RETURN(efl_isa(bar, EFL_UI_LAYOUT_CLASS)); + + efl_content_set(efl_part(obj, "bar"), bar); + pd->bar = bar; +} + +EOLIAN static Efl_Ui_Layout * +_efl_ui_navigation_layout_bar_get(Eo *obj EINA_UNUSED, Efl_Ui_Navigation_Layout_Data *pd) +{ + return pd->bar; +} + +EOLIAN static Eo * +_efl_ui_navigation_layout_efl_object_constructor(Eo *obj, Efl_Ui_Navigation_Layout_Data *pd EINA_UNUSED) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + + if (!elm_widget_theme_klass_get(obj)) + elm_widget_theme_klass_set(obj, "navigation_layout"); + obj = efl_constructor(efl_super(obj, MY_CLASS)); + efl_canvas_object_type_set(obj, MY_CLASS_NAME); + + elm_widget_sub_object_parent_add(obj); + + elm_widget_can_focus_set(obj, EINA_TRUE); + if (!elm_widget_theme_object_set(obj, wd->resize_obj, + elm_widget_theme_klass_get(obj), + elm_widget_theme_element_get(obj), + elm_widget_theme_style_get(obj))) + CRI("Failed to set layout!"); + + return obj; +} + +/* Standard widget overrides */ +ELM_PART_CONTENT_DEFAULT_GET(efl_ui_navigation_layout, "content") +ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_navigation_layout, Efl_Ui_Navigation_Layout_Data) + +/* Internal EO APIs and hidden overrides */ +#define EFL_UI_NAVIGATION_LAYOUT_EXTRA_OPS \ + ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_navigation_layout) + +#include "efl_ui_navigation_layout.eo.c" diff --git a/src/lib/elementary/efl_ui_navigation_layout.eo b/src/lib/elementary/efl_ui_navigation_layout.eo new file mode 100644 index 0000000000..aea7b8b2b8 --- /dev/null +++ b/src/lib/elementary/efl_ui_navigation_layout.eo @@ -0,0 +1,29 @@ +class Efl.Ui.Navigation_Layout (Efl.Ui.Layout, Efl.Content) +{ + [[Navigation_Layout widget. + + Navigation_Layout widget provides a layout form useful for navigation. + Navigation_Layout widget is used to be pushed to or popped from Stack + widget(Efl.Ui.Stack class) as a content. + ]] + methods { + @property bar { + [[The bar object which is located at the top area as a title. + ]] + set { + } + get { + } + values { + value: Efl.Ui.Layout; + [[The bar object located at the top area of the Navigation Layout. + ]] + } + } + } + implements { + Efl.Object.constructor; + Efl.Content.content { set; get; } + Efl.Content.content_unset; + } +} diff --git a/src/lib/elementary/efl_ui_navigation_layout_private.h b/src/lib/elementary/efl_ui_navigation_layout_private.h new file mode 100644 index 0000000000..47d3e4464d --- /dev/null +++ b/src/lib/elementary/efl_ui_navigation_layout_private.h @@ -0,0 +1,20 @@ +#ifndef EFL_UI_WIDGET_NAVIGATION_LAYOUT_H +#define EFL_UI_WIDGET_NAVIGATION_LAYOUT_H + +typedef struct _Efl_Ui_Navigation_Layout_Data Efl_Ui_Navigation_Layout_Data; +struct _Efl_Ui_Navigation_Layout_Data +{ + Efl_Ui_Layout *bar; +}; + +#define EFL_UI_NAVIGATION_LAYOUT_DATA_GET_OR_RETURN(o, ptr, ...) \ + Efl_Ui_Navigation_Layout_Data *ptr; \ + ptr = efl_data_scope_get(o, EFL_UI_NAVIGATION_LAYOUT_CLASS); \ + if (EINA_UNLIKELY(!ptr)) \ + { \ + CRI("no ui navigation layout data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return __VA_ARGS__; \ + } + +#endif |