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;
39 static const int W_HUGE_SIZE_PORTRAIT_TEXT_GAP = 90;
41 LocationHelpForm::LocationHelpForm(void)
42 :__pContentPanel(null)
46 LocationHelpForm::~LocationHelpForm(void)
51 LocationHelpForm::CreateHeader(const Tizen::Base::String& textTitle)
53 Header* pHeader = GetHeader();
55 pHeader->SetStyle(HEADER_STYLE_TITLE);
56 pHeader->SetTitleText(textTitle);
60 LocationHelpForm::CreateFooter(void)
62 Footer* pFooter = GetFooter();
65 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
66 pFooter->AddActionEventListener(*this);
68 SetFormBackEventListener(this);
72 LocationHelpForm::CreateHelpText(const Rectangle& bounds)
74 Rectangle helpTitleRect;
75 Rectangle HelpContentsRect;
79 __pContentPanel = new ScrollPanel();
80 __pContentPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
82 int fontSize = GetFontSize();
84 helpTitleRect = bounds;
86 helpTitleRect.y = XYH_BASE_POINT;
87 helpTitleRect.height = XYH_BASE_POINT;
89 HelpContentsRect = helpTitleRect;
90 HelpContentsRect.y = XYH_BASE_POINT;
91 HelpContentsRect.height = XYH_BASE_POINT;
93 for (int count = 0; count < ID_ITEM_COUNT; count ++)
97 case ID_HELP_TEXT_GPS:
99 itemTitle = ResourceManager::GetString(L"IDS_CAM_OPT_GPS");
100 itemHelp = ResourceManager::GetString(L"IDS_LBS_POP_APPLICATIONS_WILL_BE_PERMITTED_TO_USE_YOUR_LOCATION");
104 case ID_HELP_TEXT_NETWORK_POSITION:
106 itemTitle = ResourceManager::GetString(L"IDS_LBS_BODY_NETWORK_POSITION");
107 itemHelp = ResourceManager::GetString(L"IDS_LBS_BODY_ENABLING_NETWORK_POSITIONING_WILL_HELP_YOU_FIND_YOUR_LOCATION_EVEN_IF_YOU_ARE_INDOORS_MSG");
112 helpTitleRect.x = H_TEXT_GAP;
113 helpTitleRect.height = GetHeightForStringArea(itemTitle, bounds.width + W_HUGE_SIZE_PORTRAIT_TEXT_GAP, fontSize) + H_TEXT_GAP;
114 HelpContentsRect.x = H_TEXT_GAP;
115 HelpContentsRect.y = (helpTitleRect.y + helpTitleRect.height);
116 HelpContentsRect.height = GetHeightForStringArea(itemHelp, bounds.width , fontSize) + H_TEXT_GAP;
118 Label* pLabel = new (std::nothrow) Label();
119 pLabel->Construct(helpTitleRect, itemTitle);
120 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
121 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
122 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_BOLD);
123 pLabel->SetTextColor(COLOR_MAIN_TEXT);
125 __pContentPanel->AddControl(pLabel);
127 Label* pSecondLabel = new (std::nothrow) Label();
128 pSecondLabel->Construct(HelpContentsRect, itemHelp);
129 pSecondLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
130 pSecondLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
131 pSecondLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
132 pSecondLabel->SetTextColor(COLOR_HELP_TEXT_TYPE_01);
134 __pContentPanel->AddControl(pSecondLabel);
136 helpTitleRect.y = (HelpContentsRect.y + HelpContentsRect.height);
138 AddControl(__pContentPanel);
142 LocationHelpForm::CreateHelpTextView(void)
144 Rectangle bounds = GetClientAreaBounds();
145 bounds.x = H_TEXT_GAP;
146 bounds.y = Y_HELP_TEXT_PAGE;
148 CreateHelpText(bounds);
152 LocationHelpForm::OnInitializing(void)
154 CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_HELP"));
155 CreateHelpTextView();
156 // SetOrientationAutoMode();
162 LocationHelpForm::OnTerminating(void)
164 SetFormBackEventListener(null);
169 LocationHelpForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
174 LocationHelpForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
179 LocationHelpForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
181 SceneManager* pSceneManager = SceneManager::GetInstance();
182 AppAssert(pSceneManager);
184 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
188 LocationHelpForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
190 RemoveControl(__pContentPanel);
191 __pContentPanel = null;
192 CreateHelpTextView();
196 LocationHelpForm::SetOrientationAutoMode(void)
198 SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
199 AddOrientationEventListener(*this);