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 * @brief This is the header file for the %Tab class.
21 * This header file contains the declarations of the %Tab class and its helper classes.
24 #ifndef _FUI_CTRL_TAB_H_
25 #define _FUI_CTRL_TAB_H_
27 #include <FBaseObject.h>
28 #include <FBaseTypes.h>
29 #include <FBaseString.h>
30 #include <FGrpBitmap.h>
31 #include <FGrpRectangle.h>
32 #include <FUiControl.h>
33 #include <FUiContainer.h>
34 #include <FUiCtrlForm.h>
35 #include <FUiIActionEventListener.h>
37 namespace Tizen { namespace Ui
39 class IActionEventListener;
42 namespace Tizen { namespace Ui { namespace Controls
44 class _PublicActionEvent;
50 * @brief <i> [Deprecated] </i> This class is an implementation of a %Tab control.
52 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
55 * @remarks Note that tabs are part of a Form control, not a Frame control. This means that each tab item cannot be a form. You can associate a Panel
56 * control or a ScrollPanel control to each tab item.
58 * The %Tab class is an implementation of a %Tab control.
59 * %Tab control displays the user selection in the form of a horizontal list. Each
60 * item of %Tab control consists of its text string and optional bitmap image.
61 * Items can be added to an itemlist of the tab model with AddItem(). Items can
62 * be inserted into an itemlist by InsertItemAt(), updated into an itemlist by SetItemAt(),
63 * removed from an itemlist by RemoveItemAt(), etc. It is possible to customize the
64 * background image of the tab shelf, and the image of the currently selected tab item.
65 * A badge icon can also be used to give more information for each tab item.
69 * @image html ui_controls_tab.png
72 * This is the simple UI application that uses a %Tab control.
76 //Sample code for TabSample.h
81 : public Tizen::Ui::Controls::Form
82 , public Tizen::Ui::IActionEventListener
88 bool Initialize(void);
89 virtual result OnInitializing(void);
91 // IActionEventListener
92 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
95 Tizen::Ui::Controls::Tab* __pTab;
100 // Sample code for TabSample.cpp
101 #include "TabSample.h"
103 using namespace Tizen::Ui::Controls;
106 TabSample::Initialize()
108 Construct(FORM_STYLE_NORMAL|FORM_STYLE_TEXT_TAB);
113 TabSample::OnInitializing(void)
115 result r = E_SUCCESS;
117 // Gets an instance of Tab
120 // Adds items to the tab
121 __pTab->AddItem(L"First", 0);
122 __pTab->AddItem(L"Second", 1);
123 __pTab->AddActionEventListener(*this);
128 // IActionEventListener implementation
130 TabSample::OnActionPerformed(const Control& source, int actionId)
151 class _OSP_EXPORT_ Tab
152 : public Tizen::Ui::Control
157 * Adds a listener instance.
158 * The added listener can listen to events on the context of the given event dispatcher when they are fired.
160 * @brief <i> [Deprecated] </i>
161 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
164 * @param[in] listener The event listener to be added
167 void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
171 * Removes a listener instance.
172 * The removed listener cannot listen to events when they are fired.
174 * @brief <i> [Deprecated] </i>
175 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
178 * @param[in] listener The event listener to be removed
181 void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
186 * Adds an item consisting of the specified text string.
188 * @brief <i> [Deprecated] </i>
189 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
192 * @return An error code
193 * @param[in] text The text string of the item
194 * @param[in] actionId The action ID for this item
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
197 * @exception E_SYSTEM A system error has occurred, or @n
198 * the total number of items has exceed the %Tab control's maximum item count.
199 * @remarks The @c actionId range is @c 0-999. @n
200 * The maximum number of items for %Tab with text style is @c 9. @n
201 * The maximum number of items for icon style %Tab is @c 8.
202 * @remarks This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style.
205 result AddItem(const Tizen::Base::String& text, int actionId);
209 * Adds an item consisting of the title icon and the specified text string.
211 * @brief <i> [Deprecated] </i>
212 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
215 * @return An error code
216 * @param[in] titleIcon The bitmap for the title icon
217 * @param[in] text The text string of the item
218 * @param[in] actionId The specified @c actionId for this item
219 * @exception E_SUCCESS The method is successful.
220 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
221 * @exception E_SYSTEM A system error has occurred, or @n
222 * the total number of items has exceed the %Tab control's maximum item count.
223 * @remarks The @c actionId range is @c 0-999. @n
224 * The maximum number of items for %Tab with text style is @c 9. @n
225 * The maximum number of items for icon style %Tab is @c 8. @n
226 * This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style.
227 * @remarks If the size of bitmap is greater than the default size , the bitmap is scaled down.
230 result AddItem(const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
234 * Adds the item that consists of the specified icon.
236 * @brief <i> [Deprecated] </i>
237 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
240 * @return An error code
241 * @param[in] icon The bitmap for the icon
242 * @param[in] actionId The specified @c actionId for this item
243 * @exception E_SUCCESS The method is successful.
244 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
245 * @exception E_SYSTEM A system error has occurred, or @n
246 * the total number of items has exceed the %Tab control's maximum item count.
247 * @remarks The @c actionId range is @c 0-999. @n
248 * The maximum number of items for %Tab with text style is @c 9. @n
249 * The maximum number of items for icon style %Tab is @c 8. @n
250 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
251 * If the size of the bitmap is greater than the default size, the bitmap is scaled down.
254 result AddItem(const Tizen::Graphics::Bitmap& icon, int actionId);
258 * Inserts the item that consists of only a text string at the specified index.
260 * @brief <i> [Deprecated] </i>
261 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
264 * @return An error code
265 * @param[in] index The index of the item
266 * @param[in] text The text string of the item
267 * @param[in] actionId The specified @c actionId for this item
268 * @exception E_SUCCESS The method is successful.
269 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
270 * @exception E_SYSTEM A system error has occurred, or @n
271 * the total number of items has exceed the %Tab control's maximum item count.
272 * @remarks The @c actionId range is @c 0-999. @n
273 * The maximum number of items for %Tab with text style is @c 9. @n
274 * The maximum number of items for icon style %Tab is @c 8.
275 * @remarks This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style.
278 result InsertItemAt(int index, const Tizen::Base::String& text, int actionId);
282 * Inserts the item that consists of the title icon and specified text string at the specified index.
284 * @brief <i> [Deprecated] </i>
285 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
288 * @return An error code
289 * @param[in] index The index of the item
290 * @param[in] titleIcon The bitmap for the title icon
291 * @param[in] text The text string of the item
292 * @param[in] actionId The specified @c actionId for this item
293 * @exception E_SUCCESS The method is successful.
294 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
295 * @exception E_SYSTEM A system error has occurred, or @n
296 * the total number of items has exceed the %Tab control's maximum item count.
297 * @remarks The @c actionId range is @c 0-999.
298 * @remarks The maximum number of items for %Tab with text style is @c 9. @n
299 * The maximum number of items for icon style %Tab is @c 8. @n
300 * This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style. @n
301 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
304 result InsertItemAt(int index, const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
308 * Inserts the item which consists of the title icon and specified text string at the specified index.
310 * @brief <i> [Deprecated] </i>
311 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
314 * @return An error code
315 * @param[in] index The index of the item
316 * @param[in] icon The Bitmap for the Icon
317 * @param[in] actionId The specified @c actionId for this item
318 * @exception E_SUCCESS The method is successful.
319 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
320 * @exception E_SYSTEM A system error has occurred, or @n
321 * the total number of items has exceed the %Tab control's maximum item count.
322 * @remarks The @c actionId range is @c 0-999.
323 * @remarks The maximum number of items for %Tab with text style is @c 9. @n
324 * The maximum number of items for icon style %Tab is @c 8. @n
325 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
326 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
329 result InsertItemAt(int index, const Tizen::Graphics::Bitmap& icon, int actionId);
333 * Sets the item that consists of only a text string at the specified index.
335 * @brief <i> [Deprecated] </i>
336 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
339 * @return An error code
340 * @param[in] index The index of the item
341 * @param[in] text The text string of the item
342 * @param[in] actionId The specified @c actionId for this item
343 * @exception E_SUCCESS The method is successful.
344 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
345 * @exception E_SYSTEM A system error has occurred.
346 * @remarks The @c actionId range is @c 0-999. @n
347 * This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style.
350 result SetItemAt(int index, const Tizen::Base::String& text, int actionId);
354 * Sets the item that consists of the title icon and the specified text string at the given index.
356 * @brief <i> [Deprecated] </i>
357 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
360 * @return An error code
361 * @param[in] index The index of the item
362 * @param[in] titleIcon The bitmap for the title icon
363 * @param[in] text The text string of the item
364 * @param[in] actionId The action ID for the item
365 * @exception E_SUCCESS The method is successful.
366 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
367 * @exception E_SYSTEM A system error has occurred.
368 * @remarks The @c actionId range is @c 0-999. @n
369 * This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style. @n
370 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
373 result SetItemAt(int index, const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
377 * Sets the item that consists of only a title icon at the specified index.
379 * @brief <i> [Deprecated] </i>
380 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
383 * @return An error code
384 * @param[in] index The index of the item
385 * @param[in] icon The bitmap for the icon
386 * @param[in] actionId The action ID for the item
387 * @exception E_SUCCESS The method is successful.
388 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
389 * @exception E_SYSTEM A system error has occurred.
390 * @remarks The @c actionId range is @c 0-999. @n
391 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
392 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
395 result SetItemAt(int index, const Tizen::Graphics::Bitmap& icon, int actionId);
399 * Removes item at the given index from the tab.
401 * @brief <i> [Deprecated] </i>
402 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
405 * @return An error code
406 * @param[in] index The index of the item
407 * @exception E_SUCCESS The method is successful.
408 * @exception E_INVALID_ARG The specified input parameter is invalid.
409 * @exception E_SYSTEM A system error has occurred.
412 result RemoveItemAt(int index);
416 * Removes all the items from the tab.
418 * @brief <i> [Deprecated] </i>
419 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
422 * @return An error code
423 * @exception E_SUCCESS The method is successful.
424 * @exception E_SYSTEM A system error has occurred.
427 result RemoveAllItems(void);
431 * Sets the badge icon of the specified item.
433 * @brief <i> [Deprecated] </i>
434 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
437 * @return An error code
438 * @param[in] actionId The specified @c actionId for this item
439 * @param[in] pBadgeIcon The bitmap for the icon
440 * @exception E_SUCCESS The method is successful.
441 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
442 * @exception E_SYSTEM A system error has occurred.
443 * @remarks The @c actionId range is @c 0-999. @n
444 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
447 result SetBadgeIcon(int actionId, const Tizen::Graphics::Bitmap* pBadgeIcon);
451 * Gets the number of items in the specified tab.
453 * @brief <i> [Deprecated] </i>
454 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
457 * @return The number of items in the tab
460 int GetItemCount(void) const;
464 * Gets the index of the item at the specified action ID.
466 * @brief <i> [Deprecated] </i>
467 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
470 * @return The index of the item, @n
471 * else @c -1 if an error occurs
472 * @param[in] actionId The action ID of the item
473 * @remarks The @c actionId range is @c 0-999.
476 int GetItemIndexFromActionId(int actionId) const;
480 * Gets the action ID of the item at the specified index.
482 * @brief <i> [Deprecated] </i>
483 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
486 * @return The action ID of the item, @n
487 * else @c -1 if @c index is less than @c 0 or greater than the item count of tab
488 * @param[in] index The index of the item
491 int GetItemActionIdAt(int index) const;
495 * Sets the selected item for the specified index.
497 * @brief <i> [Deprecated] </i>
498 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
501 * @param[in] index The index of the item
504 void SetSelectedItem(int index);
508 * Gets the index of the selected item from the tab.
510 * @brief <i> [Deprecated] </i>
511 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
514 * @return The index of the item, @n
515 * else @c -1 if an error occurs
518 int GetSelectedItemIndex(void) const;
522 * Sets the edit-enabled mode.
524 * @brief <i> [Deprecated] </i>
525 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
528 * @param[in] enable Set to @c true to enable edit mode, @n
532 void SetEditModeEnabled(bool enable);
536 * Checks whether the edit mode is set.
538 * @brief <i> [Deprecated] </i>
539 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
542 * @return @c true if the edit mode is set, @n
546 bool IsEditModeEnabled(void) const;
550 * Sets the background bitmap of the tab.
552 * @brief <i> [Deprecated] </i>
553 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
556 * @return An error code
557 * @param[in] bitmap The background bitmap
558 * @exception E_SUCCESS The method is successful.
559 * @exception E_INVALID_ARG The background bitmap is invalid.
560 * @exception E_SYSTEM A system error has occurred.
563 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
567 * Sets the background bitmap of the focused item.
569 * @brief <i> [Deprecated] </i>
570 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
573 * @return An error code
574 * @param[in] bitmap The background bitmap of the focused item
575 * @exception E_SUCCESS The method is successful.
576 * @exception E_INVALID_ARG The background bitmap is invalid.
577 * @exception E_SYSTEM A system error has occurred.
580 result SetFocusedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
584 * Sets the text color of the tab.
586 * @brief <i> [Deprecated] </i>
587 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
590 * @param[in] textColor The color to be set
593 void SetTextColor(const Tizen::Graphics::Color& textColor);
597 * Gets the text color of the tab.
599 * @brief <i> [Deprecated] </i>
600 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
603 * @return The text color
606 Tizen::Graphics::Color GetTextColor(void) const;
610 * Sets the text color for the selected item of the tab.
612 * @brief <i> [Deprecated] </i>
613 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
616 * @param[in] textColor The color to be set
619 void SetSelectedTextColor(const Tizen::Graphics::Color& textColor);
623 * Gets the text color for the selected item of the tab.
625 * @brief <i> [Deprecated] </i>
626 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
629 * @return The text color
632 Tizen::Graphics::Color GetSelectedTextColor(void) const;
636 * Gets the color of the text when the %Tab item is highlighted.
638 * @brief <i> [Deprecated] </i>
639 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
642 * @return The highlighted text color
643 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
646 Tizen::Graphics::Color GetHighlightedTextColor(void) const;
650 * Sets the color of the text when the tab item is highlighted.
652 * @brief <i> [Deprecated] </i>
653 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
656 * @param[in] color The color to be set
657 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
660 void SetHighlightedTextColor(const Tizen::Graphics::Color& color);
664 * Sets the background bitmap of the highlighted tab item.
666 * @brief <i> [Deprecated] </i>
667 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
670 * @return An error code
671 * @param[in] bitmap The background bitmap of the focused item
672 * @exception E_SUCCESS The method is successful.
673 * @exception E_INVALID_ARG The background bitmap is invalid.
674 * @exception E_SYSTEM A system error has occurred.
675 * @remarks The background bitmap must use the 9-patched bitmap.
676 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
679 result SetHighlightedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
682 //void SetStyle(int style);
686 // This method is for internal use only.
687 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
689 // The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
695 // This method is for internal use only.
696 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
698 // This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
704 // This method is for internal use only.
705 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
707 // Initializes this instance of %Tab with the specified parameter.
710 // @return An error code
711 // @param[in] tabHandle The handle of the tab
712 // @exception E_SUCCESS The method is successful.
713 // @exception E_SYSTEM A system error has occurred.
715 result Construct(void);
718 // Stores __BitmapItem.
720 Tizen::Base::Collection::ArrayList __items;
723 friend class _TabImpl;
727 }}} //Tizen::Ui::Controls
729 #endif // _FUI_CTRL_TAB_H_