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
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];
--- /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.
+*/
+
+#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
--- /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.
+*/
+
+#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
class CGalleryView : public CBaseView, CListenerMgr,
IKeyDownListener, IMouseClickedListener,
- IMouseMoveListener, IFocusedListener, IUnfocusedListener,
+ IMouseMoveListener, IFocusedListener,
CMediaContentDbUpdateListener, CUsbConnectionListener {
private:
struct SGalleryView *m;
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);
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) :
IMouseClickedListener(this),
IMouseMoveListener(this),
IFocusedListener(this),
- IUnfocusedListener(this),
m(0) {}
virtual ~CGalleryView() {}
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);
};
--- /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.
+*/
+
+#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
--- /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.
+*/
+
+#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
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);
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);
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",
#include "SortMgr.h"
#include "MediaContentDbListener.h"
#include "UsbConnectionListener.h"
+#include "CtxPopup.h"
#include "timeout_handler.h"
#include "mediainfo.h"
#include "mediadata.h"
--- /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 <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();
+}
--- /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 <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();
+}
#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"
CMediadata *pMediadata;
+ CCtxPopup *pCtxPopup;
+
struct layout_data *ld;
SGalleryView() {
pLayoutMgr = NULL;
ld = NULL;
+
+ pCtxPopup = NULL;
}
~SGalleryView() {}
}
}
-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);
}
}
-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);
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]));
}
}
-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;
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);
evas_object_del(m->base);
- delete m;
+ free(m);
m = NULL;
}
{
ASSERT(m);
- if (m->ctxpopup)
- m_DestroyCtxpopup();
+ if (m->pCtxPopup) {
+ m->pCtxPopup->Destroy();
+ delete m->pCtxPopup;
+ m->pCtxPopup = NULL;
+ }
}
void CGalleryView::t_OnResume(void)
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;
{
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;
}
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;
}
vmgr->PopView();
}
- m_DestroyCtxpopup();
+ if (m->pCtxPopup) {
+ m->pCtxPopup->Destroy();
+ delete m->pCtxPopup;
+ m->pCtxPopup = NULL;
+ }
m->pMediadata->DestroyMediaList();
#include "Sort.h"
#include "MediaContentDbListener.h"
#include "UsbConnectionListener.h"
+#include "CtxPopup.h"
#include "video_player.h"
#include "gallery_view.h"
#include "layout_all.h"
#include "Sort.h"
#include "MediaContentDbListener.h"
#include "UsbConnectionListener.h"
+#include "CtxPopup.h"
#include "video_player.h"
#include "BaseLayout.h"
#include "LayoutMgr.h"
CBaseLayout::Destroy();
- delete m;
+ free(m);
m = NULL;
}
#include "Sort.h"
#include "MediaContentDbListener.h"
#include "UsbConnectionListener.h"
+#include "CtxPopup.h"
#include "layout_all.h"
#include "layout_folder.h"
#include "gallery_view.h"
CBaseLayout::Destroy();
- delete m;
+ free(m);
m = NULL;
}
--- /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 <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();
+}
--- /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 <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);
+}
#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
SETTING_SPEED_FAST
};
-enum _cur_ctxpopup {
- CTXPOPUP_NONE = 0,
- CTXPOPUP_ZOOM,
- CTXPOPUP_SPEED,
-};
-
enum EObjectType {
PHOTOVIEWER_BTN = 0,
PHOTOVIEWER_CTXPOPUP
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;
slideshow_state = 0;
slideshow_speed = 0;
- focus_timer = NULL;
+ zoom_level = 0;
+
+ pCtxPopup = NULL;
- ctxpopup = NULL;
- cur_ctxpopup = 0;
+ focus_timer = NULL;
}
~SPhotoViewerView() {}
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
}
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
}
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;
}
}
-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)
m->slideshow_state = STATE_PAUSE;
m->slideshow_speed = SETTING_SPEED_NORMAL;
- m->ctxpopup = NULL;
return true;
}
return ret;
}
-
Eina_Bool CPhotoViewerView::OnFocus(void)
{
/* set focus on Next button in photo viewer */
}
+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);
{
ASSERT(m);
+ if (m->pCtxPopup) {
+ m->pCtxPopup->Destroy();
+ delete m->pCtxPopup;
+ m->pCtxPopup = NULL;
+ }
+
elm_object_tooltip_hide(m->focusedbtn);
if (m->slideshow_timer)
{
int i;
- m_DestroyCtxpopup();
+ if (m->pCtxPopup) {
+ m->pCtxPopup->Destroy();
+ delete m->pCtxPopup;
+ m->pCtxPopup = NULL;
+ }
elm_object_signal_emit(m->base, SIG_HIDE, "");
}
break;
- case PHOTOVIEWER_CTXPOPUP:
- if (!strcmp(ev->keyname, KEY_BACK))
- m_DestroyCtxpopup();
-
- break;
default:
break;
}
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;
}
{
switch (id) {
case PHOTOVIEWER_BTN:
- case PHOTOVIEWER_CTXPOPUP:
if (!elm_object_focus_get(obj))
elm_object_focus_set(obj, EINA_TRUE);
break;