diff options
Diffstat (limited to 'project/src/MainListForm.cpp')
-rwxr-xr-x | project/src/MainListForm.cpp | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/project/src/MainListForm.cpp b/project/src/MainListForm.cpp new file mode 100755 index 0000000..e1ec1d0 --- /dev/null +++ b/project/src/MainListForm.cpp @@ -0,0 +1,112 @@ +// +// Tizen C++ SDK +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.tizenopensource.org/license +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include <FApp.h> +#include "MainListForm.h" +#include "XmlReader.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +MainListForm::MainListForm(void) +{ +} + +MainListForm::~MainListForm(void) +{ +} + +bool +MainListForm::Initialize(void) +{ + Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR); + return true; +} + +result +MainListForm::OnInitializing(void) +{ + result r = E_SUCCESS; + + Header* pHeader = GetHeader(); + pHeader->SetTitleText("XML PARSER APP"); + + //For xmlreader + Button* pXmlReader = new (std::nothrow) Button(); + pXmlReader->Construct(Rectangle(BUTTON_LEFT_RIGHT_MARGIN, BUTTON_TOP_MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT), L"XML Reader"); + pXmlReader->AddActionEventListener(*this); + pXmlReader->SetActionId(ID_BUTTON_XMLReader); + AddControl(*pXmlReader); + + //For htmlparser + Button* pHtmlParser = new (std::nothrow) Button(); + pHtmlParser->Construct(Rectangle(BUTTON_LEFT_RIGHT_MARGIN, BUTTON_TOP_MARGIN + ( BUTTON_HEIGHT + BUTTON_BOTTOM_MARGIN ), BUTTON_WIDTH, BUTTON_HEIGHT), L"HTML Parser"); + pHtmlParser->AddActionEventListener(*this); + pHtmlParser->SetActionId(ID_BUTTON_HTMLParser); + AddControl(*pHtmlParser); + + //For xmlparser + Button* pXmlParser = new (std::nothrow) Button(); + pXmlParser->Construct(Rectangle(BUTTON_LEFT_RIGHT_MARGIN, BUTTON_TOP_MARGIN + 2 * ( BUTTON_HEIGHT + BUTTON_BOTTOM_MARGIN ), BUTTON_WIDTH, BUTTON_HEIGHT), L"XML Parser"); + pXmlParser->AddActionEventListener(*this); + pXmlParser->SetActionId(ID_BUTTON_XMLParser); + AddControl(*pXmlParser); + + //For xmlwriter + Button* pXmlWriter = new (std::nothrow) Button(); + pXmlWriter->Construct(Rectangle(BUTTON_LEFT_RIGHT_MARGIN, BUTTON_TOP_MARGIN + 3 * ( BUTTON_HEIGHT + BUTTON_BOTTOM_MARGIN ), BUTTON_WIDTH, BUTTON_HEIGHT), L"XML Writer"); + pXmlWriter->AddActionEventListener(*this); + pXmlWriter->SetActionId(ID_BUTTON_XMLWriter); + AddControl(*pXmlWriter); + return r; +} + +result +MainListForm::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +MainListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + + switch (actionId) + { + case ID_BUTTON_XMLReader: + pSceneManager->GoForward(ForwardSceneTransition(L"XmlReaderScene")); + break; + case ID_BUTTON_HTMLParser: + pSceneManager->GoForward(ForwardSceneTransition(L"HtmlParserScene")); + break; + case ID_BUTTON_XMLParser: + pSceneManager->GoForward(ForwardSceneTransition(L"XmlParserScene")); + break; + case ID_BUTTON_XMLWriter: + pSceneManager->GoForward(ForwardSceneTransition(L"XmlWriterScene")); + break; + default: + break; + } +} |