#include <CtxPopup.h>
+#include "PopupWindow.h"
struct SContentInfo;
struct SRltvCtnt;
private:
static void sm_CbRltdCtntSelected(void *data, Evas_Object *obj, const char *emission, const char *source);
- static void sm_CbPopupKeyPressed(void *data, Evas *e, Evas_Object *obj, void *ei);
- void m_OnPopUpKeyPressed(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+ static void sm_CbRemove(void* cookie, CPopupWindow *instance);
+ void m_OnRemove(CPopupWindow *instance);
- static void sm_CbRemove(void *data, Evas_Object *obj, void *ei);
- void m_OnRemove(Evas_Object *obj);
-
- static void sm_CbCancel(void *data, Evas_Object *obj, void *ei);
- void m_OnCancel(Evas_Object *obj);
+ static void sm_CbCancel(void* cookie, CPopupWindow *instance);
+ void m_OnCancel(CPopupWindow *instance);
static int sm_CbSortPlaylist(const void *d1, const void *d2);
static void sm_CbPopupDeleted(void *data, Evas *e, Evas_Object *obj, void *ei);
bool m_CreateInfoPart(void);
bool m_CreateFullView(void);
CCtxPopup *m_CreatePlaylistPopup(void);
- Evas_Object *m_CreateRemovePopup(Evas_Object *base, const char *msg,
- Evas_Object_Event_Cb _close_cb, Evas_Smart_Cb _remove_cb,
- Evas_Smart_Cb _cancel_cb, void *dt);
+ CPopupWindow *m_CreateRemovePopup(Evas_Object *base, const char *msg);
void m_DestroyPopup(void);
void m_HandleBtnSelected(int btnType);
void m_HandleMoreinfoSelected(Evas_Object *obj);
--- /dev/null
+/*
+* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the License);
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* 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 <Elementary.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include <InputHandler.h>
+#include <PopupWindow.h>
+#include "i18n.h"
+#include "define.h"
+#include "dbg.h"
+#include "common.h"
+#include "RemovePopupWindow.h"
+
+
+#define NUM_BTNS 2
+
+const char *btnText[NUM_BTNS] = {
+ _(MUSIC_TEXT_REMOVE),
+ _(MUSIC_TEXT_CANCEL)
+};
+
+void CRemovePopupWindow::t_OnConfiguration(void)
+{
+ t_SetParams(_(MUSIC_TEXT_REMOVE), NULL, _(m_msg), NUM_BTNS, (const char **)btnText);
+}
+
+bool CRemovePopupWindow::Create(Evas_Object* base, const SCallback* callback, const char *msg)
+{
+ m_msg = msg;
+
+ if (!CPopupWindow::Create(base, callback)) {
+ _ERR("Creation of remove popup failed");
+ return false;
+ }
+
+ return true;
+}
\ No newline at end of file
#include "ViewMgr.h"
#include "context-view.h"
#include "PlayListCtxPopup.h"
+#include "PopupWindow.h"
+#include "RemovePopupWindow.h"
#include "Info.h"
#define _GET_PRIV(o) evas_object_data_get(o, "CTMDATA");
Evas_Object *playbtn;
Evas_Object *first_line[TABLE_MAX_COL];
Evas_Object *last_line[TABLE_MAX_COL];
- Evas_Object *popup;
+ //Evas_Object *popup;
+ CRemovePopupWindow *popup;
CPlayListCtxPopup *ctxpopup;
Ecore_Idler *idler;
CMusicController *mhandle;
}
-void CContextView::sm_CbPopupKeyPressed(void *data, Evas *e, Evas_Object *obj, void *ei)
+void CContextView::sm_CbRemove(void* cookie, CPopupWindow *instance)
{
- CContextView *root = (CContextView *)data;
+ CContextView *root = (CContextView *)cookie;
if (root)
- root->m_OnPopUpKeyPressed(e, obj, (Evas_Event_Key_Down *)ei);
+ root->m_OnRemove(instance);
}
-void CContextView::m_OnPopUpKeyPressed(Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
-{
- if (!ev->keyname)
- return;
-
- if (!strcmp(ev->keyname, KEY_BACK) ||
- !strcmp(ev->keyname, KEY_BACK_REMOTE))
- m_DestroyPopup();
-}
-
-
-void CContextView::sm_CbRemove(void *data, Evas_Object *obj, void *ei)
-{
- CContextView *root = (CContextView *)data;
- if (root)
- root->m_OnRemove(obj);
-}
-
-
-void CContextView::m_OnRemove(Evas_Object *obj)
+void CContextView::m_OnRemove(CPopupWindow *instance)
{
SContentInfo *cinfo = NULL;
- if (!obj) {
+ if (!instance) {
_ERR("Invalid argument.");
return;
}
}
-void CContextView::sm_CbCancel(void *data, Evas_Object *obj, void *ei)
+void CContextView::sm_CbCancel(void* cookie, CPopupWindow *instance)
{
- CContextView *root = (CContextView *)data;
+ CContextView *root = (CContextView *)cookie;
if (root)
- root->m_OnCancel(obj);
+ root->m_OnCancel(instance);
}
-void CContextView::m_OnCancel(Evas_Object *obj)
+void CContextView::m_OnCancel(CPopupWindow *instance)
{
- if (!obj) {
+ if (!instance) {
_ERR("Invalid argument.");
return;
}
}
-Evas_Object *CContextView::m_CreateRemovePopup(Evas_Object *base, const char *msg,
- Evas_Object_Event_Cb _close_cb, Evas_Smart_Cb _remove_cb,
- Evas_Smart_Cb _cancel_cb, void *dt)
+CPopupWindow *CContextView::m_CreateRemovePopup(Evas_Object *base, const char *msg)
{
- Evas_Object *popup, *yesbtn, *nobtn, *lbl;
+ CRemovePopupWindow *popup;
- if (!base || !_remove_cb || !_cancel_cb || !dt) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- popup = elm_popup_add(base);
+ popup = new CRemovePopupWindow;
if (!popup) {
- _ERR("elm_popup_add failed.");
- return NULL;
- }
-
- elm_object_style_set(popup, MUSIC_STYLE_REMOVE_POPUP);
- elm_object_part_text_set(popup, MUSIC_PART_RPOPUP_TITLE,
- _(MUSIC_TEXT_REMOVE));
- elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
- evas_object_event_callback_add(popup, EVAS_CALLBACK_KEY_DOWN,
- _close_cb, dt);
- evas_object_show(popup);
-
- lbl = elm_label_add(popup);
- if (!lbl) {
- _ERR("Add Evas_Object failed.");
- evas_object_del(popup);
- return NULL;
- }
-
- elm_object_style_set(lbl, MUSIC_STYLE_REMOVE_LABEL);
- elm_object_text_set(lbl, _(msg));
- elm_object_content_set(popup, lbl);
-
- yesbtn = elm_button_add(popup);
- if (!yesbtn) {
- _ERR("Add Evas_Object failed.");
- evas_object_del(popup);
+ _ERR("Memory alloc failed");
return NULL;
}
- elm_object_text_set(yesbtn, _(MUSIC_TEXT_REMOVE));
- elm_object_part_content_set(popup, MUSIC_PART_RPOPUP_BTN1, yesbtn);
- evas_object_smart_callback_add(yesbtn, MUSIC_SIGNAL_CLICKED,
- _remove_cb, dt);
+ CPopupWindow::SCallback cb;
+ cb.cookie = this;
+ cb.onBtn1Pressed = sm_CbRemove;
+ cb.onBtn2Pressed = sm_CbCancel;
+ cb.onBtn3Pressed = NULL;
- nobtn = elm_button_add(popup);
- if (!nobtn) {
- _ERR("Add Evas_Object failed.");
- evas_object_del(popup);
+ if (!popup->Create(base, &cb, msg)) {
+ _ERR("Pop creation failed");
+ delete popup;
return NULL;
}
- elm_object_text_set(nobtn, _(MUSIC_TEXT_CANCEL));
- elm_object_part_content_set(popup, MUSIC_PART_RPOPUP_BTN2, nobtn);
- evas_object_smart_callback_add(nobtn, MUSIC_SIGNAL_CLICKED,
- _cancel_cb, dt);
- elm_object_focus_set(nobtn, EINA_TRUE);
-
return popup;
}
void CContextView::m_DestroyPopup(void)
{
- if (m->popup)
- evas_object_del(m->popup);
+ if (m->popup && m->popup->FlagCreate())
+ m->popup->Destroy();
if (m->ctxpopup && m->ctxpopup->FlagCreate())
m->ctxpopup->Destroy();
+ delete m->popup;
m->popup = NULL;
delete m->ctxpopup;
m->ctxpopup = NULL;
break;
case CONTEXT_VIEW_BUTTON_DEL:
- m->popup = m_CreateRemovePopup(m->base,
- MUSIC_TEXT_REMOVE_SMSG, sm_CbPopupKeyPressed,
- sm_CbRemove, sm_CbCancel, this);
+ m->popup = (CRemovePopupWindow *)m_CreateRemovePopup(m->base, MUSIC_TEXT_REMOVE_SMSG);
break;
case CONTEXT_VIEW_BUTTON_RENAME:
break;
case CONTEXT_VIEW_BUTTON_DELETE:
- m->popup = m_CreateRemovePopup(m->base,
- MUSIC_TEXT_REMOVE_PLMSG, sm_CbPopupKeyPressed,
- sm_CbRemove, sm_CbCancel, this);
+ m->popup = (CRemovePopupWindow *)m_CreateRemovePopup(m->base, MUSIC_TEXT_REMOVE_PLMSG);
break;
default: