Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / cpp / Sample / Tizen C++ / Dictionary / Dictionary / project / src / ViewDescriptForm.cpp
1 //
2 // Tizen C++ SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (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
8 //
9 //     http://www.tizenopensource.org/license
10 //
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.
16 //
17
18 #include "ViewDescriptForm.h"
19
20 using namespace Osp::Base;
21 using namespace Osp::Base::Collection;
22 using namespace Osp::Base::Utility;
23 using namespace Osp::Io;
24 using namespace Osp::App;
25 using namespace Osp::Graphics;
26 using namespace Osp::Ui::Controls;
27
28 ViewDescriptForm::ViewDescriptForm(void)
29 {
30 }
31
32 ViewDescriptForm::~ViewDescriptForm(void)
33 {
34 }
35
36 result
37 ViewDescriptForm::Construct(String* pstr)
38 {
39         __strDescription = *pstr;
40
41         Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
42
43         EditArea* pEaEditor = new (std::nothrow) EditArea;
44         TryReturn(pEaEditor != null, E_OUT_OF_MEMORY, "new EditArea() is null");
45
46         TryReturn(pEaEditor != null, E_OUT_OF_MEMORY, "new EditArea() is null");
47
48         Rectangle rect = Rectangle(10, 10, GetClientAreaBounds().width - 20, GetClientAreaBounds().height - 15);
49         result r = pEaEditor->Construct(rect);
50         TryReturn(r == E_SUCCESS, r, "FileViewForm - EditArea::Construct() is failed by %s", GetErrorMessage(r));
51
52         pEaEditor->SetKeypadEnabled(false);
53         pEaEditor->SetEnabled(false);
54
55         r = AddControl(*pEaEditor);
56         TryReturn(r == E_SUCCESS, r, "FileViewForm - AddControl() is failed by %s", GetErrorMessage(r));
57
58         pEaEditor->SetText(__strDescription);
59
60         Header* pHeader = GetHeader();
61         pHeader->SetTitleText(L"Description");
62
63         return E_SUCCESS;
64 }