modify sample code
authorChoongeun Hong <cheun.hong@samsung.com>
Wed, 20 Mar 2013 11:27:12 +0000 (20:27 +0900)
committerChoongeun Hong <cheun.hong@samsung.com>
Wed, 20 Mar 2013 11:27:12 +0000 (20:27 +0900)
Change-Id: I0916cbf80d98feea396faca862c175d5ffa7b881
Signed-off-by: Choongeun Hong <cheun.hong@samsung.com>
inc/FUiCtrlSplitPanel.h

index 7579803..6da20a3 100755 (executable)
@@ -55,47 +55,83 @@ class ISplitPanelEventListenerF;
 
 class SplitPanelSample
        : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::ISplitPanelEventListener
 {
 public:
+       SplitPanelSample(void)
+       : __pSplitPanel(null)
+       , __pFirstPanel(null)
+       , __pSecondPanel(null){}
+
        virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+
+private:
+       Tizen::Ui::Controls::SplitPanel* __pSplitPanel;
+       Tizen::Ui::Controls::Panel* __pFirstPanel;
+       Tizen::Ui::Controls::Panel* __pSecondPanel;
 };
  * @endcode
  *
  * @code
 // Sample code for SplitPanelSample.cpp
+#include <FGraphics.h>
+
 #include "SplitPanelSample.h"
 
+using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
-using namespace Tizen::Graphics;
+
+bool
+SplitPanelSample::Initialize(void)
+{
+       Construct(FORM_STYLE_NORMAL);
+       return true;
+}
 
 result
 SplitPanelSample::OnInitializing(void)
 {
        // Creates an instance of SplitPanel
-       SplitPanel* pSplitPanel = new (std::nothrow) SplitPanel();
-       pSplitPanel->Construct(Rectangle(0, 0, 800, 400),
+       __pSplitPanel = new (std::nothrow) SplitPanel();
+       __pSplitPanel->Construct(Rectangle(0, 0, 800, 400),
                        SPLIT_PANEL_DIVIDER_STYLE_MOVABLE, SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL);
 
        // Creates instances of Panel
-       Panel* pFirstPanel = new (std::nothrow) Panel();
-       pFirstPanel->Construct(Rectangle(0, 0, 400, 480));
+       __pFirstPanel = new (std::nothrow) Panel();
+       __pFirstPanel->Construct(Rectangle(0, 0, 400, 480));
 
-       Panel* pSecondPanel = new (std::nothrow) Panel();
-       pSecondPanel->Construct(Rectangle(0, 0, 400, 480));
+       __pSecondPanel = new (std::nothrow) Panel();
+       __pSecondPanel->Construct(Rectangle(0, 0, 400, 480));
 
        //Sets the divider position to the slit panel
-       pSplitPanel->SetDividerPosition(400);
+       __pSplitPanel->SetDividerPosition(400);
 
        //Sets panes to the split panel
-       pSplitPanel->SetPane(pFirstPanel, SPLIT_PANEL_PANE_ORDER_FIRST);
-       pSplitPanel->SetPane(pSecondPanel, SPLIT_PANEL_PANE_ORDER_SECOND);
+       __pSplitPanel->SetPane(__pFirstPanel, SPLIT_PANEL_PANE_ORDER_FIRST);
+       __pSplitPanel->SetPane(__pSecondPanel, SPLIT_PANEL_PANE_ORDER_SECOND);
 
        // Adds the split panel to the form
-       AddControl(*pSplitPanel);
+       AddControl(*__pSplitPanel);
 
        return E_SUCCESS;
 }
+
+ result
+ SplitPanelSample::OnTerminating(void)
+ {
+       // Sets null panes to the split panel
+        __pSplitPanel->SetPane(null, SPLIT_PANEL_PANE_ORDER_FIRST);
+        __pSplitPanel->SetPane(null, SPLIT_PANEL_PANE_ORDER_SECOND);
+
+       //Deallocates the control
+        __pFirstPanel->Destroy();
+        __pSecondPanel->Destroy();
+        return E_SUCCESS;
+ }
+
  * @endcode
  *
  */