From: Jinkun Jang Date: Tue, 19 Mar 2013 07:04:21 +0000 (+0900) Subject: sync with master X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e827688e5b3d4389952f323fbe32abb13ccaed7;p=apps%2Fnative%2Fsample%2FBasicApp.git sync with master --- diff --git a/project/inc/MainForm.h b/project/inc/MainForm.h index 8e1182e..31d7445 100644 --- a/project/inc/MainForm.h +++ b/project/inc/MainForm.h @@ -30,6 +30,7 @@ public: virtual ~MainForm(void); result Initialize(int panelId); + result CreateImagePanel(void); virtual result OnInitializing(void); virtual result OnTerminating(void); diff --git a/project/manifest.xml b/project/manifest.xml index bba9580..7106a86 100644 --- a/project/manifest.xml +++ b/project/manifest.xml @@ -1,11 +1,11 @@ $(manifestAppId) - 1.0.0 + 2.0.0 C++App - 2.0 + 2.1 diff --git a/project/src/MainForm.cpp b/project/src/MainForm.cpp index 0837e08..bd2dca6 100644 --- a/project/src/MainForm.cpp +++ b/project/src/MainForm.cpp @@ -33,6 +33,9 @@ MainForm::MainForm(void) , __status(ORIENTATION_PORTRAIT) , __panelId(0) { + __pPanel[0] = null; + __pPanel[1] = null; + __pPanel[2] = null; } MainForm::~MainForm(void) @@ -57,6 +60,16 @@ MainForm::Initialize(int panelId) } result +MainForm::CreateImagePanel(void) +{ + ImagePanel* pImagePanel = new (std::nothrow) ImagePanel(); + pImagePanel->Initialize(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height)); + AddOrientationEventListener(*pImagePanel); + AddControl(*pImagePanel); + __pPanel[2] = pImagePanel; +} + +result MainForm::OnInitializing(void) { result r = E_SUCCESS; @@ -117,13 +130,6 @@ MainForm::OnInitializing(void) } } - // Set Image Panel - ImagePanel* pImagePanel = new (std::nothrow) ImagePanel(); - pImagePanel->Initialize(rect); - AddOrientationEventListener(*pImagePanel); - AddControl(*pImagePanel); - __pPanel[2] = pImagePanel; - // Set the current panel as selected in the header and display it on the form if (pHeader) { @@ -131,12 +137,22 @@ MainForm::OnInitializing(void) if(__panelId == 2) { + if (__pPanel[2] == null) + { + CreateImagePanel(); + } SetOrientation(ORIENTATION_AUTOMATIC); } - __pPanel[0]->SetShowState(false); - __pPanel[1]->SetShowState(false); - __pPanel[2]->SetShowState(false); + if (__pPanel[0] != null) + { + __pPanel[0]->SetShowState(false); + } + if (__pPanel[1] != null) + { + __pPanel[1]->SetShowState(false); + } + __pPanel[__panelId]->SetShowState(true); } @@ -182,27 +198,58 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) { case ID_HEADER_ITEM1: { - __pPanel[0]->SetShowState(true); - __pPanel[1]->SetShowState(false); - __pPanel[2]->SetShowState(false); + if (__pPanel[0] != null) + { + __pPanel[0]->SetShowState(true); + } + if (__pPanel[1] != null) + { + __pPanel[1]->SetShowState(false); + } + if (__pPanel[2] != null) + { + __pPanel[2]->SetShowState(false); + } SetOrientation(ORIENTATION_PORTRAIT); } break; case ID_HEADER_ITEM2: { - __pPanel[0]->SetShowState(false); - __pPanel[1]->SetShowState(true); - __pPanel[2]->SetShowState(false); + if (__pPanel[0] != null) + { + __pPanel[0]->SetShowState(false); + } + if (__pPanel[1] != null) + { + __pPanel[1]->SetShowState(true); + } + if (__pPanel[2] != null) + { + __pPanel[2]->SetShowState(false); + } SetOrientation(__status); } break; case ID_HEADER_ITEM3: { - __pPanel[0]->SetShowState(false); - __pPanel[1]->SetShowState(false); - __pPanel[2]->SetShowState(true); + if (__pPanel[2] == null) + { + CreateImagePanel(); + } + if (__pPanel[0] != null) + { + __pPanel[0]->SetShowState(false); + } + if (__pPanel[1] != null) + { + __pPanel[1]->SetShowState(false); + } + if (__pPanel[2] != null) + { + __pPanel[2]->SetShowState(true); + } SetOrientation(ORIENTATION_AUTOMATIC); } break;