From: Denis Dolzhenko Date: Wed, 20 Jan 2016 14:01:56 +0000 (+0200) Subject: TizenRefApp-5518: Append realized\unrealized cbs to genlist item + refact View, ViewItem X-Git-Tag: accepted/tizen/mobile/20160122.035308~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F57499%2F1;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-5518: Append realized\unrealized cbs to genlist item + refact View, ViewItem Change-Id: I832217f3ccc1ad318584a4ad9c38c24ffccff6ee Signed-off-by: Denis Dolzhenko --- diff --git a/src/Common/View/inc/ListItem.h b/src/Common/View/inc/ListItem.h index 634a0f6..103bde3 100644 --- a/src/Common/View/inc/ListItem.h +++ b/src/Common/View/inc/ListItem.h @@ -85,18 +85,18 @@ namespace Msg bool isCheckable() const; protected: - // TODO: remove ListItem prefix - virtual std::string getListItemText(ListItem &item, const char *part); - virtual Evas_Object *getListItemContent(ListItem &item, const char *part); - virtual bool getListItemState(ListItem &item, const char *part); - virtual void onListItemDelete(ListItem &item); + virtual std::string getText(ListItem &item, const char *part); + virtual Evas_Object *getContent(ListItem &item, const char *part); + virtual bool getState(ListItem &item, const char *part); + virtual void onDelete(ListItem &item); virtual const char *getCheckPart(ListItem &item); + virtual void onRealized(ListItem &item) {}; + virtual void onUnrealized(ListItem &item) {}; + private: virtual void onViewDestroyed(); - Evas_Object *addCheck(); - void onCheckChanged(Evas_Object *obj, void *eventInfo); static char * elm_gen_item_text_get_cb(void * data, Evas_Object * obj, const char * part); diff --git a/src/Common/View/inc/ListView.h b/src/Common/View/inc/ListView.h index f874b46..36139c8 100644 --- a/src/Common/View/inc/ListView.h +++ b/src/Common/View/inc/ListView.h @@ -59,12 +59,8 @@ namespace Msg void updateRealizedItems(); - void registerItemRealizedCallback(); - void registerItemExpandedCallback(); - void registerItemContractedCallback(); - private: - typedef void (IListViewListener::*ListenerMethod)(ListItem &item, void *funcData); + typedef void (IListViewListener::*ListenerMethod)(ListItem &item); public: static void notifyListener(void *data, Evas_Object *obj, void *event_info, ListenerMethod method); @@ -73,11 +69,8 @@ namespace Msg void createListView(Evas_Object *parent); static void on_item_selected_cb(void *data, Evas_Object *obj, void *event_info); - static void on_drag_left_cb(void *data, Evas_Object *obj, void *event_info); - static void on_drag_right_cb(void *data, Evas_Object *obj, void *event_info); static void on_realized_cb(void *data, Evas_Object *obj, void *event_info); - static void on_expanded_cb(void *data, Evas_Object *obj, void *event_info); - static void on_contracted_cb(void *data, Evas_Object *obj, void *event_info); + static void on_unrealized_cb(void *data, Evas_Object *obj, void *event_info); private: IListViewListener *m_pListener; @@ -88,13 +81,8 @@ namespace Msg { public: virtual ~IListViewListener() {}; - virtual void onListItemSelected(ListItem &listItem, void *funcData) {}; - virtual void onListItemDragLeft(ListItem &listItem, void *funcData) {}; - virtual void onListItemDragRight(ListItem &listItem, void *funcData) {}; - virtual void onListItemExpanded(ListItem &listItem, void *funcData) {}; - virtual void onListItemContracted(ListItem &listItem, void *funcData) {}; - virtual void onListItemRealized(ListItem &listItem, void *funcData) {}; - virtual void onListItemChecked(ListItem &listItem, void *funcData) {}; + virtual void onListItemSelected(ListItem &listItem) {}; + virtual void onListItemChecked(ListItem &listItem) {}; }; template diff --git a/src/Common/View/inc/SelectAllListItem.h b/src/Common/View/inc/SelectAllListItem.h index 145782e..1b9fe3d 100644 --- a/src/Common/View/inc/SelectAllListItem.h +++ b/src/Common/View/inc/SelectAllListItem.h @@ -33,7 +33,7 @@ namespace Msg private: virtual const char *getCheckPart(ListItem &item); - virtual std::string getListItemText(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); private: std::string m_Text; diff --git a/src/Common/View/inc/View.h b/src/Common/View/inc/View.h index 7871ba2..71cf966 100644 --- a/src/Common/View/inc/View.h +++ b/src/Common/View/inc/View.h @@ -32,46 +32,46 @@ namespace Msg public: View(); - inline void destroy(); - inline operator Evas_Object *() const; - inline Evas_Object *getEo() const; - inline bool isVisible() const; - inline void show(); - inline void hide(); - inline void setVisibility(bool show); - inline void move(Evas_Coord x, Evas_Coord y); - inline void setSizeHintWeight(double x = EVAS_HINT_EXPAND, double y = EVAS_HINT_EXPAND); - inline void setSizeHintAlign(double x = EVAS_HINT_FILL, double y = EVAS_HINT_FILL); + void destroy(); + operator Evas_Object *() const; + Evas_Object *getEo() const; + bool isVisible() const; + void show(); + void hide(); + void setVisibility(bool show); + void move(Evas_Coord x, Evas_Coord y); + void setSizeHintWeight(double x = EVAS_HINT_EXPAND, double y = EVAS_HINT_EXPAND); + void setSizeHintAlign(double x = EVAS_HINT_FILL, double y = EVAS_HINT_FILL); void expand(); - static void expand(Evas_Object *obj); - inline void setSizeHintMin(Evas_Coord w, Evas_Coord h); - inline void setSizeHintMax(Evas_Coord w, Evas_Coord h); + void expand(Evas_Object *obj); + void setSizeHintMin(Evas_Coord w, Evas_Coord h); + void setSizeHintMax(Evas_Coord w, Evas_Coord h); Evas_Object *setContent(Evas_Object *content, const char *part = nullptr, bool saveOldContent = false); - inline Evas_Object *unsetContent(const char *part = nullptr); - inline Evas_Object* getContent(const char *part = nullptr) const; - inline void setFocusAllow(bool enable); - inline bool getFocusAllow() const; - inline void setFocus(bool focus); - inline bool getFocus() const; - inline void setTranslateble(bool translateble, const char *domain, const char *part = nullptr); - inline void emitSignal(const char *emission, const char *source); - inline void setData(const char *key, const void *data); - inline void *getData(const char *key) const; - inline void addEventCb(Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data); + Evas_Object *unsetContent(const char *part = nullptr); + Evas_Object* getContent(const char *part = nullptr) const; + void setFocusAllow(bool enable); + bool getFocusAllow() const; + void setFocus(bool focus); + bool getFocus() const; + void setTranslateble(bool translateble, const char *domain, const char *part = nullptr); + void emitSignal(const char *emission, const char *source); + void setData(const char *key, const void *data); + void *getData(const char *key) const; + void addEventCb(Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data); template - inline static T staticCast(Evas_Object *obj); + static T staticCast(void *evasObj); template - inline static T reinterpretCast(void *obj); + static T reinterpretCast(void *evasObj); template - inline static T dynamicCast(Evas_Object *obj); + static T dynamicCast(void *evasObj); - inline std::string getText(const char *part = nullptr) const; - inline const char *getTextCStr(const char *part = nullptr) const; - inline void setText(const char *text, const char *part = nullptr); - inline void setText(const std::string &text, const char *part = nullptr); - inline void setText(const TText &text, const char *part = nullptr); - inline static void setText(Evas_Object *obj, const TText &text, const char *part = nullptr); + std::string getText(const char *part = nullptr) const; + const char *getTextCStr(const char *part = nullptr) const; + void setText(const char *text, const char *part = nullptr); + void setText(const std::string &text, const char *part = nullptr); + void setText(const TText &text, const char *part = nullptr); + static void setText(Evas_Object *obj, const TText &text, const char *part = nullptr); static Evas_Object *addLayout(Evas_Object *parent, const std::string &edjePath, const std::string &group); @@ -87,10 +87,10 @@ namespace Msg View(View&) = delete; View& operator=(View&) = delete; Evas_Object_Event_Cb getCb(Evas_Callback_Type); - inline void *getSmartData() const; - inline static void *getSmartData(Evas_Object *obj); - inline void setSmartData(const void *data); - inline static void setSmartData(Evas_Object *obj, const void *data); + void *getSmartData() const; + static void *getSmartData(Evas_Object *obj); + void setSmartData(const void *data); + static void setSmartData(Evas_Object *obj, const void *data); private: static void on_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -260,21 +260,21 @@ namespace Msg } template - inline T View::staticCast(Evas_Object *obj) + inline T View::staticCast(void *evasObj) { - return static_cast(getSmartData(obj)); + return static_cast(getSmartData((Evas_Object*)evasObj)); } template - inline T View::reinterpretCast(void *obj) + inline T View::reinterpretCast(void *evasObj) { - return reinterpret_cast(getSmartData((Evas_Object*)obj)); + return reinterpret_cast(getSmartData((Evas_Object*)evasObj)); } template - inline T View::dynamicCast(Evas_Object *obj) + inline T View::dynamicCast(void *evasObj) { - return dynamic_cast(staticCast(obj)); + return dynamic_cast(staticCast(evasObj)); } inline void View::addEventCb(Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data) diff --git a/src/Common/View/inc/ViewItem.h b/src/Common/View/inc/ViewItem.h index 3183a33..25a1d27 100644 --- a/src/Common/View/inc/ViewItem.h +++ b/src/Common/View/inc/ViewItem.h @@ -34,25 +34,32 @@ namespace Msg ViewItem(ViewItem&) = delete; ViewItem& operator=(const ViewItem&) = delete; - inline operator Elm_Object_Item *() const; + operator Elm_Object_Item *() const; virtual void destroy(); Evas_Object *setContent(Evas_Object *content, const char *part = nullptr, bool saveOldContent = false); Evas_Object *getContent(const char *part = nullptr) const; void emitSignal(const char *signal, const char *source = "elm"); - inline void *getData() const; - inline void setData(void *data); - inline Elm_Object_Item *getElmObjItem() const; - inline Evas_Object *getWidget() const; - inline void disabled(bool val); - inline bool isDisabled() const; - inline void setTranslateble(bool translateble, const char *domain, const char *part = nullptr); - - inline std::string getText(const char *part = nullptr) const; - inline const char *getTextCStr(const char *part = nullptr) const; - inline void setText(const char *text, const char *part = nullptr); - inline void setText(const std::string &text, const char *part = nullptr); - inline void setText(const TText &text, const char *part = nullptr); - inline static void setText(Elm_Object_Item *it, const TText &text, const char *part = nullptr); + void *getData() const; + void setData(void *data); + Elm_Object_Item *getElmObjItem() const; + Evas_Object *getWidget() const; + void disabled(bool val); + bool isDisabled() const; + void setTranslateble(bool translateble, const char *domain, const char *part = nullptr); + + std::string getText(const char *part = nullptr) const; + const char *getTextCStr(const char *part = nullptr) const; + void setText(const char *text, const char *part = nullptr); + void setText(const std::string &text, const char *part = nullptr); + void setText(const TText &text, const char *part = nullptr); + static void setText(Elm_Object_Item *it, const TText &text, const char *part = nullptr); + + template + static T staticCast(void *elmObjectItem); + template + static T reinterpretCast(void *elmObjectItem); + template + static T dynamicCast(void *elmObjectItem); protected: virtual ~ViewItem(); @@ -137,6 +144,23 @@ namespace Msg return elm_object_item_part_text_get(m_pItem, part); } + template + inline T ViewItem::staticCast(void *elmObjectItem) + { + return static_cast(elm_object_item_data_get((Elm_Object_Item*)elmObjectItem)); + } + + template + inline T ViewItem::reinterpretCast(void *elmObjectItem) + { + return reinterpret_cast(elm_object_item_data_get((Elm_Object_Item*)elmObjectItem)); + } + + template + inline T ViewItem::dynamicCast(void *elmObjectItem) + { + return dynamic_cast(staticCast(elmObjectItem)); + } } #endif /* ViewItem_h_ */ diff --git a/src/Common/View/src/ListItem.cpp b/src/Common/View/src/ListItem.cpp index 017019b..5720c57 100644 --- a/src/Common/View/src/ListItem.cpp +++ b/src/Common/View/src/ListItem.cpp @@ -130,7 +130,7 @@ char *ListItem::elm_gen_item_text_get_cb(void *data, Evas_Object *obj, const cha if(self) { - std::string text = self->getListItemText(*self, part); + std::string text = self->getText(*self, part); return text.empty() ? nullptr : strdup(text.c_str()); } @@ -155,7 +155,7 @@ Evas_Object *ListItem::elm_gen_item_content_get_cb(void * data, Evas_Object * ob } } - return self->getListItemContent(*self, part); + return self->getContent(*self, part); } Evas_Object *ListItem::addCheck() @@ -206,7 +206,7 @@ void ListItem::onCheckChanged(Evas_Object *obj, void *eventInfo) Eina_Bool ListItem::elm_gen_item_state_get_cb(void *data, Evas_Object *obj, const char *part) { ListItem *self = static_cast(data); - return self ? self->getListItemState(*self, part) : false; + return self ? self->getState(*self, part) : false; } void ListItem::setSelected(bool selected) @@ -234,22 +234,22 @@ void ListItem::updateFields(const char *parts, Elm_Genlist_Item_Field_Type type) elm_genlist_item_fields_update(getElmObjItem(), parts, type); } -std::string ListItem::getListItemText(ListItem &item, const char* part) +std::string ListItem::getText(ListItem &item, const char* part) { return std::string(); } -Evas_Object* ListItem::getListItemContent(ListItem &item, const char* part) +Evas_Object* ListItem::getContent(ListItem &item, const char* part) { return nullptr; } -bool ListItem::getListItemState(ListItem &item, const char* part) +bool ListItem::getState(ListItem &item, const char* part) { return false; } -void ListItem::onListItemDelete(ListItem &item) +void ListItem::onDelete(ListItem &item) { delete this; } @@ -268,6 +268,6 @@ void ListItem::elm_gen_item_del_cb(void *data, Evas_Object *obj) ListItem *self = static_cast(data); if(self) - self->onListItemDelete(*self); + self->onDelete(*self); } diff --git a/src/Common/View/src/ListView.cpp b/src/Common/View/src/ListView.cpp index 140d9a2..cc4ab70 100644 --- a/src/Common/View/src/ListView.cpp +++ b/src/Common/View/src/ListView.cpp @@ -53,8 +53,8 @@ void ListView::setListener(IListViewListener *listener) void ListView::createListView(Evas_Object *parent) { setEo(elm_genlist_add(parent)); - evas_object_smart_callback_add(getEo(), "drag,start,right", on_drag_right_cb, this); - evas_object_smart_callback_add(getEo(), "drag,start,left", on_drag_left_cb, this); + evas_object_smart_callback_add(getEo(), "realized", ListView::on_realized_cb, this); + evas_object_smart_callback_add(getEo(), "unrealized", ListView::on_unrealized_cb, this); } bool ListView::appendItem(ListItem &listItem, ListItem *parent) @@ -141,22 +141,21 @@ void ListView::setHomogeneous(bool isHomogeneous) ListItem *ListView::getSelectedItem() const { Elm_Object_Item *elmItem = elm_genlist_selected_item_get(getEo()); - return static_cast(elm_object_item_data_get(elmItem)); + return ListItem::staticCast(elmItem); } void ListView::notifyListener(void *data, Evas_Object *obj, void *event_info, ListenerMethod method) { - Elm_Object_Item *elmItem = static_cast(event_info); - ListItem *item = static_cast(elm_object_item_data_get(elmItem)); - + ListItem *item = ListItem::staticCast(event_info); MSG_ASSERT(item, "Item is null"); + if(item) { ListView *owner = item->getOwner(); MSG_ASSERT(owner, "ListItem::owner is null"); if(owner && owner->m_pListener) - (owner->m_pListener->*method)(*item, data); + (owner->m_pListener->*method)(*item); } } @@ -195,30 +194,14 @@ bool ListView::getMultiSelection() const return elm_genlist_multi_select_get(getEo()); } -void ListView::registerItemRealizedCallback() -{ - evas_object_smart_callback_add(getEo(), "realized", ListView::on_realized_cb, this); -} - -void ListView::registerItemExpandedCallback() -{ - evas_object_smart_callback_add(getEo(), "expanded", ListView::on_expanded_cb, this); -} - -void ListView::registerItemContractedCallback() -{ - evas_object_smart_callback_add(getEo(), "contracted", ListView::on_contracted_cb, this); -} - void ListView::on_item_selected_cb(void *data, Evas_Object *obj, void *event_info) { - Elm_Object_Item *elmItem = static_cast(event_info); - ListItem *self = static_cast(elm_object_item_data_get(elmItem)); + ListItem *item = ListItem::staticCast(event_info); - self->setSelected(false); - if(self->getOwner()->getCheckMode() && self->isCheckable()) + item->setSelected(false); + if(item->getOwner()->getCheckMode() && item->isCheckable()) { - self->changeCheckedState(true); + item->changeCheckedState(true); notifyListener(data, obj, event_info, &IListViewListener::onListItemChecked); } else @@ -227,27 +210,14 @@ void ListView::on_item_selected_cb(void *data, Evas_Object *obj, void *event_inf } } -void ListView::on_drag_left_cb(void *data, Evas_Object *obj, void *event_info) -{ - notifyListener(data, obj, event_info, &IListViewListener::onListItemDragLeft); -} - -void ListView::on_drag_right_cb(void *data, Evas_Object *obj, void *event_info) -{ - notifyListener(data, obj, event_info, &IListViewListener::onListItemDragRight); -} - void ListView::on_realized_cb(void *data, Evas_Object *obj, void *event_info) { - notifyListener(data, obj, event_info, &IListViewListener::onListItemRealized); -} - -void ListView::on_expanded_cb(void *data, Evas_Object *obj, void *event_info) -{ - notifyListener(data, obj, event_info, &IListViewListener::onListItemExpanded); + ListItem *item = ListItem::staticCast(event_info); + item->onRealized(*item); } -void ListView::on_contracted_cb(void *data, Evas_Object *obj, void *event_info) +void ListView::on_unrealized_cb(void *data, Evas_Object *obj, void *event_info) { - notifyListener(data, obj, event_info, &IListViewListener::onListItemContracted); + ListItem *item = ListItem::staticCast(event_info); + item->onUnrealized(*item); } diff --git a/src/Common/View/src/SelectAllListItem.cpp b/src/Common/View/src/SelectAllListItem.cpp index 745c159..2a84eab 100644 --- a/src/Common/View/src/SelectAllListItem.cpp +++ b/src/Common/View/src/SelectAllListItem.cpp @@ -43,7 +43,7 @@ const char *SelectAllListItem::getCheckPart(ListItem &item) return checkPart; } -std::string SelectAllListItem::getListItemText(ListItem &item, const char *part) +std::string SelectAllListItem::getText(ListItem &item, const char *part) { if(strcmp(part, textPart) == 0) { diff --git a/src/Conversation/ContactList/Controller/inc/ConvContactList.h b/src/Conversation/ContactList/Controller/inc/ConvContactList.h index 61f0df7..3a7bb68 100644 --- a/src/Conversation/ContactList/Controller/inc/ConvContactList.h +++ b/src/Conversation/ContactList/Controller/inc/ConvContactList.h @@ -42,7 +42,7 @@ namespace Msg private: // IListViewListener: - virtual void onListItemSelected(ListItem &listItem, void *funcData); + virtual void onListItemSelected(ListItem &listItem); template void search(); diff --git a/src/Conversation/ContactList/Controller/src/ConvContactList.cpp b/src/Conversation/ContactList/Controller/src/ConvContactList.cpp index 266bde6..e261b4d 100644 --- a/src/Conversation/ContactList/Controller/src/ConvContactList.cpp +++ b/src/Conversation/ContactList/Controller/src/ConvContactList.cpp @@ -119,7 +119,7 @@ bool ConvContactList::onPredictSearchUpdateRequest() return false; // Delete idler } -void ConvContactList::onListItemSelected(ListItem &listItem, void *funcData) +void ConvContactList::onListItemSelected(ListItem &listItem) { ContactListItem &contactItem = static_cast(listItem); MSG_LOG("Selected recipient: ", contactItem.getRecipient()); diff --git a/src/Conversation/ContactList/View/inc/ContactListViewItem.h b/src/Conversation/ContactList/View/inc/ContactListViewItem.h index 68c9142..2503cd7 100644 --- a/src/Conversation/ContactList/View/inc/ContactListViewItem.h +++ b/src/Conversation/ContactList/View/inc/ContactListViewItem.h @@ -39,8 +39,8 @@ namespace Msg virtual Evas_Object *getThumbnail() const = 0; private: - virtual std::string getListItemText(ListItem &item, const char *part); - virtual Evas_Object *getListItemContent(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); + virtual Evas_Object *getContent(ListItem &item, const char *part); }; } diff --git a/src/Conversation/ContactList/View/src/ContactListViewItem.cpp b/src/Conversation/ContactList/View/src/ContactListViewItem.cpp index 754b010..1a0fa8b 100644 --- a/src/Conversation/ContactList/View/src/ContactListViewItem.cpp +++ b/src/Conversation/ContactList/View/src/ContactListViewItem.cpp @@ -32,7 +32,7 @@ ContactListViewItem::~ContactListViewItem() { } -std::string ContactListViewItem::getListItemText(ListItem &item, const char *part) +std::string ContactListViewItem::getText(ListItem &item, const char *part) { if(getStyle() == nameOrEmailStyle) { @@ -61,7 +61,7 @@ std::string ContactListViewItem::getListItemText(ListItem &item, const char *par return ""; } -Evas_Object *ContactListViewItem::getListItemContent(ListItem &item, const char *part) +Evas_Object *ContactListViewItem::getContent(ListItem &item, const char *part) { if(strcmp(part, "elm.icon.1") == 0) { diff --git a/src/Conversation/ConvList/Controller/inc/ConvList.h b/src/Conversation/ConvList/Controller/inc/ConvList.h index ff6ddd9..5ba04ef 100644 --- a/src/Conversation/ConvList/Controller/inc/ConvList.h +++ b/src/Conversation/ConvList/Controller/inc/ConvList.h @@ -97,8 +97,8 @@ namespace Msg ConvListItem *getItem(MsgId msgId) const; // IListViewListener: - virtual void onListItemSelected(ListItem &listItem, void *funcData); - virtual void onListItemChecked(ListItem &listItem, void *funcData); + virtual void onListItemSelected(ListItem &listItem); + virtual void onListItemChecked(ListItem &listItem); // IMsgStorageListener: virtual void onMsgStorageUpdate(const MsgIdList &msgIdList); diff --git a/src/Conversation/ConvList/Controller/src/ConvList.cpp b/src/Conversation/ConvList/Controller/src/ConvList.cpp index 2c96022..784ff66 100644 --- a/src/Conversation/ConvList/Controller/src/ConvList.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvList.cpp @@ -172,7 +172,7 @@ void ConvList::selectListItems(bool state) m_pList->updateRealizedItems(); } -void ConvList::onListItemSelected(ListItem &listItem, void *funcData) +void ConvList::onListItemSelected(ListItem &listItem) { ConvListItem &item = static_cast(listItem); item.setSelected(false); @@ -185,7 +185,7 @@ void ConvList::onSelectAllChanged(Evas_Object *obj, void *eventInfo) selectListItems(m_pSelectAll->getCheckState()); } -void ConvList::onListItemChecked(ListItem &listItem, void *funcData) +void ConvList::onListItemChecked(ListItem &listItem) { bool allSelected = isAllListItemSelected(); m_pSelectAll->setCheckState(allSelected); diff --git a/src/Conversation/ConvList/View/inc/ConvListViewItem.h b/src/Conversation/ConvList/View/inc/ConvListViewItem.h index cb62503..4e46996 100644 --- a/src/Conversation/ConvList/View/inc/ConvListViewItem.h +++ b/src/Conversation/ConvList/View/inc/ConvListViewItem.h @@ -41,8 +41,8 @@ namespace Msg virtual std::string getTime() = 0; private: - virtual std::string getListItemText(ListItem &item, const char *part); - virtual Evas_Object *getListItemContent(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); + virtual Evas_Object *getContent(ListItem &item, const char *part); virtual const char *getCheckPart(ListItem &item); }; } diff --git a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp index 27edfe8..a9c1b0b 100644 --- a/src/Conversation/ConvList/View/src/ConvListViewItem.cpp +++ b/src/Conversation/ConvList/View/src/ConvListViewItem.cpp @@ -49,7 +49,7 @@ ConvListViewItem::~ConvListViewItem() } -std::string ConvListViewItem::getListItemText(ListItem &item, const char *part) +std::string ConvListViewItem::getText(ListItem &item, const char *part) { if(!strcmp(part, "elm.text")) return getText(); @@ -59,7 +59,7 @@ std::string ConvListViewItem::getListItemText(ListItem &item, const char *part) return ""; } -Evas_Object *ConvListViewItem::getListItemContent(ListItem &item, const char *part) +Evas_Object *ConvListViewItem::getContent(ListItem &item, const char *part) { if(!strcmp(part, "elm.swallow.end")) return getBubble(); diff --git a/src/MsgThread/Controller/inc/ThreadList.h b/src/MsgThread/Controller/inc/ThreadList.h index 6896aac..a70d473 100644 --- a/src/MsgThread/Controller/inc/ThreadList.h +++ b/src/MsgThread/Controller/inc/ThreadList.h @@ -47,8 +47,8 @@ namespace Msg virtual void onMsgStorageChange(const MsgIdList &idList); // IListViewListener: - virtual void onListItemSelected(ListItem &listItem, void *funcData); - virtual void onListItemChecked(ListItem &listItem, void *funcData); + virtual void onListItemSelected(ListItem &listItem); + virtual void onListItemChecked(ListItem &listItem); private: void showSelectAllItem(bool show, bool resetCheck = true); diff --git a/src/MsgThread/Controller/inc/ThreadSearchList.h b/src/MsgThread/Controller/inc/ThreadSearchList.h index ebf0453..04f3929 100644 --- a/src/MsgThread/Controller/inc/ThreadSearchList.h +++ b/src/MsgThread/Controller/inc/ThreadSearchList.h @@ -43,7 +43,7 @@ namespace Msg private: // IListViewListener: - virtual void onListItemSelected(ListItem &listItem, void *funcData); + virtual void onListItemSelected(ListItem &listItem); void search(); diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index f00bd62..0235689 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -145,14 +145,14 @@ void ThreadList::onMsgStorageChange(const MsgIdList &idList) m_pListener->onThreadListChanged(); } -void ThreadList::onListItemSelected(ListItem &listItem, void *funcData) +void ThreadList::onListItemSelected(ListItem &listItem) { ThreadListItem *it = dynamic_cast(&listItem); if(it && m_pListener) m_pListener->onListItemSelected(it->getThreadId()); } -void ThreadList::onListItemChecked(ListItem &listItem, void *funcData) +void ThreadList::onListItemChecked(ListItem &listItem) { if(ThreadListItem *it = dynamic_cast(&listItem)) checkHandler(*it); diff --git a/src/MsgThread/Controller/src/ThreadSearchList.cpp b/src/MsgThread/Controller/src/ThreadSearchList.cpp index 16cef99..6f2db60 100644 --- a/src/MsgThread/Controller/src/ThreadSearchList.cpp +++ b/src/MsgThread/Controller/src/ThreadSearchList.cpp @@ -115,7 +115,7 @@ void ThreadSearchList::search() m_pListener->onSearchListChanged(); } -void ThreadSearchList::onListItemSelected(ListItem &listItem, void *funcData) +void ThreadSearchList::onListItemSelected(ListItem &listItem) { if(m_pListener) { diff --git a/src/MsgThread/View/inc/ThreadListViewItem.h b/src/MsgThread/View/inc/ThreadListViewItem.h index 557712b..526208e 100644 --- a/src/MsgThread/View/inc/ThreadListViewItem.h +++ b/src/MsgThread/View/inc/ThreadListViewItem.h @@ -51,9 +51,11 @@ namespace Msg virtual std::string getStatus(); virtual Evas_Object *getIcon(); + using ListItem::getState; + private: - virtual std::string getListItemText(ListItem &item, const char *part); - virtual Evas_Object *getListItemContent(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); + virtual Evas_Object *getContent(ListItem &item, const char *part); virtual const char *getCheckPart(ListItem &item); private: diff --git a/src/MsgThread/View/src/ThreadListViewItem.cpp b/src/MsgThread/View/src/ThreadListViewItem.cpp index 2c54df5..dd4f349 100644 --- a/src/MsgThread/View/src/ThreadListViewItem.cpp +++ b/src/MsgThread/View/src/ThreadListViewItem.cpp @@ -55,7 +55,7 @@ ThreadListViewItem::~ThreadListViewItem() { } -std::string ThreadListViewItem::getListItemText(ListItem &item, const char *part) +std::string ThreadListViewItem::getText(ListItem &item, const char *part) { if(!strcmp(part, messagePart)) { @@ -80,7 +80,7 @@ std::string ThreadListViewItem::getListItemText(ListItem &item, const char *part return ""; } -Evas_Object *ThreadListViewItem::getListItemContent(ListItem &item, const char *part) +Evas_Object *ThreadListViewItem::getContent(ListItem &item, const char *part) { Evas_Object *content = nullptr; diff --git a/src/Settings/Controller/inc/MsgOnSimCard.h b/src/Settings/Controller/inc/MsgOnSimCard.h index 2c4c702..09d8465 100644 --- a/src/Settings/Controller/inc/MsgOnSimCard.h +++ b/src/Settings/Controller/inc/MsgOnSimCard.h @@ -51,7 +51,7 @@ namespace Msg int getItemsCount() const; // IListViewListener: - virtual void onListItemChecked(ListItem &listItem, void *funcData); + virtual void onListItemChecked(ListItem &listItem); void checkHandler(SelectAllListItem &item); // IHwButtonListener: diff --git a/src/Settings/Controller/inc/Settings.h b/src/Settings/Controller/inc/Settings.h index 1ebd5df..421c01b 100644 --- a/src/Settings/Controller/inc/Settings.h +++ b/src/Settings/Controller/inc/Settings.h @@ -46,7 +46,7 @@ namespace Msg virtual void onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId); // IListViewListener: - virtual void onListItemSelected(ListItem &listItem, void *funcData); + virtual void onListItemSelected(ListItem &listItem); // ISettingsListViewItemListener virtual void onCheckButtonChanged(SettingsListViewItem &item); diff --git a/src/Settings/Controller/inc/SimListViewItem.h b/src/Settings/Controller/inc/SimListViewItem.h index 21c8a9e..366bf24 100644 --- a/src/Settings/Controller/inc/SimListViewItem.h +++ b/src/Settings/Controller/inc/SimListViewItem.h @@ -37,7 +37,7 @@ namespace Msg private: virtual const char *getCheckPart(ListItem &item); // ListItem: - virtual std::string getListItemText(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); }; } diff --git a/src/Settings/Controller/src/MsgOnSimCard.cpp b/src/Settings/Controller/src/MsgOnSimCard.cpp index b640750..8614118 100644 --- a/src/Settings/Controller/src/MsgOnSimCard.cpp +++ b/src/Settings/Controller/src/MsgOnSimCard.cpp @@ -90,7 +90,7 @@ void MsgOnSimCard::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) setMode(NormalMode); } -void MsgOnSimCard::onListItemChecked(ListItem &listItem, void *funcData) +void MsgOnSimCard::onListItemChecked(ListItem &listItem) { if(SelectAllListItem *it = dynamic_cast(&listItem)) { diff --git a/src/Settings/Controller/src/Settings.cpp b/src/Settings/Controller/src/Settings.cpp index f46a581..d3896c5 100644 --- a/src/Settings/Controller/src/Settings.cpp +++ b/src/Settings/Controller/src/Settings.cpp @@ -378,7 +378,7 @@ void Settings::callItemHandler(SettingsListItem &item) (this->*m)(item); } -void Settings::onListItemSelected(ListItem &listItem, void *funcData) +void Settings::onListItemSelected(ListItem &listItem) { MSG_LOG("Item: ", &listItem); listItem.setSelected(false); diff --git a/src/Settings/Controller/src/SimListViewItem.cpp b/src/Settings/Controller/src/SimListViewItem.cpp index 485041c..09cd813 100644 --- a/src/Settings/Controller/src/SimListViewItem.cpp +++ b/src/Settings/Controller/src/SimListViewItem.cpp @@ -46,7 +46,7 @@ SimListViewItem::~SimListViewItem() { } -std::string SimListViewItem::getListItemText(ListItem &item, const char *part) +std::string SimListViewItem::getText(ListItem &item, const char *part) { if(!strcmp(part, messagePart)) { diff --git a/src/Settings/View/inc/SettingsGroupListViewItem.h b/src/Settings/View/inc/SettingsGroupListViewItem.h index 1a790c8..22cb33e 100644 --- a/src/Settings/View/inc/SettingsGroupListViewItem.h +++ b/src/Settings/View/inc/SettingsGroupListViewItem.h @@ -32,7 +32,7 @@ namespace Msg private: // ListItem: - virtual std::string getListItemText(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); private: const std::string m_Title; diff --git a/src/Settings/View/inc/SettingsListViewItem.h b/src/Settings/View/inc/SettingsListViewItem.h index 026fb71..86aca81 100644 --- a/src/Settings/View/inc/SettingsListViewItem.h +++ b/src/Settings/View/inc/SettingsListViewItem.h @@ -47,8 +47,8 @@ namespace Msg private: // ListItem: - virtual std::string getListItemText(ListItem &item, const char *part); - virtual Evas_Object *getListItemContent(ListItem &item, const char *part); + virtual std::string getText(ListItem &item, const char *part); + virtual Evas_Object *getContent(ListItem &item, const char *part); void onCheckButtonChanged(Evas_Object *obj, void *eventInfo); diff --git a/src/Settings/View/src/SettingsGroupListViewItem.cpp b/src/Settings/View/src/SettingsGroupListViewItem.cpp index 6376cd3..7be6a1e 100644 --- a/src/Settings/View/src/SettingsGroupListViewItem.cpp +++ b/src/Settings/View/src/SettingsGroupListViewItem.cpp @@ -34,7 +34,7 @@ SettingsGroupListViewItem::~SettingsGroupListViewItem() { } -std::string SettingsGroupListViewItem::getListItemText(ListItem &item, const char *part) +std::string SettingsGroupListViewItem::getText(ListItem &item, const char *part) { return m_Title; diff --git a/src/Settings/View/src/SettingsListViewItem.cpp b/src/Settings/View/src/SettingsListViewItem.cpp index fb8e061..b6f6e7f 100644 --- a/src/Settings/View/src/SettingsListViewItem.cpp +++ b/src/Settings/View/src/SettingsListViewItem.cpp @@ -78,7 +78,7 @@ void SettingsListViewItem::setSubText(const std::string &text) m_SubText = text; } -std::string SettingsListViewItem::getListItemText(ListItem &item, const char *part) +std::string SettingsListViewItem::getText(ListItem &item, const char *part) { if(getStyle().get() == oneLineIconStyle.get()) { @@ -107,7 +107,7 @@ std::string SettingsListViewItem::getListItemText(ListItem &item, const char *pa return ""; } -Evas_Object *SettingsListViewItem::getListItemContent(ListItem &item, const char *part) +Evas_Object *SettingsListViewItem::getContent(ListItem &item, const char *part) { if(getStyle().get() == oneLineIconStyle.get()) {