-collections {
-
- base_scale: 1.8;
+#include "macros.inl"
- group
- {
- name: "conv_contact_list_layout";
- parts {
- part {
- name: "swl.rect";
- type: SWALLOW;
- scale: 1;
- repeat_events: 1;
- description {
- state: "default" 0.0;
- rel1 {relative: 0.0 0.0;}
- rel2 {relative: 1.0 1.0;}
- align: 0 0.0;
- visible: 1;
- fixed: 1 1;
- }
- }
- part {
- name: "bg_rect";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- color: 255 255 255 255;
- rel1 {to: "swl.contact_list"; relative: 0.0 0.0;}
- rel2 {to: "swl.contact_list"; relative: 1.0 1.0;}
- visible: 1;
- align: 0 0.0;
- fixed: 1 1;
- }
- }
- part {
- name: "swl.contact_list";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- visible: 1;
- align: 0 0;
- fixed: 1 1;
- }
- }
- }
- }
+collections {
+ BASE_SCALE;
+ group
+ {
+ images {
+ image: "messages_bubble_line_draft.#.png" RAW;
+ }
+ name: "conv_contact_list_layout";
+ parts {
+ part {
+ name: "pad.left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 32 0;
+ fixed: 1 0;
+ rel1{relative: 0.0 0.0;}
+ rel2{relative: 0.0 1.0;}
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "pad.right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 120 0;
+ fixed: 1 0;
+ rel1{relative: 1.0 0.0;}
+ rel2{relative: 1.0 1.0;}
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "pad.bottom";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 120;
+ fixed: 0 1;
+ rel1{relative: 0.0 1.0;}
+ rel2{relative: 1.0 1.0;}
+ align: 0.0 1.0;
+ }
+ }
+ part {
+ name: "metric";
+ type: SPACER;
+ scale: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { to_x: "pad.left"; relative: 1.0 0.0; }
+ rel2 { to_x: "pad.right"; to_y: "pad.bottom"; relative: 0.0 0.0; }
+ }
+ }
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 0;
+ rel1 { to: "swl.contact_list"; relative: 0.0 0.0; }
+ rel2 { to: "swl.contact_list"; relative: 1.0 1.0; }
+ color: 235 235 255 255;
+ }
+ }
+ part {
+ name: "swl.contact_list";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0 0;
+ rel1 { to: "metric"; relative: 0.0 0.0; }
+ rel2 { to: "metric"; relative: 1.0 0.0; }
+ }
+ }
+ part {
+ name: "frame";
+ repeat_events: 1;
+ description {
+ state: "default";
+ image.normal: "messages_bubble_line_draft.#.png";
+ rel1 { to: "swl.contact_list"; relative: 0.0 0.0; }
+ rel2 { to: "swl.contact_list"; relative: 1.0 1.0; }
+ color: 65 197 217 255;
+ }
+ }
+ }
+ }
}
#include "ConvContactListView.h"
#include "Resource.h"
+#include "Logger.h"
using namespace Msg;
ConvContactListView::ConvContactListView(Evas_Object *parent)
- : m_pRect(nullptr)
- , m_pBox(nullptr)
- , m_pList(nullptr)
+ : m_pList(nullptr)
+ , m_pGrid(nullptr)
{
setEo(addLayout(parent, CONV_CONTACT_LIST_LAYOUT, "conv_contact_list_layout"));
setFocusAllow(false);
+ addEventCb(EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
- m_pList = new ListView(getEo());
+ m_pGrid = elm_grid_add(*this);
+
+ m_pList = new ListView(m_pGrid);
m_pList->setMultiSelection(true);
m_pList->setMode(ELM_LIST_COMPRESS);
m_pList->setHomogeneous(true);
m_pList->setFocusAllow(false);
- m_pList->addSmartCb("realized", SMART_CALLBACK(ConvContactListView, onGometryChanged), this);
- m_pList->addSmartCb("unrealized", SMART_CALLBACK(ConvContactListView, onGometryChanged), this);
- m_pList->expand();
+ m_pList->addEventCb(EVAS_CALLBACK_CHANGED_SIZE_HINTS, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
m_pList->show();
+ elm_scroller_content_min_limit(*m_pList, false, true);
- m_pBox = elm_box_add(getEo());
- evas_object_show(m_pBox);
- elm_box_pack_end(m_pBox, *m_pList);
-
- setContent(m_pBox, "swl.contact_list");
- setContent(createRect(getEo()), "swl.rect");
+ elm_grid_pack(m_pGrid, *m_pList, 0, 0, 100, 100);
+ setContent(m_pGrid, "swl.contact_list");
}
ConvContactListView::~ConvContactListView()
void ConvContactListView::recalcGeometry()
{
- int itemHeight = getItemHeight();
-
- int h = itemHeight * m_pList->getItemsCount();
+ int maxHeight = 0;
+ int width = 0;
+ edje_object_part_geometry_get(getEdje(), "metric", nullptr, nullptr, &width, &maxHeight);
- int maxListHeight = 0;
- evas_object_geometry_get(m_pRect, nullptr, nullptr, nullptr, &maxListHeight);
+ int h = 0;
+ evas_object_size_hint_min_get(*m_pList, nullptr, &h);
- if(h > maxListHeight)
- h = maxListHeight;
-
- evas_object_size_hint_min_set(m_pBox, 0, h);
- evas_object_size_hint_max_set(m_pBox, -1, h);
-}
+ if(h > maxHeight)
+ h = maxHeight;
-int ConvContactListView::getItemHeight() const
-{
- int res = 0;
- Evas_Object *track = nullptr;
- Elm_Object_Item *item = elm_genlist_first_item_get(*m_pList);
-
- for(; item ;)
- {
- track = elm_object_item_track(item);
- if(track)
- break;
- item = elm_genlist_item_next_get(item);
- }
-
- if(track)
- {
- evas_object_geometry_get(track, nullptr, nullptr, nullptr, &res);
- elm_object_item_untrack(track);
- }
-
- return res;
-}
-
-Evas_Object *ConvContactListView::createRect(Evas_Object *parent)
-{
- m_pRect = evas_object_rectangle_add(evas_object_evas_get(parent));
- evas_object_show(m_pRect);
- evas_object_color_set(m_pRect, 0, 0, 0, 0);
- evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_MOVE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
- evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_RESIZE, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
- evas_object_event_callback_add(m_pRect, EVAS_CALLBACK_CHANGED_SIZE_HINTS, EVAS_EVENT_CALLBACK(ConvContactListView, onGometryChanged), this);
- return m_pRect;
+ evas_object_size_hint_min_set(m_pGrid, width, h);
}
void ConvContactListView::onGometryChanged(Evas_Object *obj, void *eventInfo)