View: Draw the gengrid items 74/42774/1
authorHyojung Jo <hj903.jo@samsung.com>
Thu, 2 Jul 2015 07:53:48 +0000 (16:53 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Thu, 2 Jul 2015 07:53:48 +0000 (16:53 +0900)
Change-Id: I1fcb7fa1bc1ae5cba53ff4b513e4cc5382383203
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
include/define.h
res/apps-theme.edc
res/view/base.edc
res/widget/gengrid.edc [new file with mode: 0644]
src/grid/grid_myapps.c
src/view/view_base.c

index 7a549f9f3ed0c0cf7c1899a6310a8d77c1e46454..ec593be92a7b1e92f7e14c0eaf8b6e13693bb0c9 100644 (file)
@@ -36,6 +36,7 @@
 
 /* Style */
 #define STYLE_MENU_BTN "style.menu.button"
+#define STYLE_APP "style.app"
 
 /* Font */
 #define FONT_TIZENSANS_REGULAR "TizenSans"
 #define STR_APPS "Apps"
 #define STR_MYAPPS "My Apps"
 #define STR_APPSTORE "App Store"
+#define STR_NULL "(NULL)"
 
 /* Count */
 #define MENU_COUNT 2
 
+/* Size */
+#define SIZE_GRID_WIDTH (212+26)
+#define SIZE_GRID_HEIGHT (294+26)
+
 #endif /* __AIR_APPS_DEFINE_H__ */
index f4862722138cf42011ad98a17f57f18721bd1315..abc2484a4202b6f35971ef64eee2ab261954db4f 100644 (file)
@@ -18,4 +18,5 @@
 
 collections {
        #include "widget/button.edc"
+       #include "widget/gengrid.edc"
 }
index ee3891860b370b32e9da2abf40a589a8598c3d61..29afdc165867fdfe22f3839f318125030b0be282 100644 (file)
@@ -117,14 +117,10 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               min, 0 134;
-                               rel1 {
-                                       to, "title.bg";
-                                       relative, 0.0 1.0;
-                               }
-                               rel2.to, "title.bg";
-                               fixed, 0 1;
-                               align, 0.5 0.0;
+                               min, 62 318;
+                               rel2.relative, 0.0 0.0;
+                               fixed, 1 1;
+                               align, 0.0 0.0;
                        }
                }
 
@@ -134,14 +130,10 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               min, 0 614;
                                rel1 {
                                        to, "padding.grid";
-                                       relative, 0.0 1.0;
+                                       relative, 1.0 1.0;
                                }
-                               rel2.to, "padding.grid";
-                               fixed, 0 1;
-                               align, 0.5 0.0;
                        }
                }
        }
diff --git a/res/widget/gengrid.edc b/res/widget/gengrid.edc
new file mode 100644 (file)
index 0000000..e7d7edf
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group {
+       name, "elm/gengrid/item/style.app/default";
+       data.item, "focus_highlight" "on";
+       data.item, "texts" "elm.text";
+       data.item, "contents" "elm.swallow.icon";
+       parts {
+               part {
+                       name, "padding.bottom.right";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 26 26;
+                               rel1.relative, 1.0 1.0;
+                               fixed, 1 1;
+                               align, 1.0 1.0;
+                       }
+               }
+
+               part {
+                       name, "bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 255 255 255 255;
+                               min, 212 294;
+                               rel2 {
+                                       to, "padding.bottom.right";
+                                       relative, 0.0 0.0;
+                               }
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "text.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               /* FIXME: The color is temporarily defined. */
+                               color, 0 119 246 80;
+                               min, 212 82;
+                               rel1.to, "padding.bottom.right";
+                               rel2 {
+                                       to, "padding.bottom.right";
+                                       relative, 0.0 0.0;
+                               }
+                               align, 1.0 1.0;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "padding.elm.text";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 18 0;
+                               rel1.to, "text.bg";
+                               rel2 {
+                                       to, "text.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "elm.text";
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 255 255 255 255;
+                               min, 176 82;
+                               rel1 {
+                                       to, "padding.elm.text";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2 {
+                                       to, "padding.elm.text";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.0 0.0;
+                               fixed, 1 1;
+                               text {
+                                       font, FONT_TIZENSANS_LIGHT;
+                                       size, 28;
+                                       align, 0.0 0.5;
+                               }
+                       }
+               }
+
+               part {
+                       name, "padding.elm.icon";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 56 56;
+                               rel2.relative, 0.0 0.0;
+                               align, 0.0 0.0;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "elm.swallow.icon";
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 100 100;
+                               rel1 {
+                                       to, "padding.elm.icon";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2.to, "padding.elm.icon";
+                               align, 0.0 0.0;
+                               fixed, 1 1;
+                       }
+               }
+       }
+}
index 4a73234919f3d5967521a9b11b563894f3fa78f5..252dfbca938dbb44d615b1e2366d1655e1f83bf2 100644 (file)
 #include <gridmgr.h>
 #include <app_debug.h>
 
+#include "define.h"
+#include "data/app.h"
+
 static char *_text_get(void *data, Evas_Object *obj, const char *part)
 {
-       /* It will implemented later. */
+       struct app_data *adata;
+
+       if (!data) {
+               _ERR("Invalid argument.");
+               return NULL;
+       }
+       adata = data;
 
-       return NULL;
+       return get_app_name(adata);
 }
 
 static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
 {
-       /* It will implemented later. */
+       struct app_data *adata;
+       Evas_Object *img;
+       char *icon;
+
+       if (!data || !obj) {
+               _ERR("Invalid argument.");
+               return NULL;
+       }
+       adata = data;
+
+       icon = get_app_icon(adata);
+
+       img = elm_image_add(obj);
+       if (!img) {
+               _ERR("elm_image_add failed.");
+               return NULL;
+       }
+
+       if (!icon || !strcmp(icon, STR_NULL))
+               /* FIXME: The default icon image should be registerd. */
+               elm_image_file_set(img, NULL, NULL);
+       else
+               elm_image_file_set(img, icon, NULL);
 
-       return NULL;
+       return img;
 }
 
 static struct grid_class _gclass = {
-       .item_style = "default",
+       .item_style = STYLE_APP,
        .text_get = _text_get,
        .content_get = _content_get,
        .state_get = NULL,
index 6e0deee2a1430fddaed78046e2d60603eba840ff..751d7c1e3da1f4435296149ba544687c4b5b3afa 100644 (file)
@@ -231,6 +231,13 @@ static Evas_Object *_add_grid(struct _priv *priv)
                        EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
+       elm_gengrid_multi_select_set(grid, EINA_FALSE);
+       elm_gengrid_horizontal_set(grid, EINA_TRUE);
+       elm_gengrid_align_set(grid, 0.0, 0.0);
+       elm_gengrid_item_size_set(grid,
+                       elm_config_scale_get() * SIZE_GRID_WIDTH,
+                       elm_config_scale_get() * SIZE_GRID_HEIGHT);
+
        gclass = get_myapps_grid_class();
        if (!gclass) {
                _ERR("Get myapps grid class failed.");