Applied latest source code
[apps/native/preloaded/Settings.git] / src / StWifiDirectAboutForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file                StWifiDirectAboutForm.cpp
19  * @brief               This is the implementation file for WifiDirectAboutForm class.
20  */
21
22 #include "StResourceManager.h"
23 #include "StTypes.h"
24 #include "StWifiDirectAboutForm.h"
25
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;
31
32 static const int ID_MAX_ITEM_COUNT = 0;
33 static const int ID_ITEM_COUNT = 3; 
34 static const int XYH_BASE_POINT = 0;
35
36 WifiDirectAboutForm::WifiDirectAboutForm(void)
37 {
38 }
39
40 WifiDirectAboutForm::~WifiDirectAboutForm(void)
41 {
42 }
43
44 bool
45 WifiDirectAboutForm::Initialize(void)
46 {
47         Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
48
49         return true;
50 }
51
52 void
53 WifiDirectAboutForm::CreateHeader(const Tizen::Base::String& textTitle)
54 {
55         Header* pHeader = GetHeader();
56
57         pHeader->SetStyle(HEADER_STYLE_TITLE);
58         pHeader->SetTitleText(textTitle);
59 }
60
61 void
62 WifiDirectAboutForm::CreateFooter(void)
63 {
64         Footer* pFooter = GetFooter();
65         AppAssert(pFooter);
66
67         pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
68         pFooter->AddActionEventListener(*this);
69
70         SetFormBackEventListener(this);
71 }
72
73 void
74 WifiDirectAboutForm::CreateHelpText(const Rectangle& bounds)
75 {
76         Label* pLabel = null;
77         Rectangle helpTitleRect;
78         Rectangle HelpContentsRect;
79         String itemTitle;
80         String itemHelp;
81
82         helpTitleRect = bounds;
83         helpTitleRect.height = H_HELP_TEXT_LINE;
84
85         HelpContentsRect = helpTitleRect;
86         HelpContentsRect.y = XYH_BASE_POINT;
87         HelpContentsRect.height = XYH_BASE_POINT;
88
89         itemHelp = ResourceManager::GetString(L"IDS_ST_BODY_WI_FI_DIRECT_HELP_MSG");
90
91         pLabel = new (std::nothrow) Label();
92         pLabel->Construct(bounds, itemHelp);
93         pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
94         pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
95         pLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_BOLD);
96         pLabel->SetTextColor(COLOR_MAIN_TEXT);
97
98         AddControl(pLabel);
99 }
100
101 void
102 WifiDirectAboutForm::CreateHelpTextView(void)
103 {
104         Rectangle bounds = GetClientAreaBounds();
105         bounds.x = X_HELP_TEXT_PAGE;
106         bounds.y = Y_HELP_TEXT_PAGE;
107         bounds.width -= (bounds.x * WIDTH_GAP);
108
109         CreateHelpText(bounds);
110 }
111
112 result
113 WifiDirectAboutForm::OnInitializing(void)
114 {
115         CreateHeader(ResourceManager::GetString(L"IDS_WIFI_BODY_ABOUT_WI_FI_DIRECT_ABB"));
116         CreateHelpTextView();
117
118         AppLogDebug("ENTER");
119
120         return E_SUCCESS;
121 }
122
123 result
124 WifiDirectAboutForm::OnTerminating(void)
125 {
126         SetFormBackEventListener(null);
127         return E_SUCCESS;
128 }
129
130 void
131 WifiDirectAboutForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
132 {
133 }
134
135 void
136 WifiDirectAboutForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
137 {
138 }
139
140 void
141 WifiDirectAboutForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
142 {
143         SceneManager* pSceneManager = SceneManager::GetInstance();
144         AppAssert(pSceneManager);
145
146         pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
147 }