3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 //!Internet IntFontSize class
19 /*@file: IntFontSize.cpp
20 *@brief: This class defines IntFontSize used to change the font size
24 #include <FAppUiApp.h>
27 #include "IntCommonLib.h"
28 #include "IntReaderFontSizeForm.h"
29 #include "IntSceneRegister.h"
30 #include "IntSettingPresentationModel.h"
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Controls;
38 using namespace Tizen::Ui::Scenes;
41 ReaderFontSizeForm::ReaderFontSizeForm(void)
47 ReaderFontSizeForm::~ReaderFontSizeForm(void)
53 ReaderFontSizeForm::Initialize(void)
55 Form::Construct(L"IDL_FONT_SIZE");
61 ReaderFontSizeForm::OnInitializing(void)
65 SceneManager* pSceneManager = SceneManager::GetInstance();
66 if (pSceneManager != null)
68 r = pSceneManager->AddSceneEventListener(IDSCN_FONT_SIZE, *this);
69 TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r));
72 SetFormBackEventListener(this);
74 r = GetHeader()->SetTitleText(CommonUtil::GetString(L"IDS_BR_BODY_FONT_SIZE"));
75 TryCatch(!IsFailed(r),,"OnInitialized failed with %s",GetErrorMessage(r));
77 __pFontSlider = static_cast< Slider* >(GetControl(
78 L"IDC_FONT_SLIDER", true));
79 if (__pFontSlider == null)
83 __pFontSlider->AddSliderEventListener(*this);
85 r = __pFontSlider->SetBounds(Rectangle(0, 10, GetClientAreaBounds().width, 120));
86 TryCatch(!IsFailed(r),,"OnInitialized failed with %s",GetErrorMessage(r));
88 r = __pFontSlider->SetRange(10, 30);
89 TryCatch(!IsFailed(r),,"OnInitialized failed with %s",GetErrorMessage(r));
91 GetFooter()->AddActionEventListener(*this);
98 ReaderFontSizeForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
100 __pFontValue = dynamic_cast<Integer*>(pArgs->GetAt(0));
102 if (__pFontValue == null)
107 if (__pFontSlider != null && __pFontValue != null)
109 __pFontSlider->SetValue(__pFontValue->ToInt());
115 ReaderFontSizeForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
121 ReaderFontSizeForm::OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value)
123 *__pFontValue = value;
128 ReaderFontSizeForm::OnFormBackRequested(Form& source)
130 result r = E_FAILURE;
131 SceneManager* pSceneManager = SceneManager::GetInstance();
132 ArrayList *pArgList = new(std::nothrow) ArrayList();
134 if (pArgList != null)
136 r = pArgList->Construct();
137 TryCatch(!IsFailed(r),,"OnFormBackRequested failed with %s",GetErrorMessage(r));
139 SettingPresentationModel::GetInstance()->SetReaderFontSize(__pFontValue->ToInt());
140 TryCatch(!IsFailed(r),,"OnFormBackRequested failed with %s",GetErrorMessage(r));
142 if (pSceneManager != null)
144 r = pSceneManager->GoBackward(BackwardSceneTransition());
145 TryCatch(!IsFailed(r), "ReaderFontSizeForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
151 if( pArgList != NULL)
160 ReaderFontSizeForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)