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.
21 * @brief This is the header file for the %Tab class.
23 * This header file contains the declarations of the %Tab class and its helper classes.
27 #ifndef _FUI_CTRL_TAB_H_
28 #define _FUI_CTRL_TAB_H_
30 #include <FBaseObject.h>
31 #include <FBaseTypes.h>
32 #include <FBaseString.h>
33 #include <FGrpBitmap.h>
34 #include <FGrpRectangle.h>
35 #include <FUiControl.h>
36 #include <FUiContainer.h>
37 #include <FUiCtrlForm.h>
38 #include <FUiIActionEventListener.h>
40 namespace Tizen { namespace Ui
42 class IActionEventListener;
45 namespace Tizen { namespace Ui { namespace Controls
47 class _PublicActionEvent;
53 * @brief <i> [Deprecated] </i> This class is an implementation of a %Tab control.
55 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
58 * @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
59 * control or a ScrollPanel control to each tab item.
61 * The %Tab class is an implementation of a %Tab control.
62 * %Tab control displays the user selection in the form of a horizontal list. Each
63 * item of %Tab control consists of its text string and optional bitmap image.
64 * Items can be added to an itemlist of the tab model with AddItem(). Items can
65 * be inserted into an itemlist by InsertItemAt(), updated into an itemlist by SetItemAt(),
66 * removed from an itemlist by RemoveItemAt(), etc. It is possible to customize the
67 * background image of the tab shelf, and the image of the currently selected tab item.
68 * A badge icon can also be used to give more information for each tab item.
72 * @image html ui_controls_tab.png
75 * This is the simple UI application that uses a %Tab control.
79 //Sample code for TabSample.h
84 : public Tizen::Ui::Controls::Form
85 , public Tizen::Ui::IActionEventListener
91 bool Initialize(void);
92 virtual result OnInitializing(void);
94 // IActionEventListener
95 virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
98 Tizen::Ui::Controls::Tab* __pTab;
103 // Sample code for TabSample.cpp
104 #include "TabSample.h"
106 using namespace Tizen::Ui::Controls;
109 TabSample::Initialize()
111 Construct(FORM_STYLE_NORMAL|FORM_STYLE_TEXT_TAB);
116 TabSample::OnInitializing(void)
118 result r = E_SUCCESS;
120 // Gets an instance of Tab
123 // Adds items to the tab
124 __pTab->AddItem(L"First", 0);
125 __pTab->AddItem(L"Second", 1);
126 __pTab->AddActionEventListener(*this);
131 // IActionEventListener implementation
133 TabSample::OnActionPerformed(const Control& source, int actionId)
154 class _OSP_EXPORT_ Tab
155 : public Tizen::Ui::Control
160 * Adds a listener instance.
161 * The added listener can listen to events on the context of the given event dispatcher when they are fired.
163 * @brief <i> [Deprecated] </i>
164 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
167 * @param[in] listener The event listener to add
170 void AddActionEventListener(Tizen::Ui::IActionEventListener& listener);
174 * Removes a listener instance.
175 * The removed listener cannot listen to events when they are fired.
177 * @brief <i> [Deprecated] </i>
178 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
181 * @param[in] listener The event listener to remove
184 void RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener);
189 * Adds an item consisting of the specified text string.
191 * @brief <i> [Deprecated] </i>
192 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
195 * @return An error code
196 * @param[in] text The text string of the item
197 * @param[in] actionId The action ID for this item
198 * @exception E_SUCCESS The method is successful.
199 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
200 * @exception E_SYSTEM A system error has occurred, or @n
201 * the total number of items has exceed the %Tab control's maximum item count.
202 * @remarks The @c actionId range is @c 0-999. @n
203 * The maximum number of items for %Tab with text style is @c 9. @n
204 * The maximum number of items for icon style %Tab is @c 8.
205 * @remarks This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style.
208 result AddItem(const Tizen::Base::String& text, int actionId);
212 * Adds an item consisting of the title icon and the specified text string.
214 * @brief <i> [Deprecated] </i>
215 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
218 * @return An error code
219 * @param[in] titleIcon The bitmap for the title icon
220 * @param[in] text The text string of the item
221 * @param[in] actionId The specified @c actionId for this item
222 * @exception E_SUCCESS The method is successful.
223 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
224 * @exception E_SYSTEM A system error has occurred, or @n
225 * the total number of items has exceed the %Tab control's maximum item count.
226 * @remarks The @c actionId range is @c 0-999. @n
227 * The maximum number of items for %Tab with text style is @c 9. @n
228 * The maximum number of items for icon style %Tab is @c 8. @n
229 * This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style.
230 * @remarks If the size of bitmap is greater than the default size , the bitmap is scaled down.
233 result AddItem(const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
237 * Adds the item that consists of the specified icon.
239 * @brief <i> [Deprecated] </i>
240 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
243 * @return An error code
244 * @param[in] icon The bitmap for the icon
245 * @param[in] actionId The specified @c actionId for this item
246 * @exception E_SUCCESS The method is successful.
247 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
248 * @exception E_SYSTEM A system error has occurred, or @n
249 * the total number of items has exceed the %Tab control's maximum item count.
250 * @remarks The @c actionId range is @c 0-999. @n
251 * The maximum number of items for %Tab with text style is @c 9. @n
252 * The maximum number of items for icon style %Tab is @c 8. @n
253 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
254 * If the size of the bitmap is greater than the default size, the bitmap is scaled down.
257 result AddItem(const Tizen::Graphics::Bitmap& icon, int actionId);
261 * Inserts the item that consists of only a text string at the specified index.
263 * @brief <i> [Deprecated] </i>
264 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
267 * @return An error code
268 * @param[in] index The index of the item
269 * @param[in] text The text string of the item
270 * @param[in] actionId The specified @c actionId for this item
271 * @exception E_SUCCESS The method is successful.
272 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
273 * @exception E_SYSTEM A system error has occurred, or @n
274 * the total number of items has exceed the %Tab control's maximum item count.
275 * @remarks The @c actionId range is @c 0-999. @n
276 * The maximum number of items for %Tab with text style is @c 9. @n
277 * The maximum number of items for icon style %Tab is @c 8.
278 * @remarks This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style.
281 result InsertItemAt(int index, const Tizen::Base::String& text, int actionId);
285 * Inserts the item that consists of the title icon and specified text string at the specified index.
287 * @brief <i> [Deprecated] </i>
288 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
291 * @return An error code
292 * @param[in] index The index of the item
293 * @param[in] titleIcon The bitmap for the title icon
294 * @param[in] text The text string of the item
295 * @param[in] actionId The specified @c actionId for this item
296 * @exception E_SUCCESS The method is successful.
297 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
298 * @exception E_SYSTEM A system error has occurred, or @n
299 * the total number of items has exceed the %Tab control's maximum item count.
300 * @remarks The @c actionId range is @c 0-999.
301 * @remarks The maximum number of items for %Tab with text style is @c 9. @n
302 * The maximum number of items for icon style %Tab is @c 8. @n
303 * This method can only be used when the %Form control has the FORM_STYLE_TEXT_TAB style. @n
304 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
307 result InsertItemAt(int index, const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
311 * Inserts the item which consists of the title icon and specified text string at the specified index.
313 * @brief <i> [Deprecated] </i>
314 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
317 * @return An error code
318 * @param[in] index The index of the item
319 * @param[in] icon The Bitmap for the Icon
320 * @param[in] actionId The specified @c actionId for this item
321 * @exception E_SUCCESS The method is successful.
322 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
323 * @exception E_SYSTEM A system error has occurred, or @n
324 * the total number of items has exceed the %Tab control's maximum item count.
325 * @remarks The @c actionId range is @c 0-999.
326 * @remarks The maximum number of items for %Tab with text style is @c 9. @n
327 * The maximum number of items for icon style %Tab is @c 8. @n
328 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
329 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
332 result InsertItemAt(int index, const Tizen::Graphics::Bitmap& icon, int actionId);
336 * Sets the item that consists of only a text string at the specified index.
338 * @brief <i> [Deprecated] </i>
339 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
342 * @return An error code
343 * @param[in] index The index of the item
344 * @param[in] text The text string of the item
345 * @param[in] actionId The specified @c actionId for this item
346 * @exception E_SUCCESS The method is successful.
347 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
348 * @exception E_SYSTEM A system error has occurred.
349 * @remarks The @c actionId range is @c 0-999. @n
350 * This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style.
353 result SetItemAt(int index, const Tizen::Base::String& text, int actionId);
357 * Sets the item that consists of the title icon and the specified text string at the given index.
359 * @brief <i> [Deprecated] </i>
360 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
363 * @return An error code
364 * @param[in] index The index of the item
365 * @param[in] titleIcon The bitmap for the title icon
366 * @param[in] text The text string of the item
367 * @param[in] actionId The action ID for the item
368 * @exception E_SUCCESS The method is successful.
369 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
370 * @exception E_SYSTEM A system error has occurred.
371 * @remarks The @c actionId range is @c 0-999. @n
372 * This method can only be used when the Form control has the FORM_STYLE_TEXT_TAB style. @n
373 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
376 result SetItemAt(int index, const Tizen::Graphics::Bitmap& titleIcon, const Tizen::Base::String& text, int actionId);
380 * Sets the item that consists of only a title icon at the specified index.
382 * @brief <i> [Deprecated] </i>
383 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
386 * @return An error code
387 * @param[in] index The index of the item
388 * @param[in] icon The bitmap for the icon
389 * @param[in] actionId The action ID for the item
390 * @exception E_SUCCESS The method is successful.
391 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
392 * @exception E_SYSTEM A system error has occurred.
393 * @remarks The @c actionId range is @c 0-999. @n
394 * This method can only be used when the Form control has the FORM_STYLE_ICON_TAB style. @n
395 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
398 result SetItemAt(int index, const Tizen::Graphics::Bitmap& icon, int actionId);
402 * Removes item at the given index from the tab.
404 * @brief <i> [Deprecated] </i>
405 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
408 * @return An error code
409 * @param[in] index The index of the item
410 * @exception E_SUCCESS The method is successful.
411 * @exception E_INVALID_ARG The specified input parameter is invalid.
412 * @exception E_SYSTEM A system error has occurred.
415 result RemoveItemAt(int index);
419 * Removes all the items from the tab.
421 * @brief <i> [Deprecated] </i>
422 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
425 * @return An error code
426 * @exception E_SUCCESS The method is successful.
427 * @exception E_SYSTEM A system error has occurred.
430 result RemoveAllItems(void);
434 * Sets the badge icon of the specified item.
436 * @brief <i> [Deprecated] </i>
437 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
440 * @return An error code
441 * @param[in] actionId The specified @c actionId for this item
442 * @param[in] pBadgeIcon The bitmap for the icon
443 * @exception E_SUCCESS The method is successful.
444 * @exception E_OUT_OF_RANGE The specified @c actionId is out of range.
445 * @exception E_SYSTEM A system error has occurred.
446 * @remarks The @c actionId range is @c 0-999. @n
447 * If the size of bitmap is greater than the default size, the bitmap is scaled down.
450 result SetBadgeIcon(int actionId, const Tizen::Graphics::Bitmap* pBadgeIcon);
454 * Gets the number of items in the specified tab.
456 * @brief <i> [Deprecated] </i>
457 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
460 * @return The number of items in the tab
463 int GetItemCount(void) const;
467 * Gets the index of the item at the specified action ID.
469 * @brief <i> [Deprecated] </i>
470 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
473 * @return The index of the item, @n
474 * else @c -1 if an error occurs
475 * @param[in] actionId The action ID of the item
476 * @remarks The @c actionId range is @c 0-999.
479 int GetItemIndexFromActionId(int actionId) const;
483 * Gets the action ID of the item at the specified index.
485 * @brief <i> [Deprecated] </i>
486 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
489 * @return The action ID of the item, @n
490 * else @c -1 if @c index is less than @c 0 or greater than the item count of tab
491 * @param[in] index The index of the item
494 int GetItemActionIdAt(int index) const;
498 * Sets the selected item for the specified index.
500 * @brief <i> [Deprecated] </i>
501 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
504 * @param[in] index The index of the item
507 void SetSelectedItem(int index);
511 * Gets the index of the selected item from the tab.
513 * @brief <i> [Deprecated] </i>
514 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
517 * @return The index of the item, @n
518 * else @c -1 if an error occurs
521 int GetSelectedItemIndex(void) const;
525 * Sets the edit-enabled mode.
527 * @brief <i> [Deprecated] </i>
528 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
531 * @param[in] enable Set to @c true to enable edit mode, @n
535 void SetEditModeEnabled(bool enable);
539 * Checks whether the edit mode is set.
541 * @brief <i> [Deprecated] </i>
542 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
545 * @return @c true if the edit mode is set, @n
549 bool IsEditModeEnabled(void) const;
553 * Sets the background bitmap of the tab.
555 * @brief <i> [Deprecated] </i>
556 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
559 * @return An error code
560 * @param[in] bitmap The background bitmap
561 * @exception E_SUCCESS The method is successful.
562 * @exception E_INVALID_ARG The background bitmap is invalid.
563 * @exception E_SYSTEM A system error has occurred.
566 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
570 * Sets the background bitmap of the focused item.
572 * @brief <i> [Deprecated] </i>
573 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
576 * @return An error code
577 * @param[in] bitmap The background bitmap of the focused item
578 * @exception E_SUCCESS The method is successful.
579 * @exception E_INVALID_ARG The background bitmap is invalid.
580 * @exception E_SYSTEM A system error has occurred.
583 result SetFocusedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
587 * Sets the text color of the tab.
589 * @brief <i> [Deprecated] </i>
590 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
593 * @param[in] textColor The color to set
596 void SetTextColor(const Tizen::Graphics::Color& textColor);
600 * Gets the text color of the tab.
602 * @brief <i> [Deprecated] </i>
603 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
606 * @return The text color
609 Tizen::Graphics::Color GetTextColor(void) const;
613 * Sets the text color for the selected item of the tab.
615 * @brief <i> [Deprecated] </i>
616 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
619 * @param[in] textColor The color to set
622 void SetSelectedTextColor(const Tizen::Graphics::Color& textColor);
626 * Gets the text color for the selected item of the tab.
628 * @brief <i> [Deprecated] </i>
629 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
632 * @return The text color
635 Tizen::Graphics::Color GetSelectedTextColor(void) const;
639 * Gets the color of the text when the %Tab item is highlighted.
641 * @brief <i> [Deprecated] </i>
642 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
645 * @return The highlighted text color
646 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
649 Tizen::Graphics::Color GetHighlightedTextColor(void) const;
653 * Sets the color of the text when the tab item is highlighted.
655 * @brief <i> [Deprecated] </i>
656 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
659 * @param[in] color The color to set
660 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
663 void SetHighlightedTextColor(const Tizen::Graphics::Color& color);
667 * Sets the background bitmap of the highlighted tab item.
669 * @brief <i> [Deprecated] </i>
670 * @deprecated This class is deprecated because the use of the %Tab control is no longer recommended.
673 * @return An error code
674 * @param[in] bitmap The background bitmap of the focused item
675 * @exception E_SUCCESS The method is successful.
676 * @exception E_INVALID_ARG The background bitmap is invalid.
677 * @exception E_SYSTEM A system error has occurred.
678 * @remarks The background bitmap must use the 9-patched bitmap.
679 * @remarks When a user navigates the user interface using the directional keys, the focused UI control is highlighted.
682 result SetHighlightedItemBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
685 //void SetStyle(int style);
689 // This method is for internal use only.
690 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
692 // 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.
698 // This method is for internal use only.
699 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
701 // 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.
707 // This method is for internal use only.
708 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
710 // Initializes this instance of %Tab with the specified parameter.
713 // @return An error code
714 // @param[in] tabHandle The handle of the tab
715 // @exception E_SUCCESS The method is successful.
716 // @exception E_SYSTEM A system error has occurred.
718 result Construct(void);
721 // Stores __BitmapItem.
723 Tizen::Base::Collection::ArrayList __items;
726 friend class _TabImpl;
730 }}} //Tizen::Ui::Controls
732 #endif // _FUI_CTRL_TAB_H_