* limitations under the License.
*/
+#define STATE_NORMAL 0
+#define STATE_LOCKED 1
+#define STATE_CHECKED 2
+
group {
name, "elm/gengrid/item/style.grid.wireless/default";
data.item, "focus_highlight" "on";
data.item, "texts" "part.thumb.text";
- data.item, "contents" "part.thumb.icon";
+ data.item, "states" "part_state_check part_state_lock";
+ images {
+ image, IC_NETWORK_NOR_04_PNG COMP;
+ image, IC_NETWORK_FOC_04_PNG COMP;
+ image, IC_LOCK_NETWORK_NOR_04_PNG COMP;
+ image, IC_LOCK_NETWORK_FOC_04_PNG COMP;
+ image, IC_CHECK_NOR_PNG COMP;
+ image, IC_CHECK_FOC_PNG COMP;
+ }
+
+ script {
+ public lock_state;
+ public check_state;
+ }
+
parts {
part {
name, "padding.bottom.right";
relative, 0.0 0.0;
}
fixed, 1 1;
- visible, 0;
}
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ color, 0 119 246 255;
}
part {
}
part {
- name, PART_THUMB_ICON;
- type, SWALLOW;
+ name, "part.wifi.icon";
+ type, IMAGE;
scale, 1;
mouse_events, 1;
description {
perspective_on, 1;
perspective, "map";
}
+ image.normal, IC_NETWORK_NOR_04_PNG;
}
description {
- state, "focused" 0.0;
+ state, "focused.locked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ image.normal, IC_LOCK_NETWORK_FOC_04_PNG;
+ }
+ description {
+ state, "focused.unlocked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ image.normal, IC_NETWORK_FOC_04_PNG;
+ }
+ description {
+ state, "unfocused.locked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ image.normal, IC_LOCK_NETWORK_NOR_04_PNG;
+ }
+ description {
+ state, "unfocused.unlocked" 0.0;
inherit, "default" 0.0;
map.on, 1;
+ image.normal, IC_NETWORK_NOR_04_PNG;
}
}
}
part {
- name, PART_THUMB_TEXT;
+ name, PART_WIFI_NAME;
type, TEXT;
scale, 1;
description {
}
}
+ part {
+ name, "padding.check.icon";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 20 0;
+ rel1 {
+ to, "part.bg";
+ relative, 1.0 0.0;
+ }
+ rel2.to, "part.bg";
+ align, 1.0 0.5;
+ fixed, 1 0;
+ }
+ }
+
+ part {
+ name, "part.check.icon";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 50 50;
+ rel1 {
+ to, "padding.check.icon";
+ relative, 0.0 0.5;
+ }
+ rel2 {
+ to, "padding.check.icon";
+ relative, 0.0 0.5;
+ }
+ align, 1.0 0.5;
+ fixed, 1 1;
+ image.normal, IC_CHECK_NOR_PNG;
+ visible, 0;
+ }
+ description {
+ state, "focused.checked" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ map.on, 1;
+ image.normal, IC_CHECK_FOC_PNG;
+ }
+ description {
+ state, "focused.unchecked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ }
+ description {
+ state, "unfocused.checked" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ map.on, 1;
+ }
+ description {
+ state, "unfocused.unchecked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ }
+ }
+
part {
name, "part.inside.line.up";
type, RECT;
}
}
}
+
+ programs {
+ program {
+ name, "load";
+ signal, "load";
+ source, "";
+ script {
+ set_int(lock_state, STATE_NORMAL);
+ set_int(check_state, STATE_NORMAL);
+ }
+ }
+
+ program {
+ name, "elm,state,focused";
+ signal, "elm,state,focused";
+ source, SRC_ELM;
+ script {
+ new state;
+ state = get_int(lock_state);
+ if (state == STATE_LOCKED)
+ set_state(PART:"part.wifi.icon", "focused.locked", 0.0);
+ else
+ set_state(PART:"part.wifi.icon", "focused.unlocked", 0.0);
+
+ state = get_int(check_state);
+ if (state == STATE_CHECKED)
+ set_state(PART:"part.check.icon", "focused.checked", 0.0);
+ else
+ set_state(PART:"part.check.icon", "focused.unchecked", 0.0);
+
+ set_state(PART:PART_THUMB_TEXT, "focused", 0.0);
+ set_state(PART:"part.bg", "focused", 0.0);
+ }
+ }
+
+ program {
+ name, "elm,state,unfocused";
+ signal, "elm,state,unfocused";
+ source, SRC_ELM;
+ script {
+ new state;
+ state = get_int(lock_state);
+ if (state == STATE_LOCKED)
+ set_state(PART:"part.wifi.icon", "unfocused.locked", 0.0);
+ else
+ set_state(PART:"part.wifi.icon", "unfocused.unlocked", 0.0);
+
+ state = get_int(check_state);
+ if (state == STATE_CHECKED)
+ set_state(PART:"part.check.icon", "unfocused.checked", 0.0);
+ else
+ set_state(PART:"part.check.icon", "unfocused.unchecked", 0.0);
+
+ set_state(PART:PART_THUMB_TEXT, "default", 0.0);
+ set_state(PART:"part.bg", "default", 0.0);
+ }
+ }
+
+ program {
+ signal, "elm,state,part_state_lock,active";
+ source, SRC_ELM;
+ script {
+ set_int(lock_state, STATE_LOCKED);
+ set_state(PART:"part.wifi.icon", "unfocused.locked", 0.0);
+ }
+ }
+ program {
+ signal, "elm,state,part_state_check,active";
+ source, SRC_ELM;
+ script {
+ set_int(check_state, STATE_CHECKED);
+ set_state(PART:"part.check.icon", "unfocused.checked", 0.0);
+ }
+ }
+ }
}
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <Elementary.h>
+#include <gridmgr.h>
+#include <app_define.h>
+#include <app_debug.h>
+
+#include "define.h"
+#include "grid.h"
+#include "data/data_wireless.h"
+
+static char *_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ struct wifi_ap_info *ap_info;
+
+ if (!data) {
+ _ERR("Get data failed.");
+ return NULL;
+ }
+
+ ap_info = data;
+
+ if (!strcmp(part, PART_WIFI_NAME) && ap_info->essid)
+ return strdup(ap_info->essid);
+
+ return NULL;
+}
+
+static Eina_Bool _state_get(void *data, Evas_Object *obj, const char *part)
+{
+ struct wifi_ap_info *ap_info;
+
+ if (!data) {
+ _ERR("Get data failed.");
+ return EINA_FALSE;
+ }
+
+ ap_info = data;
+
+ if (!strcmp(part, PART_STATE_LOCK)) {
+ if (ap_info->secure_type != WIFI_SECURITY_TYPE_NONE)
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
+ } else if (!strcmp(part, PART_STATE_CHECK)) {
+ if (ap_info->connection_state
+ == WIFI_CONNECTION_STATE_CONNECTED)
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
+ }
+
+ return EINA_FALSE;
+}
+
+static struct grid_class _gclass = {
+ .item_style = STYLE_GRID_WIRELESS,
+ .text_get = _text_get,
+ .state_get = _state_get,
+ .del = NULL,
+};
+
+struct grid_class *get_wireless_grid_class(void)
+{
+ return &_gclass;
+}