3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef _MULTI_FORM_H_
19 #define _MULTI_FORM_H_
24 #include "SafeMacros.h"
25 #include "AppConfig.h"
28 static const int LISTVIEW_ITEM_HEIGHT = 100;
30 using namespace Tizen::Base;
31 using namespace Tizen::Ui::Controls;
35 typedef MultiForm* (*MultiFormCreateProc)(void);
38 : public Tizen::Base::Object
43 SettingListData(String* name, int id)
48 ~SettingListData(void)
50 SAFE_DELETE(pItemName);
54 : public Tizen::Ui::Controls::Form
55 , public Tizen::Ui::IActionEventListener
56 , public Tizen::Ui::Controls::IFormBackEventListener
57 , public Tizen::Ui::IOrientationEventListener
58 , public Tizen::System::IDeviceEventListener
59 , public Tizen::Ui::IPropagatedKeyEventListener
63 virtual ~MultiForm(void);
65 static result RegisterAllScenes();
66 static result SceneRegister(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId, MultiFormCreateProc proc);
67 static MultiFormCreateProc GetFormProc(Tizen::Base::String formId);
68 result Construct(Tizen::Base::String resourceId);
69 void Deactivate(void);
71 virtual void OnForeground(void);
72 virtual void OnBackground(void);
73 virtual void OnLowMemory(void);
74 virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
75 virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
76 virtual void OnScreenOn(void);
77 virtual void OnScreenOff(void);
78 virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state);
79 virtual bool OnKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo);
80 virtual bool OnKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;}
81 virtual bool OnPreviewKeyPressed(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;}
82 virtual bool OnPreviewKeyReleased(Tizen::Ui::Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){return false;}
83 void ShowErrorMessagePopup(String filePath, String Class, const char* pMethod, result r, const char* pSrcfileName, int lineNo, String errorMsg = L"");
84 void ShowErrorMessagePopup(String title,unsigned int actionId, const char* pFormat, ...);
85 void ShowMessagePopup(const char* pMessage, unsigned int actionId);
86 void ShowMessagePopup(String title,String message, unsigned int actionId);
87 void ClearErrorPopup(void);
88 bool GetErrorPopupState(void) const;
89 bool IsProcessedEvent(void){return _isProcessedEvent;}
90 void ResetProcessedEvent(void){_isProcessedEvent = false;}
93 CONST_INT(ID_BUTTON_ERROR_POPUP_OK);
95 virtual result OnInitializing(void);
96 result Activate(void* pParam);
97 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
98 virtual void OnClientDeactivated(MultiForm* pForm, void* pParam);
99 virtual void OnDeactivate(void);
100 virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
102 result DrawBitmap(Tizen::Graphics::Rectangle rect, const Tizen::Graphics::Bitmap& bitmap, bool fit = true, bool clear = false);
104 Tizen::Graphics::Rectangle GetClientBounds(Tizen::Ui::Control& ctrl) const;
105 result SetHeaderText(const Tizen::Base::String& title);
106 result SetHeaderText(const char* pFormat, ...);
107 result SetHeaderSuffix(const char* pFormat, ...);
108 result SetHeaderItem(Tizen::Ui::Controls::ButtonPosition position, const Tizen::Base::String& title, int actionId);
109 result AddHeaderEventListener(Tizen::Ui::IActionEventListener* pListener);
111 result ShowFooter(bool show);
112 result ShowFooterItem(int index, bool show);
113 result SetFooterStyle(Tizen::Ui::Controls::FooterStyle style, int actionId, Tizen::Ui::IActionEventListener* pListener);
114 result AddFooterItem(const Tizen::Base::String& text, int actionId);
115 result SetFooterItem(int index, const Tizen::Base::String& text, int actionId);
116 result RemoveFooterItem(int index);
117 result SetStepInfo(int stepCount, int stepIndex, int prevIndex, int nextIndex);
118 result SetStepIndex(int index);
122 int GetTotalStep(void);
124 void FitControlBounds(Tizen::Ui::Control& src, Tizen::Ui::Control* pUpper, Tizen::Ui::Control* pLower, int topMargin, int bottomMargin, bool resize = false);
125 result SetControlText(Tizen::Ui::Controls::Label* pLabel, const char* pFormat, ...);
126 result SetControlText(Tizen::Ui::Controls::Button* pButton, const char* pFormat, ...);
127 result SetControlText(Tizen::Ui::Controls::EditArea* pEditArea, const char* pFormat, ...);
128 result SetControlText(Tizen::Ui::Controls::EditArea* pEditArea, const Tizen::Base::String& str);
129 result AppendControlText(Tizen::Ui::Controls::EditArea* pEditArea, const char* pFormat, ...);
130 result HideAndGetBounds(Tizen::Ui::Control* pCtrl, Tizen::Graphics::Rectangle& rect);
134 Tizen::Ui::Controls::Frame* _pFrame;
135 static Tizen::Base::Collection::HashMap* _pSceneProcMap;
138 bool _isProcessedEvent;
139 Tizen::Ui::Controls::Popup* _pErrorMessagePopup;
140 Tizen::Ui::Controls::Label* _pErrorMessagePopupLabel;
141 Tizen::Ui::Controls::Button* _pErrorMessagePopupBtn;
153 #endif // _MULTI_FORM_H_