2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrlListView.h
20 * @brief This is the header file for the %ListView class.
22 * This header file contains the declarations of the %ListView class and its helper classes.
25 #ifndef _FUI_CTRL_LIST_VIEW_H_
26 #define _FUI_CTRL_LIST_VIEW_H_
28 #include <FBaseObject.h>
29 #include <FBaseTypes.h>
30 #include <FGrpFloatRectangle.h>
31 #include <FGrpRectangle.h>
32 #include <FUiContainer.h>
33 #include <FUiControl.h>
34 #include <FUiCtrlIFastScrollListener.h>
35 #include <FUiCtrlIListViewItemEventListener.h>
36 #include <FUiCtrlIListViewItemProvider.h>
37 #include <FUiCtrlIListViewItemProviderF.h>
38 #include <FUiCtrlIScrollEventListener.h>
39 #include <FUiCtrlIScrollEventListenerF.h>
40 #include <FUiCtrlListViewTypes.h>
41 #include <FUiCtrlScrollPanelTypes.h>
42 #include <FUiIUiLinkEventListener.h>
44 namespace Tizen { namespace Ui { namespace Controls
51 * @brief This class defines common behavior for a %ListView control.
55 * The %ListView class displays a list of simple and user-configured items. A simple item has a fixed layout consisting of a bitmap
56 * and a text string. A user-configured item in a %ListView instance can have a different layout and height than the other items.
57 * Each user-configured item is composed of elements that can be texts and bitmaps, and is configured using the CustomItem class.
59 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_listviews.htm">ListViews</a>.
61 * The following example demonstrates how to use the %ListView class.
65 //Sample code for ListViewSample.h
69 : public Tizen::Ui::Controls::Form
70 , public Tizen::Ui::Controls::IListViewItemEventListener
71 , public Tizen::Ui::Controls::IListViewItemProvider
76 , __pItemContext(null){}
78 bool Initialize(void);
79 virtual result OnInitializing(void);
80 virtual result OnTerminating(void);
82 // IListViewItemEventListener
83 virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
84 virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
85 virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView &listView, int index, Tizen::Ui::Controls::SweepDirection direction);
87 // IListViewItemProvider
88 virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
89 virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
90 virtual int GetItemCount(void);
93 static const int ID_FORMAT_STRING = 100;
94 static const int ID_FORMAT_BITMAP = 101;
95 static const int ID_CONTEXT_ITEM_1 = 103;
96 static const int ID_CONTEXT_ITEM_2 = 104;
98 Tizen::Graphics::Bitmap* __pHome;
99 Tizen::Graphics::Bitmap* __pMsg;
100 Tizen::Graphics::Bitmap* __pAlarm;
101 Tizen::Graphics::Bitmap* __pCall;
103 Tizen::Ui::Controls::ListView* __pListView;
104 Tizen::Ui::Controls::ListContextItem* __pItemContext;
109 //Sample code for ListViewSample.cpp
111 #include <FGraphics.h>
113 #include "ListViewSample.h"
115 using namespace Tizen::App;
116 using namespace Tizen::Base;
117 using namespace Tizen::Graphics;
118 using namespace Tizen::Media;
119 using namespace Tizen::Ui::Controls;
122 ListViewSample::Initialize(void)
124 Construct(FORM_STYLE_NORMAL);
129 ListViewSample::OnInitializing(void)
131 result r = E_SUCCESS;
133 // Creates an instance of ListView
134 __pListView = new ListView();
135 __pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, false);
136 __pListView->SetItemProvider(*this);
137 __pListView->AddListViewItemEventListener(*this);
139 // Adds the list view to the form
140 AddControl(*__pListView);
142 // Creates an instance of ListContextItem
143 __pItemContext = new ListContextItem();
144 __pItemContext->Construct();
145 __pItemContext->AddElement(ID_CONTEXT_ITEM_1, L"Test1");
146 __pItemContext->AddElement(ID_CONTEXT_ITEM_2, L"Test2");
148 // Gets instances of Bitmap
149 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
150 __pHome = pAppResource->GetBitmapN(L"tizen.png");
151 __pMsg = pAppResource->GetBitmapN(L"tizen.png");
152 __pAlarm = pAppResource->GetBitmapN(L"tizen.png");
153 __pCall = pAppResource->GetBitmapN(L"tizen.png");
159 ListViewSample::OnTerminating(void)
161 result r = E_SUCCESS;
163 // Deallocates bitmaps
169 // Deallocates the item context
170 delete __pItemContext;
175 // IListViewItemEventListener implementation
177 ListViewSample::OnListViewItemStateChanged(ListView &listView, int index, int elementId, ListItemStatus status)
181 case ID_FORMAT_BITMAP:
186 case ID_FORMAT_STRING:
197 ListViewSample::OnListViewContextItemStateChanged(ListView &listView, int index, int elementId, ListContextItemStatus state)
201 case ID_CONTEXT_ITEM_1:
206 case ID_CONTEXT_ITEM_2:
217 ListViewSample::OnListViewItemSwept(ListView &listView, int index, SweepDirection direction)
222 // IListViewItemProvider implementation
224 ListViewSample::CreateItem(int index, int itemWidth)
226 // Creates an instance of CustomItem
227 CustomItem* pItem = new CustomItem();
228 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
234 style = LIST_ANNEX_STYLE_NORMAL;
235 pItem->Construct(Dimension(itemWidth,112), style);
236 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pHome, null, null);
237 pItem->AddElement(Rectangle(80, 25, 150, 50), ID_FORMAT_STRING, L"Home", true);
242 style = LIST_ANNEX_STYLE_DETAILED;
243 pItem->Construct(Dimension(itemWidth,112), style);
244 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pMsg, null, null);
245 pItem->AddElement(Rectangle(80, 25, 150, 50), ID_FORMAT_STRING, L"Msg", true);
250 style = LIST_ANNEX_STYLE_ONOFF_SLIDING;
251 pItem->Construct(Dimension(itemWidth,112), style);
252 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pAlarm, null, null);
253 pItem->AddElement(Rectangle(80, 25, 150, 50), ID_FORMAT_STRING, L"Alarm", true);
258 style = LIST_ANNEX_STYLE_MARK;
259 pItem->Construct(Dimension(itemWidth,112), style);
260 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pCall, null, null);
261 pItem->AddElement(Rectangle(80, 25, 150, 50), ID_FORMAT_STRING, L"Call", true);
268 pItem->SetContextItem(__pItemContext);
274 ListViewSample::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
282 ListViewSample::GetItemCount(void)
289 class _OSP_EXPORT_ ListView
290 : public Tizen::Ui::Control
294 * The object is not fully constructed after this constructor is
295 * called. For full construction, the Construct() method must be
296 * called right after calling this constructor.
303 * This destructor overrides Tizen::Base::Object::~Object().
307 virtual ~ListView(void);
311 * Initializes this instance of %ListView with the specified parameters.
313 * @brief <i> [Deprecated] </i>
314 * @deprecated This method is deprecated.
317 * @return An error code
318 * @param[in] rect An instance of the Graphics::Rectangle class @n
319 * This instance represents the x and y coordinates of the left top corner of the created %ListView along with the width
321 * @param[in] itemDivider Set to @c true to display an item divider, @n
323 * @param[in] fastScroll Set to @c true to use fast scroll, @n
325 * @exception E_SUCCESS The method is successful.
326 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
327 * Either the @c rect.width or @c rect.height parameter has a negative value.
328 * @exception E_SYSTEM A system error has occurred.
331 result Construct(const Tizen::Graphics::Rectangle& rect, bool itemDivider = true, bool fastScroll = false);
334 * Initializes this instance of %ListView with the specified parameters.
338 * @return An error code
339 * @param[in] rect An instance of the Graphics::Rectangle class @n
340 * This instance represents the x and y coordinates of the left top corner of the created %ListView along with the width
342 * @param[in] itemDivider Set to @c true to display an item divider, @n
344 * @param[in] scrollStyle Set to scroll style
345 * @exception E_SUCCESS The method is successful.
346 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
347 * Either the @c rect.width or @c rect.height parameter has a negative value.
348 * @exception E_SYSTEM A system error has occurred.
350 result Construct(const Tizen::Graphics::Rectangle& rect, bool itemDivider, ListScrollStyle scrollStyle);
353 * Initializes this instance of %ListView with the specified parameters.
357 * @return An error code
358 * @param[in] rect An instance of the Graphics::Rectangle class @n
359 * This instance represents the x and y coordinates of the left top corner of the created %ListView along with the width
361 * @param[in] itemDivider Set to @c true to display an item divider, @n
363 * @param[in] scrollStyle Set to scroll style
364 * @exception E_SUCCESS The method is successful.
365 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
366 * Either the @c rect.width or @c rect.height parameter has a negative value.
367 * @exception E_SYSTEM A system error has occurred.
369 result Construct(const Tizen::Graphics::FloatRectangle& rect, bool itemDivider, ListScrollStyle scrollStyle);
372 * Sets the item provider that creates and deletes items for the list.
376 * @return An error code
377 * @param[in] provider The item provider to create and delete items
378 * @exception E_SUCCESS The method is successful.
379 * @exception E_SYSTEM A system error has occurred.
380 * @remarks If an item provider is not set for the list, the list does not work. @n
381 * The specified @c provider should be allocated in heap memory.
383 result SetItemProvider(IListViewItemProvider& provider);
386 * Sets the item provider that creates and deletes items for the list.
390 * @return An error code
391 * @param[in] provider The item provider to create and delete items
392 * @exception E_SUCCESS The method is successful.
393 * @exception E_SYSTEM A system error has occurred.
394 * @remarks If an item provider is not set for the list, the list does not work. @n
395 * The specified @c provider should be allocated in heap memory.
397 result SetItemProvider(IListViewItemProviderF& provider);
400 * Adds a listener instance that listens to state changes of list view items. @n
401 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
405 * @param[in] listener The event listener to add
407 void AddListViewItemEventListener(IListViewItemEventListener& listener);
410 * Removes a listener instance that listens to state changes of list view items. @n
411 * The removed listener cannot listen to events when they are fired.
415 * @param[in] listener The event listener to remove
417 void RemoveListViewItemEventListener(IListViewItemEventListener& listener);
420 * Adds a listener instance that listens to state changes of a fast scroll. @n
421 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
425 * @param[in] listener The event listener to add
427 void AddFastScrollListener(IFastScrollListener& listener);
430 * Removes a listener instance that listens to state changes of a fast scroll. @n
431 * The removed listener cannot listen to events when they are fired.
435 * @param[in] listener The event listener to remove
437 void RemoveFastScrollListener(IFastScrollListener& listener);
440 * Adds a listener instance that listens to state changes of a scroll event. @n
441 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
445 * @param[in] listener The event listener to add
446 * @see IScrollEventListener::OnScrollEndReached()
447 * @see RemoveScrollEventListener()
449 void AddScrollEventListener(IScrollEventListener& listener);
452 * Adds a listener instance that listens to state changes of a scroll event. @n
453 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
457 * @param[in] listener The event listener to add
458 * @see IScrollEventListener::OnScrollEndReached()
459 * @see RemoveScrollEventListener()
461 void AddScrollEventListener(IScrollEventListenerF& listener);
464 * Removes a listener instance that listens to state changes of a scroll event. @n
465 * The removed listener cannot listen to events when they are fired.
469 * @param[in] listener The event listener to remove
470 * @see IScrollEventListener::OnScrollEndReached()
471 * @see AddScrollEventListener()
473 void RemoveScrollEventListener(IScrollEventListener& listener);
476 * Removes a listener instance that listens to state changes of a scroll event. @n
477 * The removed listener cannot listen to events when they are fired.
481 * @param[in] listener The event listener to remove
482 * @see IScrollEventListener::OnScrollEndReached()
483 * @see AddScrollEventListener()
485 void RemoveScrollEventListener(IScrollEventListenerF& listener);
488 * Adds a link event listener.
492 * @param[in] listener The event listener to add
493 * @remarks The added listener is notified when a link is selected by the user.
494 * @see RemoveUiLinkEventListener()
496 void AddUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
499 * Removes the specified link event listener. @n
500 * The removed listener cannot listen to events when they are fired.
504 * @param[in] listener The event listener to remove
505 * @see AddUiLinkEventListener()
507 void RemoveUiLinkEventListener(Tizen::Ui::IUiLinkEventListener& listener);
510 * Sets the sweep event to enable.
514 * @return An error code
515 * @param[in] enable Set to @c true to enable the sweep, @n
517 * @exception E_SUCCESS The method is successful.
518 * @exception E_SYSTEM A system error has occurred.
520 result SetSweepEnabled(bool enable);
523 * Sets the index list of the scroll by texts.
527 * @return An error code
528 * @param[in] text The text of the index
529 * @param[in] useSearchIcon Set to @c true to show the magnifying icon, @n
531 * @exception E_SUCCESS The method is successful.
532 * @exception E_INVALID_ARG A specified input parameter is invalid.
533 * @exception E_INVALID_STATE This instance is in an invalid state.
534 * @exception E_SYSTEM A system error has occurred.
536 result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
539 * Gets the index of the top drawn item of the %ListView control.
543 * @return The index of the top drawn item
545 int GetTopDrawnItemIndex(void) const;
548 * Gets the index of the bottom drawn item of the %ListView control.
552 * @return The index of the bottom drawn item
554 int GetBottomDrawnItemIndex(void) const;
557 * Scrolls to the item at the specified index. @n
558 * The specified item is drawn at the top of the %ListView control.
562 * @return An error code
563 * @param[in] index The item index
564 * @exception E_SUCCESS The method is successful.
565 * @exception E_OUT_OF_RANGE The specified input parameter is invalid.
566 * @exception E_SYSTEM A system error has occurred.
567 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
569 result ScrollToItem(int index);
572 * Scrolls to the item at the specified index. @n
573 * The specified item is drawn at the position specified by the item alignment.
577 * @return An error code
578 * @param[in] index The item index
579 * @param[in] itemAlignment The item alignment
580 * @exception E_SUCCESS The method is successful.
581 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
582 * @exception E_SYSTEM A system error has occurred.
584 result ScrollToItem(int index, ListScrollItemAlignment itemAlignment);
587 * Sets the check status of the item at the specified index.
591 * @return An error code
592 * @param[in] index The item index
593 * @param[in] check The check status
594 * @exception E_SUCCESS The method is successful.
595 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
596 * @exception E_INVALID_OPERATION The item is disabled.
597 * @exception E_SYSTEM A system error has occurred.
598 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
600 result SetItemChecked(int index, bool check);
603 * Checks whether the item at the specified index is checked.
607 * @return @c true if the item is checked, @n
609 * @param[in] index The item index
610 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
612 bool IsItemChecked(int index) const;
615 * Sets the enabled/disabled status of the item at the specified index.
619 * @return An error code
620 * @param[in] index The item index
621 * @param[in] enable The enabled/disabled status
622 * @exception E_SUCCESS The method is successful.
623 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
624 * @exception E_SYSTEM A system error has occurred.
625 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
628 result SetItemEnabled(int index, bool enable);
631 * Checks whether the item at the specified index is enabled.
635 * @return @c true if the item is enabled, @n
637 * @param[in] index The item index
638 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
640 bool IsItemEnabled(int index) const;
643 * Counts the number of items.
647 * @return The total number of items
649 int GetItemCount(void) const;
652 * Shows the description text of the given item.
656 * @return An error code
657 * @param[in] index The index of the item
658 * @exception E_SUCCESS The method is successful.
659 * @exception E_OUT_OF_RANGE The specified input parameter is invalid.
660 * @exception E_SYSTEM A system error has occurred.
661 * @remarks If no description text is set to the item of the specified index, this method does not show the description text.
662 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
664 result ShowItemDescriptionText(int index);
667 * Hides the description text of the given item.
671 * @return An error code
672 * @param[in] index The index of the item
673 * @exception E_SUCCESS The method is successful.
674 * @exception E_OUT_OF_RANGE The specified input parameter is invalid.
675 * @exception E_SYSTEM A system error has occurred.
676 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
678 result HideItemDescriptionText(int index);
681 * Refreshes the specified item.
685 * @return An error code
686 * @param[in] index The item index
687 * @param[in] type The item to add, remove, or modify
688 * @exception E_SUCCESS The method is successful.
689 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
690 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
691 * @exception E_SYSTEM A system error has occurred.
692 * @remarks 3 refresh types are supported: LIST_REFRESH_TYPE_ITEM_ADD, LIST_REFRESH_TYPE_ITEM_REMOVE, and LIST_REFRESH_TYPE_ITEM_MODIFY.
693 * - LIST_REFRESH_TYPE_ITEM_ADD is used when new data is added to the data model. @n
694 * - LIST_REFRESH_TYPE_ITEM_REMOVE is used when a data is deleted from the data model. @n
695 * - LIST_REFRESH_TYPE_ITEM_MODIFY is used when an existing data has changes and needs to be updated. @n
696 * Calling this method with LIST_REFRESH_TYPE_ITEM_MODIFY invokes the item provider to call DeleteItem() and CreateItem() for the given index in
698 * @remarks This method internally calls Invalidate(), so you do not need to call them to update the screen.
700 result RefreshList(int index, ListRefreshType type);
703 * Refreshes the specified item's element.
707 * @return An error code
708 * @param[in] index The item index
709 * @param[in] elementId The item element ID
710 * @exception E_SUCCESS The method is successful.
711 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
712 * @exception E_SYSTEM A system error has occurred.
713 * @remarks This method internally calls Invalidate(), so you do not need to call them to update the screen.
715 result RefreshList(int index, int elementId);
718 * Updates the whole items of a list.
722 * @return An error code
723 * @exception E_SUCCESS The method is successful.
724 * @exception E_SYSTEM A system error has occurred.
725 * @remarks This method clears the items in the list and re-invokes the methods of the item provider to fill the list.
727 result UpdateList(void);
730 * Gets the index of the item at the specified position.
734 * @return The index of the item, @n
735 * else @c -1 if there is no list item at the specified position
736 * @param[in] x The X position of the point
737 * @param[in] y The Y position of the point
738 * @remarks The method returns -1 when there is no list item at the specified position.
739 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
741 int GetItemIndexFromPosition(int x, int y) const;
744 * Gets the index of the item at the specified position.
748 * @return The index of the item, @n
749 * else @c -1 if there is no list item at the specified position
750 * @param[in] x The X position of the point
751 * @param[in] y The Y position of the point
752 * @remarks The method returns -1 when there is no list item at the specified position.
753 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
755 int GetItemIndexFromPosition(float x, float y) const;
758 * Gets the index of the item at the specified position.
762 * @return The index of the item
763 * @param[in] position The position of the point, @n
764 * else @c -1 if there is no list item at the specified position
765 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
767 int GetItemIndexFromPosition(const Tizen::Graphics::Point& position) const;
770 * Gets the index of the item at the specified position.
774 * @return The index of the item
775 * @param[in] position The position of the point, @n
776 * else @c -1 if there is no list item at the specified position
777 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
779 int GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position) const;
782 * Gets the index of the item and ID of the element at the specified position.
786 * @return An error code
787 * @param[in] x The X position of the item
788 * @param[in] y The Y position of the item
789 * @param[out] itemIndex The index of the item
790 * @param[out] elementId The ID of the element
791 * @exception E_SUCCESS The method is successful.
792 * @exception E_SYSTEM A system error has occurred, or @n
793 * there is no item at the specified position.
794 * @remarks The specified @c itemIndex is -1 when there is no list item at the specified position.
795 * @remarks The specified @c elementId is -1 when there is no element at the specified position.
796 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
798 result GetItemIndexFromPosition(int x, int y, int& itemIndex, int& elementId) const;
801 * Gets the index of the item and ID of the element at the specified position.
805 * @return An error code
806 * @param[in] x The X position of the item
807 * @param[in] y The Y position of the item
808 * @param[out] itemIndex The index of the item
809 * @param[out] elementId The ID of the element
810 * @exception E_SUCCESS The method is successful.
811 * @exception E_SYSTEM A system error has occurred, or @n
812 * there is no item at the specified position.
813 * @remarks The specified @c itemIndex is -1 when there is no list item at the specified position.
814 * @remarks The specified @c elementId is -1 when there is no element at the specified position.
815 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
817 result GetItemIndexFromPosition(float x, float y, int& itemIndex, int& elementId) const;
820 * Gets the index of the item and ID of the element at the specified position.
824 * @return An error code
825 * @param[in] position The position of the point
826 * @param[out] itemIndex The index of the item
827 * @param[out] elementId The ID of the element
828 * @exception E_SUCCESS The method is successful.
829 * @exception E_SYSTEM A system error has occurred, or @n
830 * there is no item at the specified position.
831 * @remarks The specified @c itemIndex is -1 when there is no list item at the specified position.
832 * @remarks The specified @c elementId is -1 when there is no element at the specified position.
833 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
835 result GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& itemIndex, int& elementId) const;
838 * Gets the index of the item and ID of the element at the specified position.
842 * @return An error code
843 * @param[in] position The position of the point
844 * @param[out] itemIndex The index of the item
845 * @param[out] elementId The ID of the element
846 * @exception E_SUCCESS The method is successful.
847 * @exception E_SYSTEM A system error has occurred, or @n
848 * there is no item at the specified position.
849 * @remarks The specified @c itemIndex is -1 when there is no list item at the specified position.
850 * @remarks The specified @c elementId is -1 when there is no element at the specified position.
851 * @remarks This method should be called only after list items are created. If this method needs to be called early in the lifecycle of the ListView, then UpdateList() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
853 result GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& itemIndex, int& elementId) const;
856 * Sets the color of a division line between items.
860 * @return An error code
861 * @param[in] color The division line color
862 * @exception E_SUCCESS The method is successful.
864 result SetItemDividerColor(const Tizen::Graphics::Color& color);
867 * Gets the color of a division line between items.
871 * @return The color of a section, @n
872 * else RGBA(0, 0, 0, 0) if the instance is invalid
874 Tizen::Graphics::Color GetItemDividerColor(void) const;
877 * Sets the background color of this control.
881 * @return An error code
882 * @param[in] color The background color
883 * @exception E_SUCCESS The method is successful.
884 * @remarks The method sets the alpha value of the specified @c color to @c 255, when a device does not support 32bit color space. @n
885 * The background bitmap has priority over the background color. When both the background bitmap and the background color are specified, only
886 * the bitmap image is displayed.
888 result SetBackgroundColor(const Tizen::Graphics::Color& color);
891 * Gets the background color of this control.
895 * @return The background color, @n
896 * else RGBA(0, 0, 0, 0) if the instance is invalid
898 Tizen::Graphics::Color GetBackgroundColor(void) const;
901 * Sets the bitmap of this control.
905 * @return An error code
906 * @param[in] pBitmap The bitmap for the list
907 * @exception E_SUCCESS The method is successful.
908 * @exception E_SYSTEM A system error has occurred.
910 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
913 * Sets the bitmap of the empty list.
917 * @return An error code
918 * @param[in] pBitmap The bitmap for the empty list
919 * @exception E_SUCCESS The method is successful.
920 * @exception E_SYSTEM A system error has occurred.
922 result SetBitmapOfEmptyList(const Tizen::Graphics::Bitmap* pBitmap);
925 * Sets the text of the empty list.
929 * @return An error code
930 * @param[in] text The text for the empty list
931 * @exception E_SUCCESS The method is successful.
932 * @exception E_SYSTEM A system error has occurred.
934 result SetTextOfEmptyList(const Tizen::Base::String& text);
937 * Gets the text to display when there is no item in a list.
941 * @return The text to display, @n
942 * else an empty string if the instance is invalid
944 Tizen::Base::String GetTextOfEmptyList(void) const;
947 * Sets a color of the text to display when there is no item in a list.
951 * @return An error code
952 * @param[in] color The color of the text to display
953 * @exception E_SUCCESS The method is successful.
954 * @exception E_SYSTEM A system error has occurred.
956 result SetTextColorOfEmptyList(const Tizen::Graphics::Color& color);
959 * Gets a color of the text to display when there is no item in a list.
963 * @return The color of the text to display
965 Tizen::Graphics::Color GetTextColorOfEmptyList(void) const;
968 * Begins the reordering mode.
972 * @return An error code
973 * @exception E_SUCCESS The method is successful.
974 * @exception E_SYSTEM A system error has occurred.
975 * @see IListViewItemEventListener::OnListViewItemReordered()
977 result BeginReorderingMode(void);
980 * Ends the reordering mode.
984 * @return An error code
985 * @exception E_SUCCESS The method is successful.
986 * @exception E_SYSTEM A system error has occurred.
987 * @see IListViewItemEventListener::OnListViewItemReordered()
989 result EndReorderingMode(void);
992 * Checks whether the %ListView control is in reordering mode.
996 * @return @c true if the %ListView is in reordering mode, @n
999 bool IsInReorderingMode(void) const;
1002 * Sets the scroll input handling mode.
1006 * @param[in] mode The scroll input handling mode
1007 * @see GetScrollInputMode()
1009 void SetScrollInputMode(ScrollInputMode mode);
1013 * Gets the scroll input handling mode.
1017 * @return The scroll input handling mode
1018 * @see SetScrollInputMode()
1020 ScrollInputMode GetScrollInputMode(void) const;
1023 * Opens the context item at the specified index.
1027 * @return An error code
1028 * @param[in] itemIndex The item index
1029 * @exception E_SUCCESS The method is successful.
1030 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1031 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1033 result OpenContextItem(int itemIndex);
1036 * Closes the context item at the specified index.
1040 * @return An error code
1041 * @param[in] itemIndex The item index
1042 * @exception E_SUCCESS The method is successful.
1043 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1044 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1046 result CloseContextItem(int itemIndex);
1049 * Returns whether the context item at the specified index is opened.
1053 * @return @c true if the context item is opened, else @c false
1054 * @param[in] itemIndex The item itemIndex
1055 * @exception E_SUCCESS The method is successful.
1056 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1058 bool IsContextItemOpened(int itemIndex) const;
1061 friend class _ListViewImpl;
1065 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1067 ListView(const ListView& rhs);
1070 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1072 ListView& operator =(const ListView& rhs);
1075 }}} // Tizen::Ui::Controls
1077 #endif // _FUI_CTRL_LIST_VIEW_H_