TizenRefApp-8148 Implement skeleton of contact frame. 21/118421/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Fri, 10 Mar 2017 09:09:39 +0000 (11:09 +0200)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Fri, 10 Mar 2017 09:09:39 +0000 (11:09 +0200)
Change-Id: I6c8be679d979d483c53a82d5c420d013bfeb8131
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/View/src/ListView.cpp
src/Composer/Controller/inc/ContactFrame.h [new file with mode: 0644]
src/Composer/Controller/src/ContactFrame.cpp [new file with mode: 0644]

index 215375b898331f6db069176b4ea3ee67c021caee..bc9d0c5fcf5f228a9e447be84a05ae28dbc5cfe1 100644 (file)
@@ -65,9 +65,10 @@ void ListView::setListener(IListViewListener *listener)
 void ListView::createListView(Evas_Object *parent, Eext_Circle_Surface *parentCircleSurface)
 {
     setEo(elm_genlist_add(parent));
-    evas_object_smart_callback_add(getEo(), "realized", ListView::on_realized_cb, this);
-    evas_object_smart_callback_add(getEo(), "unrealized", ListView::on_unrealized_cb, this);
-    evas_object_smart_callback_add(getEo(), "longpressed", ListView::on_longpressed_cb, this);
+    setMode(ELM_LIST_COMPRESS);
+    addSmartCb("realized", ListView::on_realized_cb, this);
+    addSmartCb("unrealized", ListView::on_unrealized_cb, this);
+    addSmartCb("longpressed", ListView::on_longpressed_cb, this);
 
     if (parentCircleSurface) {
         // Default settings:
diff --git a/src/Composer/Controller/inc/ContactFrame.h b/src/Composer/Controller/inc/ContactFrame.h
new file mode 100644 (file)
index 0000000..ff4dbb6
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef ContactFrame_h_
+#define ContactFrame_h_
+
+#include "FrameController.h"
+#include "ListView.h"
+#include "ContactAddress.h"
+
+namespace Msg {
+
+    class IContactFrameListener;
+
+    class ContactFrame
+        : public FrameController
+        , private IListViewListener {
+
+        public:
+            ContactFrame(NaviFrameController &parent);
+            virtual ~ContactFrame();
+
+            void setListener(IContactFrameListener *l);
+
+        private:
+            // NaviFrameItem:
+            void onAttached(ViewItem &item) override;
+
+            // Hw buttons:
+            void onHwBackButtonPreessed(Evas_Object *obj, void *event);
+
+            // IListViewListener:
+            void onListItemSelected(ListItem &listItem) override;
+
+        private:
+            void prepareList();
+
+        private:
+            ListView *m_pList;
+            IContactFrameListener *m_pListener;
+    };
+
+    class IContactFrameListener {
+        public:
+            virtual ~IContactFrameListener() {}
+            virtual void onContactSelected(ContactAddressRef &contact) {};
+    };
+}
+
+#endif /* ContactFrame_h_ */
diff --git a/src/Composer/Controller/src/ContactFrame.cpp b/src/Composer/Controller/src/ContactFrame.cpp
new file mode 100644 (file)
index 0000000..ba94997
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2016  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "ContactFrame.h"
+
+using namespace Msg;
+
+ContactFrame::ContactFrame(NaviFrameController &parent)
+    : FrameController(parent)
+    , m_pList(nullptr)
+    , m_pListener(nullptr)
+{
+    MSG_LOG("");
+    prepareList();
+}
+
+ContactFrame::~ContactFrame()
+{
+    MSG_LOG("");
+}
+
+void ContactFrame::setListener(IContactFrameListener *l)
+{
+    m_pListener = l;
+}
+
+void ContactFrame::prepareList()
+{
+    if (!m_pList) {
+        m_pList = new ListView(getParent());
+        m_pList->addHwButtonEvent(EEXT_CALLBACK_BACK, makeCbFirst(&ContactFrame::onHwBackButtonPreessed), this);
+        m_pList->setHomogeneous(false);
+        m_pList->setMultiSelection(false);
+        m_pList->setListener(this);
+    }
+}
+
+void ContactFrame::onAttached(ViewItem &item)
+{
+    MSG_LOG("");
+    FrameController::onAttached(item);
+    setContent(*m_pList);
+}
+
+void ContactFrame::onListItemSelected(ListItem &listItem)
+{
+    MSG_LOG("");
+    if (m_pListener) {
+        // TODO: impl.
+    }
+}
+
+void ContactFrame::onHwBackButtonPreessed(Evas_Object *obj, void *event)
+{
+    MSG_LOG("");
+    pop();
+}
+