2 // Copyright (c) 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.
18 * @file StLocationHelpForm.cpp
19 * @brief This is the implementation file for LocationHelpForm class.
22 #include "StLocationHelpForm.h"
23 #include "StResourceManager.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Graphics;
28 using namespace Tizen::Ui;
29 using namespace Tizen::Ui::Controls;
30 using namespace Tizen::Ui::Scenes;
32 static const int XYH_BASE_POINT = 0;
34 static const int ID_ITEM_COUNT = 2;
35 static const int ID_HELP_TEXT_GPS = 0;
36 static const int ID_HELP_TEXT_NETWORK_POSITION = 1;
38 static const int H_TEXT_GAP = 20;
40 LocationHelpForm::LocationHelpForm(void)
41 : __pContentPanel(null)
45 LocationHelpForm::~LocationHelpForm(void)
50 LocationHelpForm::CreateHeader(const Tizen::Base::String& textTitle)
52 Header* pHeader = GetHeader();
54 pHeader->SetStyle(HEADER_STYLE_TITLE);
55 pHeader->SetTitleText(textTitle);
59 LocationHelpForm::CreateFooter(void)
61 Footer* pFooter = GetFooter();
64 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
65 pFooter->AddActionEventListener(*this);
67 SetFormBackEventListener(this);
71 LocationHelpForm::CreateHelpText(const Rectangle& bounds)
73 Rectangle helpTitleRect;
74 Rectangle HelpContentsRect;
78 __pContentPanel = new ScrollPanel();
79 __pContentPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
81 int fontSize = GetFontSize();
83 helpTitleRect = bounds;
85 helpTitleRect.y = XYH_BASE_POINT;
86 helpTitleRect.height = XYH_BASE_POINT;
88 HelpContentsRect = helpTitleRect;
89 HelpContentsRect.y = XYH_BASE_POINT;
90 HelpContentsRect.height = XYH_BASE_POINT;
92 for (int count = 0; count < ID_ITEM_COUNT; count ++)
96 case ID_HELP_TEXT_GPS:
98 itemTitle = ResourceManager::GetString(L"IDS_CAM_OPT_GPS");
99 itemHelp = ResourceManager::GetString(L"IDS_LBS_POP_APPLICATIONS_WILL_BE_PERMITTED_TO_USE_YOUR_LOCATION");
103 case ID_HELP_TEXT_NETWORK_POSITION:
105 itemTitle = ResourceManager::GetString(L"IDS_LBS_BODY_NETWORK_POSITION");
106 itemHelp = ResourceManager::GetString(L"IDS_LBS_BODY_ENABLING_NETWORK_POSITIONING_WILL_HELP_YOU_FIND_YOUR_LOCATION_EVEN_IF_YOU_ARE_INDOORS_MSG");
111 helpTitleRect.x = H_TEXT_GAP;
112 helpTitleRect.height = GetHeightForStringArea(itemTitle, helpTitleRect.width - helpTitleRect.x, fontSize) + H_TEXT_GAP;
113 HelpContentsRect.x = H_TEXT_GAP;
114 HelpContentsRect.y = (helpTitleRect.y + helpTitleRect.height);
115 HelpContentsRect.height = GetHeightForStringArea(itemHelp, bounds.width - 4, fontSize) + H_TEXT_GAP;
117 Label* pLabel = new (std::nothrow) Label();
118 pLabel->Construct(helpTitleRect, itemTitle);
119 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
120 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
121 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_BOLD);
122 pLabel->SetTextColor(COLOR_MAIN_TEXT);
124 __pContentPanel->AddControl(pLabel);
126 Label* pSecondLabel = new (std::nothrow) Label();
127 pSecondLabel->Construct(HelpContentsRect, itemHelp);
128 pSecondLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
129 pSecondLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
130 pSecondLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
131 pSecondLabel->SetTextColor(COLOR_HELP_TEXT_TYPE_01);
133 __pContentPanel->AddControl(pSecondLabel);
135 helpTitleRect.y = (HelpContentsRect.y + HelpContentsRect.height);
137 AddControl(__pContentPanel);
141 LocationHelpForm::CreateHelpTextView(void)
143 Rectangle bounds = GetClientAreaBounds();
144 bounds.x = H_TEXT_GAP;
145 bounds.y = Y_HELP_TEXT_PAGE;
147 CreateHelpText(bounds);
151 LocationHelpForm::OnInitializing(void)
153 CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_HELP"));
154 CreateHelpTextView();
159 LocationHelpForm::OnTerminating(void)
161 SetFormBackEventListener(null);
166 LocationHelpForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
171 LocationHelpForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
176 LocationHelpForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
178 SceneManager* pSceneManager = SceneManager::GetInstance();
179 AppAssert(pSceneManager);
181 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
185 LocationHelpForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
187 RemoveControl(__pContentPanel);
188 __pContentPanel = null;
189 CreateHelpTextView();
193 LocationHelpForm::SetOrientationAutoMode(void)
195 SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
196 AddOrientationEventListener(*this);