sync with master
[apps/native/sample/QrCodeRecognizer.git] / project / src / TouchForm.cpp
1 //
2 // Tizen Native SDK
3 // Open Service Platform
4 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 // All rights reserved.
6 //
7 // This software contains confidential and proprietary information
8 // of Samsung Electronics Co., Ltd.
9 // The user of this software agrees not to disclose, disseminate or copy such
10 // Confidential Information and shall use the software only in accordance with
11 // the terms of the license agreement the user entered into with Samsung.
12 //
13
14 #include <FApp.h>
15 #include "TouchForm.h"
16
17 TouchForm::TouchForm(void)
18     : __pPanel(0)
19 {
20 }
21
22 TouchForm::~TouchForm(void)
23 {
24 }
25
26 bool
27 TouchForm::Initialize(void)
28 {
29     Construct(L"IDF_FORM");
30
31     return true;
32 }
33
34 result
35 TouchForm::OnInitializing(void)
36 {
37     result r = E_SUCCESS;
38     AddTouchEventListener(*this);
39
40     __pPanel = static_cast<PanelButton*>(GetControl("IDC_BUTTON_PANEL"));
41     return r;
42 }
43
44 result
45 TouchForm::OnTerminating(void)
46 {
47     result r = E_SUCCESS;
48     return r;
49 }
50
51 void
52 TouchForm::OnTouchLongPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
53 {
54 }
55
56 void
57 TouchForm::OnTouchMoved(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
58 {
59 }
60
61 void
62 TouchForm::OnTouchPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
63 {
64 }
65
66 void
67 TouchForm::OnTouchReleased(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
68 {
69     static int __clicked = 0;
70     if (3 <= __clicked)
71     {
72         if (__pPanel)
73         {
74             if (!__pPanel->GetShowState())
75             {
76                 __pPanel->SetEnabled(true);
77                 __pPanel->SetShowState(true);
78             }
79         }
80         __clicked = 0;
81     }
82     ++__clicked;
83 }
84
85 void
86 TouchForm::OnTouchDoublePressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
87 {
88 }
89
90 void
91 TouchForm::OnTouchFocusIn(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
92 {
93 }
94
95 void
96 TouchForm::OnTouchFocusOut(const Tizen::Ui::Control &source, const Tizen::Graphics::Point &currentPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
97 {
98 }
99
100 void
101 TouchForm::Activate(void)
102 {
103     this->SetShowState(true);
104     this->SetEnabled(true);
105     Tizen::Ui::Controls::Frame *pFrame = Tizen::App::Application::GetInstance()->GetAppFrame()->GetFrame();
106     pFrame->SetCurrentForm(*this);
107     this->RequestRedraw(true);
108     AddTouchEventListener(*this);
109 }
110
111 void
112 TouchForm::Deactivate(void)
113 {
114     this->SetEnabled(false);
115     this->SetShowState(false);
116     RemoveTouchEventListener(*this);
117 }
118
119 void
120 TouchForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
121 {
122     switch(requestId)
123     {
124     case TouchForm::REQUEST_ACTIVATE:
125     {
126         Activate();
127         break;
128     }
129     case TouchForm::REQUEST_DEACTIVATE:
130     {
131         Deactivate();
132         break;
133     }
134     default:
135         break;
136     }
137 }
138