summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-12-12 22:59:48 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-12-13 14:13:09 -0200
commitfd92dec358bf6d98b4b334e938140049b6f5f12e (patch)
tree524a928aaf65e4ff25b2c2948c67885961de004f
parente747e1ec2a4991ff53c854327ee66033686d7503 (diff)
elementary: Add efl_ui_list widget
-rw-r--r--config/default/base.src.in269
-rw-r--r--config/mobile/base.src.in269
-rw-r--r--config/standard/base.src.in269
-rw-r--r--data/elementary/themes/Makefile.am1
-rw-r--r--data/elementary/themes/default.edc1
-rw-r--r--data/elementary/themes/edc/efl/list.edc8
-rw-r--r--src/Makefile_Elementary.am15
-rw-r--r--src/examples/elementary/Makefile.am25
-rw-r--r--src/examples/elementary/efl_ui_list_example.edc280
-rw-r--r--src/examples/elementary/efl_ui_list_example_1.c111
-rw-r--r--src/examples/elementary/efl_ui_list_example_2.c74
-rw-r--r--src/examples/elementary/efl_ui_list_example_3.c329
-rw-r--r--src/examples/elementary/layout_model_connect.c1
-rw-r--r--src/lib/elementary/Elementary.h8
-rw-r--r--src/lib/elementary/efl_ui_layout.c32
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.c127
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.eo22
-rw-r--r--src/lib/elementary/efl_ui_list.c668
-rw-r--r--src/lib/elementary/efl_ui_list.eo108
-rw-r--r--src/lib/elementary/efl_ui_list_model.eo48
-rw-r--r--src/lib/elementary/efl_ui_list_pan.eo16
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.c659
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.eo8
-rw-r--r--src/lib/elementary/efl_ui_list_private.h132
-rw-r--r--src/lib/elementary/efl_ui_list_relayout.eo23
-rw-r--r--src/lib/elementary/efl_ui_list_segarray.c427
-rw-r--r--src/lib/elementary/efl_ui_list_segarray.h42
-rw-r--r--src/lib/elementary/efl_ui_list_types.eot9
-rw-r--r--src/lib/elementary/elm_widget_layout.h2
29 files changed, 3973 insertions, 10 deletions
diff --git a/config/default/base.src.in b/config/default/base.src.in
index 10d7d0e6a5..7e9444c10c 100644
--- a/config/default/base.src.in
+++ b/config/default/base.src.in
@@ -2796,5 +2796,274 @@ group "Elm_Config" struct {
2796 } 2796 }
2797 } 2797 }
2798 } 2798 }
2799 group "Elm_Config_Bindings_Widget" struct {
2800 value "name" string: "Efl.Ui.List";
2801 group "key_bindings" list {
2802 group "Elm_Config_Binding_Key" struct {
2803 value "context" int: 0;
2804 value "key" string: "Left";
2805 value "action" string: "move";
2806 value "params" string: "left";
2807 group "modifiers" list {
2808 group "Elm_Config_Binding_Modifier" struct {
2809 value "mod" string: "Shift";
2810 value "flag" uchar: 0;
2811 }
2812 }
2813 }
2814 group "Elm_Config_Binding_Key" struct {
2815 value "context" int: 0;
2816 value "key" string: "Left";
2817 value "action" string: "move";
2818 value "params" string: "left_multi";
2819 group "modifiers" list {
2820 group "Elm_Config_Binding_Modifier" struct {
2821 value "mod" string: "Shift";
2822 value "flag" uchar: 1;
2823 }
2824 }
2825 }
2826 group "Elm_Config_Binding_Key" struct {
2827 value "context" int: 0;
2828 value "key" string: "KP_Left";
2829 value "action" string: "move";
2830 value "params" string: "left";
2831 group "modifiers" list {
2832 group "Elm_Config_Binding_Modifier" struct {
2833 value "mod" string: "Shift";
2834 value "flag" uchar: 0;
2835 }
2836 }
2837 }
2838 group "Elm_Config_Binding_Key" struct {
2839 value "context" int: 0;
2840 value "key" string: "KP_Left";
2841 value "action" string: "move";
2842 value "params" string: "left_multi";
2843 group "modifiers" list {
2844 group "Elm_Config_Binding_Modifier" struct {
2845 value "mod" string: "Shift";
2846 value "flag" uchar: 1;
2847 }
2848 }
2849 }
2850 group "Elm_Config_Binding_Key" struct {
2851 value "context" int: 0;
2852 value "key" string: "Right";
2853 value "action" string: "move";
2854 value "params" string: "right";
2855 group "modifiers" list {
2856 group "Elm_Config_Binding_Modifier" struct {
2857 value "mod" string: "Shift";
2858 value "flag" uchar: 0;
2859 }
2860 }
2861 }
2862 group "Elm_Config_Binding_Key" struct {
2863 value "context" int: 0;
2864 value "key" string: "Right";
2865 value "action" string: "move";
2866 value "params" string: "right_multi";
2867 group "modifiers" list {
2868 group "Elm_Config_Binding_Modifier" struct {
2869 value "mod" string: "Shift";
2870 value "flag" uchar: 1;
2871 }
2872 }
2873 }
2874 group "Elm_Config_Binding_Key" struct {
2875 value "context" int: 0;
2876 value "key" string: "KP_Right";
2877 value "action" string: "move";
2878 value "params" string: "right";
2879 group "modifiers" list {
2880 group "Elm_Config_Binding_Modifier" struct {
2881 value "mod" string: "Shift";
2882 value "flag" uchar: 0;
2883 }
2884 }
2885 }
2886 group "Elm_Config_Binding_Key" struct {
2887 value "context" int: 0;
2888 value "key" string: "KP_Right";
2889 value "action" string: "move";
2890 value "params" string: "right_multi";
2891 group "modifiers" list {
2892 group "Elm_Config_Binding_Modifier" struct {
2893 value "mod" string: "Shift";
2894 value "flag" uchar: 1;
2895 }
2896 }
2897 }
2898 group "Elm_Config_Binding_Key" struct {
2899 value "context" int: 0;
2900 value "key" string: "Up";
2901 value "action" string: "move";
2902 value "params" string: "up";
2903 group "modifiers" list {
2904 group "Elm_Config_Binding_Modifier" struct {
2905 value "mod" string: "Shift";
2906 value "flag" uchar: 0;
2907 }
2908 }
2909 }
2910 group "Elm_Config_Binding_Key" struct {
2911 value "context" int: 0;
2912 value "key" string: "Up";
2913 value "action" string: "move";
2914 value "params" string: "up_multi";
2915 group "modifiers" list {
2916 group "Elm_Config_Binding_Modifier" struct {
2917 value "mod" string: "Shift";
2918 value "flag" uchar: 1;
2919 }
2920 }
2921 }
2922 group "Elm_Config_Binding_Key" struct {
2923 value "context" int: 0;
2924 value "key" string: "KP_Up";
2925 value "action" string: "move";
2926 value "params" string: "up";
2927 group "modifiers" list {
2928 group "Elm_Config_Binding_Modifier" struct {
2929 value "mod" string: "Shift";
2930 value "flag" uchar: 0;
2931 }
2932 }
2933 }
2934 group "Elm_Config_Binding_Key" struct {
2935 value "context" int: 0;
2936 value "key" string: "KP_Up";
2937 value "action" string: "move";
2938 value "params" string: "up_multi";
2939 group "modifiers" list {
2940 group "Elm_Config_Binding_Modifier" struct {
2941 value "mod" string: "Shift";
2942 value "flag" uchar: 1;
2943 }
2944 }
2945 }
2946 group "Elm_Config_Binding_Key" struct {
2947 value "context" int: 0;
2948 value "key" string: "Down";
2949 value "action" string: "move";
2950 value "params" string: "down";
2951 group "modifiers" list {
2952 group "Elm_Config_Binding_Modifier" struct {
2953 value "mod" string: "Shift";
2954 value "flag" uchar: 0;
2955 }
2956 }
2957 }
2958 group "Elm_Config_Binding_Key" struct {
2959 value "context" int: 0;
2960 value "key" string: "Down";
2961 value "action" string: "move";
2962 value "params" string: "down_multi";
2963 group "modifiers" list {
2964 group "Elm_Config_Binding_Modifier" struct {
2965 value "mod" string: "Shift";
2966 value "flag" uchar: 1;
2967 }
2968 }
2969 }
2970 group "Elm_Config_Binding_Key" struct {
2971 value "context" int: 0;
2972 value "key" string: "KP_Down";
2973 value "action" string: "move";
2974 value "params" string: "down";
2975 group "modifiers" list {
2976 group "Elm_Config_Binding_Modifier" struct {
2977 value "mod" string: "Shift";
2978 value "flag" uchar: 0;
2979 }
2980 }
2981 }
2982 group "Elm_Config_Binding_Key" struct {
2983 value "context" int: 0;
2984 value "key" string: "KP_Down";
2985 value "action" string: "move";
2986 value "params" string: "down_multi";
2987 group "modifiers" list {
2988 group "Elm_Config_Binding_Modifier" struct {
2989 value "mod" string: "Shift";
2990 value "flag" uchar: 1;
2991 }
2992 }
2993 }
2994 group "Elm_Config_Binding_Key" struct {
2995 value "context" int: 0;
2996 value "key" string: "Prior";
2997 value "action" string: "move";
2998 value "params" string: "prior";
2999 }
3000 group "Elm_Config_Binding_Key" struct {
3001 value "context" int: 0;
3002 value "key" string: "KP_Prior";
3003 value "action" string: "move";
3004 value "params" string: "prior";
3005 }
3006 group "Elm_Config_Binding_Key" struct {
3007 value "context" int: 0;
3008 value "key" string: "Next";
3009 value "action" string: "move";
3010 value "params" string: "next";
3011 }
3012 group "Elm_Config_Binding_Key" struct {
3013 value "context" int: 0;
3014 value "key" string: "KP_Next";
3015 value "action" string: "move";
3016 value "params" string: "next";
3017 }
3018 group "Elm_Config_Binding_Key" struct {
3019 value "context" int: 0;
3020 value "key" string: "Home";
3021 value "action" string: "move";
3022 value "params" string: "first";
3023 }
3024 group "Elm_Config_Binding_Key" struct {
3025 value "context" int: 0;
3026 value "key" string: "KP_Home";
3027 value "action" string: "move";
3028 value "params" string: "first";
3029 }
3030 group "Elm_Config_Binding_Key" struct {
3031 value "context" int: 0;
3032 value "key" string: "End";
3033 value "action" string: "move";
3034 value "params" string: "last";
3035 }
3036 group "Elm_Config_Binding_Key" struct {
3037 value "context" int: 0;
3038 value "key" string: "KP_End";
3039 value "action" string: "move";
3040 value "params" string: "last";
3041 }
3042 group "Elm_Config_Binding_Key" struct {
3043 value "context" int: 0;
3044 value "key" string: "Return";
3045 value "action" string: "select";
3046 value "params" string: "";
3047 }
3048 group "Elm_Config_Binding_Key" struct {
3049 value "context" int: 0;
3050 value "key" string: "KP_Enter";
3051 value "action" string: "select";
3052 value "params" string: "";
3053 }
3054 group "Elm_Config_Binding_Key" struct {
3055 value "context" int: 0;
3056 value "key" string: "space";
3057 value "action" string: "select";
3058 value "params" string: "";
3059 }
3060 group "Elm_Config_Binding_Key" struct {
3061 value "context" int: 0;
3062 value "key" string: "Escape";
3063 value "action" string: "escape";
3064 value "params" string: "";
3065 }
3066 }
3067 }
2799 } 3068 }
2800} 3069}
diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in
index 5f5b5dd63b..18d3612548 100644
--- a/config/mobile/base.src.in
+++ b/config/mobile/base.src.in
@@ -2789,5 +2789,274 @@ group "Elm_Config" struct {
2789 } 2789 }
2790 } 2790 }
2791 } 2791 }
2792 group "Elm_Config_Bindings_Widget" struct {
2793 value "name" string: "Efl.Ui.List";
2794 group "key_bindings" list {
2795 group "Elm_Config_Binding_Key" struct {
2796 value "context" int: 0;
2797 value "key" string: "Left";
2798 value "action" string: "move";
2799 value "params" string: "left";
2800 group "modifiers" list {
2801 group "Elm_Config_Binding_Modifier" struct {
2802 value "mod" string: "Shift";
2803 value "flag" uchar: 0;
2804 }
2805 }
2806 }
2807 group "Elm_Config_Binding_Key" struct {
2808 value "context" int: 0;
2809 value "key" string: "Left";
2810 value "action" string: "move";
2811 value "params" string: "left_multi";
2812 group "modifiers" list {
2813 group "Elm_Config_Binding_Modifier" struct {
2814 value "mod" string: "Shift";
2815 value "flag" uchar: 1;
2816 }
2817 }
2818 }
2819 group "Elm_Config_Binding_Key" struct {
2820 value "context" int: 0;
2821 value "key" string: "KP_Left";
2822 value "action" string: "move";
2823 value "params" string: "left";
2824 group "modifiers" list {
2825 group "Elm_Config_Binding_Modifier" struct {
2826 value "mod" string: "Shift";
2827 value "flag" uchar: 0;
2828 }
2829 }
2830 }
2831 group "Elm_Config_Binding_Key" struct {
2832 value "context" int: 0;
2833 value "key" string: "KP_Left";
2834 value "action" string: "move";
2835 value "params" string: "left_multi";
2836 group "modifiers" list {
2837 group "Elm_Config_Binding_Modifier" struct {
2838 value "mod" string: "Shift";
2839 value "flag" uchar: 1;
2840 }
2841 }
2842 }
2843 group "Elm_Config_Binding_Key" struct {
2844 value "context" int: 0;
2845 value "key" string: "Right";
2846 value "action" string: "move";
2847 value "params" string: "right";
2848 group "modifiers" list {
2849 group "Elm_Config_Binding_Modifier" struct {
2850 value "mod" string: "Shift";
2851 value "flag" uchar: 0;
2852 }
2853 }
2854 }
2855 group "Elm_Config_Binding_Key" struct {
2856 value "context" int: 0;
2857 value "key" string: "Right";
2858 value "action" string: "move";
2859 value "params" string: "right_multi";
2860 group "modifiers" list {
2861 group "Elm_Config_Binding_Modifier" struct {
2862 value "mod" string: "Shift";
2863 value "flag" uchar: 1;
2864 }
2865 }
2866 }
2867 group "Elm_Config_Binding_Key" struct {
2868 value "context" int: 0;
2869 value "key" string: "KP_Right";
2870 value "action" string: "move";
2871 value "params" string: "right";
2872 group "modifiers" list {
2873 group "Elm_Config_Binding_Modifier" struct {
2874 value "mod" string: "Shift";
2875 value "flag" uchar: 0;
2876 }
2877 }
2878 }
2879 group "Elm_Config_Binding_Key" struct {
2880 value "context" int: 0;
2881 value "key" string: "KP_Right";
2882 value "action" string: "move";
2883 value "params" string: "right_multi";
2884 group "modifiers" list {
2885 group "Elm_Config_Binding_Modifier" struct {
2886 value "mod" string: "Shift";
2887 value "flag" uchar: 1;
2888 }
2889 }
2890 }
2891 group "Elm_Config_Binding_Key" struct {
2892 value "context" int: 0;
2893 value "key" string: "Up";
2894 value "action" string: "move";
2895 value "params" string: "up";
2896 group "modifiers" list {
2897 group "Elm_Config_Binding_Modifier" struct {
2898 value "mod" string: "Shift";
2899 value "flag" uchar: 0;
2900 }
2901 }
2902 }
2903 group "Elm_Config_Binding_Key" struct {
2904 value "context" int: 0;
2905 value "key" string: "Up";
2906 value "action" string: "move";
2907 value "params" string: "up_multi";
2908 group "modifiers" list {
2909 group "Elm_Config_Binding_Modifier" struct {
2910 value "mod" string: "Shift";
2911 value "flag" uchar: 1;
2912 }
2913 }
2914 }
2915 group "Elm_Config_Binding_Key" struct {
2916 value "context" int: 0;
2917 value "key" string: "KP_Up";
2918 value "action" string: "move";
2919 value "params" string: "up";
2920 group "modifiers" list {
2921 group "Elm_Config_Binding_Modifier" struct {
2922 value "mod" string: "Shift";
2923 value "flag" uchar: 0;
2924 }
2925 }
2926 }
2927 group "Elm_Config_Binding_Key" struct {
2928 value "context" int: 0;
2929 value "key" string: "KP_Up";
2930 value "action" string: "move";
2931 value "params" string: "up_multi";
2932 group "modifiers" list {
2933 group "Elm_Config_Binding_Modifier" struct {
2934 value "mod" string: "Shift";
2935 value "flag" uchar: 1;
2936 }
2937 }
2938 }
2939 group "Elm_Config_Binding_Key" struct {
2940 value "context" int: 0;
2941 value "key" string: "Down";
2942 value "action" string: "move";
2943 value "params" string: "down";
2944 group "modifiers" list {
2945 group "Elm_Config_Binding_Modifier" struct {
2946 value "mod" string: "Shift";
2947 value "flag" uchar: 0;
2948 }
2949 }
2950 }
2951 group "Elm_Config_Binding_Key" struct {
2952 value "context" int: 0;
2953 value "key" string: "Down";
2954 value "action" string: "move";
2955 value "params" string: "down_multi";
2956 group "modifiers" list {
2957 group "Elm_Config_Binding_Modifier" struct {
2958 value "mod" string: "Shift";
2959 value "flag" uchar: 1;
2960 }
2961 }
2962 }
2963 group "Elm_Config_Binding_Key" struct {
2964 value "context" int: 0;
2965 value "key" string: "KP_Down";
2966 value "action" string: "move";
2967 value "params" string: "down";
2968 group "modifiers" list {
2969 group "Elm_Config_Binding_Modifier" struct {
2970 value "mod" string: "Shift";
2971 value "flag" uchar: 0;
2972 }
2973 }
2974 }
2975 group "Elm_Config_Binding_Key" struct {
2976 value "context" int: 0;
2977 value "key" string: "KP_Down";
2978 value "action" string: "move";
2979 value "params" string: "down_multi";
2980 group "modifiers" list {
2981 group "Elm_Config_Binding_Modifier" struct {
2982 value "mod" string: "Shift";
2983 value "flag" uchar: 1;
2984 }
2985 }
2986 }
2987 group "Elm_Config_Binding_Key" struct {
2988 value "context" int: 0;
2989 value "key" string: "Prior";
2990 value "action" string: "move";
2991 value "params" string: "prior";
2992 }
2993 group "Elm_Config_Binding_Key" struct {
2994 value "context" int: 0;
2995 value "key" string: "KP_Prior";
2996 value "action" string: "move";
2997 value "params" string: "prior";
2998 }
2999 group "Elm_Config_Binding_Key" struct {
3000 value "context" int: 0;
3001 value "key" string: "Next";
3002 value "action" string: "move";
3003 value "params" string: "next";
3004 }
3005 group "Elm_Config_Binding_Key" struct {
3006 value "context" int: 0;
3007 value "key" string: "KP_Next";
3008 value "action" string: "move";
3009 value "params" string: "next";
3010 }
3011 group "Elm_Config_Binding_Key" struct {
3012 value "context" int: 0;
3013 value "key" string: "Home";
3014 value "action" string: "move";
3015 value "params" string: "first";
3016 }
3017 group "Elm_Config_Binding_Key" struct {
3018 value "context" int: 0;
3019 value "key" string: "KP_Home";
3020 value "action" string: "move";
3021 value "params" string: "first";
3022 }
3023 group "Elm_Config_Binding_Key" struct {
3024 value "context" int: 0;
3025 value "key" string: "End";
3026 value "action" string: "move";
3027 value "params" string: "last";
3028 }
3029 group "Elm_Config_Binding_Key" struct {
3030 value "context" int: 0;
3031 value "key" string: "KP_End";
3032 value "action" string: "move";
3033 value "params" string: "last";
3034 }
3035 group "Elm_Config_Binding_Key" struct {
3036 value "context" int: 0;
3037 value "key" string: "Return";
3038 value "action" string: "select";
3039 value "params" string: "";
3040 }
3041 group "Elm_Config_Binding_Key" struct {
3042 value "context" int: 0;
3043 value "key" string: "KP_Enter";
3044 value "action" string: "select";
3045 value "params" string: "";
3046 }
3047 group "Elm_Config_Binding_Key" struct {
3048 value "context" int: 0;
3049 value "key" string: "space";
3050 value "action" string: "select";
3051 value "params" string: "";
3052 }
3053 group "Elm_Config_Binding_Key" struct {
3054 value "context" int: 0;
3055 value "key" string: "Escape";
3056 value "action" string: "escape";
3057 value "params" string: "";
3058 }
3059 }
3060 }
2792 } 3061 }
2793} 3062}
diff --git a/config/standard/base.src.in b/config/standard/base.src.in
index 13497910ae..9781512539 100644
--- a/config/standard/base.src.in
+++ b/config/standard/base.src.in
@@ -2786,5 +2786,274 @@ group "Elm_Config" struct {
2786 } 2786 }
2787 } 2787 }
2788 } 2788 }
2789 group "Elm_Config_Bindings_Widget" struct {
2790 value "name" string: "Efl.Ui.List";
2791 group "key_bindings" list {
2792 group "Elm_Config_Binding_Key" struct {
2793 value "context" int: 0;
2794 value "key" string: "Left";
2795 value "action" string: "move";
2796 value "params" string: "left";
2797 group "modifiers" list {
2798 group "Elm_Config_Binding_Modifier" struct {
2799 value "mod" string: "Shift";
2800 value "flag" uchar: 0;
2801 }
2802 }
2803 }
2804 group "Elm_Config_Binding_Key" struct {
2805 value "context" int: 0;
2806 value "key" string: "Left";
2807 value "action" string: "move";
2808 value "params" string: "left_multi";
2809 group "modifiers" list {
2810 group "Elm_Config_Binding_Modifier" struct {
2811 value "mod" string: "Shift";
2812 value "flag" uchar: 1;
2813 }
2814 }
2815 }
2816 group "Elm_Config_Binding_Key" struct {
2817 value "context" int: 0;
2818 value "key" string: "KP_Left";
2819 value "action" string: "move";
2820 value "params" string: "left";
2821 group "modifiers" list {
2822 group "Elm_Config_Binding_Modifier" struct {
2823 value "mod" string: "Shift";
2824 value "flag" uchar: 0;
2825 }
2826 }
2827 }
2828 group "Elm_Config_Binding_Key" struct {
2829 value "context" int: 0;
2830 value "key" string: "KP_Left";
2831 value "action" string: "move";
2832 value "params" string: "left_multi";
2833 group "modifiers" list {
2834 group "Elm_Config_Binding_Modifier" struct {
2835 value "mod" string: "Shift";
2836 value "flag" uchar: 1;
2837 }
2838 }
2839 }
2840 group "Elm_Config_Binding_Key" struct {
2841 value "context" int: 0;
2842 value "key" string: "Right";
2843 value "action" string: "move";
2844 value "params" string: "right";
2845 group "modifiers" list {
2846 group "Elm_Config_Binding_Modifier" struct {
2847 value "mod" string: "Shift";
2848 value "flag" uchar: 0;
2849 }
2850 }
2851 }
2852 group "Elm_Config_Binding_Key" struct {
2853 value "context" int: 0;
2854 value "key" string: "Right";
2855 value "action" string: "move";
2856 value "params" string: "right_multi";
2857 group "modifiers" list {
2858 group "Elm_Config_Binding_Modifier" struct {
2859 value "mod" string: "Shift";
2860 value "flag" uchar: 1;
2861 }
2862 }
2863 }
2864 group "Elm_Config_Binding_Key" struct {
2865 value "context" int: 0;
2866 value "key" string: "KP_Right";
2867 value "action" string: "move";
2868 value "params" string: "right";
2869 group "modifiers" list {
2870 group "Elm_Config_Binding_Modifier" struct {
2871 value "mod" string: "Shift";
2872 value "flag" uchar: 0;
2873 }
2874 }
2875 }
2876 group "Elm_Config_Binding_Key" struct {
2877 value "context" int: 0;
2878 value "key" string: "KP_Right";
2879 value "action" string: "move";
2880 value "params" string: "right_multi";
2881 group "modifiers" list {
2882 group "Elm_Config_Binding_Modifier" struct {
2883 value "mod" string: "Shift";
2884 value "flag" uchar: 1;
2885 }
2886 }
2887 }
2888 group "Elm_Config_Binding_Key" struct {
2889 value "context" int: 0;
2890 value "key" string: "Up";
2891 value "action" string: "move";
2892 value "params" string: "up";
2893 group "modifiers" list {
2894 group "Elm_Config_Binding_Modifier" struct {
2895 value "mod" string: "Shift";
2896 value "flag" uchar: 0;
2897 }
2898 }
2899 }
2900 group "Elm_Config_Binding_Key" struct {
2901 value "context" int: 0;
2902 value "key" string: "Up";
2903 value "action" string: "move";
2904 value "params" string: "up_multi";
2905 group "modifiers" list {
2906 group "Elm_Config_Binding_Modifier" struct {
2907 value "mod" string: "Shift";
2908 value "flag" uchar: 1;
2909 }
2910 }
2911 }
2912 group "Elm_Config_Binding_Key" struct {
2913 value "context" int: 0;
2914 value "key" string: "KP_Up";
2915 value "action" string: "move";
2916 value "params" string: "up";
2917 group "modifiers" list {
2918 group "Elm_Config_Binding_Modifier" struct {
2919 value "mod" string: "Shift";
2920 value "flag" uchar: 0;
2921 }
2922 }
2923 }
2924 group "Elm_Config_Binding_Key" struct {
2925 value "context" int: 0;
2926 value "key" string: "KP_Up";
2927 value "action" string: "move";
2928 value "params" string: "up_multi";
2929 group "modifiers" list {
2930 group "Elm_Config_Binding_Modifier" struct {
2931 value "mod" string: "Shift";
2932 value "flag" uchar: 1;
2933 }
2934 }
2935 }
2936 group "Elm_Config_Binding_Key" struct {
2937 value "context" int: 0;
2938 value "key" string: "Down";
2939 value "action" string: "move";
2940 value "params" string: "down";
2941 group "modifiers" list {
2942 group "Elm_Config_Binding_Modifier" struct {
2943 value "mod" string: "Shift";
2944 value "flag" uchar: 0;
2945 }
2946 }
2947 }
2948 group "Elm_Config_Binding_Key" struct {
2949 value "context" int: 0;
2950 value "key" string: "Down";
2951 value "action" string: "move";
2952 value "params" string: "down_multi";
2953 group "modifiers" list {
2954 group "Elm_Config_Binding_Modifier" struct {
2955 value "mod" string: "Shift";
2956 value "flag" uchar: 1;
2957 }
2958 }
2959 }
2960 group "Elm_Config_Binding_Key" struct {
2961 value "context" int: 0;
2962 value "key" string: "KP_Down";
2963 value "action" string: "move";
2964 value "params" string: "down";
2965 group "modifiers" list {
2966 group "Elm_Config_Binding_Modifier" struct {
2967 value "mod" string: "Shift";
2968 value "flag" uchar: 0;
2969 }
2970 }
2971 }
2972 group "Elm_Config_Binding_Key" struct {
2973 value "context" int: 0;
2974 value "key" string: "KP_Down";
2975 value "action" string: "move";
2976 value "params" string: "down_multi";
2977 group "modifiers" list {
2978 group "Elm_Config_Binding_Modifier" struct {
2979 value "mod" string: "Shift";
2980 value "flag" uchar: 1;
2981 }
2982 }
2983 }
2984 group "Elm_Config_Binding_Key" struct {
2985 value "context" int: 0;
2986 value "key" string: "Prior";
2987 value "action" string: "move";
2988 value "params" string: "prior";
2989 }
2990 group "Elm_Config_Binding_Key" struct {
2991 value "context" int: 0;
2992 value "key" string: "KP_Prior";
2993 value "action" string: "move";
2994 value "params" string: "prior";
2995 }
2996 group "Elm_Config_Binding_Key" struct {
2997 value "context" int: 0;
2998 value "key" string: "Next";
2999 value "action" string: "move";
3000 value "params" string: "next";
3001 }
3002 group "Elm_Config_Binding_Key" struct {
3003 value "context" int: 0;
3004 value "key" string: "KP_Next";
3005 value "action" string: "move";
3006 value "params" string: "next";
3007 }
3008 group "Elm_Config_Binding_Key" struct {
3009 value "context" int: 0;
3010 value "key" string: "Home";
3011 value "action" string: "move";
3012 value "params" string: "first";
3013 }
3014 group "Elm_Config_Binding_Key" struct {
3015 value "context" int: 0;
3016 value "key" string: "KP_Home";
3017 value "action" string: "move";
3018 value "params" string: "first";
3019 }
3020 group "Elm_Config_Binding_Key" struct {
3021 value "context" int: 0;
3022 value "key" string: "End";
3023 value "action" string: "move";
3024 value "params" string: "last";
3025 }
3026 group "Elm_Config_Binding_Key" struct {
3027 value "context" int: 0;
3028 value "key" string: "KP_End";
3029 value "action" string: "move";
3030 value "params" string: "last";
3031 }
3032 group "Elm_Config_Binding_Key" struct {
3033 value "context" int: 0;
3034 value "key" string: "Return";
3035 value "action" string: "select";
3036 value "params" string: "";
3037 }
3038 group "Elm_Config_Binding_Key" struct {
3039 value "context" int: 0;
3040 value "key" string: "KP_Enter";
3041 value "action" string: "select";
3042 value "params" string: "";
3043 }
3044 group "Elm_Config_Binding_Key" struct {
3045 value "context" int: 0;
3046 value "key" string: "space";
3047 value "action" string: "select";
3048 value "params" string: "";
3049 }
3050 group "Elm_Config_Binding_Key" struct {
3051 value "context" int: 0;
3052 value "key" string: "Escape";
3053 value "action" string: "escape";
3054 value "params" string: "";
3055 }
3056 }
3057 }
2789 } 3058 }
2790} 3059}
diff --git a/data/elementary/themes/Makefile.am b/data/elementary/themes/Makefile.am
index 40ff6973c8..74ba32fa63 100644
--- a/data/elementary/themes/Makefile.am
+++ b/data/elementary/themes/Makefile.am
@@ -1037,6 +1037,7 @@ elementary/themes/edc/efl/text.edc \
1037elementary/themes/edc/efl/textpath.edc \ 1037elementary/themes/edc/efl/textpath.edc \
1038elementary/themes/edc/efl/tooltip.edc \ 1038elementary/themes/edc/efl/tooltip.edc \
1039elementary/themes/edc/efl/video.edc \ 1039elementary/themes/edc/efl/video.edc \
1040elementary/themes/edc/efl/list.edc \
1040elementary/themes/edc/efl/win.edc 1041elementary/themes/edc/efl/win.edc
1041 1042
1042elementary_fdo_actions_128_files = \ 1043elementary_fdo_actions_128_files = \
diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc
index 119f42eeba..0b43454863 100644
--- a/data/elementary/themes/default.edc
+++ b/data/elementary/themes/default.edc
@@ -168,6 +168,7 @@ collections {
168#include "edc/efl/button.edc" 168#include "edc/efl/button.edc"
169#include "edc/efl/calendar.edc" 169#include "edc/efl/calendar.edc"
170#include "edc/efl/nstate.edc" 170#include "edc/efl/nstate.edc"
171#include "edc/efl/list.edc"
171// XXX: mobile mode needs invisible scrollers... make signals that do this 172// XXX: mobile mode needs invisible scrollers... make signals that do this
172#include "edc/efl/scroller.edc" 173#include "edc/efl/scroller.edc"
173// XXX: mobile mode needs different entry setup 174// XXX: mobile mode needs different entry setup
diff --git a/data/elementary/themes/edc/efl/list.edc b/data/elementary/themes/edc/efl/list.edc
new file mode 100644
index 0000000000..2707924020
--- /dev/null
+++ b/data/elementary/themes/edc/efl/list.edc
@@ -0,0 +1,8 @@
1group { "efl/list";
2 inherit: "elm/list/base/default";
3}
4
5group { "efl/list/item";
6 inherit: "elm/list/item/default";
7}
8
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 4c78215646..17b689f07c 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -210,11 +210,18 @@ elm_legacy_eolian_files = \
210 lib/elementary/elm_slideshow_item.eo \ 210 lib/elementary/elm_slideshow_item.eo \
211 lib/elementary/elm_table.eo \ 211 lib/elementary/elm_table.eo \
212 lib/elementary/elm_thumb.eo \ 212 lib/elementary/elm_thumb.eo \
213 lib/elementary/efl_ui_list.eo \
214 lib/elementary/efl_ui_list_pan.eo \
215 lib/elementary/efl_ui_list_model.eo \
216 lib/elementary/efl_ui_list_relayout.eo \
217 lib/elementary/efl_ui_list_precise_layouter.eo \
218 lib/elementary/efl_ui_layout_factory.eo \
213 $(NULL) 219 $(NULL)
214 220
215elm_eolian_type_files = \ 221elm_eolian_type_files = \
216 lib/elementary/elm_general.eot \ 222 lib/elementary/elm_general.eot \
217 lib/elementary/efl_ui.eot 223 lib/elementary/efl_ui.eot \
224 lib/elementary/efl_ui_list_types.eot
218 225
219elm_public_eolian_c = $(elm_public_eolian_files:%.eo=%.eo.c) 226elm_public_eolian_c = $(elm_public_eolian_files:%.eo=%.eo.c)
220elm_public_eolian_h = $(elm_public_eolian_files:%.eo=%.eo.h) \ 227elm_public_eolian_h = $(elm_public_eolian_files:%.eo=%.eo.h) \
@@ -333,6 +340,8 @@ includesunstable_HEADERS = \
333 lib/elementary/elm_widget_thumb.h \ 340 lib/elementary/elm_widget_thumb.h \
334 lib/elementary/elm_widget_toolbar.h \ 341 lib/elementary/elm_widget_toolbar.h \
335 lib/elementary/efl_ui_video_private.h \ 342 lib/elementary/efl_ui_video_private.h \
343 lib/elementary/efl_ui_list_private.h \
344 lib/elementary/efl_ui_list_segarray.h \
336 lib/elementary/elm_widget_web.h \ 345 lib/elementary/elm_widget_web.h \
337 lib/elementary/efl_ui_clock.h \ 346 lib/elementary/efl_ui_clock.h \
338 lib/elementary/elm_code.h \ 347 lib/elementary/elm_code.h \
@@ -733,6 +742,10 @@ lib_elementary_libelementary_la_SOURCES = \
733 lib/elementary/efl_ui_focus_parent_provider_gen.c \ 742 lib/elementary/efl_ui_focus_parent_provider_gen.c \
734 lib/elementary/efl_ui_focus_util.c \ 743 lib/elementary/efl_ui_focus_util.c \
735 lib/elementary/elm_widget_item_static_focus.c \ 744 lib/elementary/elm_widget_item_static_focus.c \
745 lib/elementary/efl_ui_list.c \
746 lib/elementary/efl_ui_list_precise_layouter.c \
747 lib/elementary/efl_ui_list_segarray.c \
748 lib/elementary/efl_ui_layout_factory.c \
736 $(NULL) 749 $(NULL)
737 750
738 751
diff --git a/src/examples/elementary/Makefile.am b/src/examples/elementary/Makefile.am
index d1a3767d85..879a38f824 100644
--- a/src/examples/elementary/Makefile.am
+++ b/src/examples/elementary/Makefile.am
@@ -176,7 +176,14 @@ efl_thread_2.c \
176efl_thread_3.c \ 176efl_thread_3.c \
177efl_thread_4.c \ 177efl_thread_4.c \
178efl_thread_5.c \ 178efl_thread_5.c \
179efl_thread_6.c 179efl_thread_6.c \
180efl_thread_win32_1.c \
181efl_thread_win32_2.c \
182efl_thread_win32_3.c \
183efl_thread_win32_4.c \
184efl_ui_list_example_1.c \
185efl_ui_list_example_2.c \
186efl_ui_list_example_3.c
180 187
181if HAVE_CXX11 188if HAVE_CXX11
182SRCS += \ 189SRCS += \
@@ -208,7 +215,8 @@ twitter_example_01.edc \
208evas3d_map_example.edc \ 215evas3d_map_example.edc \
209theme_example.edc \ 216theme_example.edc \
210layout_example.edc \ 217layout_example.edc \
211codegen_example.edc 218codegen_example.edc \
219efl_ui_list_example.edc
212 220
213EDJS = $(EDCS:%.edc=%.edj) 221EDJS = $(EDCS:%.edc=%.edj)
214 222
@@ -230,13 +238,15 @@ files_DATA += \
230 layout_example.edj\ 238 layout_example.edj\
231 codegen_example.edj \ 239 codegen_example.edj \
232 evas3d_map_example.edj \ 240 evas3d_map_example.edj \
233 twitter_example_01.edj 241 twitter_example_01.edj \
242 efl_ui_list_example.edj
234 243
235CLEANFILES = \ 244CLEANFILES = \
236 theme_example.edj \ 245 theme_example.edj \
237 layout_example.edj\ 246 layout_example.edj\
238 evas3d_map_example.edj \ 247 evas3d_map_example.edj \
239 twitter_example_01.edj 248 twitter_example_01.edj \
249 efl_ui_list_example.edj
240 250
241clean-local: 251clean-local:
242 rm -f *.epb *.cfg *.cfg.bkp 252 rm -f *.epb *.cfg *.cfg.bkp
@@ -382,7 +392,10 @@ efl_thread_2 \
382efl_thread_3 \ 392efl_thread_3 \
383efl_thread_4 \ 393efl_thread_4 \
384efl_thread_5 \ 394efl_thread_5 \
385efl_thread_6 395efl_thread_6 \
396efl_ui_list_example_1 \
397efl_ui_list_example_2 \
398efl_ui_list_example_3
386#benchmark3d 399#benchmark3d
387#sphere-hunter 400#sphere-hunter
388 401
@@ -594,7 +607,7 @@ screenshots: examples
594 convert $(HTML_SS_DIR)/$${SS_FILE} $(LATEX_SS_DIR)/$${SS_FILE/.png/.eps} ; \ 607 convert $(HTML_SS_DIR)/$${SS_FILE} $(LATEX_SS_DIR)/$${SS_FILE/.png/.eps} ; \
595 done 608 done
596 609
597EXTRA_DIST = dict.txt layout_example.edc theme_example.edc codegen_example.edc evas3d_map_example.edc twitter_example_01.edc performance/layout.edc performance/background.png performance/target_texture.png sphere_hunter/sphere_hunter.edc sphere_hunter/score.jpg sphere_hunter/EFL_victory.png sphere_hunter/EFL_defeat.png codegen_example_generated.c codegen_example_generated.h codegen_example.edj prefs_example_01.epc prefs_example_02.epc prefs_example_03.epc prefs_example_03.edc 610EXTRA_DIST = dict.txt layout_example.edc theme_example.edc codegen_example.edc evas3d_map_example.edc twitter_example_01.edc efl_ui_list_example.edc performance/layout.edc performance/background.png performance/target_texture.png sphere_hunter/sphere_hunter.edc sphere_hunter/score.jpg sphere_hunter/EFL_victory.png sphere_hunter/EFL_defeat.png codegen_example_generated.c codegen_example_generated.h codegen_example.edj prefs_example_01.epc prefs_example_02.epc prefs_example_03.epc prefs_example_03.edc
598 611
599 612
600examples: $(examples_PROGRAMS) $(EDJS) 613examples: $(examples_PROGRAMS) $(EDJS)
diff --git a/src/examples/elementary/efl_ui_list_example.edc b/src/examples/elementary/efl_ui_list_example.edc
new file mode 100644
index 0000000000..3b46863b71
--- /dev/null
+++ b/src/examples/elementary/efl_ui_list_example.edc
@@ -0,0 +1,280 @@
1
2#define FN_COL_DEFAULT 255 255 255 255; color3: 0 0 0 128
3#define FN_COL_DISABLE 21 21 21 255; color3: 255 255 255 25;
4#define FN_COL_HIGHLIGHT 51 153 255 255; color2: 51 153 255 24; color3: 51 153 255 18
5#define FIXED_SIZE(_WIDTH, _HEIGHT) \
6 min: _WIDTH _HEIGHT; max: _WIDTH _HEIGHT; fixed: 1 1;
7
8
9collections {
10
11group {
12 name: "elm/list/item/custom";
13 alias: "elm/list/item/default";
14 data.item: "selectraise" "on";
15 data.item: "focusraise" "on";
16 parts {
17 part { name: "event"; type: RECT;
18 description { state: "default" 0.0;
19 color: 0 0 0 0;
20 }
21 description { state: "disabled" 0.0;
22 inherit: "default" 0.0;
23 visible: 0;
24 }
25 }
26 part { name: "base"; type: RECT; mouse_events: 0;
27 description { state: "default" 0.0;
28 color: 46 46 56 255;
29 color_class: "list_item_base_odd";
30 }
31 description { state: "odd" 0.0;
32 color: 56 56 56 255;
33 color_class: "list_item_base_odd";
34 }
35 }
36 program {
37 signal: "elm,state,odd"; source: "elm";
38 action: STATE_SET "odd" 1.0;
39 target: "base";
40 }
41 program {
42 signal: "elm,state,even"; source: "elm";
43 action: STATE_SET "default" 0.0;
44 target: "base";
45 }
46 part { name: "sel_shadow"; mouse_events: 0;
47 description { state: "default" 0.0;
48 visible: 0;
49 }
50 description { state: "selected" 0.0;
51 inherit: "default" 0.0;
52 visible: 1;
53 }
54 }
55 part { name: "sel_base"; mouse_events: 0;
56 description { state: "default" 0.0;
57 fill.smooth: 0;
58 visible: 0;
59 fill { size { relative: 0.0 1.0; offset: 120 0; } }
60 }
61 description { state: "selected" 0.0;
62 inherit: "default" 0.0;
63 visible: 1;
64 }
65 }
66 part { name: "sel_bevel"; mouse_events: 0;
67 description { state: "default" 0.0;
68 fill.smooth: 0;
69 visible: 0;
70 }
71 description { state: "selected" 0.0;
72 inherit: "default" 0.0;
73 visible: 1;
74 }
75 }
76 program {
77 signal: "elm,state,selected"; source: "elm";
78 action: STATE_SET "selected" 0.0;
79 target: "sel_shadow";
80 target: "sel_base";
81 target: "sel_bevel";
82 }
83 program {
84 signal: "elm,state,unselected"; source: "elm";
85 action: STATE_SET "default" 0.0;
86 target: "sel_shadow";
87 target: "sel_base";
88 target: "sel_bevel";
89 }
90 program {
91 signal: "elm,state,disabled"; source: "elm";
92 action: STATE_SET "disabled" 0.0;
93 target: "event";
94 }
95 program {
96 signal: "elm,state,enabled"; source: "elm";
97 action: STATE_SET "default" 0.0;
98 target: "event";
99 }
100
101 //##//
102 part { name: "elm.text"; type: TEXT; mouse_events: 0;
103 effect: SHADOW BOTTOM;
104 scale: 1;
105 description { state: "default" 0.0;
106 rel1.offset: 2 3;
107 rel1.relative: 1.0 0.0;
108 rel1.to_x: "elm.swallow.icon";
109 rel2.offset: -3 -3;
110 rel2.relative: 0.0 1.0;
111 rel2.to_x: "elm.swallow.end";
112 color: FN_COL_DEFAULT;
113 color_class: "list_item";
114 text { font: FN; size: 10;
115 min: 1 1;
116 ellipsis: -1;
117 align: 0.0 0.5;
118 text_class: "list_item";
119 }
120 }
121 description { state: "selected" 0.0;
122 inherit: "default" 0.0;
123 visible: 0;
124 }
125 description { state: "disabled" 0.0;
126 inherit: "default" 0.0;
127 visible: 0;
128 }
129 }
130 part { name: "label2"; type: TEXT; mouse_events: 0;
131 effect: SHADOW BOTTOM;
132 scale: 1;
133 description { state: "default" 0.0;
134 rel1.to: "elm.text";
135 rel2.to: "elm.text";
136 color: FN_COL_DISABLE;
137 color_class: "list_item_disabled";
138 text { font: FN; size: 10;
139 text_source: "elm.text";
140 align: 0.0 0.5;
141 text_class: "list_item";
142 }
143 visible: 0;
144 }
145 description { state: "selected" 0.0;
146 inherit: "default" 0.0;
147 visible: 0;
148 }
149 description { state: "disabled" 0.0;
150 inherit: "default" 0.0;
151 visible: 1;
152 }
153 }
154 part { name: "label3"; type: TEXT; mouse_events: 0;
155 effect: GLOW;
156 scale: 1;
157 description { state: "default" 0.0;
158 rel1.offset: -2 -3;
159 rel1.to: "elm.text";
160 rel2.offset: 1 1;
161 rel2.to: "elm.text";
162 color: FN_COL_HIGHLIGHT;
163 color_class: "list_item_selected";
164 text { font: FN; size: 10;
165 text_source: "elm.text";
166 align: 0.0 0.5;
167 text_class: "list_item";
168 }
169 visible: 0;
170 }
171 description { state: "selected" 0.0;
172 inherit: "default" 0.0;
173 visible: 1;
174 }
175 description { state: "disabled" 0.0;
176 inherit: "default" 0.0;
177 visible: 0;
178 }
179 }
180 program {
181 signal: "elm,state,selected"; source: "elm";
182 action: STATE_SET "selected" 0.0;
183 target: "elm.text";
184 target: "label2";
185 target: "label3";
186 }
187 program {
188 signal: "elm,state,unselected"; source: "elm";
189 action: STATE_SET "default" 0.0;
190 target: "elm.text";
191 target: "label2";
192 target: "label3";
193 }
194 program {
195 signal: "elm,state,disabled"; source: "elm";
196 action: STATE_SET "disabled" 0.0;
197 target: "elm.text";
198 target: "label2";
199 target: "label3";
200 }
201 program {
202 signal: "elm,state,enabled"; source: "elm";
203 action: STATE_SET "default" 0.0;
204 target: "elm.text";
205 target: "label2";
206 target: "label3";
207 }
208 //##//
209 part { name: "elm.swallow.icon"; type: SWALLOW;
210 description { state: "default" 0.0;
211 fixed: 1 0;
212 align: 0.0 0.5;
213 aspect: 1.0 1.0;
214 rel1.offset: 2 2;
215 rel2.relative: 0.0 1.0;
216 rel2.offset: 2 -3;
217 }
218 }
219 part { name: "elm.swallow.end"; type: SWALLOW;
220 description { state: "default" 0.0;
221 fixed: 1 0;
222 align: 1.0 0.5;
223 aspect: 1.0 1.0;
224 rel1.offset: -3 2;
225 rel1.relative: 1.0 0.0;
226 rel2.offset: -3 -3;
227 }
228 }
229 //##//
230
231 part { name: "sel_shine"; mouse_events: 0;
232 description { state: "default" 0.0;
233 rel1.offset: 0 -2;
234 rel1.to: "sel_base";
235 rel2.relative: 1.0 0.0;
236 rel2.offset: -1 2;
237 rel2.to: "sel_base";
238 visible: 0;
239 FIXED_SIZE(69, 5)
240 }
241 description { state: "selected" 0.0;
242 inherit: "default" 0.0;
243 visible: 1;
244 }
245 }
246 part { name: "event_block"; type: RECT;
247 description { state: "default" 0.0;
248 color: 0 0 0 0;
249 visible: 0;
250 }
251 description { state: "disabled" 0.0;
252 inherit: "default" 0.0;
253 visible: 1;
254 }
255 }
256 program {
257 signal: "elm,state,selected"; source: "elm";
258 action: STATE_SET "selected" 0.0;
259 target: "sel_shine";
260 }
261 program {
262 signal: "elm,state,unselected"; source: "elm";
263 action: STATE_SET "default" 0.0;
264 target: "sel_shine";
265 }
266 program {
267 signal: "elm,state,disabled"; source: "elm";
268 action: STATE_SET "disabled" 0.0;
269 target: "event_block";
270 }
271 program {
272 signal: "elm,state,enabled"; source: "elm";
273 action: STATE_SET "default" 0.0;
274 target: "event_block";
275 }
276 }
277}
278
279}
280
diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c
new file mode 100644
index 0000000000..488dca0dfb
--- /dev/null
+++ b/src/examples/elementary/efl_ui_list_example_1.c
@@ -0,0 +1,111 @@
1// gcc -o efl_ui_list_example_1 efl_ui_list_example_1.c `pkg-config --cflags --libs elementary`
2
3#ifdef HAVE_CONFIG_H
4# include "elementary_config.h"
5#else
6# define EFL_BETA_API_SUPPORT 1
7# define EFL_EO_API_SUPPORT 1
8#endif
9
10#include <Elementary.h>
11#include <Efl.h>
12#include <Eio.h>
13#include <stdio.h>
14
15#define NUM_ITEMS 400
16
17const char *styles[] = {
18 "odd",
19 "even"
20 };
21
22char edj_path[PATH_MAX];
23
24static void
25_realized_cb(void *data, const Efl_Event *event)
26{
27 Efl_Ui_List_Item_Event *ie = event->info;
28 if (!ie->layout) return;
29
30 Efl_Ui_Layout *layout = ie->layout;
31 elm_object_focus_allow_set(layout, EINA_TRUE);
32}
33
34/*
35static void
36_unrealized_cb(void *data EINA_UNUSED, const Efl_Event *event)
37{
38 Efl_Ui_List_Item_Event *ie = event->info;
39
40 efl_ui_view_model_set(ie->layout, NULL);
41 efl_del(ie->layout);
42}
43*/
44static Efl_Model*
45_make_model()
46{
47 Eina_Value vtext, vstyle;
48 Efl_Model_Item *model, *child;
49 unsigned int i, s;
50 char buf[256];
51
52 model = efl_add(EFL_MODEL_ITEM_CLASS, NULL);
53 eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
54
55 for (i = 0; i < (NUM_ITEMS); i++)
56 {
57 s = i%2;
58 child = efl_model_child_add(model);
59 eina_value_set(&vtext, styles[s]);
60 efl_model_property_set(child, "odd_style", &vtext);
61
62 snprintf(buf, sizeof(buf), "Item # %i", i);
63 eina_value_set(&vtext, buf);
64 efl_model_property_set(child, "name", &vtext);
65 }
66
67 eina_value_flush(&vtext);
68 return model;
69}
70
71EAPI_MAIN int
72elm_main(int argc, char **argv)
73{
74 Efl_Ui_Layout_Factory *factory;
75 Evas_Object *win, *li, *bx, *vbx;
76 Eo *model;
77
78 win = elm_win_util_standard_add("viewlist", "Viewlist");
79 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
80
81 elm_win_autodel_set(win, EINA_TRUE);
82
83 model = _make_model();
84
85 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
86 efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style");
87 efl_ui_model_connect(factory, "elm.text", "name");
88 efl_ui_layout_factory_theme_config(factory, "list", "item", "default");
89
90 li = efl_add(EFL_UI_LIST_CLASS, win);
91 efl_ui_list_layout_factory_set(li, factory);
92 efl_ui_view_model_set(li, model);
93 elm_box_pack_end(bx, li);
94
95 efl_event_callback_add(li, EFL_UI_LIST_EVENT_ITEM_REALIZED, _realized_cb, NULL);
96// efl_event_callback_add(li, EFL_UI_LIST_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL);
97
98 elm_win_resize_object_add(win, li);
99 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
100 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
101
102 //showall
103 evas_object_show(li);
104 evas_object_resize(win, 320, 320);
105 evas_object_show(win);
106
107 elm_run();
108
109 return 0;
110}
111ELM_MAIN()
diff --git a/src/examples/elementary/efl_ui_list_example_2.c b/src/examples/elementary/efl_ui_list_example_2.c
new file mode 100644
index 0000000000..9f37e322e5
--- /dev/null
+++ b/src/examples/elementary/efl_ui_list_example_2.c
@@ -0,0 +1,74 @@
1// gcc -o efl_ui_list_example_2 efl_ui_list_example_2.c `pkg-config --cflags --libs elementary`
2
3#ifdef HAVE_CONFIG_H
4# include "config.h"
5#else
6# define EFL_BETA_API_SUPPORT 1
7# define EFL_EO_API_SUPPORT 1
8#endif
9
10#include <Elementary.h>
11#include <Efl.h>
12#include <Eio.h>
13#include <stdio.h>
14
15#define EFL_MODEL_TEST_FILENAME_PATH "/tmp"
16
17static void
18_realized_cb(void *data, const Efl_Event *event)
19{
20 Efl_Ui_List_Item_Event *ie = event->info;
21 Eo *imf = data;
22 printf("realize %d\n", ie->index);
23
24 evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0);
25 evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
26
27 efl_ui_model_factory_connect(ie->layout, "elm.swallow.icon", imf);
28}
29
30EAPI_MAIN int
31elm_main(int argc, char **argv)
32{
33 Efl_Ui_Layout_Factory *factory;
34 Evas_Object *win;
35 Eo *imf, *model, *li;
36 char *dirname;
37
38 win = elm_win_util_standard_add("viewlist", "Viewlist");
39 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
40
41 elm_win_autodel_set(win, EINA_TRUE);
42
43 if (argv[1] != NULL) dirname = argv[1];
44 else dirname = EFL_MODEL_TEST_FILENAME_PATH;
45
46 model = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_added, dirname));
47 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
48 efl_ui_model_connect(factory, "elm.text", "filename");
49 efl_ui_layout_factory_theme_config(factory, "list", "item", "default");
50
51 li = efl_add(EFL_UI_LIST_CLASS, win);
52 efl_ui_list_layout_factory_set(li, factory);
53 efl_ui_view_model_set(li, model);
54
55 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
56 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
57
58
59 imf = efl_add(EFL_UI_IMAGE_FACTORY_CLASS, win);
60 efl_ui_model_connect(imf, "", "path"); //connect to "path" property
61 efl_event_callback_add(li, EFL_UI_LIST_EVENT_ITEM_REALIZED, _realized_cb, imf);
62
63 elm_win_resize_object_add(win, li);
64
65 //showall
66 evas_object_show(li);
67 evas_object_resize(win, 320, 320);
68 evas_object_show(win);
69
70 elm_run();
71
72 return 0;
73}
74ELM_MAIN()
diff --git a/src/examples/elementary/efl_ui_list_example_3.c b/src/examples/elementary/efl_ui_list_example_3.c
new file mode 100644
index 0000000000..3b35ec3528
--- /dev/null
+++ b/src/examples/elementary/efl_ui_list_example_3.c
@@ -0,0 +1,329 @@
1// gcc -o efl_ui_list_example_3 efl_ui_list_example_3.c `pkg-config --cflags --libs elementary`
2
3#ifdef HAVE_CONFIG_H
4# include "config.h"
5#else
6# define EFL_BETA_API_SUPPORT 1
7# define EFL_EO_API_SUPPORT 1
8#endif
9
10#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
11
12#include <Eo.h>
13#include <Elementary.h>
14#include <Efl.h>
15#include <Eio.h>
16#include <stdio.h>
17
18const char *subtexts[] = {
19 "Captain",
20 "Princess ",
21 "Actor",
22 "Translator",
23 "Jedi",
24 "Singer",
25 "Fighter"
26 };
27
28const char *texts[] = {
29 "Morpheus",
30 "Leia",
31 "Chuck Norris",
32 "Nyota Uhura",
33 "Darth Vader",
34 "Elvis Presley",
35 "Chun-Li"
36 };
37
38char edj_path[PATH_MAX];
39
40struct _Priv_Data
41{
42 Eo *model;
43 Evas_Object *list1;
44 Evas_Object *list2;
45 Evas_Object *e_name;
46 Evas_Object *e_occ;
47 Evas_Object *selected;
48};
49typedef struct _Priv_Data Priv_Data;
50
51static void
52_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
53{
54 Priv_Data *priv = (Priv_Data*)data;
55 efl_unref(priv->model);
56}
57
58static void
59_focused(void *data, const Efl_Event *event)
60{
61 Priv_Data *priv = (Priv_Data*)data;
62 priv->selected = efl_ui_focus_manager_focus_get(event->object);
63}
64
65static void
66_bt_add_clicked(void *data, Evas_Object *obj, void *event_info)
67{
68 Priv_Data *priv = (Priv_Data*)data;
69 Eina_Value vtext, value;
70 Efl_Model_Item *child;
71
72 eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
73 eina_value_setup(&value, EINA_VALUE_TYPE_UCHAR);
74 child = efl_model_child_add(priv->model);
75
76 eina_value_set(&vtext, elm_object_text_get(priv->e_name));
77 efl_model_property_set(child, "name", &vtext);
78
79 eina_value_set(&vtext, elm_object_text_get(priv->e_occ));
80 efl_model_property_set(child, "occupation", &vtext);
81
82 eina_value_set(&value, EINA_FALSE);
83 efl_model_property_set(child, "selected", &vtext);
84
85 eina_value_flush(&vtext);
86 eina_value_flush(&value);
87}
88
89static void
90_bt_del_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
91{
92 Priv_Data *priv = (Priv_Data*)data;
93 Eo *child = NULL;
94
95 //l = efl_ui_focus_manager_focus_get(priv->list1);
96 if(priv->selected)
97 {
98 printf("focused %p\n", priv->selected);
99 child = efl_ui_view_model_get(priv->selected);
100 efl_model_child_del(priv->model, child);
101 priv->selected = NULL;
102 }
103 else
104 {
105 printf("no focused\n");
106 }
107}
108
109static void
110_bt_none_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
111{
112 Evas_Object *li = data;
113 efl_ui_list_select_mode_set(li, ELM_OBJECT_SELECT_MODE_NONE);
114}
115
116static void
117_bt_donly_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
118{
119 Evas_Object *li = data;
120 efl_ui_list_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
121}
122
123static void
124_bt_default_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
125{
126 Evas_Object *li = data;
127 efl_ui_list_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DEFAULT);
128}
129
130static void
131_bt_set_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
132{
133 Priv_Data *priv = data;
134 efl_ui_view_model_set(priv->list2, priv->model);
135}
136
137static void
138_bt_unset_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
139{
140 Evas_Object *li = data;
141 efl_ui_view_model_set(li, NULL);
142}
143static void
144_realized_1_cb(void *data EINA_UNUSED, const Efl_Event *event)
145{
146 Efl_Ui_List_Item_Event *ie = event->info;
147
148 evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0);
149 evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
150 efl_ui_model_connect(ie->layout, "elm.text", "name");
151 efl_ui_model_connect(ie->layout, "signal/elm,state,%v", "odd_style");
152}
153
154static void
155_realized_2_cb(void *data EINA_UNUSED, const Efl_Event *event)
156{
157 Efl_Ui_List_Item_Event *ie = event->info;
158 printf("relized 2\n");
159
160 elm_object_focus_allow_set(ie->layout, EINA_TRUE);
161 evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0);
162 evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
163 efl_ui_model_connect(ie->layout, "elm.text", "occupation");
164}
165
166static Efl_Model*
167_make_model()
168{
169 Eina_Value vtext, value;
170 Efl_Model_Item *model, *child;
171 unsigned int i, len;
172
173 model = efl_add(EFL_MODEL_ITEM_CLASS, NULL);
174 eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
175 eina_value_setup(&value, EINA_VALUE_TYPE_UCHAR);
176
177 len = sizeof(texts)/sizeof(const char*);
178 for (i = 0; i < (len); i++)
179 {
180 child = efl_model_child_add(model);
181
182 i%2 ? eina_value_set(&vtext, "even") : eina_value_set(&vtext, "odd");
183 efl_model_property_set(child, "odd_style", &vtext);
184
185 eina_value_set(&vtext, texts[(i % len)]);
186 efl_model_property_set(child, "name", &vtext);
187
188 eina_value_set(&vtext, subtexts[(i % len)]);
189 efl_model_property_set(child, "occupation", &vtext);
190
191 eina_value_set(&value, EINA_FALSE);
192 efl_model_property_set(child, "selected", &value);
193 }
194
195 eina_value_flush(&vtext);
196 eina_value_flush(&value);
197 return model;
198}
199
200EAPI_MAIN int
201elm_main(int argc, char **argv)
202{
203 Priv_Data *priv;
204 Evas_Object *win, *bx, *vbx, *bt;
205 Efl_Ui_Layout_Factory *factory;
206
207 priv = alloca(sizeof(Priv_Data));
208 memset(priv, 0, sizeof(Priv_Data));
209
210 win = elm_win_util_standard_add("viewlist", "Viewlist");
211 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
212 elm_win_autodel_set(win, EINA_TRUE);
213
214 bx = elm_box_add(win);
215 elm_box_horizontal_set(bx, EINA_TRUE);
216 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
217 elm_win_resize_object_add(win, bx);
218 evas_object_show(bx);
219
220 priv->model = _make_model();
221 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
222 efl_ui_model_connect(factory, "elm.text", "filename");
223 efl_ui_layout_factory_theme_config(factory, "list", "item", "default");
224
225 priv->list1 = efl_add(EFL_UI_LIST_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
226 efl_event_callback_add(priv->list1, EFL_UI_LIST_EVENT_ITEM_REALIZED, _realized_1_cb, priv);
227 evas_object_size_hint_weight_set(priv->list1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
228 evas_object_size_hint_align_set(priv->list1, EVAS_HINT_FILL, EVAS_HINT_FILL);
229 elm_box_pack_end(bx, priv->list1);
230 efl_ui_list_layout_factory_set(priv->list1, factory);
231
232 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
233 efl_ui_model_connect(factory, "elm.text", "filename");
234 efl_ui_model_connect(factory, "signal/elm,state,%v", "selected");
235 efl_ui_layout_factory_theme_config(factory, "list", "item", "default");
236 priv->list2 = efl_add(EFL_UI_LIST_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
237 efl_event_callback_add(priv->list2, EFL_UI_LIST_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2);
238 evas_object_size_hint_weight_set(priv->list2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
239 evas_object_size_hint_align_set(priv->list2, EVAS_HINT_FILL, EVAS_HINT_FILL);
240 efl_ui_list_layout_factory_set(priv->list2, factory);
241
242 vbx = elm_box_add(win);
243 elm_box_pack_end(bx, vbx);
244
245 bt = elm_label_add(win);
246 elm_object_text_set(bt, "Name:");
247 elm_box_pack_end(vbx, bt);
248 evas_object_show(bt);
249
250 priv->e_name = elm_entry_add(win);
251 elm_box_pack_end(vbx, priv->e_name);
252 elm_object_text_set(priv->e_name, "Neo");
253 evas_object_size_hint_weight_set(priv->e_name, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
254 evas_object_size_hint_align_set(priv->e_name, EVAS_HINT_FILL, EVAS_HINT_FILL);
255 evas_object_show(priv->e_name);
256
257 bt = elm_label_add(win);
258 elm_object_text_set(bt, "Occupation:");
259 elm_box_pack_end(vbx, bt);
260 evas_object_show(bt);
261
262 priv->e_occ = elm_entry_add(win);
263 elm_box_pack_end(vbx, priv->e_occ);
264 elm_object_text_set(priv->e_occ, "Chosen");
265 evas_object_size_hint_weight_set(priv->e_occ, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
266 evas_object_size_hint_align_set(priv->e_occ, EVAS_HINT_FILL, EVAS_HINT_FILL);
267 evas_object_show(priv->e_occ);
268
269 bt = elm_button_add(win);
270 elm_object_text_set(bt, "Add Item");
271 evas_object_smart_callback_add(bt, "clicked", _bt_add_clicked, priv);
272 evas_object_show(bt);
273 elm_box_pack_end(vbx, bt);
274
275 bt = elm_button_add(win);
276 elm_object_text_set(bt, "Delete Item");
277 evas_object_smart_callback_add(bt, "clicked", _bt_del_clicked, priv);
278 evas_object_show(bt);
279 elm_box_pack_end(vbx, bt);
280
281 bt = elm_button_add(win);
282 elm_object_text_set(bt, "Select None");
283 evas_object_smart_callback_add(bt, "clicked", _bt_none_clicked, priv->list2);
284 evas_object_show(bt);
285 elm_box_pack_end(vbx, bt);
286
287 bt = elm_button_add(win);
288 elm_object_text_set(bt, "Select DisplayOnly");
289 evas_object_smart_callback_add(bt, "clicked", _bt_donly_clicked, priv->list2);
290 evas_object_show(bt);
291 elm_box_pack_end(vbx, bt);
292
293 bt = elm_button_add(win);
294 elm_object_text_set(bt, "Select Default");
295 evas_object_smart_callback_add(bt, "clicked", _bt_default_clicked, priv->list2);
296 evas_object_show(bt);
297 elm_box_pack_end(vbx, bt);
298
299 bt = elm_button_add(win);
300 elm_object_text_set(bt, "Model Set");
301 evas_object_smart_callback_add(bt, "clicked", _bt_set_clicked, priv);
302 evas_object_show(bt);
303 elm_box_pack_end(vbx, bt);
304
305
306 bt = elm_button_add(win);
307 elm_object_text_set(bt, "Model Unset");
308 evas_object_smart_callback_add(bt, "clicked", _bt_unset_clicked, priv->list2);
309 evas_object_show(bt);
310 elm_box_pack_end(vbx, bt);
311
312 elm_box_pack_end(bx, priv->list2);
313 efl_event_callback_add(priv->list2, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _focused ,priv);
314
315 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, priv);
316
317 //showall
318 evas_object_show(priv->list1);
319 evas_object_show(priv->list2);
320 evas_object_show(bx);
321 evas_object_show(vbx);
322 evas_object_resize(win, 400, 320);
323 evas_object_show(win);
324
325 elm_run();
326
327 return 0;
328}
329ELM_MAIN()
diff --git a/src/examples/elementary/layout_model_connect.c b/src/examples/elementary/layout_model_connect.c
index b856692246..aa34478f08 100644
--- a/src/examples/elementary/layout_model_connect.c
+++ b/src/examples/elementary/layout_model_connect.c
@@ -127,7 +127,6 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
127 elm_object_part_content_set(panes, "right", bxr); 127 elm_object_part_content_set(panes, "right", bxr);
128 128
129 /*Label widget */ 129 /*Label widget */
130
131 _label_init(win, bxr, "FILENAME:"); 130 _label_init(win, bxr, "FILENAME:");
132 priv->label = _label_init(win, bxr, ""); 131 priv->label = _label_init(win, bxr, "");
133 efl_ui_model_connect(priv->label, "default", "path"); //connect "default" to "filename" property 132 efl_ui_model_connect(priv->label, "default", "path"); //connect "default" to "filename" property
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 66b3c8fd14..c1422ae838 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -280,6 +280,7 @@ EAPI extern Elm_Version *elm_version;
280#include <elm_win.h> 280#include <elm_win.h>
281 281
282#ifdef EFL_EO_API_SUPPORT 282#ifdef EFL_EO_API_SUPPORT
283#include "efl_ui_list_segarray.h"
283# include <efl_config_global.eo.h> 284# include <efl_config_global.eo.h>
284# include <efl_ui_widget_part.eo.h> 285# include <efl_ui_widget_part.eo.h>
285# include <efl_ui_widget_part_bg.eo.h> 286# include <efl_ui_widget_part_bg.eo.h>
@@ -312,6 +313,13 @@ EAPI extern Elm_Version *elm_version;
312# include <efl_ui_spin.eo.h> 313# include <efl_ui_spin.eo.h>
313# include <efl_ui_spin_button.eo.h> 314# include <efl_ui_spin_button.eo.h>
314# include <efl_ui_image_factory.eo.h> 315# include <efl_ui_image_factory.eo.h>
316# include <efl_ui_slider_interval.eo.h>
317# include <efl_ui_layout_factory.eo.h>
318# include <efl_ui_list_types.eot.h>
319# include <efl_ui_list_model.eo.h>
320# include <efl_ui_list_relayout.eo.h>
321# include <efl_ui_list.eo.h>
322# include <efl_ui_list_pan.eo.h>
315#endif 323#endif
316 324
317/* include deprecated calls last of all */ 325/* include deprecated calls last of all */
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 24fb83fd6c..5981fc1a54 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -1849,6 +1849,7 @@ _prop_future_then_cb(void* data, Efl_Event const*event)
1849 Efl_Ui_Layout_Sub_Connect *sc = data; 1849 Efl_Ui_Layout_Sub_Connect *sc = data;
1850 const Eina_Value_Type *vtype; 1850 const Eina_Value_Type *vtype;
1851 Eina_Value *value = (Eina_Value *)((Efl_Future_Event_Success*)event->info)->value; 1851 Eina_Value *value = (Eina_Value *)((Efl_Future_Event_Success*)event->info)->value;
1852 Eina_Stringshare *selected;
1852 char *text; 1853 char *text;
1853 1854
1854 sc->future = NULL; 1855 sc->future = NULL;
@@ -1858,6 +1859,18 @@ _prop_future_then_cb(void* data, Efl_Event const*event)
1858 { 1859 {
1859 eina_value_get(value, &text); 1860 eina_value_get(value, &text);
1860 _view_update(sc, text); 1861 _view_update(sc, text);
1862 return;
1863 }
1864
1865 selected = eina_stringshare_add("selected");
1866 if (vtype == EINA_VALUE_TYPE_UCHAR && sc->property == selected)
1867 {
1868 Eina_Bool sb = EINA_FALSE;
1869 eina_value_get(value, &sb);
1870 if (sb)
1871 _view_update(sc, "selected");
1872 else
1873 _view_update(sc, "unselected");
1861 } 1874 }
1862 else 1875 else
1863 { 1876 {
@@ -1865,6 +1878,8 @@ _prop_future_then_cb(void* data, Efl_Event const*event)
1865 _view_update(sc, text); 1878 _view_update(sc, text);
1866 free(text); 1879 free(text);
1867 } 1880 }
1881
1882 eina_stringshare_del(selected);
1868} 1883}
1869 1884
1870static void 1885static void
@@ -1904,6 +1919,7 @@ _efl_model_properties_changed_cb(void *data, const Efl_Event *event)
1904 { 1919 {
1905 if (sc->property == ss_prop) 1920 if (sc->property == ss_prop)
1906 { 1921 {
1922 if (sc->future) efl_future_cancel(sc->future);
1907 sc->future = efl_model_property_get(pd->model, sc->property); 1923 sc->future = efl_model_property_get(pd->model, sc->property);
1908 efl_future_then(sc->future, &_prop_future_then_cb, &_prop_future_error_cb, NULL, sc); 1924 efl_future_then(sc->future, &_prop_future_then_cb, &_prop_future_error_cb, NULL, sc);
1909 } 1925 }
@@ -1915,9 +1931,15 @@ _efl_model_properties_changed_cb(void *data, const Efl_Event *event)
1915EOLIAN static void 1931EOLIAN static void
1916_efl_ui_layout_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, Efl_Model *model) 1932_efl_ui_layout_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, Efl_Model *model)
1917{ 1933{
1934 Efl_Ui_Layout_Sub_Connect *sc;
1935 Eina_List *l;
1936
1918 if (pd->model) 1937 if (pd->model)
1919 { 1938 {
1920 efl_event_callback_del(pd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, pd); 1939 efl_event_callback_del(pd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, pd);
1940 EINA_LIST_FOREACH(pd->prop_connect, l, sc)
1941 if (sc->future) efl_future_cancel(sc->future);
1942
1921 efl_unref(pd->model); 1943 efl_unref(pd->model);
1922 pd->model = NULL; 1944 pd->model = NULL;
1923 } 1945 }
@@ -1929,7 +1951,15 @@ _efl_ui_layout_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd
1929 efl_event_callback_add(pd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, pd); 1951 efl_event_callback_add(pd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, pd);
1930 } 1952 }
1931 else 1953 else
1932 return; 1954 {
1955 EINA_LIST_FOREACH(pd->prop_connect, l, sc)
1956 {
1957 if (!sc->is_signal)
1958 elm_layout_text_set(obj, sc->name, NULL);
1959 }
1960
1961 return;
1962 }
1933 1963
1934 if (pd->prop_connect) 1964 if (pd->prop_connect)
1935 _efl_ui_layout_view_model_update(pd); 1965 _efl_ui_layout_view_model_update(pd);
diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c
new file mode 100644
index 0000000000..6fe150dc3d
--- /dev/null
+++ b/src/lib/elementary/efl_ui_layout_factory.c
@@ -0,0 +1,127 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_priv.h"
7
8#define MY_CLASS EFL_UI_LAYOUT_FACTORY_CLASS
9#define MY_CLASS_NAME "Efl.Ui.Layout_Factory"
10
11typedef struct _Efl_Ui_Layout_Factory_Data
12{
13 Eina_Array *layouts;
14 Eina_Hash *connects;
15 Eina_Stringshare *klass;
16 Eina_Stringshare *group;
17 Eina_Stringshare *style;
18} Efl_Ui_Layout_Factory_Data;
19
20Eina_Bool
21_model_connect(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata)
22{
23 Eo *layout = fdata;
24 Eina_Stringshare *name = key;
25 Eina_Stringshare *property = data;
26
27 efl_ui_model_connect(layout, name, property);
28
29 return EINA_TRUE;
30}
31
32EOLIAN static Eo *
33_efl_ui_layout_factory_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Factory_Data *pd)
34{
35 obj = efl_constructor(efl_super(obj, MY_CLASS));
36
37 pd->klass = NULL;
38 pd->group = NULL;
39 pd->style = NULL;
40 pd->layouts = eina_array_new(8);
41 pd->connects = eina_hash_stringshared_new(EINA_FREE_CB(eina_stringshare_del));
42
43 return obj;
44}
45
46EOLIAN static void
47_efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data *pd)
48{
49 Eina_Array_Iterator iterator;
50 Eo *layout;
51 unsigned int i;
52
53 eina_stringshare_del(pd->klass);
54 eina_stringshare_del(pd->group);
55 eina_stringshare_del(pd->style);
56
57 EINA_ARRAY_ITER_NEXT(pd->layouts, i, layout, iterator)
58 efl_parent_set(layout, NULL);
59
60 eina_array_free(pd->layouts);
61 eina_hash_free(pd->connects);
62
63 efl_destructor(efl_super(obj, MY_CLASS));
64}
65
66EOLIAN static Efl_Gfx *
67_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd
68 , Efl_Model *model, Efl_Gfx *parent)
69{
70 Efl_Gfx *layout;
71 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
72/*
73 if (eina_array_count(pd->layouts))
74 {
75 layout = eina_array_pop(pd->layouts);
76 efl_parent_set(layout, parent);
77 efl_ui_view_model_set(layout, model);
78 }
79 else */
80 {
81 layout = efl_add(EFL_UI_LAYOUT_CLASS, parent,
82 efl_ui_view_model_set(efl_added, model),
83 elm_layout_theme_set(efl_added, pd->klass, pd->group, pd->style));
84
85 eina_hash_foreach(pd->connects, _model_connect, layout);
86
87 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
88 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
89 }
90
91 return layout;
92}
93
94EOLIAN static void
95_efl_ui_layout_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd EINA_UNUSED, Efl_Gfx *layout)
96{
97 efl_ui_view_model_set(layout, NULL);
98 efl_del(layout);
99}
100
101EOLIAN static void
102_efl_ui_layout_factory_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd
103 , const char *name, const char *property)
104{
105 Eina_Stringshare *ss_name, *ss_prop;
106 ss_name = eina_stringshare_add(name);
107
108 if (property == NULL)
109 {
110 eina_hash_del(pd->connects, ss_name, NULL);
111 return;
112 }
113
114 ss_prop = eina_stringshare_add(property);
115 eina_stringshare_del(eina_hash_set(pd->connects, ss_name, ss_prop));
116}
117
118EOLIAN static void
119_efl_ui_layout_factory_theme_config(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd
120 , const char *klass, const char *group, const char *style)
121{
122 eina_stringshare_replace(&pd->klass, klass);
123 eina_stringshare_replace(&pd->group, group);
124 eina_stringshare_replace(&pd->style, style);
125}
126
127#include "efl_ui_layout_factory.eo.c"
diff --git a/src/lib/elementary/efl_ui_layout_factory.eo b/src/lib/elementary/efl_ui_layout_factory.eo
new file mode 100644
index 0000000000..e712900d1c
--- /dev/null
+++ b/src/lib/elementary/efl_ui_layout_factory.eo
@@ -0,0 +1,22 @@
1class Efl.Ui.Layout_Factory (Efl.Object, Efl.Ui.Factory)
2{
3 [[Efl Ui Layout Factory class]]
4 methods {
5 theme_config {
6 [[]]
7 params {
8 klass: string; [[The class of the group.]]
9 group: string; [[The group.]]
10 style: string; [[The style to used.]]
11 }
12 }
13 }
14
15 implements {
16 Efl.Object.constructor;
17 Efl.Object.destructor;
18 Efl.Ui.Factory.create;
19 Efl.Ui.Factory.release;
20 Efl.Ui.Model.Connect.connect;
21 }
22}
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
new file mode 100644
index 0000000000..4a70ab5bf4
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list.c
@@ -0,0 +1,668 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#define ELM_ACCESS_PROTECTED
5#define ELM_ACCESS_WIDGET_ACTION_PROTECTED
6#define EFL_ACCESS_SELECTION_PROTECTED
7
8#include <Elementary.h>
9#include "efl_ui_list_private.h"
10#include "efl_ui_list_precise_layouter.eo.h"
11
12#include <assert.h>
13
14#define MY_CLASS EFL_UI_LIST_CLASS
15#define MY_CLASS_NAME "Efl.Ui.List"
16
17#define MY_PAN_CLASS EFL_UI_LIST_PAN_CLASS
18
19#define SIG_CHILD_ADDED "child,added"
20#define SIG_CHILD_REMOVED "child,removed"
21#define SELECTED_PROP "selected"
22
23static const Evas_Smart_Cb_Description _smart_callbacks[] = {
24 {SIG_CHILD_ADDED, ""},
25 {SIG_CHILD_REMOVED, ""},
26 {NULL, NULL}
27};
28
29void _efl_ui_list_custom_layout(Efl_Ui_List *);
30void _efl_ui_list_item_select_set(Efl_Ui_List_LayoutItem*, Eina_Bool);
31static void _layout(Efl_Ui_List_Data* pd);
32
33static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
34static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
35static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
36
37static const Elm_Action key_actions[] = {
38 {"move", _key_action_move},
39 {"select", _key_action_select},
40 {"escape", _key_action_escape},
41 {NULL, NULL}
42};
43
44EOLIAN static void
45_efl_ui_list_pan_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd)
46{
47 evas_object_smart_changed(psd->wobj);
48}
49
50
51EOLIAN static void
52_efl_ui_list_pan_elm_pan_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord x, Evas_Coord y)
53{
54 if ((x == psd->x) && (y == psd->y)) return;
55
56 psd->x = x;
57 psd->y = y;
58
59 evas_object_smart_changed(psd->wobj);
60}
61
62EOLIAN static void
63_efl_ui_list_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
64{
65 if (x) *x = psd->x;
66 if (y) *y = psd->y;
67}
68
69EOLIAN static void
70_efl_ui_list_pan_elm_pan_pos_max_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
71{
72 Evas_Coord ow, oh;
73 Eina_Size2D min;
74
75 elm_interface_scrollable_content_viewport_geometry_get
76 (psd->wobj, NULL, NULL, &ow, &oh);
77
78 min = efl_ui_list_model_min_size_get(psd->wobj);
79 ow = min.w - ow;
80 if (ow < 0) ow = 0;
81 oh = min.h - oh;
82 if (oh < 0) oh = 0;
83
84 if (x) *x = ow;
85 if (y) *y = oh;
86}
87
88EOLIAN static void
89_efl_ui_list_pan_elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd EINA_UNUSED, Evas_Coord *x, Evas_Coord *y)
90{
91 if (x) *x = 0;
92 if (y) *y = 0;
93}
94
95EOLIAN static void
96_efl_ui_list_pan_elm_pan_content_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *w, Evas_Coord *h)
97{
98 Eina_Size2D min;
99 min = efl_ui_list_model_min_size_get(psd->wobj);
100
101 if (w) *w = min.w;
102 if (h) *h = min.h;
103}
104
105EOLIAN static void
106_efl_ui_list_pan_efl_object_destructor(Eo *obj, Efl_Ui_List_Pan_Data *psd EINA_UNUSED)
107{
108 efl_destructor(efl_super(obj, MY_PAN_CLASS));
109}
110
111#include "efl_ui_list_pan.eo.c"
112
113static Eina_Bool
114_efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind)
115{
116 const Eina_Array *properties;
117 Eina_Array_Iterator iter_prop;
118 Eina_Stringshare *property;
119 Eina_Bool ret = EINA_FALSE;
120 unsigned i = 0;
121
122 EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE);
123 EINA_SAFETY_ON_NULL_RETURN_VAL(propfind, EINA_FALSE);
124
125 properties = efl_model_properties_get(model);
126
127 EINA_ARRAY_ITER_NEXT(properties, i, property, iter_prop)
128 {
129 if (property == propfind)
130 {
131 ret = EINA_TRUE;
132 break;
133 }
134 }
135 return ret;
136}
137
138static void
139_on_item_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
140{
141 Evas_Event_Mouse_Down *ev = event_info;
142 Efl_Ui_List_LayoutItem *item = data;
143
144 if (ev->button != 1) return;
145 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
146
147 _efl_ui_list_item_select_set(item, EINA_TRUE);
148}
149
150static void
151_count_then(void * data, Efl_Event const* event EINA_UNUSED)
152{
153 Efl_Ui_List_Data *pd = data;
154 EINA_SAFETY_ON_NULL_RETURN(pd);
155
156 pd->count_future = NULL;
157 _layout(pd);
158}
159
160static void
161_count_error(void * data, Efl_Event const* event EINA_UNUSED)
162{
163 Efl_Ui_List_Data *pd = data;
164 EINA_SAFETY_ON_NULL_RETURN(pd);
165 pd->count_future = NULL;
166}
167
168static void
169_children_slice_error(void * data EINA_UNUSED, Efl_Event const* event EINA_UNUSED)
170{
171 Efl_Ui_List_Data *pd = data;
172 EINA_SAFETY_ON_NULL_RETURN(pd);
173 pd->slice_future = NULL;
174}
175
176static void
177_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rect r)
178{
179 elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
180}
181
182EOLIAN static void
183_efl_ui_list_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Elm_Object_Select_Mode mode)
184{
185 if (pd->select_mode == mode)
186 return;
187
188 pd->select_mode = mode;
189}
190
191EOLIAN static Elm_Object_Select_Mode
192_efl_ui_list_select_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
193{
194 return pd->select_mode;
195}
196
197EOLIAN static void
198_efl_ui_list_default_style_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Eina_Stringshare *style)
199{
200 eina_stringshare_replace(&pd->style, style);
201}
202
203EOLIAN static Eina_Stringshare *
204_efl_ui_list_default_style_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
205{
206 return pd->style;
207}
208
209EOLIAN static void
210_efl_ui_list_homogeneous_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Eina_Bool homogeneous)
211{
212 pd->homogeneous = homogeneous;
213}
214
215EOLIAN static Eina_Bool
216_efl_ui_list_homogeneous_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
217{
218 return pd->homogeneous;
219}
220
221EOLIAN static void
222_efl_ui_list_efl_gfx_position_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Position2D p)
223{
224 int pan_x, pan_y;
225 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, p.x, p.y))
226 return;
227
228 efl_gfx_position_set(efl_super(obj, MY_CLASS), p);
229
230 elm_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
231 evas_object_move(pd->hit_rect, p.x, p.y);
232 evas_object_move(pd->pan_obj, p.x - pan_x, p.y - pan_y);
233 evas_object_smart_changed(pd->obj);
234}
235
236EOLIAN static void
237_efl_ui_list_elm_interface_scrollable_region_bring_in(Eo *obj, Efl_Ui_List_Data *pd, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
238{
239 int pan_x, pan_y;
240 elm_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
241 elm_interface_scrollable_region_bring_in(efl_super(obj, MY_CLASS), x + pan_x, y + pan_y, w, h);
242}
243
244EOLIAN static void
245_efl_ui_list_efl_gfx_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Size2D size)
246{
247 if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h))
248 return;
249
250 evas_object_resize(pd->hit_rect, size.w, size.h);
251 efl_gfx_size_set(efl_super(obj, MY_CLASS), size);
252
253 evas_object_smart_changed(pd->obj);
254}
255
256EOLIAN static void
257_efl_ui_list_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
258{
259 _layout(pd);
260}
261
262EOLIAN static void
263_efl_ui_list_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_List_Data *pd, Evas_Object *member)
264{
265 efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
266
267 if (pd->hit_rect)
268 evas_object_raise(pd->hit_rect);
269}
270
271EOLIAN static void
272_efl_ui_list_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_Data *pd)
273{
274 Efl_Ui_List_Pan_Data *pan_data;
275 Evas_Coord minw, minh;
276
277 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
278
279 efl_canvas_group_add(efl_super(obj, MY_CLASS));
280 elm_widget_sub_object_parent_add(obj);
281
282 elm_widget_can_focus_set(obj, EINA_TRUE);
283
284 if (!elm_layout_theme_set(obj, "list", "base", elm_widget_style_get(obj)))
285 CRI("Failed to set layout!");
286
287 pd->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
288 evas_object_data_set(pd->hit_rect, "_elm_leaveme", obj);
289 evas_object_smart_member_add(pd->hit_rect, obj);
290 elm_widget_sub_object_add(obj, pd->hit_rect);
291
292 /* common scroller hit rectangle setup */
293 evas_object_color_set(pd->hit_rect, 0, 0, 0, 0);
294 evas_object_show(pd->hit_rect);
295 evas_object_repeat_events_set(pd->hit_rect, EINA_TRUE);
296
297 elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL);
298
299 elm_interface_scrollable_objects_set(obj, wd->resize_obj, pd->hit_rect);
300 elm_interface_scrollable_bounce_allow_set
301 (obj, EINA_FALSE, _elm_config->thumbscroll_bounce_enable);
302
303 pd->mode = ELM_LIST_COMPRESS;
304
305 efl_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED);
306 pd->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj));
307 pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS);
308 pan_data->wobj = obj;
309
310 elm_interface_scrollable_extern_pan_set(obj, pd->pan_obj);
311 evas_object_show(pd->pan_obj);
312
313 edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
314 evas_object_size_hint_min_set(obj, minw, minh);
315
316 elm_layout_sizing_eval(obj);
317}
318
319EOLIAN static void
320_efl_ui_list_efl_canvas_group_group_del(Eo *obj, Efl_Ui_List_Data *pd)
321{
322 ELM_SAFE_FREE(pd->pan_obj, evas_object_del);
323 efl_canvas_group_del(efl_super(obj, MY_CLASS));
324}
325
326EOLIAN static void
327_efl_ui_list_efl_ui_focus_manager_focus_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Efl_Ui_Focus_Object *focus)
328{
329 efl_ui_focus_manager_focus_set(pd->manager, focus);
330}
331
332EOLIAN static Efl_Ui_Focus_Manager*
333_efl_ui_list_elm_widget_focus_manager_create(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root)
334{
335 if (!pd->manager)
336 pd->manager = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, obj,
337 efl_ui_focus_manager_root_set(efl_added, root));
338
339 return pd->manager;
340}
341
342EOLIAN static Eo *
343_efl_ui_list_efl_object_finalize(Eo *obj, Efl_Ui_List_Data *pd)
344{
345
346 if (!pd->factory)
347 pd->factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, NULL);
348
349 if(!pd->relayout)
350 {
351 pd->relayout = efl_add(EFL_UI_LIST_PRECISE_LAYOUTER_CLASS, obj);
352 if (pd->model)
353 efl_ui_list_relayout_model_set(pd->relayout, pd->model);
354 }
355 return obj;
356}
357
358EOLIAN static Eo *
359_efl_ui_list_efl_object_constructor(Eo *obj, Efl_Ui_List_Data *pd)
360{
361 Efl_Ui_Focus_Manager *manager;
362
363 obj = efl_constructor(efl_super(obj, MY_CLASS));
364 pd->obj = obj;
365 efl_canvas_object_type_set(obj, MY_CLASS_NAME);
366 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
367 efl_access_role_set(obj, EFL_ACCESS_ROLE_LIST);
368
369 efl_ui_list_segarray_setup(&pd->segarray, 32);
370
371 manager = efl_ui_widget_focus_manager_create(obj, obj);
372 efl_composite_attach(obj, manager);
373 _efl_ui_focus_manager_redirect_events_add(manager, obj);
374
375 pd->style = eina_stringshare_add(elm_widget_style_get(obj));
376
377 pd->factory = NULL;
378 pd->orient = EFL_ORIENT_DOWN;
379 pd->align.h = 0;
380 pd->align.v = 0;
381 pd->min.w = 0;
382 pd->min.h = 0;
383
384 return obj;
385}
386
387EOLIAN static void
388_efl_ui_list_efl_object_destructor(Eo *obj, Efl_Ui_List_Data *pd)
389{
390 efl_ui_list_relayout_model_set(pd->relayout, NULL);
391
392 efl_unref(pd->model);
393 eina_stringshare_del(pd->style);
394
395 efl_ui_list_segarray_flush(&pd->segarray);
396
397 efl_destructor(efl_super(obj, MY_CLASS));
398}
399
400EOLIAN static void
401_efl_ui_list_layout_factory_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, Efl_Ui_Factory *factory)
402{
403 if (pd->factory)
404 efl_unref(pd->factory);
405
406 pd->factory = factory;
407 efl_ref(pd->factory);
408}
409
410EOLIAN static void
411_efl_ui_list_efl_ui_view_model_set(Eo *obj, Efl_Ui_List_Data *pd, Efl_Model *model)
412{
413 if (pd->model == model)
414 return;
415
416 if (pd->count_future)
417 {
418 efl_future_cancel(pd->count_future);
419 pd->count_future = NULL;
420 }
421
422 if (pd->model)
423 {
424 if (pd->relayout)
425 efl_ui_list_relayout_model_set(pd->relayout, NULL);
426 efl_ui_list_segarray_flush(&pd->segarray);
427 efl_unref(pd->model);
428 pd->model = NULL;
429 }
430
431 if (model)
432 {
433 pd->model = model;
434 efl_ref(pd->model);
435 if (pd->relayout)
436 efl_ui_list_relayout_model_set(pd->relayout, model);
437 pd->count_future = efl_model_children_count_get(pd->model);
438 efl_future_then(pd->count_future, &_count_then, &_count_error, NULL, pd);
439 }
440
441 evas_object_smart_changed(pd->obj);
442}
443
444EOLIAN static Efl_Model *
445_efl_ui_list_efl_ui_view_model_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
446{
447 return pd->model;
448}
449
450EOLIAN int
451_efl_ui_list_efl_access_selection_selected_children_count_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
452{
453 return eina_list_count(pd->selected_items);
454}
455
456EOLIAN Eo*
457_efl_ui_list_efl_access_selection_selected_child_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, int child_index)
458{
459 if(child_index < (int) eina_list_count(pd->selected_items))
460 {
461 Efl_Ui_List_Item* items = eina_list_nth(pd->selected_items, child_index);
462 return items[child_index].item.layout;
463 }
464 else
465 return NULL;
466}
467
468EOLIAN Eina_Bool
469_efl_ui_list_efl_access_selection_child_select(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED, int child_index EINA_UNUSED)
470{
471 return EINA_FALSE;
472}
473
474EOLIAN Eina_Bool
475_efl_ui_list_efl_access_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED, int child_index EINA_UNUSED)
476{
477 return EINA_FALSE;
478}
479
480EOLIAN Eina_Bool
481_efl_ui_list_efl_access_selection_is_child_selected(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, int child_index)
482{
483 return EINA_FALSE;
484}
485
486EOLIAN Eina_Bool
487_efl_ui_list_efl_access_selection_all_children_select(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
488{
489 return EINA_TRUE;
490}
491
492EOLIAN Eina_Bool
493_efl_ui_list_efl_access_selection_clear(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
494{
495 return EINA_TRUE;
496}
497
498EOLIAN Eina_Bool
499_efl_ui_list_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED, int child_index EINA_UNUSED)
500{
501 return EINA_FALSE;
502}
503
504static Eina_Bool
505_key_action_move(Evas_Object *obj, const char *params)
506{
507 return EINA_FALSE;
508}
509
510static Eina_Bool
511_key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
512{
513 return EINA_FALSE;
514}
515
516static Eina_Bool
517_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
518{
519 efl_ui_focus_manager_reset_history(obj);
520 return EINA_TRUE;
521}
522
523ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_list, Efl_Ui_List_Data)
524
525void
526_efl_ui_list_item_select_set(Efl_Ui_List_LayoutItem *item, Eina_Bool selected)
527{
528 Eina_Stringshare *sprop;
529 assert(item != NULL);
530 assert(item->children != NULL);
531
532 selected = !!selected;
533
534 sprop = eina_stringshare_add(SELECTED_PROP);
535
536 if (_efl_model_properties_has(item->children, sprop))
537 {
538 Eina_Value v;
539 eina_value_setup(&v, EINA_VALUE_TYPE_UCHAR);
540 eina_value_set(&v, selected);
541 efl_model_property_set(item->children, sprop, &v);
542 eina_value_flush(&v);
543 }
544 eina_stringshare_del(sprop);
545}
546
547static void
548_efl_ui_list_relayout_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED, Efl_Ui_List_Relayout *object)
549{
550 if(pd->relayout)
551 efl_unref(pd->relayout);
552
553 pd->relayout = object;
554 efl_ref(pd->relayout);
555}
556
557static Efl_Ui_List_Relayout *
558_efl_ui_list_relayout_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED)
559{
560 return pd->relayout;
561}
562
563static void
564_layout(Efl_Ui_List_Data *pd)
565{
566 if (!pd->model)
567 return;
568
569 efl_ui_list_relayout_layout_do(pd->relayout, pd->obj, pd->segarray_first, &pd->segarray);
570}
571
572static void
573_children_slice_then(void * data, Efl_Event const* event)
574{
575 Efl_Ui_List_Data *pd = data;
576 Eina_Accessor *acc = (Eina_Accessor*)((Efl_Future_Event_Success*)event->info)->value;
577
578 efl_ui_list_segarray_insert_accessor(&pd->segarray, pd->outstanding_slice.slice_start, acc);
579
580 pd->segarray_first = pd->outstanding_slice.slice_start;
581 pd->outstanding_slice.slice_start = pd->outstanding_slice.slice_count = 0;
582 pd->slice_future = NULL;
583}
584
585/* EFL UI LIST MODEL INTERFACE */
586EOLIAN static Eina_Size2D
587_efl_ui_list_efl_ui_list_model_min_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
588{
589 return pd->min;
590}
591
592EOLIAN static void
593_efl_ui_list_efl_ui_list_model_min_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Size2D min)
594{
595 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
596
597 pd->min.w = min.w;
598 pd->min.h = min.h;
599
600 evas_object_size_hint_min_set(wd->resize_obj, pd->min.w, pd->min.h);
601 efl_event_callback_legacy_call(pd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
602}
603
604EOLIAN static Efl_Ui_List_LayoutItem *
605_efl_ui_list_efl_ui_list_model_realize(Eo *obj, Efl_Ui_List_Data *pd, Efl_Ui_List_LayoutItem *item)
606{
607 Efl_Ui_List_Item_Event evt;
608 EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item);
609
610 item->layout = efl_ui_factory_create(pd->factory, item->children, obj);
611 evas_object_smart_member_add(item->layout, pd->pan_obj);
612 evas_object_event_callback_add(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item);
613
614 evt.child = item->children;
615 evt.layout = item->layout;
616 evt.index = efl_ui_list_item_index_get((Efl_Ui_List_Item *)item);
617 efl_event_callback_call(obj, EFL_UI_LIST_EVENT_ITEM_REALIZED, &evt);
618
619 evas_object_show(item->layout);
620 return item;
621}
622
623EOLIAN static void
624_efl_ui_list_efl_ui_list_model_unrealize(Eo *obj, Efl_Ui_List_Data *pd, Efl_Ui_List_LayoutItem *item)
625{
626 Efl_Ui_List_Item_Event evt;
627 EINA_SAFETY_ON_NULL_RETURN(item->layout);
628
629 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item);
630 evas_object_hide(item->layout);
631 evas_object_move(item->layout, -9999, -9999);
632
633 evt.child = item->children;
634 evt.layout = item->layout;
635 evt.index = efl_ui_list_item_index_get((Efl_Ui_List_Item *)item);
636 efl_event_callback_call(obj, EFL_UI_LIST_EVENT_ITEM_UNREALIZED, &evt);
637
638 evas_object_smart_member_del(item->layout);
639 efl_ui_factory_release(pd->factory, item->layout);
640 item->layout = NULL;
641}
642
643EOLIAN static void
644_efl_ui_list_efl_ui_list_model_load_range_set(Eo* obj EINA_UNUSED, Efl_Ui_List_Data* pd, int first, int count)
645{
646 if(!pd->slice_future)
647 {
648 pd->slice_future = efl_model_children_slice_get(pd->model, first, count);
649 pd->outstanding_slice.slice_start = first;
650 pd->outstanding_slice.slice_count = count;
651 efl_future_then(pd->slice_future, &_children_slice_then, &_children_slice_error, NULL, pd);
652 }
653}
654
655EOLIAN static int
656_efl_ui_list_efl_ui_list_model_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
657{
658 return pd->item_count;
659}
660
661/* Internal EO APIs and hidden overrides */
662
663#define EFL_UI_LIST_EXTRA_OPS \
664 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_list)
665
666#include "efl_ui_list.eo.c"
667#include "efl_ui_list_relayout.eo.c"
668#include "efl_ui_list_model.eo.c"
diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo
new file mode 100644
index 0000000000..e484b38504
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list.eo
@@ -0,0 +1,108 @@
1import elm_general;
2
3struct Efl.Ui.List.Item_Event
4{
5 layout: Efl.Ui.Layout;
6 child: Efl.Model;
7 index: int;
8}
9class Efl.Ui.List (Efl.Ui.Layout, Efl.Ui.View, Elm.Interface_Scrollable,
10 Efl.Access.Widget.Action, Efl.Access.Selection,
11 Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.List.Model)
12{
13 methods {
14 @property relayout {
15 values {
16 object: Efl.Ui.List.Relayout;
17 }
18 }
19 @property homogeneous {
20 get {
21 [[Get whether the homogeneous mode is enabled.]]
22 }
23 set {
24 [[Enable/disable homogeneous mode.]]
25 }
26 values {
27 homogeneous: bool; [[Assume the items within the genlist are of
28 the same height and width. Default is $false.]]
29 }
30 }
31 @property select_mode {
32 [[Listview select mode.]]
33 get {}
34 set {}
35 values {
36 mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode.]]
37 }
38 }
39 @property default_style {
40 values {
41 style: stringshare;
42 }
43 }
44 @property layout_factory {
45 [[Listview layout factory set.]]
46 set {}
47 values {
48 factory: Efl.Ui.Factory; [[The factory.]]
49 }
50 }
51 }
52 events {
53 item,realized : Efl.Ui.List.Item_Event;
54 item,unrealized : Efl.Ui.List.Item_Event;
55 item,focused : Efl.Ui.List.Item_Event;
56 item,unfocused : Efl.Ui.List.Item_Event;
57 item,highlighted : Efl.Ui.List.Item_Event;
58 item,unhighlighted : Efl.Ui.List.Item_Event;
59 item,selected : Efl.Ui.List.Item_Event;
60 item,unselected : Efl.Ui.List.Item_Event;
61 }
62
63 implements {
64 Efl.Object.constructor;
65 Efl.Object.finalize;
66 Efl.Object.destructor;
67 Efl.Gfx.position { set; }
68 Efl.Gfx.size { set; }
69 // Smart obj
70 Efl.Canvas.Group.group_member_add;
71 Efl.Canvas.Group.group_calculate;
72
73 Efl.Ui.List.Model.load_range { set;}
74 Efl.Ui.List.Model.realize;
75 Efl.Ui.List.Model.unrealize;
76 Efl.Ui.List.Model.size { get; }
77 Efl.Ui.List.Model.min_size { get; set; }
78
79 // Widget
80// Elm.Widget.focus_next_manager_is;
81// Elm.Widget.focus_direction_manager_is;
82// Elm.Widget.focus_register;
83// Elm.Widget.focus_next;
84// Elm.Widget.on_focus_update;
85// Elm.Widget.activate;
86// Elm.Widget.focused_item { get; }
87// Elm.Widget.focused_object { get; }
88 Elm.Widget.focus_manager_create;
89 Elm.Widget.widget_event;
90
91// Efl.Ui.Focus.Manager.focus {set; }
92 //Efl.Ui.Layout.sizing_eval;
93 Efl.Ui.View.model { get; set; }
94
95 Elm.Interface_Scrollable.region_bring_in;
96// Elm.Interface.Atspi_Accessible.children { get; }
97// Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
98// Efl.Access.Widget.Action.elm_actions { get; }
99 Efl.Access.Selection.selected_children_count { get; }
100 Efl.Access.Selection.selected_child { get; }
101 Efl.Access.Selection.selected_child_deselect;
102 Efl.Access.Selection.child_select;
103 Efl.Access.Selection.child_deselect;
104 Efl.Access.Selection.is_child_selected;
105 Efl.Access.Selection.all_children_select;
106 Efl.Access.Selection.clear;
107 }
108}
diff --git a/src/lib/elementary/efl_ui_list_model.eo b/src/lib/elementary/efl_ui_list_model.eo
new file mode 100644
index 0000000000..ba2b2dc107
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_model.eo
@@ -0,0 +1,48 @@
1import efl_ui_list_types;
2
3interface Efl.Ui.List.Model (Efl.Interface)
4{
5 methods {
6 @property load_range {
7 set {}
8 values {
9 first: int;
10 count: int;
11 }
12 }
13 realize {
14 params {
15 item: ptr(Efl.Ui.List.LayoutItem);
16 }
17 return: ptr(Efl.Ui.List.LayoutItem);
18 }
19 unrealize {
20 params {
21 item: ptr(Efl.Ui.List.LayoutItem);
22 }
23 }
24 // @property visible_range {
25 // set {}
26 // values {
27 // first: int;
28 // count: int;
29 // }
30 // }
31 @property size {
32 get {}
33 values {
34 s: int;
35 }
36 }
37 @property min_size {
38 [[Minimal content size.]]
39 set {}
40 get {}
41 values {
42 min: Eina.Size2D;
43 }
44 }
45
46
47 }
48}
diff --git a/src/lib/elementary/efl_ui_list_pan.eo b/src/lib/elementary/efl_ui_list_pan.eo
new file mode 100644
index 0000000000..7bbb176666
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_pan.eo
@@ -0,0 +1,16 @@
1class Efl.Ui.List.Pan (Elm.Pan)
2{
3 [[Elementary Efl_Ui_List pan class]]
4 implements {
5 Efl.Object.destructor;
6 Elm.Pan.content_size { get; }
7 Elm.Pan.pos { get; set; }
8 Elm.Pan.pos_min { get; }
9 Elm.Pan.pos_max { get; }
10 Efl.Canvas.Group.group_calculate;
11 }
12 events {
13 item,focused; [[Called when item got focus]]
14 item,unfocused; [[Called when item lost focus]]
15 }
16}
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.c b/src/lib/elementary/efl_ui_list_precise_layouter.c
new file mode 100644
index 0000000000..7f37b7f4b6
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.c
@@ -0,0 +1,659 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6
7#include <assert.h>
8
9#include "elm_priv.h"
10#include "efl_ui_list_segarray.h"
11
12#define MY_CLASS EFL_UI_LIST_PRECISE_LAYOUTER_CLASS
13
14typedef struct _Efl_Ui_List_Precise_Layouter_Data
15{
16 Eina_Bool initialized;
17 Eina_Bool recalc;
18 Eina_Bool resize;
19 Eina_Size2D min;
20 Efl_Model* model;
21 Efl_Ui_List_Model *modeler;
22 Efl_Future *count_future;
23 Ecore_Job *calc_job;
24 Efl_Ui_List_SegArray *segarray;
25 int first;
26 int count_total;
27 unsigned int calc_progress;
28} Efl_Ui_List_Precise_Layouter_Data;
29
30typedef struct _Efl_Ui_List_Precise_Layouter_Node_Data
31{
32 Eina_Size2D min;
33 Eina_Size2D size;
34 Eina_Bool realized;
35} Efl_Ui_List_Precise_Layouter_Node_Data;
36
37typedef struct _Efl_Ui_List_Precise_Layouter_Callback_Data
38{
39 Efl_Ui_List_Precise_Layouter_Data* pd;
40 Efl_Ui_List_LayoutItem* item;
41} Efl_Ui_List_Precise_Layouter_Callback_Data;
42
43
44#include "efl_ui_list_precise_layouter.eo.h"
45
46
47static void _efl_ui_list_relayout_layout_do(Efl_Ui_List_Precise_Layouter_Data *);
48static void _initilize(Eo *, Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_Model*, Efl_Ui_List_SegArray*);
49static void _finalize(Eo *, Efl_Ui_List_Precise_Layouter_Data*);
50static void _node_realize(Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_SegArray_Node*);
51static void _node_unrealize(Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_SegArray_Node*);
52
53static void
54_item_size_calc(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_LayoutItem* item)
55{
56 int boxx, boxy, boxw, boxh, boxl, boxr, boxt, boxb, pad[4];
57 double align[2];
58 Eina_Size2D max;
59
60 efl_gfx_size_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]);
61 evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh);
62 efl_gfx_size_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb);
63 efl_gfx_size_hint_align_get(item->layout, &align[0], &align[1]);
64 max = efl_gfx_size_hint_max_get(item->layout);
65
66 // box outer margin
67 boxw -= boxl + boxr;
68 boxh -= boxt + boxb;
69 boxx += boxl;
70 boxy += boxt;
71
72 if (align[0] < 0) align[0] = -1;
73 if (align[1] < 0) align[1] = -1;
74 if (align[0] > 1) align[0] = 1;
75 if (align[1] > 1) align[1] = 1;
76
77 if (max.w <= 0) max.w = INT_MAX;
78 if (max.h <= 0) max.h = INT_MAX;
79 if (max.w < item->min.w) max.w = item->min.w;
80 if (max.h < item->min.h) max.h = item->min.h;
81
82 // horizontally
83 if (max.w < INT_MAX)
84 {
85 item->size.w = MIN(MAX(item->min.w - pad[0] - pad[1], max.w), boxw);
86 item->pos.x = boxx + pad[0];
87 }
88 else if (align[0] < 0)
89 {
90 // fill x
91 item->size.w = boxw - pad[0] - pad[1];
92 item->pos.x = boxx + pad[0];
93 }
94 else
95 {
96 item->size.w = item->min.w - pad[0] - pad[1];
97 item->pos.x = boxx + ((boxw - item->size.w) * align[0]) + pad[0];
98 }
99
100 // vertically
101 if (max.h < INT_MAX)
102 {
103 item->size.h = MIN(MAX(item->min.h - pad[2] - pad[3], max.h), boxh);
104 item->pos.y = boxy + pad[2];
105 }
106 else if (align[1] < 0)
107 {
108 // fill y
109 item->size.h = item->min.h - pad[2] - pad[3];
110 item->pos.y = boxy + pad[2];
111 }
112 else
113 {
114 item->size.h = item->min.h - pad[2] - pad[3];
115 item->pos.y = boxy + ((item->min.h - item->size.h) * align[1]) + pad[2];
116 }
117}
118
119static void
120_item_min_calc(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_LayoutItem* item
121 , Eina_Size2D min, Efl_Ui_List_SegArray_Node *itemnode)
122{
123 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = itemnode->layout_data;
124 Efl_Ui_List_LayoutItem *layout_item;
125 int i, pad[4];
126
127 efl_gfx_size_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]);
128
129 min.w += pad[0] + pad[1];
130 min.h += pad[2] + pad[3];
131
132 if (item->min.h == min.h && item->min.w == min.h)
133 return;
134
135 pd->min.h += min.h - item->min.h;
136 nodedata->min.h += min.h - item->min.h;
137
138 if (nodedata->min.w <= min.w)
139 nodedata->min.w = min.w;
140 else if (nodedata->min.w == item->min.w)
141 {
142 nodedata->min.w = 0;
143 for (i = 0; i != itemnode->length; ++i)
144 {
145 layout_item = (Efl_Ui_List_LayoutItem *)itemnode->pointers[i];
146 if (nodedata->min.w < layout_item->min.w)
147 nodedata->min.w = layout_item->min.w;
148
149 if (item->min.w == layout_item->min.w)
150 break;
151 }
152 }
153
154 if (pd->min.w <= min.w)
155 pd->min.w = min.w;
156 else if (pd->min.w == item->min.w)
157 {
158 Efl_Ui_List_SegArray_Node *node;
159 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
160 pd->min.w = min.w;
161
162 EINA_ACCESSOR_FOREACH(nodes, i, node)
163 {
164 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = node->layout_data;
165 if (pd->min.w < nodedata->min.w)
166 pd->min.w = nodedata->min.w;
167
168 if (item->min.w == nodedata->min.w)
169 break;
170 }
171 eina_accessor_free(nodes);
172 }
173
174 item->min.w = min.w;
175 item->min.h = min.h;
176
177 _item_size_calc(pd, item);
178}
179
180static void
181_count_then(void * data, Efl_Event const* event)
182{
183 Efl_Ui_List_Precise_Layouter_Data *pd = data;
184 EINA_SAFETY_ON_NULL_RETURN(pd);
185 pd->count_future = NULL;
186
187 pd->count_total = *(int*)((Efl_Future_Event_Success*)event->info)->value;
188
189 if (pd->modeler && (pd->count_total != efl_ui_list_segarray_count(pd->segarray)))
190 {
191 pd->recalc = EINA_TRUE;
192 efl_ui_list_model_load_range_set(pd->modeler, 0, 0); // load all
193 }
194}
195
196static void
197_count_error(void * data, Efl_Event const* event EINA_UNUSED)
198{
199 Efl_Ui_List_Precise_Layouter_Data *pd = data;
200 EINA_SAFETY_ON_NULL_RETURN(pd);
201 pd->count_future = NULL;
202}
203
204static void
205_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED,
206 Evas_Object *obj, void *event_info EINA_UNUSED)
207{
208 Efl_Ui_List_Precise_Layouter_Callback_Data *cb_data = data;
209 Efl_Ui_List_Precise_Layouter_Data *pd = cb_data->pd;
210 Efl_Ui_List_LayoutItem *item = cb_data->item;;
211 Efl_Ui_List_SegArray_Node *node = item->tree_node;
212 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = node->layout_data;
213
214 Eina_Size2D min = efl_gfx_size_hint_combined_min_get(obj);
215 _item_min_calc(pd, item, min, node);
216 if (!nodedata->realized)
217 {
218 free(evas_object_event_callback_del(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change));
219 efl_ui_list_model_unrealize(pd->modeler, item);
220 }
221}
222
223static void
224_on_modeler_resize(void *data, Evas *e EINA_UNUSED,
225 Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
226{
227 Efl_Ui_List_Precise_Layouter_Data *pd = data;
228 pd->resize = EINA_TRUE;
229}
230
231static void
232_child_added_cb(void *data, const Efl_Event *event)
233{
234 Efl_Model_Children_Event* evt = event->info;
235 Efl_Ui_List_Precise_Layouter_Data *pd = data;
236
237 efl_ui_list_segarray_insert(pd->segarray, evt->index, evt->child);
238 pd->recalc = EINA_TRUE;
239 evas_object_smart_changed(pd->modeler);
240}
241
242static void
243_child_removed_cb(void *data, const Efl_Event *event)
244{
245 Efl_Model_Children_Event* evt = event->info;
246 Efl_Ui_List_Precise_Layouter_Data *pd = data;
247 Efl_Ui_List_LayoutItem *layout_item, *litem;
248 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata;
249 Efl_Ui_List_SegArray_Node *itemnode;
250 Efl_Ui_List_Item* item;
251 int i;
252
253 item = efl_ui_list_segarray_remove(pd->segarray, evt->index);
254 if (!item) return;
255
256 litem = (Efl_Ui_List_LayoutItem *)item;
257 itemnode = litem->tree_node;
258 nodedata = itemnode->layout_data;
259
260 free(evas_object_event_callback_del(litem->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change));
261
262 pd->min.h -= litem->min.h;
263 nodedata->min.h -= litem->min.h;
264
265 if (nodedata->min.w == litem->min.w)
266 nodedata->min.w = 0;
267 for (i = 0; i != itemnode->length; ++i)
268 {
269 layout_item = (Efl_Ui_List_LayoutItem *)itemnode->pointers[i];
270 if (nodedata->min.w < layout_item->min.w)
271 nodedata->min.w = layout_item->min.w;
272
273 if (litem->min.w == layout_item->min.w)
274 {
275 nodedata->min.w = layout_item->min.w;
276 break;
277 }
278 }
279
280 if (pd->min.w == litem->min.w)
281 {
282 Efl_Ui_List_SegArray_Node *node;
283 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
284 pd->min.w = 0;
285
286 EINA_ACCESSOR_FOREACH(nodes, i, node)
287 {
288 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = node->layout_data;
289 if (pd->min.w < nodedata->min.w)
290 pd->min.w = nodedata->min.w;
291
292 if (litem->min.w == nodedata->min.w)
293 break;
294 }
295 eina_accessor_free(nodes);
296 }
297
298 efl_ui_list_model_unrealize(pd->modeler, litem);
299
300 free(item);
301 pd->recalc = EINA_TRUE;
302 evas_object_smart_changed(pd->modeler);
303}
304
305static void
306_initilize(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_Model *modeler, Efl_Ui_List_SegArray *segarray)
307{
308 if(pd->initialized)
309 return;
310
311 pd->recalc = EINA_TRUE;
312 pd->initialized = EINA_TRUE;
313
314 pd->modeler = modeler;
315 pd->segarray = segarray;
316
317 evas_object_event_callback_add(modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd);
318// efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _count_changed, pd);
319 efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd);
320 efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed_cb, pd);
321 efl_ui_list_model_load_range_set(modeler, 0, 0); // load all
322
323 pd->min.w = 0;
324 pd->min.h = 0;
325}
326
327static void
328_finalize(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd)
329{
330 Efl_Ui_List_SegArray_Node* node;
331 int i = 0;
332
333 evas_object_event_callback_del_full(pd->modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd);
334 efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd);
335 efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed_cb, pd);
336// efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _count_changed, pd);
337
338 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
339 EINA_ACCESSOR_FOREACH(nodes, i, node)
340 {
341 _node_unrealize(pd, node);
342 free(node->layout_data);
343 }
344
345 eina_accessor_free(nodes);
346
347 pd->min.w = 0;
348 pd->min.h = 0;
349
350 efl_ui_list_model_min_size_set(pd->modeler, pd->min);
351
352 pd->segarray = NULL;
353 pd->modeler = NULL;
354
355 pd->initialized = EINA_FALSE;
356}
357
358static void
359_node_realize(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_SegArray_Node *node)
360{
361 Efl_Ui_List_LayoutItem* layout_item;
362 Efl_Ui_List_Precise_Layouter_Callback_Data *cb_data;
363 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = node->layout_data;
364 int i;
365
366 if (nodedata->realized)
367 return;
368
369 nodedata->realized = EINA_TRUE;
370
371 for (i = 0; i != node->length; ++i)
372 {
373 layout_item = (Efl_Ui_List_LayoutItem *)node->pointers[i];
374 efl_ui_list_model_realize(pd->modeler, layout_item);
375
376 if (layout_item->layout)
377 {
378 cb_data = calloc(1, sizeof(Efl_Ui_List_Precise_Layouter_Callback_Data));
379 cb_data->pd = pd;
380 cb_data->item = layout_item;
381 evas_object_event_callback_add(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
382 _item_size_calc(pd, layout_item);
383 }
384 }
385}
386
387static void
388_node_unrealize(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_SegArray_Node *node)
389{
390 Efl_Ui_List_LayoutItem* layout_item;
391 Efl_Ui_List_Precise_Layouter_Callback_Data *cb_data;
392 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = node->layout_data;
393 int i;
394
395 if (!nodedata->realized)
396 return;
397
398 nodedata->realized = EINA_FALSE;
399
400 for (i = 0; i != node->length; ++i)
401 {
402 layout_item = (Efl_Ui_List_LayoutItem *)node->pointers[i];
403 if (layout_item->layout)
404 {
405 cb_data = evas_object_event_callback_del(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change);
406 free(cb_data);
407 }
408 efl_ui_list_model_unrealize(pd->modeler, layout_item);
409 }
410}
411
412static void
413_calc_range(Efl_Ui_List_Precise_Layouter_Data *pd)
414{
415 Efl_Ui_List_SegArray_Node *node;
416 Evas_Coord ow, oh, scr_x, scr_y, ch;
417 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata;
418 int i;
419
420 elm_interface_scrollable_content_viewport_geometry_get
421 (pd->modeler, NULL, NULL, &ow, &oh);
422 elm_interface_scrollable_content_pos_get(pd->modeler, &scr_x, &scr_y);
423
424 ch = 0;
425 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
426 EINA_ACCESSOR_FOREACH(nodes, i, node)
427 {
428 nodedata = node->layout_data;
429 if (!nodedata || !nodedata->min.h)
430 continue;
431
432 if ((scr_y < ch || scr_y < nodedata->min.h + ch) &&
433 (scr_y + oh > ch || scr_y + oh > nodedata->min.h + ch))
434 _node_realize(pd, node);
435 else
436 _node_unrealize(pd, node);
437
438 ch += nodedata->min.h;
439 }
440 eina_accessor_free(nodes);
441}
442
443static void
444_calc_size_job(void *data)
445{
446 Efl_Ui_List_Precise_Layouter_Data *pd;
447 Efl_Ui_List_SegArray_Node *node;
448 Efl_Ui_List_LayoutItem *layout_item;
449 Eo *obj = data;
450 Eina_Size2D min;
451 int i;
452 double start_time = ecore_time_get();
453
454 EINA_SAFETY_ON_NULL_RETURN(data);
455 pd = efl_data_scope_get(obj, MY_CLASS);
456 if (EINA_UNLIKELY(!pd)) return;
457
458 pd->recalc = EINA_FALSE;
459
460 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
461 while (eina_accessor_data_get(nodes, pd->calc_progress, (void **)&node))
462 {
463 pd->calc_progress++;
464 if (!node->layout_data)
465 node->layout_data = calloc(1, sizeof(Efl_Ui_List_Precise_Layouter_Node_Data));
466
467 for (i = 0; i != node->length; ++i)
468 {
469 layout_item = (Efl_Ui_List_LayoutItem *)node->pointers[i];
470 EINA_SAFETY_ON_NULL_RETURN(layout_item);
471
472 // cache size of new items
473 if ((layout_item->min.w == 0) && (layout_item->min.h == 0))
474 {
475 if (!layout_item->layout)
476 {
477 efl_ui_list_model_realize(pd->modeler, layout_item);
478 }
479
480 min = efl_gfx_size_hint_combined_min_get(layout_item->layout);
481 if (min.w && min.h)
482 {
483 _item_min_calc(pd, layout_item, min, node);
484 efl_ui_list_model_unrealize(pd->modeler, layout_item);
485 }
486 else
487 {
488 Efl_Ui_List_Precise_Layouter_Callback_Data *cb_data = calloc(1, sizeof(Efl_Ui_List_Precise_Layouter_Callback_Data));
489 cb_data->pd = pd;
490 cb_data->item = layout_item;
491 evas_object_event_callback_add(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
492 }
493 }
494 }
495 if ( (ecore_time_get() - start_time ) > 0.01 )
496 {
497 ecore_job_del(pd->calc_job);
498 pd->calc_job = ecore_job_add(_calc_size_job, obj);
499 eina_accessor_free(nodes);
500 return;
501 }
502 }
503 eina_accessor_free(nodes);
504 pd->calc_progress = 0;
505 pd->calc_job = NULL;
506
507 evas_object_smart_changed(pd->modeler);
508}
509
510EOLIAN static Efl_Object *
511_efl_ui_list_precise_layouter_efl_object_constructor(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd)
512{
513 obj = efl_constructor(efl_super(obj, MY_CLASS));
514 pd->initialized = EINA_FALSE;
515 pd->count_future = NULL;
516
517 return obj;
518}
519
520EOLIAN static void
521_efl_ui_list_precise_layouter_efl_ui_list_relayout_model_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Model *model)
522{
523 if (pd->model == model)
524 return;
525
526 pd->count_total = 0;
527 if (pd->count_future)
528 {
529 efl_future_cancel(pd->count_future);
530 pd->count_future = NULL;
531 }
532
533 if (pd->model)
534 {
535 _finalize(obj, pd);
536 efl_unref(pd->model);
537 pd->model = NULL;
538 }
539
540 if (model)
541 {
542 pd->model = model;
543 efl_ref(pd->model);
544 pd->count_future = efl_model_children_count_get(pd->model);
545 efl_future_then(pd->count_future, &_count_then, &_count_error, NULL, pd);
546 }
547}
548
549static void
550_efl_ui_list_relayout_layout_do(Efl_Ui_List_Precise_Layouter_Data *pd)
551{
552 Evas_Coord ow, oh, scr_x, scr_y;
553 double cur_pos = 0;
554 Efl_Ui_List_LayoutItem* layout_item;
555 Efl_Ui_List_SegArray_Node *items_node;
556 int i, j = 0;
557
558 _calc_range(pd);
559
560 int boxx, boxy, boxw, boxh, extra = 0, rounding = 0;
561 int boxl = 0, boxr = 0, boxt = 0, boxb = 0;
562 evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh);
563 efl_gfx_size_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb);
564
565 // box outer margin
566 boxw -= boxl + boxr;
567 boxh -= boxt + boxb;
568 boxx += boxl;
569 boxy += boxt;
570
571 //padding can not be squeezed (note: could make it an option)
572// int pad;
573// double scale;
574// scale = evas_object_scale_get(pd->modeler);
575// pad = 0;//pd->pad.scalable ? (pd->pad.v * scale) : pd->pad.v;
576// length -= pad * (pd->count_total - 1);
577
578 // available space. if <0 we overflow
579 extra = boxh - pd->min.h;
580 if (extra < 0) extra = 0;
581
582 efl_ui_list_model_min_size_set(pd->modeler, pd->min);
583
584 elm_interface_scrollable_content_viewport_geometry_get(pd->modeler, NULL, NULL, &ow, &oh);
585 elm_interface_scrollable_content_pos_get(pd->modeler, &scr_x, &scr_y);
586
587 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
588 EINA_ACCESSOR_FOREACH(nodes, i, items_node)
589 {
590 Efl_Ui_List_Precise_Layouter_Node_Data *nodedata = items_node->layout_data;
591 if (!nodedata)
592 {
593 continue;
594 }
595
596 if (nodedata->realized)
597 {
598 for(j = 0; j != items_node->length;++j)
599 {
600 layout_item = (Efl_Ui_List_LayoutItem *)items_node->pointers[j];
601 double x, y, w, h;
602 double weight_x, weight_y;
603
604 if (layout_item->min.w && layout_item->min.h)
605 {
606 assert(layout_item->layout != NULL);
607 if (pd->resize)
608 _item_size_calc(pd, layout_item);
609
610 efl_gfx_size_hint_weight_get(layout_item->layout, &weight_x, &weight_y);
611 // extra rounding up (compensate cumulative error)
612 if ((i == (pd->count_total - 1)) && (cur_pos - floor(cur_pos) >= 0.5))
613 rounding = 1;
614
615 x = layout_item->pos.x;
616 y = layout_item->pos.y + cur_pos;
617 w = layout_item->size.w;
618 h = layout_item->size.h + rounding + weight_y * extra;
619 cur_pos += h;
620
621 if (w < pd->min.w) w = pd->min.w;
622 if (w > ow) w = ow;
623
624 evas_object_geometry_set(layout_item->layout, (x + 0 - scr_x), (y + 0 - scr_y), w, h);
625 }
626 }
627 }
628 else
629 {
630 cur_pos += nodedata->min.h;
631 }
632 }
633 eina_accessor_free(nodes);
634
635 pd->resize = EINA_FALSE;
636}
637
638EOLIAN static void
639_efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
640 (Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd
641 , Efl_Ui_List_Model *modeler, int first, Efl_Ui_List_SegArray *segarray)
642{
643 _initilize(obj, pd, modeler, segarray);
644
645 pd->first = first;
646
647 if (pd->recalc)
648 {
649 // cache size of new items
650 pd->calc_progress = 0;
651 ecore_job_del(pd->calc_job);
652 pd->calc_job = ecore_job_add(_calc_size_job, obj);
653 return;
654 }
655
656 _efl_ui_list_relayout_layout_do(pd);
657}
658
659#include "efl_ui_list_precise_layouter.eo.c"
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.eo b/src/lib/elementary/efl_ui_list_precise_layouter.eo
new file mode 100644
index 0000000000..d6d276e4a4
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.eo
@@ -0,0 +1,8 @@
1class Efl.Ui.List.Precise_Layouter (Efl.Object, Efl.Ui.List.Relayout)
2{
3 implements {
4 Efl.Object.constructor;
5 Efl.Ui.List.Relayout.layout_do;
6 Efl.Ui.List.Relayout.model { set; }
7 }
8}
diff --git a/src/lib/elementary/efl_ui_list_private.h b/src/lib/elementary/efl_ui_list_private.h
new file mode 100644
index 0000000000..607d1fe2b2
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_private.h
@@ -0,0 +1,132 @@
1#ifndef EFL_UI_LIST_PRIVATE_H
2#define EFL_UI_LIST_PRIVATE_H
3
4#ifdef HAVE_CONFIG_H
5# include "elementary_config.h"
6#endif
7
8#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
9#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
10#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
11
12#include <Elementary.h>
13#include "elm_priv.h"
14
15typedef struct _Efl_Ui_List_Item Efl_Ui_List_Item;
16typedef struct _Efl_Ui_List_Data Efl_Ui_List_Data;
17
18struct _Efl_Ui_List_Item
19{
20 Efl_Ui_List_LayoutItem item;
21 Efl_Future *future;
22 Efl_Ui_List *list;
23 // Evas_Coord x, y, minw, minh, w, h;
24 // // double h, v, wx, wy;
25 // double wx, wy;
26};
27
28int efl_ui_list_item_index_get(Efl_Ui_List_Item const* item);
29
30typedef struct _Efl_Ui_List_Data Efl_Ui_List_Data;
31
32#include "efl_ui_list_segarray.h"
33
34struct _Efl_Ui_List_Data
35{
36 Eo *obj;
37 Evas_Object *hit_rect;
38 Efl_Model *model;
39