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