2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <Elementary.h>
18 #include <ui-gadget-module.h>
20 #include <dpl/assert.h>
26 namespace WebAppDetailSetting {
28 void MainView::onBackBtnClicked(void *data,
34 mainView = static_cast<MainView *>(data);
36 ug_destroy_me(mainView->getUG());
39 void MainView::onSegCtrlChanged(void *data,
47 mainView = static_cast<MainView *>(data);
49 it = reinterpret_cast<Elm_Object_Item *>(event_info);
52 subCtnt = mainView->getSubCtnt();
56 if (it == mainView->getSegCtrlDetail())
57 elm_object_signal_emit(subCtnt,
58 SIG_SHOW_DETAIL, SRC_PROG);
59 else if (it == mainView->getSegCtrlPerm())
60 elm_object_signal_emit(subCtnt,
61 SIG_SHOW_PERM, SRC_PROG);
64 Evas_Object *MainView::createToolBar(Evas_Object *parent)
70 toolBar = elm_toolbar_add(parent);
73 elm_object_style_set(toolBar, "naviframe");
74 elm_toolbar_shrink_mode_set(toolBar, ELM_TOOLBAR_SHRINK_EXPAND);
75 elm_toolbar_select_mode_set(toolBar, ELM_OBJECT_SELECT_MODE_ALWAYS);
77 segCtrl = elm_segment_control_add(toolBar);
79 evas_object_del(toolBar);
83 m_segCtrlDetail = elm_segment_control_item_add(segCtrl,
85 D_("IDS_COM_BODY_DETAILS"));
87 m_segCtrlPerm = elm_segment_control_item_add(segCtrl, NULL, "Permissions");
88 elm_segment_control_item_selected_set(m_segCtrlDetail, EINA_TRUE);
89 it = elm_toolbar_item_append(toolBar, NULL, NULL, NULL, NULL);
90 elm_object_item_part_content_set(it, "object", segCtrl);
91 evas_object_smart_callback_add(segCtrl, "changed", onSegCtrlChanged, this);
96 Evas_Object *MainView::createContent(Evas_Object *parent)
101 nf = elm_naviframe_add(parent);
106 m_detail.Reset(new DetailView(nf, m_ug, m_appID));
107 if (!m_detail->loadView())
111 } catch (const std::bad_alloc &) {
123 Evas_Object *MainView::loadView(void)
132 parent = static_cast<Evas_Object *>(ug_get_parent_layout(m_ug));
135 ly = elm_layout_add(parent);
138 elm_layout_theme_set(ly, "layout", "application", "default");
143 elm_object_part_content_set(ly, "elm.swallow.bg", eo);
145 eo = createContent(ly);
148 elm_object_part_content_set(ly, "elm.swallow.content", eo);
160 MainView::MainView(ui_gadget_h ug, DPL::String appId) :
164 m_segCtrlDetail(NULL),
173 MainView::~MainView(void)
177 } /* WebAppDetailSetting */