2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.
149 * - The %Footer control does not throw any exception even though the same action ID is assigned to multiple items. @n
150 * However, the content of the specified item is copied to the %Footer control.
151 * - Depending on the style of the %Footer control, several types of items can be added or inserted.
153 result AddItem(const FooterItem& item);
157 * Inserts the footer item at the specified index.
161 * @return An error code
162 * @param[in] itemIndex The index where the item must be inserted
163 * @param[in] item The footer item object to insert
164 * @exception E_SUCCESS The method is successful.
165 * @exception E_MAX_EXCEEDED The number of items has exceeded the maximum limit.
166 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
167 * The index is greater than or equal to the number of elements or less than @c 0.
168 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
169 * The specified item is not constructed.
170 * @exception E_SYSTEM A system error has occurred.
172 * - The %Footer control does not throw any exception even though the same action ID is assigned to multiple items. @n
173 * However, the content of the specified item is copied to the %Footer control.
174 * - Depending on the style of the %Footer control, several types of items can be added or inserted.
176 result InsertItemAt(int itemIndex, const FooterItem& item);
180 * Checks whether a button item is set at the specified position.
184 * @return @c true if the button item is set at the specified position, @n
186 * @param[in] position The position of the button item
187 * @exception E_SUCCESS The method is successful.
188 * @remarks The specific error code can be accessed using the GetLastResult() method.
190 bool IsButtonSet(ButtonPosition position) const;
194 * Checks whether the back button item is set.
198 * @return @c true if the back button item is set, @n
200 * @exception E_SUCCESS The method is successful.
201 * @remarks The specific error code can be accessed using the GetLastResult() method.
203 bool IsBackButtonSet(void) const;
207 * Checks whether the tab edit mode is enabled.
211 * @return @c true if the tab edit mode is set, @n
213 * @exception E_SUCCESS The method is successful.
215 bool IsTabEditModeEnabled(void) const;
219 * Gets the color of the button item for the specified state.
223 * @return The color of the button item, @n
224 * else RGBA (0,0,0,0) if an error occurs
225 * @param[in] status The status of the button item
226 * @exception E_SUCCESS The method is successful.
227 * @remarks The specific error code can be accessed using the GetLastResult() method.
228 * @see SetButtonColor()
230 Tizen::Graphics::Color GetButtonColor(ButtonItemStatus status) const;
234 * Gets the text color of the button item for the specified state.
238 * @return The text color of the button item, @n
239 * else RGBA (0,0,0,0) if an error occurs
240 * @param[in] status The status of the button item
241 * @exception E_SUCCESS The method is successful.
242 * @remarks The specific error code can be accessed using the GetLastResult() method.
243 * @see SetButtonTextColor()
245 Tizen::Graphics::Color GetButtonTextColor(ButtonItemStatus status) const;
249 * Gets the state of the specified button item.
253 * @return The state of the button item at the specified position
254 * @param[in] position The position of the button item
255 * @exception E_SUCCESS The method is successful.
256 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
257 * There is no button set at the specified position.
258 * @remarks The specific error code can be accessed using the GetLastResult() method.
260 ButtonItemStatus GetButtonStatus(ButtonPosition position) const;
264 * Gets the state of the back button.
268 * @return The state of the back button, @n
269 * else @c BUTTON_ITEM_STATUS_NORMAL if an error occurs.
270 * @exception E_SUCCESS The method is successful.
271 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
272 * The back button is not set.
273 * @remarks The specific error code can be accessed using the GetLastResult() method.
275 ButtonItemStatus GetBackButtonStatus(void) const;
279 * Gets the color of the footer item for the specified item state.
283 * @return The color of the item, @n
284 * else RGBA (0,0,0,0) if an error occurs
285 * @param[in] status The item status
286 * @exception E_SUCCESS The method is successful.
287 * @remarks The specific error code can be accessed using the GetLastResult() method.
288 * @see SetItemColor()
290 Tizen::Graphics::Color GetItemColor(FooterItemStatus status) const;
294 * Gets the number of footer items.
298 * @return The number of footer items, @n
299 * else @c -1 if an error occurs
300 * @exception E_SUCCESS The method is successful.
301 * @remarks The specific error code can be accessed using the GetLastResult() method.
303 int GetItemCount(void) const;
307 * Gets the state of the specified footer item.
311 * @return An error code
312 * @param[in] itemIndex The index of the item
313 * @param[out] status The state of the item at the specified index
314 * @exception E_SUCCESS The method is successful.
315 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
316 * The index is greater than or equal to the number of elements or less than zero.
318 result GetItemStatus(int itemIndex, FooterItemStatus& status) const;
322 * Gets the text color of the footer item for the specified item state.
326 * @return The text color of the item, @n
327 * else RGBA (0,0,0,0) if an error occurs
328 * @param[in] status The item status
329 * @exception E_SUCCESS The method is successful.
330 * @remarks The specific error code can be accessed using the GetLastResult() method.
332 Tizen::Graphics::Color GetItemTextColor(FooterItemStatus status) const;
336 * Gets the style of the %Footer control.
340 * @return The footer style, @n
341 * else @c FOOTER_STYLE_BUTTON_TEXT if an error occurs
342 * @exception E_SUCCESS The method is successful.
343 * @remarks The specific error code can be accessed using the GetLastResult() method.
345 FooterStyle GetStyle(void) const;
349 * Gets the index of the currently selected item.
353 * @return The selected item index,@n
354 * else @c -1 if an error occurs
355 * @exception E_SUCCESS The method is successful.
356 * @exception E_UNSUPPORTED_OPERATION The operation is not supported when the style of the %Footer control is
357 * ::FOOTER_STYLE_BUTTON_TEXT, ::FOOTER_STYLE_BUTTON_ICON
358 * or ::FOOTER_STYLE_BUTTON_ICON_TEXT.
359 * @remarks The specific error code can be accessed using the GetLastResult() method.
361 int GetSelectedItemIndex(void) const;
365 * Gets the color of the footer.
369 * @return The color, @n
370 * else RGBA (0,0,0,0) if an error occurs
371 * @exception E_SUCCESS The method is successful.
372 * @remarks The specific error code can be accessed using the GetLastResult() method.
374 Tizen::Graphics::Color GetColor(void) const;
378 * Removes all the button items.
382 * @return An error code
383 * @exception E_SUCCESS The method is successful.
384 * @exception E_SYSTEM A system error has occurred.
385 * @remarks The back button will be also removed.
387 result RemoveAllButtons(void);
391 * Removes the button item at the specified position.
395 * @return An error code
396 * @param[in] position The position of the button item to remove
397 * @exception E_SUCCESS The method is successful.
398 * @exception E_SYSTEM A system error has occurred.
399 * @remarks If no button item is set at the specified position, the method will return @c E_SUCCESS.
401 result RemoveButtonAt(ButtonPosition position);
405 * Removes the back button item.
409 * @return An error code
410 * @exception E_SUCCESS The method is successful.
411 * @exception E_SYSTEM A system error has occurred.
412 * @remarks If the back button item is not set, the method will return @c E_SUCCESS.
414 result RemoveBackButton(void);
418 * Removes all the footer items.
422 * @return An error code
423 * @exception E_SUCCESS The method is successful.
424 * @exception E_SYSTEM A system error has occurred.
425 * @remarks The left, right, and back button items are not removed.
427 result RemoveAllItems(void);
431 * Removes the item at the specified index.
435 * @return An error code
436 * @param[in] itemIndex The index of the item to remove
437 * @exception E_SUCCESS The method is successful.
438 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
439 * The index is greater than or equal to the number of elements or less than @c 0.
440 * @exception E_SYSTEM A system error has occurred.
442 result RemoveItemAt(int itemIndex);
446 * Sets the background bitmap image.
450 * @return An error code
451 * @param[in] pBitmap The background image
452 * @exception E_SUCCESS The method is successful.
453 * @exception E_SYSTEM A system error has occurred.
455 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
459 * Sets the button item at the specified position.
463 * @return An error code
464 * @param[in] position The position at which to set the specified button item.
465 * @param[in] button The button item to set
466 * @exception E_SUCCESS The method is successful.
467 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
468 * The specified item is not constructed.
469 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
470 * There are more than 2 footer items.
471 * @exception E_UNSUPPORTED_OPERATION The operation is not supported when the style of the %Footer control is ::FOOTER_STYLE_TAB.
472 * @exception E_SYSTEM A system error has occurred.
473 * @remarks If there is an existing button item at the specified position, it is replaced with the new item.
474 * However, the contents of the specified item are copied to the %Footer control.
476 result SetButton(ButtonPosition position, const ButtonItem& button);
480 * Sets the button item color for the specified state.
484 * @return An error code
485 * @param[in] status The status of the button item
486 * @param[in] color The button item color to set
487 * @exception E_SUCCESS The method is successful.
488 * @exception E_SYSTEM A system error has occurred.
489 * @see GetButtonColor()
491 result SetButtonColor(ButtonItemStatus status, const Tizen::Graphics::Color& color);
495 * Enables or disables the button item at the specified position.
499 * @return An error code
500 * @param[in] position The button item position
501 * @param[in] enable Set to @c true to enable the specified button item, @n
503 * @exception E_SUCCESS The method is successful.
504 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
505 * There is no button set at the specified position.
506 * @exception E_SYSTEM A system error has occurred.
508 result SetButtonEnabled(ButtonPosition position, bool enable);
512 * Enables or disables the back button.
516 * @return An error code
517 * @param[in] enable Set to @c true to enable the back button, @n
519 * @exception E_SUCCESS The method is successful.
520 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
521 * The back button item is not set.
522 * @exception E_SYSTEM A system error has occurred.
524 result SetBackButtonEnabled(bool enable);
528 * Sets the button item text color for the specified state.
532 * @return An error code
533 * @param[in] status The status of the button item
534 * @param[in] color The button item text color to set
535 * @exception E_SUCCESS The method is successful.
536 * @exception E_SYSTEM A system error has occurred.
537 * @see GetButtonTextColor()
539 result SetButtonTextColor(ButtonItemStatus status, const Tizen::Graphics::Color& color);
542 * Sets the badge icon of the specified ButtonItem.
546 * @return An error code
547 * @param[in] position The button item position
548 * @param[in] pBadgeIcon The bitmap for the icon
549 * @exception E_SUCCESS The method is successful.
550 * @exception E_UNSUPPORTED_OPERATION This operation is not supported. @n
551 * The operation is not supported when the style of the %Footer control is ::FOOTER_STYLE_TAB.
553 result SetButtonBadgeIcon(ButtonPosition position, const Tizen::Graphics::Bitmap* pBadgeIcon);
557 * Sets the numbered badge icon of the specified ButtonItem.
561 * @return An error code
562 * @param[in] position The button item position
563 * @param[in] number The number value that should be displayed as the badge icon
564 * @exception E_SUCCESS The method is successful.
565 * @exception E_INVALID_ARG The specified @c number must be in the range defined by @c 0 and @c 99999.
566 * @exception E_UNSUPPORTED_OPERATION This operation is not supported. @n
567 * The operation is not supported when the style of the %Footer control is ::FOOTER_STYLE_TAB.
568 * @remarks To remove the numbered badge icon from an item, pass @c 0 as the value of @c number.
570 result SetButtonNumberedBadgeIcon(ButtonPosition position, int number);
574 * Sets the back button.
578 * @return An error code
579 * @exception E_SUCCESS The method is successful.
580 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
581 * There are more than 2 footer items.
582 * @exception E_UNSUPPORTED_OPERATION This operation is not supported. @n
583 * The operation is not supported when the style of the %Footer control is ::FOOTER_STYLE_TAB. @n
584 * This device does not support the software back button.
585 * @exception E_SYSTEM A system error has occurred.
587 * - When the back button is pressed, OnFormBackRequested() of IFormBackEventListener is called.
588 * - If the right button is already set, then the button is replaced with the back button.
589 * @see Tizen::Ui::Controls::IFormBackEventListener
591 result SetBackButton(void);
595 * Sets the content of the footer item at the specified index.
599 * @return An error code
600 * @param[in] itemIndex The index at which to set the specified item
601 * @param[in] item The item
602 * @exception E_SUCCESS The method is successful.
603 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
604 * The index is greater than or equal to the number of elements or less than @c 0.
605 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
606 * The specified item is not constructed.
607 * @exception E_SYSTEM A system error has occurred.
608 * @remarks The %Footer control does not throw any exception even though the same action ID is assigned to multiple items. @n
609 * However, the content of the specified item is copied to the %Footer control.
611 result SetItemAt(int itemIndex, const FooterItem& item);
615 * Sets the item color for the specified state.
619 * @return An error code
620 * @param[in] status The item status
621 * @param[in] color The item color to set
622 * @exception E_SUCCESS The method is successful.
623 * @exception E_SYSTEM A system error has occurred.
624 * @see GetItemColor()
626 result SetItemColor(FooterItemStatus status, const Tizen::Graphics::Color& color);
630 * Sets the item state at the specified index in the footer.
634 * @return An error code
635 * @param[in] itemIndex The index of the item
636 * @param[in] enable Set to @c true to enable the item state, @n
638 * @exception E_SUCCESS The method is successful.
639 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
640 * The index is greater than or equal to the number of elements or less than zero.
641 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
642 * The specified item is currently selected.
643 * @exception E_SYSTEM A system error has occurred.
645 result SetItemEnabled(int itemIndex, bool enable);
649 * Sets the badge icon of the specified tab style footer item.
653 * @return An error code
654 * @param[in] itemIndex The index of the item to set the badge icon
655 * @param[in] pBadgeIcon The bitmap for the icon
656 * @exception E_SUCCESS The method is successful.
657 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
658 * The index is greater than or equal to the number of elements or less than @c 0.
659 * @exception E_SYSTEM A system error has occurred.
661 result SetItemBadgeIcon(int itemIndex, const Tizen::Graphics::Bitmap* pBadgeIcon);
665 * Sets the numbered badge icon of the specified footer item.
669 * @return An error code
670 * @param[in] itemIndex The item index
671 * @param[in] number The number value that must be displayed as the badge icon
672 * @exception E_SUCCESS The method is successful.
673 * @exception E_INVALID_ARG The specified @c number must be in the range defined by @c 0 and @c 99999.
674 * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure. @n
675 * The index is greater than or equal to the number of elements or less than @c 0.
676 * @exception E_SYSTEM A system error has occurred.
677 * @remarks To remove the numbered badge icon from an item, pass @c 0 as the value of @c number.
679 result SetItemNumberedBadgeIcon(int itemIndex, int number);
683 * Sets the item text color for the specified state.
687 * @return An error code
688 * @param[in] status The item status
689 * @param[in] color The item text color to set
690 * @exception E_SUCCESS The method is successful.
691 * @exception E_SYSTEM A system error has occurred.
693 result SetItemTextColor(FooterItemStatus status, const Tizen::Graphics::Color& color);
697 * Selects the item at the specified index.
701 * @return An error code
702 * @param[in] itemIndex The index of the item to select
703 * @exception E_SUCCESS The method is successful.
704 * @exception E_OUT_OF_RANGE The specified index is out of the range of the data structure. @n
705 * The specified index is either greater than or equal to the number of items or is less than zero.
706 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
707 * The item at the specified index is disabled.
708 * @exception E_UNSUPPORTED_OPERATION The operation is not supported if the %Footer control style is ::FOOTER_STYLE_BUTTON_TEXT,
709 * ::FOOTER_STYLE_BUTTON_ICON or ::FOOTER_STYLE_BUTTON_ICON_TEXT.
710 * @exception E_SYSTEM A system error has occurred.
712 result SetItemSelected(int itemIndex);
716 * Sets the color of the footer.
720 * @return An error code
721 * @param[in] color The footer color to set
722 * @exception E_SUCCESS The method is successful.
724 result SetColor(const Tizen::Graphics::Color& color);
728 * Sets the style of the footer.
732 * @return An error code
733 * @param[in] style The footer style to set
734 * @exception E_SUCCESS The method is successful.
735 * @exception E_SYSTEM A system error has occurred.
736 * @remarks All items and buttons will be removed if the style is changed.
738 result SetStyle(FooterStyle style);
742 * Enables or disables the tab edit mode.
746 * @return An error code
747 * @param[in] enable Set to @c true to enable the edit mode, @n
749 * @exception E_SUCCESS The method is successful.
750 * @exception E_UNSUPPORTED_OPERATION The operation is supported when the style of the %Footer control style is ::FOOTER_STYLE_TAB.
752 result SetTabEditModeEnabled(bool enable);
756 * Adds an action event listener instance.
757 * OnActionPerformed() of the added listener is called when the user selects an item.
761 * @param[in] listener The event listener to add
762 * @remarks When the user collapses the tab style %Footer control which is in the expanded mode by pressing the more button,
763 * OnActionPerformed() is called for the currently selected tab item.
765 void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
769 * Removes an action event listener instance.
770 * The removed listener cannot listen to events when they are fired.
774 * @param[in] listener The event listener to remove
776 void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
780 * Gets the position and size of the specified button item.
784 * @return The position and size of the button item at the specified position.
785 * @param[in] position The position of the button item
786 * @exception E_SUCCESS The method is successful.
787 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
788 * There is no button set at the specified position.
789 * @remarks The specific error code can be accessed using the GetLastResult() method.
791 Tizen::Graphics::Rectangle GetButtonBounds(ButtonPosition position) const;
794 * Gets the position and size of the specified button item.
798 * @return The position and size of the button item at the specified position.
799 * @param[in] position The position of the button item
800 * @exception E_SUCCESS The method is successful.
801 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
802 * There is no button set at the specified position.
803 * @remarks The specific error code can be accessed using the GetLastResult() method.
805 Tizen::Graphics::FloatRectangle GetButtonBoundsF(ButtonPosition position) const;
810 //This method is for internal use only. Using this method can cause behavioral, security-related,
811 //and consistency-related issues in the application.
813 // This is the default constructor for this class.
820 //This method is for internal use only. Using this method can cause behavioral, security-related,
821 //and consistency-related issues in the application.
823 // This is the destructor for this class.
826 virtual ~Footer(void);
831 //This method is for internal use only. Using this method can cause behavioral, security-related,
832 //and consistency-related issues in the application.
834 // Initializes this instance of Footer with the specified parameter.
837 // @return An error code
838 // @exception E_SUCCESS The method is successful.
839 // @exception E_SYSTEM A system error has occurred.
841 result Construct(void);
843 Footer(const Footer& rhs);
844 Footer& operator =(const Footer& rhs);
847 friend class _FormImpl;
848 friend class _FooterImpl;
852 }}} // Tizen::Ui::Controls
854 #endif // _FUI_CTRL_FOOTER_H_