2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (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.
19 * @file FUiCtrlFooter.h
20 * @brief This is the header file for the %Footer class.
22 * This header file contains the declarations of the %Footer class.
25 #ifndef _FUI_CTRL_FOOTER_H_
26 #define _FUI_CTRL_FOOTER_H_
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FBaseString.h>
31 #include <FGrpBitmap.h>
32 #include <FGrpColor.h>
33 #include <FGrpRectangle.h>
34 #include <FUiControl.h>
35 #include <FUiIActionEventListener.h>
36 #include <FUiCtrlButtonItem.h>
37 #include <FUiCtrlFooterItem.h>
38 #include <FUiCtrlForm.h>
41 namespace Tizen { namespace Ui { namespace Controls
47 * Defines the possible styles of a %Footer control.
53 FOOTER_STYLE_BUTTON_TEXT, /**< The text button style */
54 FOOTER_STYLE_BUTTON_ICON, /**< The icon button style */
55 FOOTER_STYLE_BUTTON_ICON_TEXT, /**< The icon and text button style */
56 FOOTER_STYLE_SEGMENTED_TEXT, /**< The text segmented style */
57 FOOTER_STYLE_SEGMENTED_ICON, /**< The icon segmented style */
58 FOOTER_STYLE_SEGMENTED_ICON_TEXT, /**< The icon and text segmented style */
59 FOOTER_STYLE_TAB /**< The tab style */
64 * @brief This class is an implementation of a %Footer control.
68 * The %Footer class displays a multi-purpose area at the bottom of the screen. It is used to switch between different application
69 * "views", or to host buttons for performing user-defined actions.
71 *For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_footer.htm">Footer</a>.
73 *The following examples demonstrate how to use the %Footer class.
74 * - Constructing a footer
75 * When creating a %Form, specify the FORM_STYLE_FOOTER parameter in the Form::Construct() method.
80 * TestForm::Initialize(void)
82 * Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
87 * Gets the footer with the GetFooter() method, and sets the footer style
91 * TestForm::Initialize(void)
93 * Footer* pFooter = GetFooter();
94 * pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
98 * - Adding items to the footer:
99 * Adds FooterItems or ButtonItems according to the footer style. The action ID registered in the Construct() method is notified
100 * when items are touched.
104 * TestForm::Initialize(void)
106 * FooterItem footerItem;
107 * footerItem.Construct(ID_FOOTER_ITEM);
108 * footerItem.SetText("FooterItem");
110 * pFooter->AddItem(footerItem);
112 * ButtonItem buttonItem;
113 * buttonItem.Construct(BUTTON_ITEM_STYLE_ICON, ID_HEADER_BUTTON);
114 * buttonItem.SetIcon(BUTTON_ITEM_STATUS_NORMAL, __pBitmap);
116 * pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItem);
121 * -Using the back button
122 * The image of back button is internally set by UI framework.
126 * TestForm::Initialize(void)
128 * pFooter->SetBackButton();
132 class _OSP_EXPORT_ Footer
133 : public Tizen::Ui::Control
137 * Adds the specified footer item.
141 * @return An error code
142 * @param[in] item The footer item to add
143 * @exception E_SUCCESS The method is successful.
144 * @exception E_MAX_EXCEEDED The number of items has exceeded the maximum limit.
145 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
146 * The specified item is not constructed.
147 * @exception E_SYSTEM A system error has occurred.
148 * @remarks The %Footer control does not throw any exception even though the same action ID is assigned to multiple items. @n
149 * However, the content of the specified item is copied to the %Footer control. @n
150 * Depending on the style of the %Footer control, several types of items can be added or inserted.
152 result AddItem(const FooterItem& item);
156 * Inserts the footer item at the specified index.
160 * @return An error code
161 * @param[in] itemIndex The index where the item must be inserted
162 * @param[in] item The footer item object to insert
163 * @exception E_SUCCESS The method is successful.
164 * @exception E_MAX_EXCEEDED The number of items has exceeded the maximum limit.
165 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
166 * The index is greater than or equal to the number of elements or less than @c 0.
167 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
168 * The specified item is not constructed.
169 * @exception E_SYSTEM A system error has occurred.
170 * @remarks The %Footer control does not throw any exception even though the same action ID is assigned to multiple items. @n
171 * However, the content of the specified item is copied to the %Footer control. @n
172 * Depending on the style of the %Footer control, several types of items can be added or inserted.
174 result InsertItemAt(int itemIndex, const FooterItem& item);
178 * Checks whether a button item is set at the specified position.
182 * @return @c true if the button item is set at the specified position, @n
184 * @param[in] position The position of the button item
185 * @exception E_SUCCESS The method is successful.
186 * @remarks The specific error code can be accessed using the GetLastResult() method.
188 bool IsButtonSet(ButtonPosition position) const;
192 * Checks whether the back button item is set.
196 * @return @c true if the back button item is set, @n
198 * @exception E_SUCCESS The method is successful.
199 * @remarks The specific error code can be accessed using the GetLastResult() method.
201 bool IsBackButtonSet(void) const;
205 * Checks whether the tab edit mode is enabled.
209 * @return @c true if the tab edit mode is set, @n
211 * @exception E_SUCCESS The method is successful.
213 bool IsTabEditModeEnabled(void) const;
217 * Gets the color of the button item for the specified state.
221 * @return The color of the button item, @n
222 * else RGBA (0,0,0,0) if an error occurs
223 * @param[in] status The status of the button item
224 * @exception E_SUCCESS The method is successful.
225 * @remarks The specific error code can be accessed using the GetLastResult() method.
226 * @see SetButtonColor()
228 Tizen::Graphics::Color GetButtonColor(ButtonItemStatus status) const;
232 * Gets the text color of the button item for the specified state.
236 * @return The text color of the button item, @n
237 * else RGBA (0,0,0,0) if an error occurs
238 * @param[in] status The status of the button item
239 * @exception E_SUCCESS The method is successful.
240 * @remarks The specific error code can be accessed using the GetLastResult() method.
241 * @see SetButtonTextColor()
243 Tizen::Graphics::Color GetButtonTextColor(ButtonItemStatus status) const;
247 * Gets the state of the specified button item.
251 * @return The state of the button item at the specified position
252 * @param[in] position The position of the button item
253 * @exception E_SUCCESS The method is successful.
254 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
255 * There is no button set at the specified position.
256 * @remarks The specific error code can be accessed using the GetLastResult() method.
258 ButtonItemStatus GetButtonStatus(ButtonPosition position) const;
262 * Gets the state of the back button.
266 * @return The state of the back button, @n
267 * else @c BUTTON_ITEM_STATUS_NORMAL if an error occurs.
268 * @exception E_SUCCESS The method is successful.
269 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
270 * The back button is not set.
271 * @remarks The specific error code can be accessed using the GetLastResult() method.
273 ButtonItemStatus GetBackButtonStatus(void) const;
277 * Gets the color of the footer item for the specified item state.
281 * @return The color of the item, @n
282 * else RGBA (0,0,0,0) if an error occurs
283 * @param[in] status The item status
284 * @exception E_SUCCESS The method is successful.
285 * @remarks The specific error code can be accessed using the GetLastResult() method.
286 * @see SetItemColor()
288 Tizen::Graphics::Color GetItemColor(FooterItemStatus status) const;
292 * Gets the number of footer items.
296 * @return The number of footer items, @n
297 * else @c -1 if an error occurs
298 * @exception E_SUCCESS The method is successful.
299 * @remarks The specific error code can be accessed using the GetLastResult() method.
301 int GetItemCount(void) const;
305 * Gets the state of the specified footer item.
309 * @return An error code
310 * @param[in] itemIndex The index of the item
311 * @param[out] status The state of the item at the specified index
312 * @exception E_SUCCESS The method is successful.
313 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
314 * The index is greater than or equal to the number of elements or less than zero.
316 result GetItemStatus(int itemIndex, FooterItemStatus& status) const;
320 * Gets the text color of the footer item for the specified item state.
324 * @return The text color of the item, @n
325 * else RGBA (0,0,0,0) if an error occurs
326 * @param[in] status The item status
327 * @exception E_SUCCESS The method is successful.
328 * @remarks The specific error code can be accessed using the GetLastResult() method.
330 Tizen::Graphics::Color GetItemTextColor(FooterItemStatus status) const;
334 * Gets the style of the %Footer control.
338 * @return The footer style, @n
339 * else @c FOOTER_STYLE_BUTTON_TEXT if an error occurs
340 * @exception E_SUCCESS The method is successful.
341 * @remarks The specific error code can be accessed using the GetLastResult() method.
343 FooterStyle GetStyle(void) const;
347 * Gets the index of the currently selected item.
351 * @return The selected item index,@n
352 * else @c -1 if an error occurs
353 * @exception E_SUCCESS The method is successful.
354 * @exception E_UNSUPPORTED_OPERATION The operation is not supported when the style of the %Footer control is @c FOOTER_STYLE_BUTTON_TEXT, @n
355 * @c FOOTER_STYLE_BUTTON_ICON or @c FOOTER_STYLE_BUTTON_ICON_TEXT.
356 * @remarks The specific error code can be accessed using the GetLastResult() method.
358 int GetSelectedItemIndex(void) const;
362 * Gets the color of the footer.
366 * @return The color, @n
367 * else RGBA (0,0,0,0) if an error occurs
368 * @exception E_SUCCESS The method is successful.
369 * @remarks The specific error code can be accessed using the GetLastResult() method.
371 Tizen::Graphics::Color GetColor(void) const;
375 * Removes all the button items.
379 * @return An error code
380 * @exception E_SUCCESS The method is successful.
381 * @exception E_SYSTEM A system error has occurred.
382 * @remarks The back button will be also removed.
384 result RemoveAllButtons(void);
388 * Removes the button item at the specified position.
392 * @return An error code
393 * @param[in] position The position of the button item to remove
394 * @exception E_SUCCESS The method is successful.
395 * @exception E_SYSTEM A system error has occurred.
396 * @remarks If no button item is set at the specified position, the method will return @c E_SUCCESS.
398 result RemoveButtonAt(ButtonPosition position);
402 * Removes the back button item.
406 * @return An error code
407 * @exception E_SUCCESS The method is successful.
408 * @exception E_SYSTEM A system error has occurred.
409 * @remarks If the back button item is not set, the method will return @c E_SUCCESS.
411 result RemoveBackButton(void);
415 * Removes all the footer items.
419 * @return An error code
420 * @exception E_SUCCESS The method is successful.
421 * @exception E_SYSTEM A system error has occurred.
422 * @remarks The left, right, and back button items are not removed.
424 result RemoveAllItems(void);
428 * Removes the item at the specified index.
432 * @return An error code
433 * @param[in] itemIndex The index of the item to remove
434 * @exception E_SUCCESS The method is successful.
435 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
436 * The index is greater than or equal to the number of elements or less than @c 0.
437 * @exception E_SYSTEM A system error has occurred.
439 result RemoveItemAt(int itemIndex);
443 * Sets the background bitmap image.
447 * @return An error code
448 * @param[in] pBitmap The background image
449 * @exception E_SUCCESS The method is successful.
450 * @exception E_SYSTEM A system error has occurred.
452 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
456 * Sets the button item at the specified position.
460 * @return An error code
461 * @param[in] position The position at which to set the specified button item.
462 * @param[in] button The button item to set
463 * @exception E_SUCCESS The method is successful.
464 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
465 * The specified item is not constructed.
466 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
467 * There are more than 2 footer items.
468 * @exception E_UNSUPPORTED_OPERATION The operation is not supported when the style of the %Footer control is @c FOOTER_STYLE_TAB.
469 * @exception E_SYSTEM A system error has occurred.
470 * @remarks If there is an existing button item at the specified position, it is replaced with the new item.@n
471 * However, the contents of the specified item are copied to the %Footer control.
473 result SetButton(ButtonPosition position, const ButtonItem& button);
477 * Sets the button item color for the specified state.
481 * @return An error code
482 * @param[in] status The status of the button item
483 * @param[in] color The button item color to set
484 * @exception E_SUCCESS The method is successful.
485 * @exception E_SYSTEM A system error has occurred.
486 * @see GetButtonColor()
488 result SetButtonColor(ButtonItemStatus status, const Tizen::Graphics::Color& color);
492 * Enables or disables the button item at the specified position.
496 * @return An error code
497 * @param[in] position The button item position
498 * @param[in] enable Set to @c true to enable the specified button item, @n
500 * @exception E_SUCCESS The method is successful.
501 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
502 * There is no button set at the specified position.
503 * @exception E_SYSTEM A system error has occurred.
505 result SetButtonEnabled(ButtonPosition position, bool enable);
509 * Enables or disables the back button.
513 * @return An error code
514 * @param[in] enable Set to @c true to enable the back button, @n
516 * @exception E_SUCCESS The method is successful.
517 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
518 * The back button item is not set.
519 * @exception E_SYSTEM A system error has occurred.
521 result SetBackButtonEnabled(bool enable);
525 * Sets the button item text color for the specified state.
529 * @return An error code
530 * @param[in] status The status of the button item
531 * @param[in] color The button item text color to set
532 * @exception E_SUCCESS The method is successful.
533 * @exception E_SYSTEM A system error has occurred.
534 * @see GetButtonTextColor()
536 result SetButtonTextColor(ButtonItemStatus status, const Tizen::Graphics::Color& color);
539 * Sets the badge icon of the specified ButtonItem.
543 * @return An error code
544 * @param[in] position The button item position
545 * @param[in] pBadgeIcon The bitmap for the icon
546 * @exception E_SUCCESS The method is successful.
547 * @exception E_UNSUPPORTED_OPERATION This operation is not supported. @n
548 * The operation is not supported when the style of the %Footer control is @c FOOTER_STYLE_TAB.
550 result SetButtonBadgeIcon(ButtonPosition position, const Tizen::Graphics::Bitmap* pBadgeIcon);
554 * Sets the numbered badge icon of the specified ButtonItem.
558 * @return An error code
559 * @param[in] position The button item position
560 * @param[in] number The number value that should be displayed as the badge icon
561 * @exception E_SUCCESS The method is successful.
562 * @exception E_INVALID_ARG The specified @c number must be in the range defined by @c 0 and @c 99999.
563 * @exception E_UNSUPPORTED_OPERATION This operation is not supported. @n
564 * The operation is not supported when the style of the %Footer control is @c FOOTER_STYLE_TAB.
565 * @remarks To remove the numbered badge icon from an item, pass @c 0 as the value of @c number.
567 result SetButtonNumberedBadgeIcon(ButtonPosition position, int number);
571 * Sets the back button.
575 * @return An error code
576 * @exception E_SUCCESS The method is successful.
577 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
578 * There are more than 2 footer items.
579 * @exception E_UNSUPPORTED_OPERATION This operation is not supported. @n
580 * The operation is not supported when the style of the %Footer control is @c FOOTER_STYLE_TAB. @n
581 * This device does not support the software back button.
582 * @exception E_SYSTEM A system error has occurred.
583 * @remarks When the back button is pressed, OnFormBackRequested() of IFormBackEventListener is called. @n
584 * If the right button is already set, then the button is replaced with the back button.
585 * @see Tizen::Ui::Controls::IFormBackEventListener
587 result SetBackButton(void);
591 * Sets the content of the footer item at the specified index.
595 * @return An error code
596 * @param[in] itemIndex The index at which to set the specified item
597 * @param[in] item The item
598 * @exception E_SUCCESS The method is successful.
599 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
600 * The index is greater than or equal to the number of elements or less than @c 0.
601 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
602 * The specified item is not constructed.
603 * @exception E_SYSTEM A system error has occurred.
604 * @remarks The %Footer control does not throw any exception even though the same action ID is assigned to multiple items. @n
605 * However, the content of the specified item is copied to the %Footer control.
607 result SetItemAt(int itemIndex, const FooterItem& item);
611 * Sets the item color for the specified state.
615 * @return An error code
616 * @param[in] status The item status
617 * @param[in] color The item color to set
618 * @exception E_SUCCESS The method is successful.
619 * @exception E_SYSTEM A system error has occurred.
620 * @see GetItemColor()
622 result SetItemColor(FooterItemStatus status, const Tizen::Graphics::Color& color);
626 * Sets the item state at the specified index in the footer.
630 * @return An error code
631 * @param[in] itemIndex The index of the item
632 * @param[in] enable Set to @c true to enable the item state, @n
634 * @exception E_SUCCESS The method is successful.
635 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
636 * The index is greater than or equal to the number of elements or less than zero.
637 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
638 * The specified item is currently selected.
639 * @exception E_SYSTEM A system error has occurred.
641 result SetItemEnabled(int itemIndex, bool enable);
645 * Sets the badge icon of the specified tab style footer item.
649 * @return An error code
650 * @param[in] itemIndex The index of the item to set the badge icon
651 * @param[in] pBadgeIcon The bitmap for the icon
652 * @exception E_SUCCESS The method is successful.
653 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
654 * The index is greater than or equal to the number of elements or less than @c 0.
655 * @exception E_SYSTEM A system error has occurred.
657 result SetItemBadgeIcon(int itemIndex, const Tizen::Graphics::Bitmap* pBadgeIcon);
661 * Sets the numbered badge icon of the specified footer item.
665 * @return An error code
666 * @param[in] itemIndex The item index
667 * @param[in] number The number value that must be displayed as the badge icon
668 * @exception E_SUCCESS The method is successful.
669 * @exception E_INVALID_ARG The specified @c number must be in the range defined by @c 0 and @c 99999.
670 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
671 * The index is greater than or equal to the number of elements or less than @c 0.
672 * @exception E_SYSTEM A system error has occurred.
673 * @remarks To remove the numbered badge icon from an item, pass @c 0 as the value of @c number.
675 result SetItemNumberedBadgeIcon(int itemIndex, int number);
679 * Sets the item text color for the specified state.
683 * @return An error code
684 * @param[in] status The item status
685 * @param[in] color The item text color to set
686 * @exception E_SUCCESS The method is successful.
687 * @exception E_SYSTEM A system error has occurred.
689 result SetItemTextColor(FooterItemStatus status, const Tizen::Graphics::Color& color);
693 * Selects the item at the specified index.
697 * @return An error code
698 * @param[in] itemIndex The index of the item to select
699 * @exception E_SUCCESS The method is successful.
700 * @exception E_OUT_OF_RANGE The specified index is out of the range of the data structure. @n
701 * The specified index is either greater than or equal to the number of items or is less than zero.
702 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
703 * The item at the specified index is disabled.
704 * @exception E_UNSUPPORTED_OPERATION The operation is not supported if the %Footer control style is @c FOOTER_STYLE_BUTTON_TEXT, @n
705 * @c FOOTER_STYLE_BUTTON_ICON or @c FOOTER_STYLE_BUTTON_ICON_TEXT.
706 * @exception E_SYSTEM A system error has occurred.
708 result SetItemSelected(int itemIndex);
712 * Sets the color of the footer.
716 * @return An error code
717 * @param[in] color The footer color to set
718 * @exception E_SUCCESS The method is successful.
720 result SetColor(const Tizen::Graphics::Color& color);
724 * Sets the style of the footer.
728 * @return An error code
729 * @param[in] style The footer style to set
730 * @exception E_SUCCESS The method is successful.
731 * @exception E_SYSTEM A system error has occurred.
732 * @remarks All items and buttons will be removed if the style is changed.
734 result SetStyle(FooterStyle style);
738 * Enables or disables the tab edit mode.
742 * @return An error code
743 * @param[in] enable Set to @c true to enable the edit mode, @n
745 * @exception E_SUCCESS The method is successful.
746 * @exception E_UNSUPPORTED_OPERATION The operation is supported when the style of the %Footer control style is @c FOOTER_STYLE_TAB.
748 result SetTabEditModeEnabled(bool enable);
752 * Adds an action event listener instance.
753 * OnActionPerformed() of the added listener is called when the user selects an item.
757 * @param[in] listener The event listener to add
758 * @remarks When the user collapses the tab style %Footer control which is in the expanded mode by pressing the more button, OnActionPerformed() is called for the currently selected tab item.
760 void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
764 * Removes an action event listener instance.
765 * The removed listener cannot listen to events when they are fired.
769 * @param[in] listener The event listener to remove
771 void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
775 * Gets the position and size of the specified button item.
779 * @return The position and size of the button item at the specified position.
780 * @param[in] position The position of the button item
781 * @exception E_SUCCESS The method is successful.
782 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
783 * There is no button set at the specified position.
784 * @remarks The specific error code can be accessed using the GetLastResult() method.
786 Tizen::Graphics::Rectangle GetButtonBounds(ButtonPosition position) const;
789 * Gets the position and size of the specified button item.
793 * @return The position and size of the button item at the specified position.
794 * @param[in] position The position of the button item
795 * @exception E_SUCCESS The method is successful.
796 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
797 * There is no button set at the specified position.
798 * @remarks The specific error code can be accessed using the GetLastResult() method.
800 Tizen::Graphics::FloatRectangle GetButtonBoundsF(ButtonPosition position) const;
805 //This method is for internal use only. Using this method can cause behavioral, security-related,
806 //and consistency-related issues in the application.
808 // This is the default constructor for this class.
815 //This method is for internal use only. Using this method can cause behavioral, security-related,
816 //and consistency-related issues in the application.
818 // This is the destructor for this class.
821 virtual ~Footer(void);
826 //This method is for internal use only. Using this method can cause behavioral, security-related,
827 //and consistency-related issues in the application.
829 // Initializes this instance of Footer with the specified parameter.
832 // @return An error code
833 // @exception E_SUCCESS The method is successful.
834 // @exception E_SYSTEM A system error has occurred.
836 result Construct(void);
838 Footer(const Footer& rhs);
839 Footer& operator =(const Footer& rhs);
842 friend class _FormImpl;
843 friend class _FooterImpl;
847 }}} // Tizen::Ui::Controls
849 #endif // _FUI_CTRL_FOOTER_H_