sync with master
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 19 Mar 2013 07:04:21 +0000 (16:04 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 19 Mar 2013 07:04:21 +0000 (16:04 +0900)
project/inc/MainForm.h
project/manifest.xml
project/src/MainForm.cpp

index 8e1182e..31d7445 100644 (file)
@@ -30,6 +30,7 @@ public:
        virtual ~MainForm(void);
 
        result Initialize(int panelId);
+       result CreateImagePanel(void);
 
        virtual result OnInitializing(void);
        virtual result OnTerminating(void);
index bba9580..7106a86 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
     <Id>$(manifestAppId)</Id>
-    <Version>1.0.0</Version>
+    <Version>2.0.0</Version>
     <Type>C++App</Type>
     <Author/>
     <Apps>
-        <ApiVersion>2.0</ApiVersion>
+        <ApiVersion>2.1</ApiVersion>
         <Privileges/>
         <UiApp Main="True" MenuIconVisible="True" Name="$(projectName)">
             <UiScalability BaseScreenSize="Normal" CoordinateSystem="Logical" LogicalCoordinate="720"/>
index 0837e08..bd2dca6 100644 (file)
@@ -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;