Apps-common-lib: Implement partUpdate for GenItem 68/81768/1
authorYevgeniy Kolomiets <y.kolomiets@samsung.com>
Tue, 26 Jul 2016 08:13:05 +0000 (11:13 +0300)
committerEugene Kurzberg <i.kurtsberg@samsung.com>
Thu, 28 Jul 2016 08:18:46 +0000 (11:18 +0300)
Change-Id: I44c961f1449f2b8530bb4749493045c8a3b70d5e
Signed-off-by: Yevgeniy Kolomiets <y.kolomiets@samsung.com>
lib-apps-common/inc/Ui/CheckItem.h
lib-apps-common/inc/Ui/GenItem.h
lib-apps-common/inc/Ux/SelectItem.h
lib-apps-common/src/Ui/CheckItem.cpp
lib-apps-common/src/Ui/GenItem.cpp
lib-apps-common/src/Ux/SelectItem.cpp

index 5bdc38c..b245e97 100644 (file)
@@ -35,7 +35,7 @@ namespace Ui
                 */
                typedef std::function<bool(bool)> CheckCallback;
 
-               CheckItem();
+               CheckItem(GenContainer::Type type = GenContainer::TypeGenlist);
                virtual ~CheckItem() override;
 
                /**
index 37de816..cc93f3e 100644 (file)
@@ -134,6 +134,12 @@ namespace Ui
                                bool isAnimated = false);
 
                /**
+               * @brief Update item part.
+               * @see elm_gelist_item_fields_update or elm_gengrid_item_fields_update
+               */
+               void update(const char *parts, int partType);
+
+               /**
                 * @brief Remove item from genlist without destroying it.
                 */
                void pop();
index 7967293..a675f7a 100644 (file)
@@ -31,7 +31,7 @@ namespace Ux
        class EXPORT_API SelectItem : public Ui::CheckItem
        {
        public:
-               SelectItem();
+               SelectItem(Ui::GenContainer::Type type = Ui::GenContainer::TypeGenlist);
 
                /**
                 * @return Whether item is excluded from multiple selection.
index ef27cd6..b23491f 100644 (file)
@@ -20,8 +20,9 @@
 
 using namespace Ui;
 
-CheckItem::CheckItem()
-       : m_CheckPart("*"), m_IsChecked(false), m_IsChecking(false),
+CheckItem::CheckItem(GenContainer::Type type)
+       : GenItem(type),
+         m_CheckPart("*"), m_IsChecked(false), m_IsChecking(false),
          m_LinkedItem(nullptr)
 {
 }
@@ -85,7 +86,7 @@ void CheckItem::unsetLinkedItem()
 
 void CheckItem::updateCheckPart()
 {
-       elm_genlist_item_fields_update(getObjectItem(), m_CheckPart.c_str(), ELM_GENLIST_ITEM_FIELD_CONTENT);
+       update(m_CheckPart.c_str(), ELM_GENLIST_ITEM_FIELD_CONTENT);
 }
 
 Evas_Object *CheckItem::getContent(Evas_Object *parent, const char *part)
index 4d7a2f0..8c5c393 100644 (file)
@@ -23,6 +23,7 @@
 using namespace Ui;
 
 typedef void(*ScrollFunc)(Elm_Object_Item *item, int type);
+typedef void(*UpdateFieldsFunc)(Elm_Object_Item *item, const char *parts, int fieldType);
 
 struct Ui::GenItemApi
 {
@@ -32,6 +33,7 @@ struct Ui::GenItemApi
        ScrollFunc bringIn;
        ScrollFunc show;
        void(*setSelected)(Elm_Object_Item *item, Eina_Bool selected);
+       UpdateFieldsFunc updateFields;
 };
 
 namespace
@@ -42,14 +44,16 @@ namespace
                  elm_genlist_item_prev_get,
                  (ScrollFunc) elm_genlist_item_bring_in,
                  (ScrollFunc) elm_genlist_item_show,
-                 elm_genlist_item_selected_set },
+                 elm_genlist_item_selected_set,
+                 (UpdateFieldsFunc) elm_genlist_item_fields_update },
 
                { [](const Elm_Object_Item *item) -> Elm_Object_Item * { return nullptr; },
                  elm_gengrid_item_next_get,
                  elm_gengrid_item_prev_get,
                  (ScrollFunc) elm_gengrid_item_bring_in,
                  (ScrollFunc) elm_gengrid_item_show,
-                 elm_gengrid_item_selected_set }
+                 elm_gengrid_item_selected_set,
+                 (UpdateFieldsFunc) elm_gengrid_item_fields_update }
        };
 }
 
@@ -145,6 +149,11 @@ void GenItem::focus(Elm_Genlist_Item_Scrollto_Type position, bool isAnimated)
        }
 }
 
+void GenItem::update(const char *parts, int partType)
+{
+       m_Api->updateFields(m_Item, parts, partType);
+}
+
 void GenItem::pop()
 {
        onPop();
index d2c5bcb..b2e0e2f 100644 (file)
 #include "Ux/SelectView.h"
 
 using namespace Ux;
+using namespace Ui;
 
-SelectItem::SelectItem()
-       : m_SelectView(nullptr), m_SelectMode(SelectNone),
+SelectItem::SelectItem(GenContainer::Type type)
+       : CheckItem(type),
+         m_SelectView(nullptr), m_SelectMode(SelectNone),
          m_CustomResult{ 0, 0 }, m_HasCustomResult(false),
          m_IsExcluded(false)
 {