+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 __GALLERY_MAIN_INSTANCE_H__
-#define __GALLERY_MAIN_INSTANCE_H__
-
-#include "types.h"
-
-#include "ucl/appfw/IInstance.h"
-#include "ucl/appfw/IInstanceAppControlExt.h"
-
-#include "ucl/gui/Theme.h"
-#include "ucl/gui/Naviframe.h"
-
-#include "model/types.h"
-#include "presentation/types.h"
-
-namespace gallery {
-
- class Instance final :
- public ucl::IInstance,
- public ucl::IInstanceAppControlExt {
- public:
- Instance(ucl::SysEventProvider &sysEventProvider);
- virtual ~Instance();
-
- // IInstance //
-
- virtual ucl::Result onCreate(
- ucl::IInstanceContext *context) final override;
- virtual void onPause() final override;
- virtual void onResume() final override;
-
- // IInstanceAppControlExt //
-
- virtual void onAppControl(app_control_h appControl) final override;
-
- private:
- ucl::Result setupTheme();
-
- void rescanMediaContent();
- void stopMediaContentScan();
- void startMediaContentScan();
- void onScanComplete(media_content_error_e error);
-
- void onSysEvent(const ucl::SysEvent sysEvent);
-
- void onPageExitRequest(Page &page);
-
- private:
- ucl::SysEventProvider &m_sysEventProvider;
- ucl::IInstanceContext *m_context;
-
- GallerySRef m_gallery;
- bool m_isScanInProgress;
-
- ucl::WindowSRef m_win;
- ucl::Theme m_theme;
- ucl::NaviframeSRef m_navi;
-
- PageWRef m_page;
- };
-}
-
-#endif // __GALLERY_MAIN_INSTANCE_H__
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 __GALLERY_MAIN_INSTANCE_MANAGER_H__
-#define __GALLERY_MAIN_INSTANCE_MANAGER_H__
-
-#include "types.h"
-
-#include "ucl/appfw/InstanceManagerBase.h"
-
-namespace gallery {
-
- class InstanceManager : public ucl::InstanceManagerBase {
- public:
- InstanceManager();
-
- // ucl::InstanceManagerBase //
-
- virtual ucl::IInstanceSRef newInstance() const final override;
- };
-}
-
-#endif // __GALLERY_MAIN_INSTANCE_MANAGER_H__
ucl::Result updateItem(int itemIndex, const ItemParams ¶ms);
- ucl::Result isItemRealized(int itemIndex);
+ ucl::Result isItemRealized(int itemIndex) const;
+
+ void activateRotary();
+ void deactivateRotary();
private:
class Slot;
static const Info &getInfo(Type type);
template <class FUNC>
- ucl::Result doWithItem(int itemIndex, FUNC &&func);
+ ucl::Result doWithItem(int itemIndex, FUNC &&func) const;
void addUnrealizeLock();
void removeUnrealizeLock();
// Initialization
void prepare();
+ void createCircleScroller();
// Actual slots count
bool updateSlotCount();
ucl::ElmWidget m_box;
ucl::Widget m_rect1;
ucl::Widget m_rect2;
+ Evas_Object *m_circleScroller;
IImageGridListener *m_listener;
int m_itemCount;
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __GALLERY_PRESENTATION_INSTANCE_H__
+#define __GALLERY_PRESENTATION_INSTANCE_H__
+
+#include "types.h"
+
+#include "ucl/appfw/IInstance.h"
+#include "ucl/appfw/IInstanceAppControlExt.h"
+
+#include "ucl/gui/Theme.h"
+#include "ucl/gui/Naviframe.h"
+
+#include "types.h"
+#include "model/types.h"
+
+namespace gallery {
+
+ class Instance final :
+ public ucl::IInstance,
+ public ucl::IInstanceAppControlExt {
+ public:
+ Instance(ucl::SysEventProvider &sysEventProvider);
+ virtual ~Instance();
+
+ // IInstance //
+
+ virtual ucl::Result onCreate(
+ ucl::IInstanceContext *context) final override;
+ virtual void onPause() final override;
+ virtual void onResume() final override;
+
+ // IInstanceAppControlExt //
+
+ virtual void onAppControl(app_control_h appControl) final override;
+
+ private:
+ ucl::Result setupTheme();
+
+ void rescanMediaContent();
+ void stopMediaContentScan();
+ void startMediaContentScan();
+ void onScanComplete(media_content_error_e error);
+
+ void onSysEvent(const ucl::SysEvent sysEvent);
+
+ void onPageExitRequest(Page &page);
+
+ private:
+ ucl::SysEventProvider &m_sysEventProvider;
+ ucl::IInstanceContext *m_context;
+
+ GallerySRef m_gallery;
+ bool m_isScanInProgress;
+
+ ucl::WindowSRef m_win;
+ ucl::Theme m_theme;
+ ucl::NaviframeSRef m_navi;
+
+ PageWRef m_page;
+ };
+}
+
+#endif // __GALLERY_PRESENTATION_INSTANCE_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __GALLERY_PRESENTATION_INSTANCE_MANAGER_H__
+#define __GALLERY_PRESENTATION_INSTANCE_MANAGER_H__
+
+#include "types.h"
+
+#include "ucl/appfw/InstanceManagerBase.h"
+
+namespace gallery {
+
+ class InstanceManager : public ucl::InstanceManagerBase {
+ public:
+ InstanceManager();
+
+ // ucl::InstanceManagerBase //
+
+ virtual ucl::IInstanceSRef newInstance() const final override;
+ };
+}
+
+#endif // __GALLERY_PRESENTATION_INSTANCE_MANAGER_H__
bool onEachMedia(MediaItemUPtr media);
+ // Page //
+
+ virtual void onActivate() final override;
+ virtual void onDeactivate() final override;
+
// IImageGridListener //
virtual void onItemRealized(int itemIndex) final override;
#ifndef __GALLERY_PRESENTATION_TYPES_H__
#define __GALLERY_PRESENTATION_TYPES_H__
+#include <efl_extension.h>
+
#include "../types.h"
namespace gallery {
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "ucl/appfw/UIApp.h"
+
+#include "presentation/InstanceManager.h"
+
+#include "common.h"
+
+using namespace ucl;
+using namespace gallery;
+
+int main(int argc, char *argv[])
+{
+ InstanceManager mgr;
+ const int ret = UIApp(mgr).run(argc, argv);
+ ILOG("ret: %d", ret);
+ return ret;
+}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "main/Instance.h"
-
-#include <system_settings.h>
-
-#include "ucl/appfw/SysEventProvider.h"
-#include "ucl/appfw/helpers.h"
-
-#include "model/Gallery.h"
-
-#include "presentation/ThumbnailPage.h"
-
-#include "resources.h"
-
-#include "../common.h"
-
-namespace gallery { namespace { namespace impl {
-
- // TODO Since feature is temporary using hard-coded path
- constexpr auto MEDIA_FOLDER = "/opt/usr/home/owner/media";
-}}}
-
-namespace gallery {
-
- using namespace ucl;
-
- Instance::Instance(SysEventProvider &sysEventProvider) :
- m_sysEventProvider(sysEventProvider),
- m_isScanInProgress(false)
- {
- }
-
- Instance::~Instance()
- {
- stopMediaContentScan();
- }
-
- Result Instance::onCreate(IInstanceContext *const context)
- {
- m_context = context;
-
- m_gallery = Gallery::newInstance();
- if (!m_gallery) {
- LOG_RETURN(RES_FAIL, "Gallery::newInstance() failed!");
- }
-
- m_win = m_context->getWindow();
-
- FAIL_RETURN(setupTheme(), "setupTheme() failed!");
-
- m_navi = Naviframe::Builder().
- build(m_win->getConformant());
- if (!m_navi) {
- LOG_RETURN(RES_FAIL, "Naviframe::build() failed!");
- }
-
- m_win->getConformant().setContent(*m_navi);
-
- m_sysEventProvider.addEventHandler(
- DELEGATE(Instance::onSysEvent, this));
-
- return RES_OK;
- }
-
- Result Instance::setupTheme()
- {
- m_theme = Theme::create();
- if (isNotValid(m_theme)) {
- LOG_RETURN(RES_FAIL, "Theme::create() failed!");
- }
-
- m_theme.addExtension(getResPath(THEME_EDJE_PATH));
-
- m_win->setTheme(m_theme);
-
- return RES_OK;
- }
-
- void Instance::onPause()
- {
- DLOG("PAUSE");
- }
-
- void Instance::onResume()
- {
- DLOG("RESUME");
-
- if (SCAN_MEDIA_ON_RESUME) {
- rescanMediaContent();
- }
- }
-
- void Instance::rescanMediaContent()
- {
- stopMediaContentScan();
- startMediaContentScan();
- }
-
- void Instance::stopMediaContentScan()
- {
- if (m_isScanInProgress) {
- m_isScanInProgress = false;
- DLOG("Scan is in progress. Terminating...");
- const int ret = media_content_cancel_scan_folder(
- impl::MEDIA_FOLDER);
- if (ret != 0) {
- WLOG("media_content_cancel_scan_folder() failed: %d", ret);
- }
- }
- }
-
- void Instance::startMediaContentScan()
- {
- DLOG("Starting media scan...");
-
- int ret = media_content_scan_folder(impl::MEDIA_FOLDER, true,
- CALLBACK_B(Instance::onScanComplete), this);
- if (ret != 0) {
- ELOG("media_content_scan_folder() failed: %d", ret);
- return;
- }
-
- m_isScanInProgress = true;
- }
-
- void Instance::onScanComplete(media_content_error_e error)
- {
- DLOG("Media scan complete. error: %d", error);
-
- m_isScanInProgress = false;
-
- const auto thumbPage = dynamicRefCast<ThumbnailPage>(m_page);
- if (thumbPage) {
- DLOG("Reloading the ThumbnailPage...");
- thumbPage->reload();
- }
- }
-
- void Instance::onAppControl(app_control_h appControl)
- {
- DLOG("APP CONTROL");
-
- if (!m_page) {
- DLOG("Creating ThumbnailPage.");
- m_page = ThumbnailPage::Builder().
- setNaviframe(m_navi).
- setAlbum(m_gallery->getAlbum()).
- build(DELEGATE(Instance::onPageExitRequest, this));
- }
-
- if (!m_win->isVisible()) {
- DLOG("Show the window.");
- show(*m_win);
- }
- }
-
- void Instance::onSysEvent(const SysEvent sysEvent)
- {
- switch(sysEvent) {
- case SysEvent::LANGUAGE_CHANGED:
- DLOG("SysEvent::LANGUAGE_CHANGED");
- {
- char *locale = NULL;
- system_settings_get_value_string(
- SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
- elm_language_set(locale);
- free(locale);
- }
- break;
- default:
- DLOG("sysEvent: %d", sysEvent);
- break;
- }
- }
-
- void Instance::onPageExitRequest(Page &page)
- {
- if (isLast(page)) {
- DLOG("Last page. Lowering the window.");
- m_win->lower();
- } else {
- DLOG("Exit page.");
- page.exit();
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "main/InstanceManager.h"
-
-#include "main/Instance.h"
-
-namespace gallery {
-
- using namespace ucl;
-
- InstanceManager::InstanceManager() :
- InstanceManagerBase(AppParams().
- set(AppParam::WINDOW_NAME, WINDOW_NAME).
- set(AppParam::BASE_SCALE, BASE_SCALE))
- {
- }
-
- IInstanceSRef InstanceManager::newInstance() const
- {
- return makeShared<Instance>(getSysEventProvider());
- }
-}
+++ /dev/null
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "ucl/appfw/UIApp.h"
-
-#include "main/InstanceManager.h"
-
-#include "../common.h"
-
-using namespace ucl;
-using namespace gallery;
-
-int main(int argc, char *argv[])
-{
- InstanceManager mgr;
- const int ret = UIApp(mgr).run(argc, argv);
- ILOG("ret: %d", ret);
- return ret;
-}
m_box(elm_box_add(*m_scroller)),
m_rect1(evas_object_rectangle_add(m_box.getEvas())),
m_rect2(evas_object_rectangle_add(m_box.getEvas())),
+ m_circleScroller(nullptr),
m_listener(nullptr),
m_itemCount(0),
}
show(*m_scroller);
+ createCircleScroller();
+
m_scroller->addEventHandler(WidgetEvent::RESIZE,
WEAK_DELEGATE(ImageGrid::onScrollerResize, asWeak(this)));
WEAK_DELEGATE(ImageGrid::onBoxMove, asWeak(this)));
}
+ void ImageGrid::createCircleScroller()
+ {
+ const auto sfc = getCircleSurface(*m_scroller);
+ if (!sfc) {
+ LOG_RETURN_VOID(RES_FAIL, "getCircleSurface() failed!");
+ }
+
+ m_circleScroller = eext_circle_object_scroller_add(*m_scroller, sfc);
+ if (!m_circleScroller) {
+ LOG_RETURN_VOID(RES_FAIL,
+ "eext_circle_object_scroller_add() failed!");
+ }
+
+ eext_circle_object_scroller_policy_set(m_circleScroller,
+ ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
+ }
+
void ImageGrid::setListener(IImageGridListener *const listener)
{
m_listener = listener;
});
}
- Result ImageGrid::isItemRealized(const int itemIndex)
+ Result ImageGrid::isItemRealized(const int itemIndex) const
{
return doWithItem(itemIndex,
[](Slot &slot, const int itemOffset)
}
template <class FUNC>
- Result ImageGrid::doWithItem(const int itemIndex, FUNC &&func)
+ Result ImageGrid::doWithItem(const int itemIndex, FUNC &&func) const
{
if ((itemIndex < 0) || (itemIndex >= m_itemCount)) {
LOG_RETURN(RES_INVALID_ARGUMENTS,
return func(*m_slots[slotOffset], itemOffset);
}
+ void ImageGrid::activateRotary()
+ {
+ eext_rotary_object_event_activated_set(m_circleScroller, EINA_TRUE);
+ }
+
+ void ImageGrid::deactivateRotary()
+ {
+ eext_rotary_object_event_activated_set(m_circleScroller, EINA_FALSE);
+ }
+
void ImageGrid::addUnrealizeLock()
{
unrealizeSlots(0, m_slotCount);
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "presentation/Instance.h"
+
+#include <system_settings.h>
+
+#include "ucl/appfw/SysEventProvider.h"
+#include "ucl/appfw/helpers.h"
+
+#include "model/Gallery.h"
+
+#include "presentation/ThumbnailPage.h"
+
+#include "resources.h"
+
+#include "common.h"
+
+namespace gallery { namespace { namespace impl {
+
+ // TODO Since feature is temporary using hard-coded path
+ constexpr auto MEDIA_FOLDER = "/opt/usr/home/owner/media";
+}}}
+
+namespace gallery {
+
+ using namespace ucl;
+
+ Instance::Instance(SysEventProvider &sysEventProvider) :
+ m_sysEventProvider(sysEventProvider),
+ m_isScanInProgress(false)
+ {
+ }
+
+ Instance::~Instance()
+ {
+ stopMediaContentScan();
+ }
+
+ Result Instance::onCreate(IInstanceContext *const context)
+ {
+ m_context = context;
+
+ m_gallery = Gallery::newInstance();
+ if (!m_gallery) {
+ LOG_RETURN(RES_FAIL, "Gallery::newInstance() failed!");
+ }
+
+ m_win = m_context->getWindow();
+
+ FAIL_RETURN(setupTheme(), "setupTheme() failed!");
+
+ m_navi = Naviframe::Builder().
+ build(m_win->getConformant());
+ if (!m_navi) {
+ LOG_RETURN(RES_FAIL, "Naviframe::build() failed!");
+ }
+
+ m_win->getConformant().setContent(*m_navi);
+
+ FAIL_RETURN(createCircleSurface(*m_navi),
+ "createCircleSurface() failed!");
+
+ m_sysEventProvider.addEventHandler(
+ DELEGATE(Instance::onSysEvent, this));
+
+ return RES_OK;
+ }
+
+ Result Instance::setupTheme()
+ {
+ m_theme = Theme::create();
+ if (isNotValid(m_theme)) {
+ LOG_RETURN(RES_FAIL, "Theme::create() failed!");
+ }
+
+ m_theme.addExtension(getResPath(THEME_EDJE_PATH));
+
+ m_win->setTheme(m_theme);
+
+ return RES_OK;
+ }
+
+ void Instance::onPause()
+ {
+ DLOG("PAUSE");
+ }
+
+ void Instance::onResume()
+ {
+ DLOG("RESUME");
+
+ if (SCAN_MEDIA_ON_RESUME) {
+ rescanMediaContent();
+ }
+ }
+
+ void Instance::rescanMediaContent()
+ {
+ stopMediaContentScan();
+ startMediaContentScan();
+ }
+
+ void Instance::stopMediaContentScan()
+ {
+ if (m_isScanInProgress) {
+ m_isScanInProgress = false;
+ DLOG("Scan is in progress. Terminating...");
+ const int ret = media_content_cancel_scan_folder(
+ impl::MEDIA_FOLDER);
+ if (ret != 0) {
+ WLOG("media_content_cancel_scan_folder() failed: %d", ret);
+ }
+ }
+ }
+
+ void Instance::startMediaContentScan()
+ {
+ DLOG("Starting media scan...");
+
+ int ret = media_content_scan_folder(impl::MEDIA_FOLDER, true,
+ CALLBACK_B(Instance::onScanComplete), this);
+ if (ret != 0) {
+ ELOG("media_content_scan_folder() failed: %d", ret);
+ return;
+ }
+
+ m_isScanInProgress = true;
+ }
+
+ void Instance::onScanComplete(media_content_error_e error)
+ {
+ DLOG("Media scan complete. error: %d", error);
+
+ m_isScanInProgress = false;
+
+ const auto thumbPage = dynamicRefCast<ThumbnailPage>(m_page);
+ if (thumbPage) {
+ DLOG("Reloading the ThumbnailPage...");
+ thumbPage->reload();
+ }
+ }
+
+ void Instance::onAppControl(app_control_h appControl)
+ {
+ DLOG("APP CONTROL");
+
+ if (!m_page) {
+ DLOG("Creating ThumbnailPage.");
+ m_page = ThumbnailPage::Builder().
+ setNaviframe(m_navi).
+ setAlbum(m_gallery->getAlbum()).
+ build(DELEGATE(Instance::onPageExitRequest, this));
+ }
+
+ if (!m_win->isVisible()) {
+ DLOG("Show the window.");
+ show(*m_win);
+ }
+ }
+
+ void Instance::onSysEvent(const SysEvent sysEvent)
+ {
+ switch(sysEvent) {
+ case SysEvent::LANGUAGE_CHANGED:
+ DLOG("SysEvent::LANGUAGE_CHANGED");
+ {
+ char *locale = NULL;
+ system_settings_get_value_string(
+ SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+ }
+ break;
+ default:
+ DLOG("sysEvent: %d", sysEvent);
+ break;
+ }
+ }
+
+ void Instance::onPageExitRequest(Page &page)
+ {
+ if (isLast(page)) {
+ DLOG("Last page. Lowering the window.");
+ m_win->lower();
+ } else {
+ DLOG("Exit page.");
+ page.exit();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "presentation/InstanceManager.h"
+
+#include "presentation/Instance.h"
+
+namespace gallery {
+
+ using namespace ucl;
+
+ InstanceManager::InstanceManager() :
+ InstanceManagerBase(AppParams().
+ set(AppParam::WINDOW_NAME, WINDOW_NAME).
+ set(AppParam::BASE_SCALE, BASE_SCALE))
+ {
+ }
+
+ IInstanceSRef InstanceManager::newInstance() const
+ {
+ return makeShared<Instance>(getSysEventProvider());
+ }
+}
#include "presentation/Page.h"
-#include <efl_extension.h>
-
#include "common.h"
namespace gallery { namespace { namespace impl {
return true;
}
+ void ThumbnailPage::onActivate()
+ {
+ m_imageGrid->activateRotary();
+ }
+
+ void ThumbnailPage::onDeactivate()
+ {
+ m_imageGrid->deactivateRotary();
+ }
+
void ThumbnailPage::onItemRealized(const int itemIndex)
{
m_realizedItems.emplace_back(new RealizedItem(*this, itemIndex));
#include "../common.h"
+#include "helpers.h"
+
#endif // __GALLERY_PRESENTATION_COMMON_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "helpers.h"
+
+#include "ucl/gui/Window.h"
+#include "ucl/gui/Naviframe.h"
+
+#include "common.h"
+
+namespace gallery { namespace { namespace impl {
+
+ using namespace ucl;
+
+ constexpr EoDataKey CIRCLE_SURFACE {"gallery,eext,circle,surface"};
+}}}
+
+namespace gallery {
+
+ using namespace ucl;
+
+ Result createCircleSurface(Naviframe &navi)
+ {
+ const auto win = navi.getWindow();
+ if (!win) {
+ LOG_RETURN(RES_FAIL, "Failed to get Window from Naviframe!");
+ }
+
+ if (win->getData(impl::CIRCLE_SURFACE)) {
+ LOG_RETURN(RES_ILLEGAL_STATE, "Circle Surface data already set!");
+ }
+
+ const auto sfc = eext_circle_surface_naviframe_add(navi);
+ if (!sfc) {
+ LOG_RETURN(RES_FAIL,
+ "eext_circle_surface_conformant_add() failed!");
+ }
+
+ win->setData(impl::CIRCLE_SURFACE, sfc);
+
+ return RES_OK;
+ }
+
+ Eext_Circle_Surface *getCircleSurface(const ElmWidget &widget)
+ {
+ const auto win = widget.getWindow();
+ if (!win) {
+ LOG_RETURN_VALUE(RES_FAIL, nullptr,
+ "Failed to get Window from widget!");
+ }
+
+ const auto sfc = static_cast<Eext_Circle_Surface *>(
+ win->getData(impl::CIRCLE_SURFACE));
+ if (!sfc) {
+ LOG_RETURN_VALUE(RES_FAIL, nullptr,
+ "Failed to get Eext_Circle_Surface from window!");
+ }
+
+ return sfc;
+ }
+}
+
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 __GALLERY_PRESENTATION_HELPERS_H__
+#define __GALLERY_PRESENTATION_HELPERS_H__
+
+#include "presentation/types.h"
+
+namespace ucl {
+
+ class ElmWidget;
+ class Naviframe;
+}
+
+namespace gallery {
+
+ ucl::Result createCircleSurface(ucl::Naviframe &navi);
+
+ Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget);
+}
+
+#endif // __GALLERY_PRESENTATION_HELPERS_H__
namespace ucl {
+ class Window;
+
UCL_DECLARE_REF_ALIASES(ElmWidget);
class ElmWidget : public Widget {
void setTheme(Elm_Theme *th);
Elm_Theme *getTheme();
+ Evas_Object *getTopWidget() const;
+ Window *getWindow() const;
+
protected:
virtual void setFocusedImpl(bool value) final override;
virtual bool isFocusedImpl() const final override;
return elm_object_theme_get(getEo());
}
+ inline Evas_Object *ElmWidget::getTopWidget() const
+ {
+ return elm_object_top_widget_get(getEo());
+ }
+
// Non-member functions //
inline void enable(ElmWidget &widget)
Evas *getEvas() const;
+ void setData(EoDataKey key, void *data);
+ void delData(EoDataKey key);
+ void *getData(EoDataKey key) const;
+
void addEventHandler(WidgetEvent event, WidgetEventHandler handler);
void addEventHandler(SmartEvent event, WidgetEventHandler handler);
return evas_object_evas_get(getEo());
}
+ inline void Widget::setData(const EoDataKey key, void *const data)
+ {
+ evas_object_data_set(getEo(), key.name, data);
+ }
+
+ inline void Widget::delData(const EoDataKey key)
+ {
+ evas_object_data_del(getEo(), key.name);
+ }
+
+ inline void *Widget::getData(const EoDataKey key) const
+ {
+ return evas_object_data_get(getEo(), key.name);
+ }
+
inline void Widget::callSmartEvent(SmartEvent event, void *eventInfo)
{
evas_object_smart_callback_call(getEo(), event, eventInfo);
struct SmartEvent : Aspect<SmartEvent> { using Aspect::Aspect; };
+ struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; };
+
// WidgetEventHandler //
class Widget;
#include "ucl/gui/ElmWidget.h"
+#include "ucl/gui/Window.h"
+#include "ucl/gui/helpers.h"
+
namespace ucl {
void ElmWidget::setFocusedImpl(const bool value)
{
return elm_object_focus_get(getEo());
}
+
+ Window *ElmWidget::getWindow() const
+ {
+ return dynamicCast<Window>(getTopWidget());
+ }
}