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.
20 * @brief This is the header file for the %Tab class.
22 * This header file contains the declarations of the %Tab class and its helper classes.
25 #ifndef _FUI_CTRL_TAB_H_
26 #define _FUI_CTRL_TAB_H_
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FBaseString.h>
31 #include <FGrpBitmap.h>
32 #include <FGrpRectangle.h>
33 #include <FUiControl.h>
34 #include <FUiContainer.h>
35 #include <FUiCtrlForm.h>
36 #include <FUiIActionEventListener.h>
38 namespace Tizen { namespace Ui
40 class IActionEventListener;
43 namespace Tizen { namespace Ui { namespace Controls
45 class _PublicActionEvent;
51 * @brief <i> [Deprecated] </i> This class is an implementation of a %Tab control.
53 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
56 * @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
57 * control or a ScrollPanel control to each tab item.
59 * The %Tab class is an implementation of a %Tab control.
60 * %Tab control displays the user selection in the form of a horizontal list. Each
61 * item of %Tab control consists of its text string and optional bitmap image.
62 * Items can be added to an itemlist of the tab model with AddItem(). Items can
63 * be inserted into an itemlist by InsertItemAt(), updated into an itemlist by SetItemAt(),
64 * removed from an itemlist by RemoveItemAt(), etc. It is possible to customize the
65 * background image of the tab shelf, and the image of the currently selected tab item.
66 * A badge icon can also be used to give more information for each tab item.
70 * @image html ui_controls_tab.png
73 * This is the simple UI application that uses a %Tab control.
77 //Sample code for TabSample.h
82 : public Tizen::Ui::Controls::Form
83 , public Tizen::Ui::IActionEventListener
89 bool Initialize(void);
90 virtual result OnInitializing(void);
92 // IActionEventListener
93 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
96 Tizen::Ui::Controls::Tab* __pTab;
101 // Sample code for TabSample.cpp
102 #include "TabSample.h"
104 using namespace Tizen::Ui::Controls;
107 TabSample::Initialize()
109 Construct(FORM_STYLE_NORMAL|FORM_STYLE_TEXT_TAB);
114 TabSample::OnInitializing(void)
116 result r = E_SUCCESS;
118 // Gets an instance of Tab
121 // Adds items to the tab
122 __pTab->AddItem(L"First", 0);
123 __pTab->AddItem(L"Second", 1);
124 __pTab->AddActionEventListener(*this);
129 // IActionEventListener implementation
131 TabSample::OnActionPerformed(const Control& source, int actionId)
152 class _OSP_EXPORT_ Tab
153 : public Tizen::Ui::Control
158 * Adds a listener instance.
159 * The added listener can listen to events on the context of the given event dispatcher when they are fired.
161 * @brief <i> [Deprecated] </i>
162 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
165 * @param[in] listener The event listener to be added
168 void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
172 * Removes a listener instance.
173 * The removed listener cannot listen to events when they are fired.
175 * @brief <i> [Deprecated] </i>
176 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
179 * @param[in] listener The event listener to be removed
182 void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
187 * Adds an item consisting of the specified text string.
189 * @brief <i> [Deprecated] </i>
190 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
193 * @return An error code
194 * @param[in] text The text string of the item
195 * @param[in] actionId The action ID for this item
196 * @exception E_SUCCESS The method is successful.
197 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
198 * @exception E_SYSTEM A system error has occurred, or @n
199 * the total number of items has exceed the %Tab control's maximum item count.
200 * @remarks The @c actionId range is @c 0-999. @n
201 * The maximum number of items for %Tab with text style is @c 9. @n
202 * The maximum number of items for icon style %Tab is @c 8.
203 * @remarks This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style.
206 result AddItem(const Tizen::Base::String& text, int actionId);
210 * Adds an item consisting of the title icon and the specified text string.
212 * @brief <i> [Deprecated] </i>
213 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
216 * @return An error code
217 * @param[in] titleIcon The bitmap for the title icon
218 * @param[in] text The text string of the item
219 * @param[in] actionId The specified @c actionId for this item
220 * @exception E_SUCCESS The method is successful.
221 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
222 * @exception E_SYSTEM A system error has occurred, or @n
223 * the total number of items has exceed the %Tab control's maximum item count.
224 * @remarks The @c actionId range is @c 0-999. @n
225 * The maximum number of items for %Tab with text style is @c 9. @n
226 * The maximum number of items for icon style %Tab is @c 8. @n
227 * This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style.
228 * @remarks If the size of bitmap is greater than the default size , the bitmap is scaled down.
231 result AddItem(const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
235 * Adds the item that consists of the specified icon.
237 * @brief <i> [Deprecated] </i>
238 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
241 * @return An error code
242 * @param[in] icon The bitmap for the icon
243 * @param[in] actionId The specified @c actionId for this item
244 * @exception E_SUCCESS The method is successful.
245 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
246 * @exception E_SYSTEM A system error has occurred, or @n
247 * the total number of items has exceed the %Tab control's maximum item count.
248 * @remarks The @c actionId range is @c 0-999. @n
249 * The maximum number of items for %Tab with text style is @c 9. @n
250 * The maximum number of items for icon style %Tab is @c 8. @n
251 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
252 * If the size of the bitmap is greater than the default size, the bitmap is scaled down.
255 result AddItem(const Tizen::Graphics::Bitmap& icon, int actionId);
259 * Inserts the item that consists of only a text string at the specified index.
261 * @brief <i> [Deprecated] </i>
262 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
265 * @return An error code
266 * @param[in] index The index of the item
267 * @param[in] text The text string of the item
268 * @param[in] actionId The specified @c actionId for this item
269 * @exception E_SUCCESS The method is successful.
270 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
271 * @exception E_SYSTEM A system error has occurred, or @n
272 * the total number of items has exceed the %Tab control's maximum item count.
273 * @remarks The @c actionId range is @c 0-999. @n
274 * The maximum number of items for %Tab with text style is @c 9. @n
275 * The maximum number of items for icon style %Tab is @c 8.
276 * @remarks This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style.
279 result InsertItemAt(int index, const Tizen::Base::String& text, int actionId);
283 * Inserts the item that consists of the title icon and specified text string at the specified index.
285 * @brief <i> [Deprecated] </i>
286 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
289 * @return An error code
290 * @param[in] index The index of the item
291 * @param[in] titleIcon The bitmap for the title icon
292 * @param[in] text The text string of the item
293 * @param[in] actionId The specified @c actionId for this item
294 * @exception E_SUCCESS The method is successful.
295 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
296 * @exception E_SYSTEM A system error has occurred, or @n
297 * the total number of items has exceed the %Tab control's maximum item count.
298 * @remarks The @c actionId range is @c 0-999.
299 * @remarks The maximum number of items for %Tab with text style is @c 9. @n
300 * The maximum number of items for icon style %Tab is @c 8. @n
301 * This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style. @n
302 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
305 result InsertItemAt(int index, const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
309 * Inserts the item which consists of the title icon and specified text string at the specified index.
311 * @brief <i> [Deprecated] </i>
312 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
315 * @return An error code
316 * @param[in] index The index of the item
317 * @param[in] icon The Bitmap for the Icon
318 * @param[in] actionId The specified @c actionId for this item
319 * @exception E_SUCCESS The method is successful.
320 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
321 * @exception E_SYSTEM A system error has occurred, or @n
322 * the total number of items has exceed the %Tab control's maximum item count.
323 * @remarks The @c actionId range is @c 0-999.
324 * @remarks The maximum number of items for %Tab with text style is @c 9. @n
325 * The maximum number of items for icon style %Tab is @c 8. @n
326 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
327 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
330 result InsertItemAt(int index, const Tizen::Graphics::Bitmap& icon, int actionId);
334 * Sets the item that consists of only a text string at the specified index.
336 * @brief <i> [Deprecated] </i>
337 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
340 * @return An error code
341 * @param[in] index The index of the item
342 * @param[in] text The text string of the item
343 * @param[in] actionId The specified @c actionId for this item
344 * @exception E_SUCCESS The method is successful.
345 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
346 * @exception E_SYSTEM A system error has occurred.
347 * @remarks The @c actionId range is @c 0-999. @n
348 * This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style.
351 result SetItemAt(int index, const Tizen::Base::String& text, int actionId);
355 * Sets the item that consists of the title icon and the specified text string at the given index.
357 * @brief <i> [Deprecated] </i>
358 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
361 * @return An error code
362 * @param[in] index The index of the item
363 * @param[in] titleIcon The bitmap for the title icon
364 * @param[in] text The text string of the item
365 * @param[in] actionId The action ID for the item
366 * @exception E_SUCCESS The method is successful.
367 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
368 * @exception E_SYSTEM A system error has occurred.
369 * @remarks The @c actionId range is @c 0-999. @n
370 * This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style. @n
371 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
374 result SetItemAt(int index, const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
378 * Sets the item that consists of only a title icon at the specified index.
380 * @brief <i> [Deprecated] </i>
381 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
384 * @return An error code
385 * @param[in] index The index of the item
386 * @param[in] icon The bitmap for the icon
387 * @param[in] actionId The action ID for the item
388 * @exception E_SUCCESS The method is successful.
389 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
390 * @exception E_SYSTEM A system error has occurred.
391 * @remarks The @c actionId range is @c 0-999. @n
392 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
393 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
396 result SetItemAt(int index, const Tizen::Graphics::Bitmap& icon, int actionId);
400 * Removes item at the given index from the tab.
402 * @brief <i> [Deprecated] </i>
403 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
406 * @return An error code
407 * @param[in] index The index of the item
408 * @exception E_SUCCESS The method is successful.
409 * @exception E_INVALID_ARG The specified input parameter is invalid.
410 * @exception E_SYSTEM A system error has occurred.
413 result RemoveItemAt(int index);
417 * Removes all the items from the tab.
419 * @brief <i> [Deprecated] </i>
420 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
423 * @return An error code
424 * @exception E_SUCCESS The method is successful.
425 * @exception E_SYSTEM A system error has occurred.
428 result RemoveAllItems(void);
432 * Sets the badge icon of the specified item.
434 * @brief <i> [Deprecated] </i>
435 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
438 * @return An error code
439 * @param[in] actionId The specified @c actionId for this item
440 * @param[in] pBadgeIcon The bitmap for the icon
441 * @exception E_SUCCESS The method is successful.
442 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
443 * @exception E_SYSTEM A system error has occurred.
444 * @remarks The @c actionId range is @c 0-999. @n
445 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
448 result SetBadgeIcon(int actionId, const Tizen::Graphics::Bitmap* pBadgeIcon);
452 * Gets the number of items in the specified tab.
454 * @brief <i> [Deprecated] </i>
455 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
458 * @return The number of items in the tab
461 int GetItemCount(void) const;
465 * Gets the index of the item at the specified action ID.
467 * @brief <i> [Deprecated] </i>
468 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
471 * @return The index of the item, @n
472 * else @c -1 if an error occurs
473 * @param[in] actionId The action ID of the item
474 * @remarks The @c actionId range is @c 0-999.
477 int GetItemIndexFromActionId(int actionId) const;
481 * Gets the action ID of the item at the specified index.
483 * @brief <i> [Deprecated] </i>
484 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
487 * @return The action ID of the item, @n
488 * else @c -1 if @c index is less than @c 0 or greater than the item count of tab
489 * @param[in] index The index of the item
492 int GetItemActionIdAt(int index) const;
496 * Sets the selected item for the specified index.
498 * @brief <i> [Deprecated] </i>
499 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
502 * @param[in] index The index of the item
505 void SetSelectedItem(int index);
509 * Gets the index of the selected item from the tab.
511 * @brief <i> [Deprecated] </i>
512 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
515 * @return The index of the item, @n
516 * else @c -1 if an error occurs
519 int GetSelectedItemIndex(void) const;
523 * Sets the edit-enabled mode.
525 * @brief <i> [Deprecated] </i>
526 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
529 * @param[in] enable Set to @c true to enable edit mode, @n
533 void SetEditModeEnabled(bool enable);
537 * Checks whether the edit mode is set.
539 * @brief <i> [Deprecated] </i>
540 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
543 * @return @c true if the edit mode is set, @n
547 bool IsEditModeEnabled(void) const;
551 * Sets the background bitmap of the tab.
553 * @brief <i> [Deprecated] </i>
554 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
557 * @return An error code
558 * @param[in] bitmap The background bitmap
559 * @exception E_SUCCESS The method is successful.
560 * @exception E_INVALID_ARG The background bitmap is invalid.
561 * @exception E_SYSTEM A system error has occurred.
564 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
568 * Sets the background bitmap of the focused item.
570 * @brief <i> [Deprecated] </i>
571 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
574 * @return An error code
575 * @param[in] bitmap The background bitmap of the focused item
576 * @exception E_SUCCESS The method is successful.
577 * @exception E_INVALID_ARG The background bitmap is invalid.
578 * @exception E_SYSTEM A system error has occurred.
581 result SetFocusedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
585 * Sets the text color of the tab.
587 * @brief <i> [Deprecated] </i>
588 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
591 * @param[in] textColor The color to be set
594 void SetTextColor(const Tizen::Graphics::Color& textColor);
598 * Gets the text color of the tab.
600 * @brief <i> [Deprecated] </i>
601 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
604 * @return The text color
607 Tizen::Graphics::Color GetTextColor(void) const;
611 * Sets the text color for the selected item of the tab.
613 * @brief <i> [Deprecated] </i>
614 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
617 * @param[in] textColor The color to be set
620 void SetSelectedTextColor(const Tizen::Graphics::Color& textColor);
624 * Gets the text color for the selected item of the tab.
626 * @brief <i> [Deprecated] </i>
627 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
630 * @return The text color
633 Tizen::Graphics::Color GetSelectedTextColor(void) const;
637 * Gets the color of the text when the %Tab item is highlighted.
639 * @brief <i> [Deprecated] </i>
640 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
643 * @return The highlighted text color
644 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
647 Tizen::Graphics::Color GetHighlightedTextColor(void) const;
651 * Sets the color of the text when the tab item is highlighted.
653 * @brief <i> [Deprecated] </i>
654 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
657 * @param[in] color The color to be set
658 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
661 void SetHighlightedTextColor(const Tizen::Graphics::Color& color);
665 * Sets the background bitmap of the highlighted tab item.
667 * @brief <i> [Deprecated] </i>
668 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
671 * @return An error code
672 * @param[in] bitmap The background bitmap of the focused item
673 * @exception E_SUCCESS The method is successful.
674 * @exception E_INVALID_ARG The background bitmap is invalid.
675 * @exception E_SYSTEM A system error has occurred.
676 * @remarks The background bitmap must use the 9-patched bitmap.
677 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
680 result SetHighlightedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
683 //void SetStyle(int style);
687 // This method is for internal use only.
688 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
690 // 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.
696 // This method is for internal use only.
697 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
699 // 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.
705 // This method is for internal use only.
706 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
708 // Initializes this instance of %Tab with the specified parameter.
711 // @return An error code
712 // @param[in] tabHandle The handle of the tab
713 // @exception E_SUCCESS The method is successful.
714 // @exception E_SYSTEM A system error has occurred.
716 result Construct(void);
719 // Stores __BitmapItem.
721 Tizen::Base::Collection::ArrayList __items;
724 friend class _TabImpl;
728 }}} //Tizen::Ui::Controls
730 #endif // _FUI_CTRL_TAB_H_