Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / partner / cpp / Sample / Tizen C++ / FriendFinder / FriendFinder / project / inc / MainForm.h
1 //\r
2 // Open Service Platform\r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
4 //\r
5 // Licensed under the Flora License, Version 1.0 (the License);\r
6 // you may not use this file except in compliance with the License.\r
7 // You may obtain a copy of the License at\r
8 //\r
9 //     http://www.tizenopensource.org/license\r
10 //\r
11 // Unless required by applicable law or agreed to in writing, software\r
12 // distributed under the License is distributed on an AS IS BASIS,\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 // See the License for the specific language governing permissions and\r
15 // limitations under the License.\r
16 //\r
17 #ifndef _MAIN_FORM_H_\r
18 #define _MAIN_FORM_H_\r
19 \r
20 #include <FBase.h>\r
21 #include <FUi.h>\r
22 #include "ConnectionManager.h"\r
23 \r
24 class ProfileForm;\r
25 class FriendListForm;\r
26 \r
27 #define FRIEND_FINDER_IMAGE_DIR             L"data/Image"\r
28 #define FRIEND_FINDER_USER_INFO_PATH        L"data/FriendFinderInfo.txt"\r
29 #define FRIEND_FINDER_DEVICE_NAME_PREFIX    L"FriendFinder_"\r
30 \r
31 typedef enum\r
32 {\r
33     FORM_ID_PROFILE_FORM,\r
34     FORM_ID_FRIEND_LIST_FORM\r
35 }FriendFinderFormId;\r
36 \r
37 class MainForm :\r
38     public Osp::Ui::Controls::Form,\r
39     public Osp::Ui::IActionEventListener,\r
40     public Osp::Ui::ITouchEventListener\r
41 {\r
42 \r
43 public:\r
44     MainForm(void);\r
45     virtual ~MainForm(void);\r
46 \r
47     bool Initialize(void);\r
48 \r
49 public:\r
50     // from Form\r
51     virtual result OnInitializing(void);\r
52 \r
53     // from IActionEventListener\r
54     virtual void OnActionPerformed(const Osp::Ui::Control& source, int actionId);\r
55 \r
56     // from ITouchEventListener\r
57     virtual void OnTouchPressed (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo);\r
58     virtual void OnTouchDoublePressed (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo){}\r
59     virtual void OnTouchFocusIn (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo){}\r
60     virtual void OnTouchFocusOut (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo){}\r
61     virtual void OnTouchLongPressed (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo){}\r
62     virtual void OnTouchMoved (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo){}\r
63     virtual void OnTouchReleased (const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo &touchInfo){}\r
64 \r
65 public:\r
66     void ShowMainForm(FriendFinderFormId formId, Osp::Base::Object* pData);\r
67     void ShowFriendProfile(const Osp::Base::String& userName, const Osp::Base::String& imagePath, const Osp::Base::String& deviceName);\r
68     void ClearFriendProfile(void);\r
69     void ShowRequestPopup(const Osp::Base::String& targetName);\r
70     void CloseRequestPopup(void);\r
71     void ShowConnectingPopup(const Osp::Base::String& targetName);\r
72     void CloseConnectingPopup(void);\r
73     void UpdateProgressBar(int progress);\r
74     void EnableCancelButton(void);\r
75     void DisableCancelButton(void);\r
76     void ShowTimeoutMessageBox(const Osp::Base::String& title, const Osp::Base::String& text, unsigned long timeout);\r
77     void ShowNoticePopup(const Osp::Base::String& title, const Osp::Base::String& description);\r
78     void CloseNoticePopup(void);\r
79 \r
80 private:\r
81     void ShowSubForm(FriendFinderFormId formId);\r
82 \r
83 private:\r
84     static const int ID_BUTTON_ACCEPT_CONNECTION = 101;\r
85     static const int ID_BUTTON_REJECT_CONNECTION = 102;\r
86     static const int ID_BUTTON_CANCEL_CONNECTION = 103;\r
87     static const int ID_BUTTON_NOTICE_POPUP_CLOSE = 104;\r
88     static const int ID_OPTION_FIND_FRIEND = 105;\r
89     static const int ID_OPTION_PROFILE = 106;\r
90 \r
91     Osp::Ui::Controls::Panel* __pProfilePanel;\r
92     Osp::Ui::Controls::Label* __pFriendProfileLabel;\r
93     Osp::Ui::Controls::Label* __pConnectionStatusLabel;\r
94 \r
95     Osp::Ui::Controls::Popup* __pRequestPopup;\r
96 \r
97     Osp::Ui::Controls::Popup* __pConnectingPopup;\r
98     Osp::Ui::Controls::Button* __pConnectingCancelButton;\r
99     Osp::Ui::Controls::Progress* __pConnectingProgress;\r
100 \r
101     Osp::Ui::Controls::Popup* __pNoticePopup;\r
102 \r
103     ProfileForm* __pProfileForm;\r
104     FriendListForm* __pFriendListForm;\r
105     ConnectionManager __connManager;\r
106 \r
107     Osp::Base::String __friendImagePath;\r
108 };\r
109 \r
110 #endif  //_MAIN_FORM_H_\r