void addSignalCb(const char *emission, const char *source, Edje_Signal_Cb func, void *data);
template<typename T>
- static T staticCast(void *evasObj);
+ static T *staticCast(const void *evasObj);
template<typename T>
- static T reinterpretCast(void *evasObj);
- template<typename T>
- static T dynamicCast(void *evasObj);
+ static T *dynamicCast(const void *evasObj);
/**
* @brief Gets text placed in specified part.
View(View&) = delete;
View& operator=(View&) = delete;
Evas_Object_Event_Cb getCb(Evas_Callback_Type);
- void *getData() const;
- static void *getData(Evas_Object *obj);
- void setData(const void *data);
- static void setData(Evas_Object *obj, const void *data);
+ static View *getThis(const Evas_Object *obj);
private:
static void on_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
return evas_object_data_get(m_pEo, key);
}
- inline void View::setData(const void *data)
- {
- setData(m_pEo, data);
- }
-
- inline void *View::getData() const
- {
- return getData(m_pEo);
- }
-
- template<typename T>
- inline T View::staticCast(void *evasObj)
- {
- return static_cast<T>(getData((Evas_Object*)evasObj));
- }
-
template<typename T>
- inline T View::reinterpretCast(void *evasObj)
+ inline T *View::staticCast(const void *evasObj)
{
- return reinterpret_cast<T>(getData((Evas_Object*)evasObj));
+ return static_cast<T*>(getThis((Evas_Object*)evasObj));
}
template<typename T>
- inline T View::dynamicCast(void *evasObj)
+ inline T *View::dynamicCast(const void *evasObj)
{
- return dynamic_cast<T>(staticCast<View*>(evasObj));
+ return dynamic_cast<T*>(staticCast<View*>(evasObj));
}
inline void View::addEventCb(Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
void *getData() const;
/**
- * @brief Sets item-data.
- * @param[in] data item-data.
- */
- void setData(void *data);
-
- /**
* @brief Gets Elm_Object_Item current view-item is wrapping.
* @return wrapped object-item.
*/
static void setText(Elm_Object_Item *it, const TText &text, const char *part = nullptr);
template<typename T>
- static T staticCast(void *elmObjectItem);
- template<typename T>
- static T reinterpretCast(void *elmObjectItem);
+ static T *staticCast(const void *elmObjectItem);
template<typename T>
- static T dynamicCast(void *elmObjectItem);
+ static T *dynamicCast(const void *elmObjectItem);
protected:
virtual ~ViewItem();
void setElmObjItem(Elm_Object_Item *item);
private:
+ static ViewItem *getThis(const Elm_Object_Item *item);
static void on_delete_cb(void *data, Evas_Object *obj, void *event_info);
private:
return elm_object_item_data_get(m_pItem);
}
- inline void ViewItem::setData(void *data)
- {
- elm_object_item_data_set(m_pItem, data);
- }
-
inline void ViewItem::disabled(bool val)
{
elm_object_item_disabled_set(m_pItem, val);
return elm_object_item_part_text_get(m_pItem, part);
}
- template<typename T>
- inline T ViewItem::staticCast(void *elmObjectItem)
+ inline ViewItem *ViewItem::getThis(const Elm_Object_Item *item)
{
- return static_cast<T>(elm_object_item_data_get((Elm_Object_Item*)elmObjectItem));
+ return (ViewItem*)elm_object_item_data_get(item);
}
template<typename T>
- inline T ViewItem::reinterpretCast(void *elmObjectItem)
+ inline T *ViewItem::staticCast(const void *elmObjectItem)
{
- return reinterpret_cast<T>(elm_object_item_data_get((Elm_Object_Item*)elmObjectItem));
+ return static_cast<T*>(getThis((Elm_Object_Item*)elmObjectItem));
}
template<typename T>
- inline T ViewItem::dynamicCast(void *elmObjectItem)
+ inline T *ViewItem::dynamicCast(const void *elmObjectItem)
{
- return dynamic_cast<T>(staticCast<ViewItem*>(elmObjectItem));
+ return dynamic_cast<T*>(staticCast<ViewItem*>(elmObjectItem));
}
}
ListItem *ListView::getSelectedItem() const
{
Elm_Object_Item *elmItem = elm_genlist_selected_item_get(getEo());
- return ListItem::staticCast<ListItem*>(elmItem);
+ return ListItem::staticCast<ListItem>(elmItem);
}
unsigned ListView::getItemsCount() const
ListItem *ListView::getNextItem(ListItem &item) const
{
- return ListItem::staticCast<ListItem*>(elm_genlist_item_next_get(item));
+ return ListItem::staticCast<ListItem>(elm_genlist_item_next_get(item));
}
ListItem *ListView::getPrevItem(ListItem &item) const
{
- return ListItem::staticCast<ListItem*>(elm_genlist_item_prev_get(item));
+ return ListItem::staticCast<ListItem>(elm_genlist_item_prev_get(item));
}
void ListView::demoteItem(ListItem &item)
void ListView::notifyListener(void *data, Evas_Object *obj, void *event_info, ListenerMethod method)
{
- ListItem *item = ListItem::staticCast<ListItem*>(event_info);
+ ListItem *item = ListItem::staticCast<ListItem>(event_info);
MSG_ASSERT(item, "Item is null");
if (item) {
void ListView::on_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
- ListItem *item = ListItem::staticCast<ListItem*>(event_info);
+ ListItem *item = ListItem::staticCast<ListItem>(event_info);
item->setSelected(false);
if (item->getOwner()->getCheckMode() && item->isCheckable()) {
void ListView::on_realized_cb(void *data, Evas_Object *obj, void *event_info)
{
- ListItem *item = ListItem::staticCast<ListItem*>(event_info);
+ ListItem *item = ListItem::staticCast<ListItem>(event_info);
item->onRealized(*item);
}
void ListView::on_unrealized_cb(void *data, Evas_Object *obj, void *event_info)
{
- ListItem *item = ListItem::staticCast<ListItem*>(event_info);
+ ListItem *item = ListItem::staticCast<ListItem>(event_info);
item->onUnrealized(*item);
}
void ListView::on_longpressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- ListItem *item = ListItem::staticCast<ListItem*>(event_info);
+ ListItem *item = ListItem::staticCast<ListItem>(event_info);
item->setSelected(false);
if (!item->getOwner()->getCheckMode())
notifyListener(data, obj, event_info, &IListViewListener::onListItemLongPressed);
MbeRecipientItem *MbeRecipientsView::getSelectedItem() const
{
- MbeRecipientItem *pSelected = ViewItem::staticCast<MbeRecipientItem*>(elm_multibuttonentry_selected_item_get(getEo()));
+ auto *pSelected = ViewItem::staticCast<MbeRecipientItem>(elm_multibuttonentry_selected_item_get(getEo()));
return pSelected ? pSelected : m_pSelectedItem;
}
void MbeRecipientsView::onMbeItemClicked(Evas_Object *obj, void *eventInfo)
{
- m_pSelectedItem = ViewItem::staticCast<MbeRecipientItem*>(eventInfo);
+ m_pSelectedItem = ViewItem::staticCast<MbeRecipientItem>(eventInfo);
if (m_pListener)
m_pListener->onMbeItemClicked(*m_pSelectedItem);
}
NaviFrameItem *NaviFrameView::getTopFrame() const
{
- return ViewItem::staticCast<NaviFrameItem*>(elm_naviframe_top_item_get(getEo()));
+ return ViewItem::staticCast<NaviFrameItem>(elm_naviframe_top_item_get(getEo()));
}
int NaviFrameView::getItemsCount() const
MSG_LOG("");
m_TransitionStatus = false;
- auto *transFinishedItem = ViewItem::staticCast<NaviFrameItem*>(eventInfo);
+ auto *transFinishedItem = ViewItem::staticCast<NaviFrameItem>(eventInfo);
for (NaviFrameItem *item: m_ItemsToDelete) {
if (item == transFinishedItem)
m_pEo = eo;
if (eo) {
- setData(this);
+ evas_object_data_set(eo, thisKey, this);
setEventCb(EVAS_CALLBACK_FREE);
setEventCb(EVAS_CALLBACK_DEL);
}
return layout;
}
-void View::setData(Evas_Object *obj, const void *data)
+View *View::getThis(const Evas_Object *obj)
{
- evas_object_data_set(obj, thisKey, (void*)data);
-}
-
-void *View::getData(Evas_Object *obj)
-{
- return evas_object_data_get(obj, thisKey);
+ return static_cast<View*>(evas_object_data_get(obj, thisKey));
}
std::string Msg::markupToUtf8(const char *str)
void ViewItem::setElmObjItem(Elm_Object_Item *item)
{
m_pItem = item;
- setData(this);
+ elm_object_item_data_set(getElmObjItem(), this);
elm_object_item_del_cb_set(m_pItem, on_delete_cb);
onAttached(*this);
}
void ViewItem::on_delete_cb(void *data, Evas_Object *obj, void *event_info)
{
- Elm_Object_Item *it = static_cast<Elm_Object_Item*>(event_info);
- ViewItem *self = static_cast<ViewItem*>(elm_object_item_data_get(it));
+ auto *self = staticCast<ViewItem>(event_info);
self->onViewDestroyed();
}
void Viewer::onRecipItemClicked(Evas_Object *obj, void *eventInfo)
{
MSG_LOG("");
- MbeRecipientItem *item = ViewItem::staticCast<MbeRecipientItem*>(eventInfo);
+ auto *item = ViewItem::staticCast<MbeRecipientItem>(eventInfo);
recipientClickHandler(item->getAddress());
}