#ifndef __SORT_CTXPOPUP_H__
#define __SORT_CTXPOPUP_H__
-struct SGetCallbackPair;
-struct SSetCallbackPair;
-
class CSortCtxPopup : public CCtxPopup {
private:
- SGetCallbackPair *GetCb;
- SSetCallbackPair *SetCb;
+ int sort_type;
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);
+ void SetSortType(int type);
};
#endif
#ifndef __SOURCE_CTXPOPUP_H__
#define __SOURCE_CTXPOPUP_H__
-struct SGetCallbackPair;
-struct SSetCallbackPair;
-
class CSourceCtxPopup : public CCtxPopup {
private:
- SGetCallbackPair *GetCb;
- SSetCallbackPair *SetCb;
+ int source_type;
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);
+ void SetSourceType(int type);
};
#endif
virtual void t_OnResume(void);
private:
- 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);
+
+ static void sm_CbCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text);
+ void m_OnCtxPopupSelected(CCtxPopup *instance, const char *text);
private:
void m_DrawNotifyPopup(const char *text);
#ifndef __SETTING_CTXPOPUP_H__
#define __SETTING_CTXPOPUP_H__
-struct SGetCallbackPair;
-struct SSetCallbackPair;
-
class CSettingCtxPopup : public CCtxPopup {
private:
- SGetCallbackPair *GetCb;
- SSetCallbackPair *SetCb;
+ int slideshow_speed;
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);
+ void SetSlideshowSpeed(int speed);
};
#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 int sm_CbSlideshowSpeed(void *cookie);
- static void sm_CbSetSlideshowSpeed(void *cookie, int speed);
- static void sm_CbSetZoomLevel(void *cookie, int zoom_level);
+ static void sm_CbCtxPopupSelected(void *cookie, CCtxPopup *instance, const char *text);
+ void m_OnCtxPopupSelected(CCtxPopup *instance, const char *text);
static Eina_Bool sm_CbTimerTooltip(void *cookie);
Eina_Bool m_OnTimerTooltip(void);
#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),
+ t_SetList(sorttext, SORT_TEXT_SIZE, sort_type,
CCtxPopup::TOPBTN_SORT, sort_btn_id,
POSITION_SORT_POPUP_X, POSITION_SORT_POPUP_Y,
NULL,
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)
- return;
-
- if (i != GetCb->cb(GetCb->cookie)) {
- SetCb->cb(SetCb->cookie, i);
- CCtxPopup::t_OnBtnClicked(obj, ev);
- }
-
+ CCtxPopup::t_OnBtnClicked(obj, ev);
Destroy();
}
+
+void CSortCtxPopup::SetSortType(int type)
+{
+ sort_type = type;
+}
#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),
+ t_SetList(sourcetext, SOURCE_TEXT_SIZE, source_type,
CCtxPopup::TOPBTN_SOURCE, source_btn_id,
POSITION_SOURCE_POPUP_X, POSITION_SOURCE_POPUP_Y,
NULL,
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)
- return;
-
- if (i != GetCb->cb(GetCb->cookie)) {
- SetCb->cb(SetCb->cookie, i);
- CCtxPopup::t_OnBtnClicked(obj, ev);
- }
-
+ CCtxPopup::t_OnBtnClicked(obj, ev);
Destroy();
}
+
+void CSourceCtxPopup::SetSourceType(int type)
+{
+ source_type = type;
+}
if (!root)
return;
+ root->m_OnCtxPopupSelected(instance, text);
+}
+
+void CGalleryView::m_OnCtxPopupSelected(CCtxPopup *instance, const char *text)
+{
+ int i;
+
switch (instance->Type()) {
case CCtxPopup::TOPBTN_SORT:
- root->m_SetBtnText(text);
- root->m_SortLayout();
+ for (i = 0; i < SORT_TEXT_SIZE; i++) {
+ if (!strcmp(sorttext[i], text))
+ break;
+ }
+
+ if (i == SORT_TEXT_SIZE || i == m->sort_type)
+ break;
+
+ m->sort_type = i;
+
+ elm_object_text_set(m->hover_btn, text);
+ m_SortLayout();
break;
case CCtxPopup::TOPBTN_SOURCE:
- root->m_SetBtnText(text);
- root->m_SourceChange();
+ for (i = 0; i < SOURCE_TEXT_SIZE; i++) {
+ if (!strcmp(sourcetext[i], text))
+ break;
+ }
+
+ if (i == SOURCE_TEXT_SIZE || i == m->source_type)
+ break;
+
+ m->source_type = i;
+
+ elm_object_text_set(m->hover_btn, text);
+ m_SourceChange();
break;
default:
break;
}
}
-void CGalleryView::m_SetBtnText(const char *text)
-{
- if (!text)
- return;
-
- elm_object_text_set(m->hover_btn, text);
-}
-
void CGalleryView::m_SortLayout(void)
{
switch (m->current_layout) {
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);
cb.onSelected = sm_CbCtxPopupSelected;
CSortCtxPopup *pCtxPopup = new CSortCtxPopup;
- pCtxPopup->RegisterGetCallback(sm_CbSortType, m);
- pCtxPopup->RegisterSetCallback(sm_CbSetSortType, m);
m->pCtxPopup = pCtxPopup;
+ pCtxPopup->SetSortType(m->sort_type);
pCtxPopup->Create(m->base, &cb);
}
break;
cb.onSelected = sm_CbCtxPopupSelected;
CSourceCtxPopup *pCtxPopup = new CSourceCtxPopup;
- pCtxPopup->RegisterGetCallback(sm_CbSourceType, m);
- pCtxPopup->RegisterSetCallback(sm_CbSetSourceType, m);
m->pCtxPopup = pCtxPopup;
+ pCtxPopup->SetSourceType(m->source_type);
pCtxPopup->Create(m->base, &cb);
}
break;
#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),
+ t_SetList(speed_text, MAX_SPEED_BTNS, slideshow_speed,
CCtxPopup::TOPBTN_BASE, speed_btn_id,
POSITION_SETTING_POPUP_X, POSITION_SETTING_POPUP_Y,
NULL,
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)
- return;
-
- if (i != GetCb->cb(GetCb->cookie)) {
- SetCb->cb(SetCb->cookie, i);
- CCtxPopup::t_OnBtnClicked(obj, ev);
- }
-
+ CCtxPopup::t_OnBtnClicked(obj, ev);
Destroy();
}
+
+void CSettingCtxPopup::SetSlideshowSpeed(int speed)
+{
+ slideshow_speed = speed;
+}
elm_object_signal_emit(obj, "elm,action,highlight", "elm");
CSettingCtxPopup::SCallback cb;
- cb.cookie = m;
- cb.onSelected = sm_CbSettingCtxPopupSelected;
+ cb.cookie = this;
+ cb.onSelected = sm_CbCtxPopupSelected;
CSettingCtxPopup *pCtxPopup = new CSettingCtxPopup;
- pCtxPopup->RegisterGetCallback(sm_CbSlideshowSpeed, m);
- pCtxPopup->RegisterSetCallback(sm_CbSetSlideshowSpeed, m);
m->pCtxPopup = pCtxPopup;
+ pCtxPopup->SetSlideshowSpeed(m->slideshow_speed);
pCtxPopup->Create(m->base, &cb);
m_OnTimerTooltip();
return ECORE_CALLBACK_CANCEL;
}
-void CPhotoViewerView::sm_CbSettingCtxPopupSelected(void *cookie,
+void CPhotoViewerView::sm_CbCtxPopupSelected(void *cookie,
CCtxPopup *instance, const char *text)
{
- SPhotoViewerView *m = (SPhotoViewerView *)cookie;
- if (!m)
+ CPhotoViewerView *root = (CPhotoViewerView *)cookie;
+ if (!root)
+ return;
+
+ root->m_OnCtxPopupSelected(instance, text);
+}
+
+void CPhotoViewerView::m_OnCtxPopupSelected(CCtxPopup *instance, const char *text)
+{
+ int i;
+
+ for (i = 0; i < MAX_SPEED_BTNS; i++) {
+ if (!strcmp(speed_text[i], text))
+ break;
+ }
+
+ if (i == MAX_SPEED_BTNS || i == m->slideshow_speed)
return;
+ m->slideshow_speed = i;
+
if (m->slideshow_timer) {
ecore_timer_interval_set(m->slideshow_timer,
slideshow_timeout[m->slideshow_speed]);
return ECORE_CALLBACK_CANCEL;
}
-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);