apply CtxPopup in app-common 44/35544/1 accepted/tizen/tv/20150218.123108 submit/tizen/20150218.021530
authorJehun Lim <jehun.lim@samsung.com>
Tue, 17 Feb 2015 11:48:58 +0000 (20:48 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Tue, 17 Feb 2015 11:48:58 +0000 (20:48 +0900)
Change-Id: I0b2280b4f565b7a1b81a50cddf2215a5ca79a0cb
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
19 files changed:
CMakeLists.txt
include/common/menudef.h
include/view/gallery-view/SortCtxPopup.h [new file with mode: 0644]
include/view/gallery-view/SourceCtxPopup.h [new file with mode: 0644]
include/view/gallery-view/gallery_view.h
include/view/photo-viewer/SettingCtxPopup.h [new file with mode: 0644]
include/view/photo-viewer/ZoomCtxPopup.h [new file with mode: 0644]
include/view/photo-viewer/photoviewer_view.h
src/common/menudef.cpp
src/main.cpp
src/view/gallery-view/SortCtxPopup.cpp [new file with mode: 0644]
src/view/gallery-view/SourceCtxPopup.cpp [new file with mode: 0644]
src/view/gallery-view/gallery_view.cpp
src/view/gallery-view/layout_all.cpp
src/view/gallery-view/layout_events.cpp
src/view/gallery-view/layout_folder.cpp
src/view/photo-viewer/SettingCtxPopup.cpp [new file with mode: 0644]
src/view/photo-viewer/ZoomCtxPopup.cpp [new file with mode: 0644]
src/view/photo-viewer/photoviewer_view.cpp

index 5ce81b9..55ea112 100644 (file)
@@ -66,8 +66,12 @@ src/view/gallery-view/gallery_view.cpp
 src/view/gallery-view/layout_all.cpp
 src/view/gallery-view/layout_events.cpp
 src/view/gallery-view/layout_folder.cpp
+src/view/gallery-view/SortCtxPopup.cpp
+src/view/gallery-view/SourceCtxPopup.cpp
 src/view/ctxtmenu-view/ctxtmenu_view.cpp
 src/view/photo-viewer/photoviewer_view.cpp
+src/view/photo-viewer/SettingCtxPopup.cpp
+src/view/photo-viewer/ZoomCtxPopup.cpp
 src/view/photo-viewer/zoom_view.cpp
 src/view/video-player/video_player.cpp
 src/data/mediadata.cpp
index 8a81d83..b118538 100644 (file)
@@ -85,7 +85,13 @@ extern const char *zoom_text[MAX_ZOOM_BTNS];
 
 extern const char *speed_text[MAX_SPEED_BTNS];
 
-extern const char *hover_btn_id[SOURCE_TEXT_SIZE + SORT_TEXT_SIZE];
+extern const char *sort_btn_id[SORT_TEXT_SIZE];
+
+extern const char *source_btn_id[SOURCE_TEXT_SIZE];
+
+extern const char *zoom_btn_id[MAX_ZOOM_BTNS];
+
+extern const char *speed_btn_id[MAX_SPEED_BTNS];
 
 extern const char *layout_type[MAX_LAYOUT];
 
diff --git a/include/view/gallery-view/SortCtxPopup.h b/include/view/gallery-view/SortCtxPopup.h
new file mode 100644 (file)
index 0000000..cca9d5f
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+* 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.
+*/
+
+#ifndef __SORT_CTXPOPUP_H__
+#define __SORT_CTXPOPUP_H__
+
+struct SGetCallbackPair;
+struct SSetCallbackPair;
+
+class CSortCtxPopup : public CCtxPopup {
+private:
+       SGetCallbackPair *GetCb;
+       SSetCallbackPair *SetCb;
+
+protected:
+       virtual void t_OnConfiguration(void);
+       virtual void t_OnBtnClicked(Evas_Object *obj, void *ev);
+
+public:
+       void RegisterGetCallback(int (*cb)(void *cookie), void *cookie);
+       void RegisterSetCallback(void (*cb)(void *cookie, int sort), void *cookie);
+};
+
+#endif
diff --git a/include/view/gallery-view/SourceCtxPopup.h b/include/view/gallery-view/SourceCtxPopup.h
new file mode 100644 (file)
index 0000000..98e5e92
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+* 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.
+*/
+
+#ifndef __SOURCE_CTXPOPUP_H__
+#define __SOURCE_CTXPOPUP_H__
+
+struct SGetCallbackPair;
+struct SSetCallbackPair;
+
+class CSourceCtxPopup : public CCtxPopup {
+private:
+       SGetCallbackPair *GetCb;
+       SSetCallbackPair *SetCb;
+
+protected:
+       virtual void t_OnConfiguration(void);
+       virtual void t_OnBtnClicked(Evas_Object *obj, void *ev);
+
+public:
+       void RegisterGetCallback(int (*cb)(void *cookie), void *cookie);
+       void RegisterSetCallback(void (*cb)(void *cookie, int sort), void *cookie);
+};
+
+#endif
index 7ac9664..1fbdcb9 100644 (file)
@@ -64,7 +64,7 @@ struct layout_data {
 
 class CGalleryView : public CBaseView, CListenerMgr,
        IKeyDownListener, IMouseClickedListener,
-       IMouseMoveListener, IFocusedListener, IUnfocusedListener,
+       IMouseMoveListener, IFocusedListener,
        CMediaContentDbUpdateListener, CUsbConnectionListener {
 private:
        struct SGalleryView *m;
@@ -76,30 +76,22 @@ protected:
        virtual void t_OnResume(void);
 
 private:
-       static void sm_CbSortDateDescClicked(void *cookie);
-       static void sm_CbSortDateAscClicked(void *cookie);
-       static void sm_CbSortAZClicked(void *cookie);
-       static void sm_CbSortZAClicked(void *cookie);
-       static void sm_CbSourceAllClicked(void *cookie);
-       static void sm_CbSourceTVClicked(void *cookie);
-       static void sm_CbSourceUSBClicked(void *cookie);
-
+       static void sm_CbCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text);
        static void sm_CbLayoutShown(void *cookie, CBaseLayout *pBaseLayout);
        static void sm_CbAllLayoutFocus(void *cookie);
        static void sm_CbAllLayoutSort(void *cookie, int sort);
        static void sm_CbAllLayoutHide(void *cookie);
        static void sm_CbGetSignalFromLayout(void *cookie, int sig);
        static Eina_List *sm_CbGetMediaList(void *cookie);
+       static int sm_CbSortType(void *cookie);
+       static void sm_CbSetSortType(void *cookie, int sort);
+       static int sm_CbSourceType(void *cookie);
+       static void sm_CbSetSourceType(void *cookie, int source);
 
 private:
        void m_DrawNotifyPopup(const char *text);
        void m_DestroyNotifyPopup(void);
 
-       void m_DrawCtxpopup(const char **text_arr, int size_arr,
-                       const char *style, int selected_index,
-                       int position_x, int position_y);
-       void m_DestroyCtxpopup(void);
-
        void m_AddUpdownIcon(Evas_Object *btn, const char *icon_file);
        void m_FocusUpdownArrow(void);
        void m_UnfocusUpdownArrow(void);
@@ -107,14 +99,15 @@ private:
        Evas_Object *m_GetHoverselObject(const char **text_arr,
                        int size_arr, const char *style);
 
+       void m_SetBtnText(const char *text);
        bool m_DrawTopArea(void);
        bool m_DrawLeftArea(void);
        bool m_DrawItems(void);
        void m_DrawContentArea(int ltype);
 
        void m_FocusLayout(void);
-       void m_SortLayout(int sort_type);
-       void m_SourceChange(int source_type);
+       void m_SortLayout(void);
+       void m_SourceChange(void);
 
 public:
        CGalleryView(const char *szViewId) :
@@ -123,7 +116,6 @@ public:
                IMouseClickedListener(this),
                IMouseMoveListener(this),
                IFocusedListener(this),
-               IUnfocusedListener(this),
                m(0) {}
        virtual ~CGalleryView() {}
 
@@ -137,7 +129,6 @@ public:
        virtual void OnMouseClicked(int id, Evas_Object *obj);
        virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
        virtual void OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item);
-       virtual void OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item);
        virtual void OnConnect(void);
        virtual void OnUpdated(const SEntity *entity);
 };
diff --git a/include/view/photo-viewer/SettingCtxPopup.h b/include/view/photo-viewer/SettingCtxPopup.h
new file mode 100644 (file)
index 0000000..659d386
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+* 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.
+*/
+
+#ifndef __SETTING_CTXPOPUP_H__
+#define __SETTING_CTXPOPUP_H__
+
+struct SGetCallbackPair;
+struct SSetCallbackPair;
+
+class CSettingCtxPopup : public CCtxPopup {
+private:
+       SGetCallbackPair *GetCb;
+       SSetCallbackPair *SetCb;
+
+protected:
+       virtual void t_OnConfiguration(void);
+       virtual void t_OnBtnClicked(Evas_Object *obj, void *ev);
+
+public:
+       void RegisterGetCallback(int (*cb)(void *cookie), void *cookie);
+       void RegisterSetCallback(void (*cb)(void *cookie, int speed), void *cookie);
+};
+
+#endif
diff --git a/include/view/photo-viewer/ZoomCtxPopup.h b/include/view/photo-viewer/ZoomCtxPopup.h
new file mode 100644 (file)
index 0000000..0056cce
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+* 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.
+*/
+
+#ifndef __ZOOM_CTXPOPUP_H__
+#define __ZOOM_CTXPOPUP_H__
+
+struct SSetCallbackPair;
+
+class CZoomCtxPopup : public CCtxPopup {
+private:
+       SSetCallbackPair *SetCb;
+
+protected:
+       virtual void t_OnConfiguration(void);
+       virtual void t_OnBtnClicked(Evas_Object *obj, void *ev);
+
+public:
+       void RegisterSetCallback(void (*cb)(void *cookie, int zoom_level), void *cookie);
+};
+
+#endif
index 92df937..043c7c5 100644 (file)
@@ -66,6 +66,13 @@ private:
        void m_OnRotateBtnClicked(Evas_Object *obj,
                        const char *emission, const char *source);
 
+       static void sm_CbSettingCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text);
+       static void sm_CbZoomCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text);
+
+       static int sm_CbSlideshowSpeed(void *cookie);
+       static void sm_CbSetSlideshowSpeed(void *cookie, int speed);
+       static void sm_CbSetZoomLevel(void *cookie, int zoom_level);
+
        static Eina_Bool sm_CbTimerTooltip(void *dt);
        Eina_Bool m_OnTimerTooltip(void);
 
@@ -80,10 +87,6 @@ private:
        static Eina_Bool sm_CbTimerSlideshow(void *dt);
 
 private:
-       void m_DrawCtxpopup(const char **text_arr, int size_arr,
-                       const char *style, int selected_index,
-                       int position_x, int position_y);
-       void m_DestroyCtxpopup(void);
        bool m_DrawContentArea(CMediaInfo *minfo);
        bool m_DrawTopArea(CMediaInfo *minfo);
        bool m_DrawBottomArea(void);
index 8bc4da7..cc7a387 100644 (file)
@@ -19,16 +19,31 @@ const char *menutext[MENUITEM_SIZE] = {
        N_("FOLDER")
 };
 
-const char *hover_btn_id[] = {
+const char *sort_btn_id[SORT_TEXT_SIZE] = {
        "date_desc",
        "date_asc",
        "az",
-       "za",
+       "za"
+};
+
+const char *source_btn_id[SOURCE_TEXT_SIZE] = {
        "all",
        "tv",
        "usb"
 };
 
+const char *zoom_btn_id[MAX_ZOOM_BTNS] = {
+       "original",
+       "x2",
+       "x4"
+};
+
+const char *speed_btn_id[MAX_SPEED_BTNS] = {
+       "normal",
+       "slow",
+       "fast"
+};
+
 const char *menuicons[MENUITEM_SIZE] = {
        IMAGEDIR"/ico_fullview_all.png",
        IMAGEDIR"/ico_fullview_event.png",
index 7aebd5d..7d277a4 100644 (file)
@@ -31,6 +31,7 @@
 #include "SortMgr.h"
 #include "MediaContentDbListener.h"
 #include "UsbConnectionListener.h"
+#include "CtxPopup.h"
 #include "timeout_handler.h"
 #include "mediainfo.h"
 #include "mediadata.h"
diff --git a/src/view/gallery-view/SortCtxPopup.cpp b/src/view/gallery-view/SortCtxPopup.cpp
new file mode 100644 (file)
index 0000000..eec0fa9
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+* 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 <Ecore.h>
+#include <app.h>
+#include <InputHandler.h>
+#include <ExtNameInfo.h>
+#include <MediaContentDbListener.h>
+#include <UsbConnectionListener.h>
+#include <BaseView.h>
+#include <BaseLayout.h>
+#include <CtxPopup.h>
+#include "SortCtxPopup.h"
+#include "gallery_view.h"
+#include "define.h"
+#include "menudef.h"
+
+#define BTN_ID "BTN_ID"
+
+struct SGetCallbackPair {
+       int (*cb)(void *cookie);
+       void *cookie;
+};
+
+struct SSetCallbackPair {
+       void (*cb)(void *cookie, int sort);
+       void *cookie;
+};
+
+void CSortCtxPopup::RegisterGetCallback(int (*cb)(void *cookie), void *cookie)
+{
+       GetCb = new SGetCallbackPair;
+       if (!GetCb)
+               return;
+
+       GetCb->cb = cb;
+       GetCb->cookie = cookie;
+}
+
+void CSortCtxPopup::RegisterSetCallback(void (*cb)(void *cookie, int sort), void *cookie)
+{
+       SetCb = new SSetCallbackPair;
+       if (!SetCb)
+               return;
+
+       SetCb->cb = cb;
+       SetCb->cookie = cookie;
+}
+
+void CSortCtxPopup::t_OnConfiguration(void)
+{
+       t_SetList(sorttext, SORT_TEXT_SIZE, GetCb->cb(GetCb->cookie),
+                       CCtxPopup::TOPBTN_SORT, sort_btn_id,
+                       POSITION_SORT_POPUP_X, POSITION_SORT_POPUP_Y,
+                       STYLE_CTXPOPUP_HOVER,
+                       STYLE_BTN_HOVERTEXT, STYLE_BTN_HOVERTEXT, STYLE_BTN_HOVERTEXT);
+}
+
+void CSortCtxPopup::t_OnBtnClicked(Evas_Object *obj, void  *ev)
+{
+       if (!obj)
+               return;
+
+       int i;
+       const char *current_id;
+
+       current_id = (const char *)evas_object_data_get(obj, BTN_ID);
+       if (!current_id)
+               return;
+
+       for (i = 0; i < SORT_TEXT_SIZE; i++) {
+               if (!strcmp(sort_btn_id[i], current_id))
+                       break;
+       }
+
+       if (i == SORT_TEXT_SIZE || i == GetCb->cb(GetCb->cookie))
+               return;
+
+       SetCb->cb(SetCb->cookie, i);
+       CCtxPopup::t_OnBtnClicked(obj, ev);
+
+       Destroy();
+}
diff --git a/src/view/gallery-view/SourceCtxPopup.cpp b/src/view/gallery-view/SourceCtxPopup.cpp
new file mode 100644 (file)
index 0000000..519ff0d
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+* 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 <Ecore.h>
+#include <app.h>
+#include <InputHandler.h>
+#include <ExtNameInfo.h>
+#include <MediaContentDbListener.h>
+#include <UsbConnectionListener.h>
+#include <BaseView.h>
+#include <BaseLayout.h>
+#include <CtxPopup.h>
+#include "SourceCtxPopup.h"
+#include "gallery_view.h"
+#include "define.h"
+#include "menudef.h"
+
+#define BTN_ID "BTN_ID"
+
+struct SGetCallbackPair {
+       int (*cb)(void *cookie);
+       void *cookie;
+};
+
+struct SSetCallbackPair {
+       void (*cb)(void *cookie, int source);
+       void *cookie;
+};
+
+void CSourceCtxPopup::RegisterGetCallback(int (*cb)(void *cookie), void *cookie)
+{
+       GetCb = new SGetCallbackPair;
+       if (!GetCb)
+               return;
+
+       GetCb->cb = cb;
+       GetCb->cookie = cookie;
+}
+
+void CSourceCtxPopup::RegisterSetCallback(void (*cb)(void *cookie, int source), void *cookie)
+{
+       SetCb = new SSetCallbackPair;
+       if (!SetCb)
+               return;
+
+       SetCb->cb = cb;
+       SetCb->cookie = cookie;
+}
+void CSourceCtxPopup::t_OnConfiguration(void)
+{
+       t_SetList(sourcetext, SOURCE_TEXT_SIZE, GetCb->cb(GetCb->cookie),
+                       CCtxPopup::TOPBTN_SOURCE, source_btn_id,
+                       POSITION_SOURCE_POPUP_X, POSITION_SOURCE_POPUP_Y,
+                       STYLE_CTXPOPUP_HOVER,
+                       STYLE_BTN_HOVERTEXT, STYLE_BTN_HOVERTEXT, STYLE_BTN_HOVERTEXT);
+}
+
+void CSourceCtxPopup::t_OnBtnClicked(Evas_Object *obj, void  *ev)
+{
+       if (!obj)
+               return;
+
+       int i;
+       const char *current_id;
+
+       current_id = (const char *)evas_object_data_get(obj, BTN_ID);
+       if (!current_id)
+               return;
+
+       for (i = 0; i < SOURCE_TEXT_SIZE; i++) {
+               if (!strcmp(source_btn_id[i], current_id))
+                       break;
+       }
+
+       if (i == SOURCE_TEXT_SIZE || i == GetCb->cb(GetCb->cookie))
+               return;
+
+       SetCb->cb(SetCb->cookie, i);
+       CCtxPopup::t_OnBtnClicked(obj, ev);
+
+       Destroy();
+}
index e4a5f4d..f93c61d 100644 (file)
 #include "ViewMgr.h"
 #include "BaseLayout.h"
 #include "LayoutMgr.h"
+#include "CtxPopup.h"
 #include "gallery_view.h"
 #include "layout_all.h"
 #include "layout_events.h"
 #include "layout_folder.h"
 #include "mediainfo.h"
 #include "mediadata.h"
+#include "SortCtxPopup.h"
+#include "SourceCtxPopup.h"
 
-#define BTN_ID "btn_id"
 #define BTN_ICN "btn_icon"
 
 #define IMAGE_UP_ARR IMAGEDIR"/ico_dropdown_date_arrow_up.png"
@@ -89,6 +91,8 @@ struct SGalleryView {
 
        CMediadata *pMediadata;
 
+       CCtxPopup *pCtxPopup;
+
        struct layout_data *ld;
 
        SGalleryView() {
@@ -111,6 +115,8 @@ struct SGalleryView {
                pLayoutMgr = NULL;
 
                ld = NULL;
+
+               pCtxPopup = NULL;
        }
 
        ~SGalleryView() {}
@@ -239,62 +245,36 @@ void CGalleryView::m_UnfocusUpdownArrow(void)
        }
 }
 
-void CGalleryView::sm_CbSortDateDescClicked(void *cookie)
-{
-       CGalleryView *m = (CGalleryView *)cookie;
-
-       m->m_SortLayout(E_SORT_DATE_DESC);
-}
-
-void CGalleryView::sm_CbSortDateAscClicked(void *cookie)
-{
-       CGalleryView *m = (CGalleryView *)cookie;
-
-       m->m_SortLayout(E_SORT_DATE_ASC);
-}
-
-void CGalleryView::sm_CbSortAZClicked(void *cookie)
-{
-       CGalleryView *m = (CGalleryView *)cookie;
-
-       m->m_SortLayout(E_SORT_A_Z);
-}
-
-void CGalleryView::sm_CbSortZAClicked(void *cookie)
-{
-       CGalleryView *m = (CGalleryView *)cookie;
-
-       m->m_SortLayout(E_SORT_Z_A);
-}
-
-void CGalleryView::sm_CbSourceAllClicked(void *cookie)
-{
-       CGalleryView *m = (CGalleryView *)cookie;
-
-       m->m_SourceChange(E_SOURCE_ALL);
-}
-
-void CGalleryView::sm_CbSourceTVClicked(void *cookie)
+void CGalleryView::sm_CbCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text)
 {
-       CGalleryView *m = (CGalleryView *)cookie;
+       CGalleryView *root = (CGalleryView *)cookie;
+       if (!root)
+               return;
 
-       m->m_SourceChange(E_SOURCE_TV);
+       switch (instance->Type()) {
+       case CCtxPopup::TOPBTN_SORT:
+               root->m_SetBtnText(text);
+               root->m_SortLayout();
+               break;
+       case CCtxPopup::TOPBTN_SOURCE:
+               root->m_SetBtnText(text);
+               root->m_SourceChange();
+               break;
+       default:
+               break;
+       }
 }
 
-void CGalleryView::sm_CbSourceUSBClicked(void *cookie)
+void CGalleryView::m_SetBtnText(const char *text)
 {
-       CGalleryView *m = (CGalleryView *)cookie;
+       if (!text)
+               return;
 
-       m->m_SourceChange(E_SOURCE_USB);
+       elm_object_text_set(m->hover_btn, text);
 }
 
-void CGalleryView::m_SortLayout(int sort_type)
+void CGalleryView::m_SortLayout(void)
 {
-       if (m->sort_type == sort_type)
-               return;
-
-       m->sort_type = sort_type;
-
        switch (m->current_layout) {
        case E_LAYOUT_ALL:
                m->pAllLayout->Sort(m->sort_type);
@@ -310,17 +290,11 @@ void CGalleryView::m_SortLayout(int sort_type)
        }
 }
 
-void CGalleryView::m_SourceChange(int source_type)
+void CGalleryView::m_SourceChange(void)
 {
-       if (m->source_type == source_type)
-               return;
-
-       m->source_type = source_type;
-
        m->pMediadata->DestroyMediaList();
 
-       if (!m->pMediadata->CreateMediaList(
-                               m->source_type, m->arglist->media_type))
+       if (!m->pMediadata->CreateMediaList(m->source_type, m->arglist->media_type))
                return;
 
        m_DrawContentArea(m->current_layout);
@@ -364,9 +338,6 @@ Evas_Object *CGalleryView::m_GetHoverselObject(const char **text_arr,
                                TYPE_KEY_DOWN | TYPE_CLICKED |
                                TYPE_MOUSE_MOVE | TYPE_FOCUSED |
                                TYPE_UNFOCUSED);
-
-               /* Calling first time to show icon */
-               OnUnfocused(GALLERY_SORTBTN, hoversel, NULL);
        } else {
                elm_object_text_set(hoversel, _(text_arr[m->source_type]));
 
@@ -524,109 +495,6 @@ void CGalleryView::m_FocusLayout(void)
        }
 }
 
-void CGalleryView::m_DestroyCtxpopup(void)
-{
-       if (!m->ctxpopup)
-               return;
-
-       evas_object_hide(m->ctxpopup);
-       evas_object_del(m->ctxpopup);
-       m->ctxpopup = NULL;
-}
-
-void CGalleryView::m_DrawCtxpopup(const char **text_arr, int size_arr,
-       const char *style, int selected_index, int position_x, int position_y)
-{
-       Evas_Object *ctxpopup, *box, *btn = NULL;
-       Evas_Object *firstbtn = NULL;
-       Elm_Ctxpopup_Direction dir;
-       int i;
-
-       ctxpopup = elm_ctxpopup_add(m->base);
-       if (!ctxpopup)
-               return;
-
-       box = elm_box_add(ctxpopup);
-       if (!box) {
-               evas_object_del(ctxpopup);
-               return;
-       }
-
-       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0);
-
-       for (i = 0; i < size_arr; i++) {
-               if (text_arr == sourcetext &&
-                       !strcmp(text_arr[i], sourcetext[E_SOURCE_USB])/* &&
-                       mediadata_connected_usb() == 0*/)
-                       continue;
-
-               btn = elm_button_add(box);
-               if (!btn) {
-                       evas_object_del(ctxpopup);
-                       return;
-               }
-
-               elm_object_style_set(btn, style);
-               elm_object_text_set(btn, _(text_arr[i]));
-
-               Connect(btn, GALLERY_CTXPOPUP,
-                               TYPE_KEY_DOWN | TYPE_CLICKED |
-                               TYPE_MOUSE_MOVE | TYPE_FOCUSED |
-                               TYPE_UNFOCUSED);
-
-               if (text_arr == sourcetext)
-                       evas_object_data_set(btn, BTN_ID,
-                       hover_btn_id[SORT_TEXT_SIZE + i]);
-               else {
-                       evas_object_data_set(btn, BTN_ID, hover_btn_id[i]);
-
-                       if (i == 0 || i == 1) {
-                               if (i == 0)
-                                       m_AddUpdownIcon(btn, IMAGE_DOWN_ARR);
-                               else if (i == 1)
-                                       m_AddUpdownIcon(btn, IMAGE_UP_ARR);
-
-                               /* Calling first time to show icon */
-                               OnUnfocused(GALLERY_SORTBTN, btn, NULL);
-                       }
-               }
-
-               evas_object_show(btn);
-
-               elm_box_pack_end(box, btn);
-
-               if (i == 0)
-                       firstbtn = btn; /* to set focus later */
-
-               if (i == selected_index)
-                       elm_object_signal_emit(btn, "elm,action,highlight", "elm");
-
-               if (i == size_arr - 1)
-                       elm_object_signal_emit(btn, "elm,action,hideline", "elm");
-       }
-
-       evas_object_show(box);
-
-       elm_object_style_set(ctxpopup, STYLE_CTXPOPUP_HOVER);
-       elm_object_content_set(ctxpopup, box);
-
-       dir = (Elm_Ctxpopup_Direction)0;
-       elm_ctxpopup_direction_priority_set(ctxpopup, dir, dir, dir, dir);
-       evas_object_move(ctxpopup,
-               position_x * elm_config_scale_get(),
-               position_y * elm_config_scale_get());
-       evas_object_show(ctxpopup);
-
-       m->ctxpopup = ctxpopup;
-
-       if (firstbtn && btn) {
-               elm_object_focus_set(firstbtn, EINA_TRUE);
-               elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
-               elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
-       }
-}
-
 void CGalleryView::sm_CbGetSignalFromLayout(void *cookie, int sig)
 {
        SGalleryView *m = (SGalleryView *)cookie;
@@ -690,6 +558,34 @@ Eina_List *CGalleryView::sm_CbGetMediaList(void *cookie)
        return m->pMediadata->MediaList();
 }
 
+int CGalleryView::sm_CbSortType(void *cookie)
+{
+       SGalleryView *m = (SGalleryView *)cookie;
+
+       return m->sort_type;
+}
+
+void CGalleryView::sm_CbSetSortType(void *cookie, int sort)
+{
+       SGalleryView *m = (SGalleryView *)cookie;
+
+       m->sort_type = sort;
+}
+
+int CGalleryView::sm_CbSourceType(void *cookie)
+{
+       SGalleryView *m = (SGalleryView *)cookie;
+
+       return m->source_type;
+}
+
+void CGalleryView::sm_CbSetSourceType(void *cookie, int source)
+{
+       SGalleryView *m = (SGalleryView *)cookie;
+
+       m->source_type = source;
+}
+
 bool CGalleryView::Create(void *data)
 {
        ASSERT(!m);
@@ -817,7 +713,7 @@ void CGalleryView::Destroy(void)
 
        evas_object_del(m->base);
 
-       delete m;
+       free(m);
        m = NULL;
 }
 
@@ -850,8 +746,11 @@ void CGalleryView::t_OnPause(void)
 {
        ASSERT(m);
 
-       if (m->ctxpopup)
-               m_DestroyCtxpopup();
+       if (m->pCtxPopup) {
+               m->pCtxPopup->Destroy();
+               delete m->pCtxPopup;
+               m->pCtxPopup = NULL;
+       }
 }
 
 void CGalleryView::t_OnResume(void)
@@ -895,8 +794,6 @@ void CGalleryView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_D
                        elm_object_focus_set(m->focused_btn, EINA_TRUE);
                break;
        case GALLERY_CTXPOPUP:
-               if (strcmp(ev->keyname, KEY_BACK) == 0)
-                       m_DestroyCtxpopup();
                break;
        default:
                break;
@@ -907,46 +804,31 @@ void CGalleryView::OnMouseClicked(int id, Evas_Object *obj)
 {
        switch (id) {
        case GALLERY_SORTBTN:
-               m_DrawCtxpopup(sorttext, SORT_TEXT_SIZE,
-                       STYLE_BTN_HOVERTEXT, m->sort_type,
-                       POSITION_SORT_POPUP_X, POSITION_SORT_POPUP_Y);
+       {
+               CSortCtxPopup::SCallback cb;
+               cb.cookie = this;
+               cb.onSelected = sm_CbCtxPopupSelected;
+
+               CSortCtxPopup *pCtxPopup = new CSortCtxPopup;
+               pCtxPopup->RegisterGetCallback(sm_CbSortType, m);
+               pCtxPopup->RegisterSetCallback(sm_CbSetSortType, m);
+               m->pCtxPopup = pCtxPopup;
+               pCtxPopup->Create(m->base, &cb);
+       }
                break;
        case GALLERY_SOURCEBTN:
-               m_DrawCtxpopup(sourcetext, SOURCE_TEXT_SIZE,
-                       STYLE_BTN_HOVERTEXT, m->source_type,
-                       POSITION_SOURCE_POPUP_X, POSITION_SOURCE_POPUP_Y);
+       {
+               CSourceCtxPopup::SCallback cb;
+               cb.cookie = this;
+               cb.onSelected = sm_CbCtxPopupSelected;
+
+               CSourceCtxPopup *pCtxPopup = new CSourceCtxPopup;
+               pCtxPopup->RegisterGetCallback(sm_CbSourceType, m);
+               pCtxPopup->RegisterSetCallback(sm_CbSetSourceType, m);
+               m->pCtxPopup = pCtxPopup;
+               pCtxPopup->Create(m->base, &cb);
+       }
                break;
-       case GALLERY_CTXPOPUP:
-               {
-                       int i;
-                       const char *current_id;
-                       void(*func[])(void *) = {
-                               sm_CbSortDateDescClicked,
-                               sm_CbSortDateAscClicked,
-                               sm_CbSortAZClicked,
-                               sm_CbSortZAClicked,
-                               sm_CbSourceAllClicked,
-                               sm_CbSourceTVClicked,
-                               sm_CbSourceUSBClicked
-                       };
-
-                       current_id = (const char *)evas_object_data_get(obj, BTN_ID);
-                       if (!current_id)
-                               return;
-
-                       for (i = 0; i < (SORT_TEXT_SIZE + SOURCE_TEXT_SIZE); i++) {
-                               if (!strcmp(hover_btn_id[i], current_id)) {
-                                       func[i](this);
-                                       break;
-                               }
-                       }
-
-                       elm_object_text_set(m->hover_btn, elm_object_text_get(obj));
-
-                       m_DestroyCtxpopup();
-
-                       break;
-               }
        default:
                break;
        }
@@ -995,58 +877,15 @@ void CGalleryView::OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item)
        case GALLERY_SOURCEBTN:
                elm_object_signal_emit(m->focused_btn, "highlight", "");
 
+#if 0
                if (m->sortbtn == obj)
                        m_FocusUpdownArrow();
+#endif
 
                m->hover_btn = obj;
                m->focus_area = FOCUS_HOVER_BTN;
 
                break;
-       case GALLERY_CTXPOPUP:
-               Evas_Object *ic;
-
-               ic = (Evas_Object *)evas_object_data_get(obj, BTN_ICN);
-               if (!ic)
-                       return;
-
-               evas_object_color_set(ic, 255, 255, 255, 255);
-
-               break;
-       default:
-               break;
-       }
-}
-
-void CGalleryView::OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item)
-{
-       switch (id) {
-       case GALLERY_CTXPOPUP:
-               const char *current_id;
-               Evas_Object *ic;
-
-               current_id = (const char *)evas_object_data_get(obj, BTN_ID);
-               if (!current_id)
-                       return;
-
-               ic = (Evas_Object *)evas_object_data_get(obj, BTN_ICN);
-               if (!ic)
-                       return;
-
-               if (!strcmp(current_id, hover_btn_id[0])) {
-                       /* date desc */
-                       if (m->sort_type == E_SORT_DATE_DESC)
-                               evas_object_color_set(ic, 147, 170, 0, 255);
-                       else
-                               evas_object_color_set(ic, 89, 89, 89, 255);
-               } else if (!strcmp(current_id, hover_btn_id[1])) {
-                       /* date asc */
-                       if (m->sort_type == E_SORT_DATE_ASC)
-                               evas_object_color_set(ic, 147, 170, 0, 255);
-                       else
-                               evas_object_color_set(ic, 89, 89, 89, 255);
-               }
-
-               break;
        default:
                break;
        }
@@ -1090,7 +929,11 @@ void CGalleryView::OnUpdated(const SEntity *entity)
                vmgr->PopView();
        }
 
-       m_DestroyCtxpopup();
+       if (m->pCtxPopup) {
+               m->pCtxPopup->Destroy();
+               delete m->pCtxPopup;
+               m->pCtxPopup = NULL;
+       }
 
        m->pMediadata->DestroyMediaList();
 
index d728bff..bdf9df6 100644 (file)
@@ -35,6 +35,7 @@
 #include "Sort.h"
 #include "MediaContentDbListener.h"
 #include "UsbConnectionListener.h"
+#include "CtxPopup.h"
 #include "video_player.h"
 #include "gallery_view.h"
 #include "layout_all.h"
index 0c88ca6..27d74a5 100644 (file)
@@ -32,6 +32,7 @@
 #include "Sort.h"
 #include "MediaContentDbListener.h"
 #include "UsbConnectionListener.h"
+#include "CtxPopup.h"
 #include "video_player.h"
 #include "BaseLayout.h"
 #include "LayoutMgr.h"
@@ -709,7 +710,7 @@ void CEventLayout::Destroy(void)
 
        CBaseLayout::Destroy();
 
-       delete m;
+       free(m);
        m = NULL;
 }
 
index 9c432a6..c606767 100644 (file)
@@ -33,6 +33,7 @@
 #include "Sort.h"
 #include "MediaContentDbListener.h"
 #include "UsbConnectionListener.h"
+#include "CtxPopup.h"
 #include "layout_all.h"
 #include "layout_folder.h"
 #include "gallery_view.h"
@@ -530,7 +531,7 @@ void CFolderLayout::Destroy(void)
 
        CBaseLayout::Destroy();
 
-       delete m;
+       free(m);
        m = NULL;
 }
 
diff --git a/src/view/photo-viewer/SettingCtxPopup.cpp b/src/view/photo-viewer/SettingCtxPopup.cpp
new file mode 100644 (file)
index 0000000..37e6691
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+* 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 <Ecore.h>
+#include <app.h>
+#include <InputHandler.h>
+#include <ExtNameInfo.h>
+#include <BaseView.h>
+#include <BaseLayout.h>
+#include <CtxPopup.h>
+#include "SettingCtxPopup.h"
+#include "define.h"
+#include "menudef.h"
+
+#define BTN_ID "BTN_ID"
+
+struct SGetCallbackPair {
+       int (*cb)(void *cookie);
+       void *cookie;
+};
+
+struct SSetCallbackPair {
+       void (*cb)(void *cookie, int sort);
+       void *cookie;
+};
+
+void CSettingCtxPopup::RegisterGetCallback(int (*cb)(void *cookie), void *cookie)
+{
+       GetCb = new SGetCallbackPair;
+       if (!GetCb)
+               return;
+
+       GetCb->cb = cb;
+       GetCb->cookie = cookie;
+}
+
+void CSettingCtxPopup::RegisterSetCallback(void (*cb)(void *cookie, int speed), void *cookie)
+{
+       SetCb = new SSetCallbackPair;
+       if (!SetCb)
+               return;
+
+       SetCb->cb = cb;
+       SetCb->cookie = cookie;
+}
+
+void CSettingCtxPopup::t_OnConfiguration(void)
+{
+       t_SetList(speed_text, MAX_SPEED_BTNS, GetCb->cb(GetCb->cookie),
+                       CCtxPopup::TOPBTN_BASE, speed_btn_id,
+                       POSITION_SETTING_POPUP_X, POSITION_SETTING_POPUP_Y,
+                       STYLE_CTXPOPUP_VIEWER,
+                       STYLE_BTN_SHORTTEXT, STYLE_BTN_SHORTTEXT, STYLE_BTN_SHORTTEXT);
+}
+
+void CSettingCtxPopup::t_OnBtnClicked(Evas_Object *obj, void  *ev)
+{
+       if (!obj)
+               return;
+
+       int i;
+       const char *current_id;
+
+       current_id = (const char *)evas_object_data_get(obj, BTN_ID);
+       if (!current_id)
+               return;
+
+       for (i = 0; i < MAX_SPEED_BTNS; i++) {
+               if (!strcmp(speed_btn_id[i], current_id))
+                       break;
+       }
+
+       if (i == MAX_SPEED_BTNS || i == GetCb->cb(GetCb->cookie))
+               return;
+
+       SetCb->cb(SetCb->cookie, i);
+       CCtxPopup::t_OnBtnClicked(obj, ev);
+
+       Destroy();
+}
diff --git a/src/view/photo-viewer/ZoomCtxPopup.cpp b/src/view/photo-viewer/ZoomCtxPopup.cpp
new file mode 100644 (file)
index 0000000..00fb6d6
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+* 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 <Ecore.h>
+#include <app.h>
+#include <InputHandler.h>
+#include <ExtNameInfo.h>
+#include <BaseView.h>
+#include <BaseLayout.h>
+#include <CtxPopup.h>
+#include "ZoomCtxPopup.h"
+#include "define.h"
+#include "menudef.h"
+
+#define BTN_ID "BTN_ID"
+
+struct SSetCallbackPair {
+       void (*cb)(void *cookie, int sort);
+       void *cookie;
+};
+
+void CZoomCtxPopup::RegisterSetCallback(void (*cb)(void *cookie, int zoom_level), void *cookie)
+{
+       SetCb = new SSetCallbackPair;
+       if (!SetCb)
+               return;
+
+       SetCb->cb = cb;
+       SetCb->cookie = cookie;
+}
+
+void CZoomCtxPopup::t_OnConfiguration(void)
+{
+       t_SetList(zoom_text, MAX_ZOOM_BTNS, E_ZOOM_ORIGINAL,
+                       CCtxPopup::TOPBTN_BASE, zoom_btn_id,
+                       POSITION_ZOOM_POPUP_X, POSITION_ZOOM_POPUP_Y,
+                       STYLE_CTXPOPUP_VIEWER,
+                       STYLE_BTN_SHORTTEXT, STYLE_BTN_SHORTTEXT, STYLE_BTN_SHORTTEXT);
+}
+
+void CZoomCtxPopup::t_OnBtnClicked(Evas_Object *obj, void  *ev)
+{
+       if (!obj)
+               return;
+
+       int i;
+       const char *current_id;
+
+       current_id = (const char *)evas_object_data_get(obj, BTN_ID);
+       if (!current_id)
+               return;
+
+       for (i = 0; i < MAX_ZOOM_BTNS; i++) {
+               if (!strcmp(zoom_btn_id[i], current_id))
+                       break;
+       }
+
+       if (i == MAX_ZOOM_BTNS)
+               return;
+
+       SetCb->cb(SetCb->cookie, i);
+       CCtxPopup::t_OnBtnClicked(obj, ev);
+}
index d8e62cd..9f46084 100644 (file)
 #include "BaseView.h"
 #include "ViewMgr.h"
 #include "InputHandler.h"
+#include "CtxPopup.h"
 #include "photoviewer_view.h"
 #include "zoom_view.h"
+#include "SettingCtxPopup.h"
+#include "ZoomCtxPopup.h"
 
-#define BTN_ID "BTN_ID"
 #define SLIDESHOW_BTN_IDX 2
 
 
@@ -53,12 +55,6 @@ enum _slideshow_speed {
        SETTING_SPEED_FAST
 };
 
-enum _cur_ctxpopup {
-       CTXPOPUP_NONE = 0,
-       CTXPOPUP_ZOOM,
-       CTXPOPUP_SPEED,
-};
-
 enum EObjectType {
        PHOTOVIEWER_BTN = 0,
        PHOTOVIEWER_CTXPOPUP
@@ -84,10 +80,11 @@ struct SPhotoViewerView {
        int slideshow_state;
        int slideshow_speed;
 
-       Ecore_Timer *focus_timer;
+       int zoom_level;
+
+       CCtxPopup *pCtxPopup;
 
-       Evas_Object *ctxpopup;
-       int cur_ctxpopup;
+       Ecore_Timer *focus_timer;
 
        SPhotoViewerView() {
                win = NULL;
@@ -105,10 +102,11 @@ struct SPhotoViewerView {
                slideshow_state = 0;
                slideshow_speed = 0;
 
-               focus_timer = NULL;
+               zoom_level = 0;
+
+               pCtxPopup = NULL;
 
-               ctxpopup = NULL;
-               cur_ctxpopup = 0;
+               focus_timer = NULL;
        }
 
        ~SPhotoViewerView() {}
@@ -237,9 +235,21 @@ void CPhotoViewerView::m_OnSettingBtnClicked(Evas_Object *obj, const char *emiss
        elm_object_signal_emit(obj,
                "elm,action,highlight", "elm");
 
+       CSettingCtxPopup::SCallback cb;
+       cb.cookie = m;
+       cb.onSelected = sm_CbSettingCtxPopupSelected;
+
+       CSettingCtxPopup *pCtxPopup = new CSettingCtxPopup;
+       pCtxPopup->RegisterGetCallback(sm_CbSlideshowSpeed, m);
+       pCtxPopup->RegisterSetCallback(sm_CbSetSlideshowSpeed, m);
+       m->pCtxPopup = pCtxPopup;
+       pCtxPopup->Create(m->base, &cb);
+
+#if 0
        m_DrawCtxpopup(speed_text, MAX_SPEED_BTNS, STYLE_BTN_SHORTTEXT, m->slideshow_speed, POSITION_SETTING_POPUP_X, POSITION_SETTING_POPUP_Y);
 
        m->cur_ctxpopup = CTXPOPUP_SPEED;
+#endif
 }
 
 
@@ -257,9 +267,20 @@ void CPhotoViewerView::m_OnZoomBtnClicked(Evas_Object *obj, const char *emission
        elm_object_signal_emit(obj,
                "elm,action,highlight", "elm");
 
+       CZoomCtxPopup::SCallback cb;
+       cb.cookie = m;
+       cb.onSelected = sm_CbZoomCtxPopupSelected;
+
+       CZoomCtxPopup *pCtxPopup = new CZoomCtxPopup;
+       pCtxPopup->RegisterSetCallback(sm_CbSetZoomLevel, m);
+       m->pCtxPopup = pCtxPopup;
+       pCtxPopup->Create(m->base, &cb);
+
+#if 0
        m_DrawCtxpopup(zoom_text, MAX_ZOOM_BTNS, STYLE_BTN_SHORTTEXT, E_ZOOM_ORIGINAL, POSITION_ZOOM_POPUP_X, POSITION_ZOOM_POPUP_Y);
 
        m->cur_ctxpopup = CTXPOPUP_ZOOM;
+#endif
 }
 
 
@@ -337,35 +358,27 @@ Eina_Bool CPhotoViewerView::m_OnTimerTooltip(void)  {
        return ECORE_CALLBACK_CANCEL;
 }
 
-void CPhotoViewerView::m_HandleZoomFunction(const char *btn_id)
+void CPhotoViewerView::sm_CbZoomCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text)
 {
-       int i;
        struct zoom_data *zd;
-       int zoom_level;
 
-       if (!btn_id)
+       SPhotoViewerView *m = (SPhotoViewerView *)cookie;
+       if (!m)
                return;
 
-       zoom_level = 0;
-
-       for (i = 0; i < MAX_ZOOM_BTNS; i++) {
-               if (!strcmp(btn_id, zoom_text[i])) {
-                       zoom_level = i;
-                       break;
-               }
-       }
-
-       m_DestroyCtxpopup();
-
-       switch (zoom_level) {
-
+       switch (m->zoom_level) {
        case E_ZOOM_X2:
        case E_ZOOM_X4:
                zd = (struct zoom_data *)calloc(1, sizeof(*zd));
                if (!zd)
                        return;
                zd->minfo = m->vd->minfo;
-               zd->zoom_level = zoom_level;
+               zd->zoom_level = m->zoom_level;
+
+               m->pCtxPopup->Destroy();
+               delete m->pCtxPopup;
+               m->pCtxPopup = NULL;
+
                if (!CViewMgr::GetInstance()->PushView(VIEW_PHOTO_ZOOM, zd))
                        _ERR("VIEW_PHOTO_ZOOM view create failed");
                break;
@@ -376,101 +389,17 @@ void CPhotoViewerView::m_HandleZoomFunction(const char *btn_id)
        }
 }
 
-void CPhotoViewerView::m_HandleSpeedFunction(const char *btn_id)
+void CPhotoViewerView::sm_CbSettingCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text)
 {
-       int i;
-
-       if (!btn_id)
+       SPhotoViewerView *m = (SPhotoViewerView *)cookie;
+       if (!m)
                return;
 
-       for (i = 0; i < MAX_SPEED_BTNS; i++) {
-               if (!strcmp(btn_id, speed_text[i])) {
-                       m->slideshow_speed = i;
-                       break;
-               }
-       }
-
        if (m->slideshow_timer) {
                ecore_timer_interval_set(m->slideshow_timer,
                        slideshow_timeout[m->slideshow_speed]);
                ecore_timer_reset(m->slideshow_timer);
        }
-
-       m_DestroyCtxpopup();
-}
-
-void CPhotoViewerView::m_DestroyCtxpopup(void)
-{
-       if (!m->ctxpopup)
-               return;
-
-       evas_object_hide(m->ctxpopup);
-       evas_object_del(m->ctxpopup);
-
-       m->ctxpopup = NULL;
-       m->cur_ctxpopup = CTXPOPUP_NONE;
-
-       elm_object_focus_set(m->focusedbtn, EINA_TRUE);
-}
-
-void CPhotoViewerView::m_DrawCtxpopup(const char **text_arr, int size_arr, const char *style, int selected_index, int position_x, int position_y)
-{
-       Evas_Object *ctxpopup, *box, *btn;
-       Evas_Object *firstbtn = NULL;
-       int i;
-
-       ctxpopup = elm_ctxpopup_add(m->base);
-       if (!ctxpopup)
-               return;
-
-       box = elm_box_add(ctxpopup);
-       if (!box) {
-               evas_object_del(ctxpopup);
-               return;
-       }
-
-       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0);
-
-       for (i = 0; i < size_arr; i++) {
-               btn = elm_button_add(box);
-               if (!btn) {
-                       evas_object_del(ctxpopup);
-                       return;
-               }
-               elm_object_style_set(btn, style);
-               elm_object_text_set(btn, _(text_arr[i]));
-               evas_object_data_set(btn, BTN_ID, text_arr[i]);
-               evas_object_show(btn);
-               elm_box_pack_end(box, btn);
-
-               if (i == 0)
-                       firstbtn = btn; /* to set focus later */
-
-               /* TODO: Need to highlight current selected item */
-               if (i == selected_index)
-                       elm_object_signal_emit(btn, "elm,action,highlight", "elm");
-
-               if (i == size_arr - 1) {
-                       elm_object_signal_emit(btn, "elm,action,hideline", "elm");
-               }
-               Connect(btn, PHOTOVIEWER_CTXPOPUP,
-                               TYPE_KEY_DOWN | TYPE_CLICKED | TYPE_MOUSE_MOVE);
-       }
-       evas_object_show(box);
-
-       elm_object_style_set(ctxpopup, STYLE_CTXPOPUP_VIEWER);
-       elm_object_content_set(ctxpopup, box);
-
-       evas_object_move(ctxpopup,
-                       position_x * elm_config_scale_get(),
-                       position_y * elm_config_scale_get());
-       evas_object_show(ctxpopup);
-
-       m->ctxpopup = ctxpopup;
-
-       if (firstbtn)
-               elm_object_focus_set(firstbtn, EINA_TRUE);
 }
 
 bool CPhotoViewerView::m_DrawContentArea(CMediaInfo *minfo)
@@ -638,7 +567,6 @@ bool CPhotoViewerView::m_DrawBottomArea(void)
 
        m->slideshow_state = STATE_PAUSE;
        m->slideshow_speed = SETTING_SPEED_NORMAL;
-       m->ctxpopup = NULL;
 
        return true;
 }
@@ -694,7 +622,6 @@ Eina_Bool CPhotoViewerView::sm_CbFocus(void *dt)
        return ret;
 }
 
-
 Eina_Bool CPhotoViewerView::OnFocus(void)
 {
        /* set focus on Next button in photo viewer */
@@ -704,6 +631,31 @@ Eina_Bool CPhotoViewerView::OnFocus(void)
 }
 
 
+void CPhotoViewerView::sm_CbSetZoomLevel(void *cookie, int zoom_level)
+{
+       SPhotoViewerView *m = (SPhotoViewerView *)cookie;
+       if (!m)
+               return;
+
+       m->zoom_level = zoom_level;
+}
+
+int CPhotoViewerView::sm_CbSlideshowSpeed(void *cookie)
+{
+       SPhotoViewerView *m = (SPhotoViewerView *)cookie;
+
+       return m->slideshow_speed;
+}
+
+void CPhotoViewerView::sm_CbSetSlideshowSpeed(void *cookie, int speed)
+{
+       SPhotoViewerView *m = (SPhotoViewerView *)cookie;
+       if (!m)
+               return;
+
+       m->slideshow_speed = speed;
+}
+
 bool CPhotoViewerView::Create(void *data)
 {
        ASSERT(!m);
@@ -821,6 +773,12 @@ void CPhotoViewerView::t_OnPause(void)
 {
        ASSERT(m);
 
+       if (m->pCtxPopup) {
+               m->pCtxPopup->Destroy();
+               delete m->pCtxPopup;
+               m->pCtxPopup = NULL;
+       }
+
        elm_object_tooltip_hide(m->focusedbtn);
 
        if (m->slideshow_timer)
@@ -854,7 +812,11 @@ void CPhotoViewerView::OnTimeout(void)
 {
        int i;
 
-       m_DestroyCtxpopup();
+       if (m->pCtxPopup) {
+               m->pCtxPopup->Destroy();
+               delete m->pCtxPopup;
+               m->pCtxPopup = NULL;
+       }
 
        elm_object_signal_emit(m->base, SIG_HIDE, "");
 
@@ -922,11 +884,6 @@ void CPhotoViewerView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_K
                }
 
                break;
-       case PHOTOVIEWER_CTXPOPUP:
-               if (!strcmp(ev->keyname, KEY_BACK))
-                       m_DestroyCtxpopup();
-
-               break;
        default:
                break;
        }
@@ -938,24 +895,6 @@ void CPhotoViewerView::OnMouseClicked(int id, Evas_Object *obj)
        case PHOTOVIEWER_BTN:
                elm_object_signal_emit(obj, "mouse,anim,start", "");
                break;
-       case PHOTOVIEWER_CTXPOPUP:
-               const char *btn_id;
-
-               btn_id = (const char *)evas_object_data_get(obj, BTN_ID);
-
-               switch (m->cur_ctxpopup) {
-               case CTXPOPUP_ZOOM:
-                       m_HandleZoomFunction(btn_id);
-                       break;
-               case CTXPOPUP_SPEED:
-                       m_HandleSpeedFunction(btn_id);
-                       break;
-               default:
-                       break;
-               }
-
-               break;
-               if (m->cur_ctxpopup == CTXPOPUP_ZOOM)
        default:
                break;
        }
@@ -965,7 +904,6 @@ void CPhotoViewerView::OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event
 {
        switch (id) {
        case PHOTOVIEWER_BTN:
-       case PHOTOVIEWER_CTXPOPUP:
                if (!elm_object_focus_get(obj))
                        elm_object_focus_set(obj, EINA_TRUE);
                break;