Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_TableView.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
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.
16 //
17
18 /**
19  * @file                FUiCtrl_TableView.cpp
20  * @brief               This file implements the _TableView class.
21  */
22
23 #include <FGrp_BitmapImpl.h>
24 #include "FUi_ControlManager.h"
25 #include "FUi_ResourceManager.h"
26 #include "FUiAnim_VisualElement.h"
27 #include "FUiCtrl_ListViewModel.h"
28 #include "FUiCtrl_FastScroll.h"
29 #include "FUiCtrl_Scroll.h"
30 #include "FUiCtrl_TableView.h"
31 #include "FUiCtrl_TableViewPresenter.h"
32 #include "FUiCtrl_TableViewItem.h"
33 #include "FUiCtrl_TableViewItemProvider.h"
34 #include "FUiCtrl_TableViewItemProviderAdaptor.h"
35 #include "FUiCtrl_UiTableViewItemEvent.h"
36 #include "FUi_CoordinateSystemUtils.h"
37
38
39 using namespace Tizen::Base;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Animations;
42 using namespace Tizen::Graphics;
43
44 namespace Tizen { namespace Ui { namespace Controls
45 {
46
47 IMPLEMENT_PROPERTY(_TableView);
48
49 _TableView::_TableView(void)
50         : __pTableViewPresenter(null)
51         , __pFastScroll(null)
52         , __pTableViewItemEvent(null)
53         , __itemDividerEnabled(false)
54         , __sweepEnabled(false)
55         , __reorderEnabled(false)
56         , __sectionStyle(false)
57         , __groupedLookEnable(false)
58         , __tableViewStyle(TABLE_VIEW_STYLE_SIMPLE)
59         , __scrollStyle(TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT)
60         , __pBitmapOfEmptyTableView(null)
61         , __pBackgroundBitmap(null)
62         , __textOfEmptyTableView(L"Empty TableView")
63         , __pExpandGroupAnimation(null)
64         , __pCollapseGroupAnimation(null)
65         , __pSweptAnimation(null)
66         , __pRemoveItemtAnimation(null)
67 {
68         Color bgColor;
69
70         GET_COLOR_CONFIG(TABLEVIEW::BG_NORMAL, bgColor);
71         GET_COLOR_CONFIG(TABLEVIEW::SECTIONITEM_BG_NORMAL, __sectionStyleColor);
72         GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_BOTTOM_BG_NORMAL, __itemDividerColor);
73
74         SetBackgroundColor(bgColor);
75 }
76
77 _TableView::~_TableView(void)
78 {
79         __pTableViewPresenter->BlockAnimationCallback(true);
80
81         if (GetVisualElement() != null)
82         {
83                 __pExpandGroupAnimation->SetVisualElementAnimationTickEventListener(null);
84                 __pExpandGroupAnimation->SetVisualElementAnimationStatusEventListener(null);
85
86                 __pCollapseGroupAnimation->SetVisualElementAnimationTickEventListener(null);
87                 __pCollapseGroupAnimation->SetVisualElementAnimationStatusEventListener(null);
88
89                 __pSweptAnimation->SetVisualElementAnimationTickEventListener(null);
90                 __pSweptAnimation->SetVisualElementAnimationStatusEventListener(null);
91
92                 __pRemoveItemtAnimation->SetVisualElementAnimationTickEventListener(null);
93                 __pRemoveItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
94
95                 GetVisualElement()->RemoveAllAnimations();
96         }
97
98         //SuperClass will delete.
99         __pTableViewPresenter = null;
100
101         if (__pFastScroll != null)
102         {
103                 DetachSystemChild(*__pFastScroll);
104
105                 delete __pFastScroll;
106                 __pFastScroll = null;
107         }
108
109         delete __pTableViewItemEvent;
110         __pTableViewItemEvent = null;
111
112         delete __pExpandGroupAnimation;
113         __pExpandGroupAnimation = null;
114
115         delete __pCollapseGroupAnimation;
116         __pCollapseGroupAnimation = null;
117
118         delete __pSweptAnimation;
119         __pSweptAnimation = null;
120
121         delete __pRemoveItemtAnimation;
122         __pRemoveItemtAnimation = null;
123 }
124
125 _TableView*
126 _TableView::CreateTableViewN(TableViewStyle style, bool itemDivider, TableViewScrollBarStyle scrollStyle)
127 {
128         ClearLastResult();
129         result r = E_SUCCESS;
130
131         _TableView* pTableView = null;
132
133         _ControlManager* pControlManager = _ControlManager::GetInstance();
134         SysTryReturn(NID_UI_CTRL, pControlManager, null, E_SYSTEM, "[E_SYSTEM] System error occurred.");
135
136         pTableView = new (std::nothrow) _TableView;
137         SysTryCatch(NID_UI_CTRL, pTableView != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
138
139         r = GetLastResult();
140         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[%s] Propagating", GetErrorMessage(r));
141
142         pTableView->AcquireHandle();
143
144         r = pTableView->Initialize(style, itemDivider, scrollStyle);
145         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to Initialize", GetErrorMessage(r));
146
147         return pTableView;
148
149 CATCH:
150         delete pTableView;
151         return null;
152 }
153
154 result
155 _TableView::Initialize(TableViewStyle style, bool itemDivider, TableViewScrollBarStyle scrollStyle)
156 {
157         result r = E_SUCCESS;
158
159         _TableViewPresenter* pPresenter = new (std::nothrow) _TableViewPresenter();
160         SysTryReturn(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
161
162         r = pPresenter->Construct(this);
163         SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
164
165         r = _ScrollPanel::Initialize(*pPresenter, false);
166         SetTableViewPresenter(pPresenter);
167         SetScrollAreaAutoResizingEnabled(false);
168
169         FloatRectangle rect = GetBoundsF();
170         SetScrollAreaBounds(rect);
171
172         SetTableViewStyle(style);
173         SetScrollStyle(scrollStyle);
174         SetItemDividerEnabled(itemDivider);
175
176         __pExpandGroupAnimation = new (std::nothrow) VisualElementValueAnimation;
177         SysTryReturn(NID_UI_CTRL, __pExpandGroupAnimation != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
178
179         __pExpandGroupAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
180         r = GetLastResult();
181         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
182
183         __pExpandGroupAnimation->SetVisualElementAnimationTickEventListener(__pTableViewPresenter);
184         r = GetLastResult();
185         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
186
187         __pExpandGroupAnimation->SetVisualElementAnimationStatusEventListener(__pTableViewPresenter);
188         r = GetLastResult();
189         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
190
191         __pCollapseGroupAnimation = new (std::nothrow) VisualElementValueAnimation;
192         SysTryReturn(NID_UI_CTRL, __pCollapseGroupAnimation != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
193
194         __pCollapseGroupAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
195         r = GetLastResult();
196         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
197
198         __pCollapseGroupAnimation->SetVisualElementAnimationTickEventListener(__pTableViewPresenter);
199         r = GetLastResult();
200         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
201
202         __pCollapseGroupAnimation->SetVisualElementAnimationStatusEventListener(__pTableViewPresenter);
203         r = GetLastResult();
204         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
205
206         __pSweptAnimation = new (std::nothrow) VisualElementValueAnimation;
207         SysTryReturn(NID_UI_CTRL, __pSweptAnimation != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
208
209         __pSweptAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseInOut"));
210         r = GetLastResult();
211         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
212
213         __pSweptAnimation->SetVisualElementAnimationTickEventListener(__pTableViewPresenter);
214         r = GetLastResult();
215         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
216
217         __pSweptAnimation->SetVisualElementAnimationStatusEventListener(__pTableViewPresenter);
218         r = GetLastResult();
219         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
220
221         __pRemoveItemtAnimation = new (std::nothrow) VisualElementValueAnimation;
222         SysTryReturn(NID_UI_CTRL, __pRemoveItemtAnimation != null, false, E_OUT_OF_MEMORY, ("[E_OUT_OF_MEMORY] The memory is insufficient."));
223
224         __pRemoveItemtAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseIn"));
225         r = GetLastResult();
226         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
227
228         __pRemoveItemtAnimation->SetVisualElementAnimationTickEventListener(this);
229         r = GetLastResult();
230         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
231
232         __pRemoveItemtAnimation->SetVisualElementAnimationStatusEventListener(this);
233         r = GetLastResult();
234         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
235
236         return r;
237
238 CATCH:
239         delete __pExpandGroupAnimation;
240         __pExpandGroupAnimation = null;
241
242         delete __pCollapseGroupAnimation;
243         __pCollapseGroupAnimation = null;
244
245         delete __pSweptAnimation;
246         __pSweptAnimation = null;
247
248         delete __pRemoveItemtAnimation;
249         __pRemoveItemtAnimation = null;
250
251         return r;
252 }
253
254 _TableViewPresenter*
255 _TableView::GetTableViewPresenter(void) const
256 {
257         return __pTableViewPresenter;
258 }
259
260 void
261 _TableView::SetTableViewPresenter(const _TableViewPresenter* pPresenter)
262 {
263         __pTableViewPresenter = const_cast<_TableViewPresenter*>(pPresenter);
264 }
265
266 result
267 _TableView::SetItemProvider(const _TableViewItemProvider* pProvider)
268 {
269         return __pTableViewPresenter->SetItemProvider(pProvider);
270 }
271
272 void
273 _TableView::SetItemProviderAdaptor(_TableViewItemProviderAdaptor* pProviderAdaptor)
274 {
275         __pTableViewPresenter->SetTableViewItemProviderAdaptor(pProviderAdaptor);
276 }
277
278 _TableViewItemProviderAdaptor*
279 _TableView::GetItemProviderAdaptor(void) const
280 {
281         return __pTableViewPresenter->GetTableViewItemProviderAdaptor();
282 }
283
284 void
285 _TableView::SetSweepEnabled(bool enable)
286 {
287         __sweepEnabled = enable;
288 }
289
290 bool
291 _TableView::IsSweepEnabled(void) const
292 {
293         return __sweepEnabled;
294 }
295
296 bool
297 _TableView::IsReorderModeEnabled(void) const
298 {
299         return __reorderEnabled;
300 }
301
302 result
303 _TableView::SetReorderModeEnabled(bool enable)
304 {
305         if (__reorderEnabled != enable)
306         {
307                 __reorderEnabled = enable;
308
309                 __pTableViewPresenter->SetReorderMode(enable);
310         }
311
312         return E_SUCCESS;
313 }
314
315 result
316 _TableView::SetItemChecked(int groupIndex, int itemIndex, bool check)
317 {
318         if (IsOnProcessing())
319         {
320                 return E_INVALID_OPERATION;
321         }
322         return __pTableViewPresenter->SetItemChecked(groupIndex, itemIndex, check);
323 }
324
325 bool
326 _TableView::IsItemChecked(int groupIndex, int itemIndex) const
327 {
328         return __pTableViewPresenter->IsItemChecked(groupIndex, itemIndex);
329 }
330
331 result
332 _TableView::SetItemEnabled(int groupIndex, int itemIndex, bool enable)
333 {
334         if (IsOnProcessing())
335         {
336                 return E_INVALID_OPERATION;
337         }
338         return __pTableViewPresenter->SetItemEnabled(groupIndex, itemIndex, enable);
339 }
340
341 void
342 _TableView::CheckItemHeightAndRefreshLayout(int groupIndex, int itemIndex)
343 {
344         TableViewItemTag itemTag = {groupIndex, itemIndex};
345         __pTableViewPresenter->CheckItemHeightAndRefreshLayout(itemTag, true);
346 }
347
348 _TableViewItem*
349 _TableView::FindItem(int groupIndex, int itemIndex) const
350 {
351         TableViewItemTag itemTag = {groupIndex, itemIndex};
352
353         return __pTableViewPresenter->FindItem(itemTag);
354 }
355
356 void
357 _TableView::UnloadItem(int groupIndex, int itemIndex)
358 {
359         if (IsOnProcessing())
360         {
361                 return;
362         }
363         return __pTableViewPresenter->UnloadItem(groupIndex, itemIndex);
364 }
365
366 _TableViewItem*
367 _TableView::LoadItem(int groupIndex, int itemIndex)
368 {
369         if (IsOnProcessing())
370         {
371                 return null;
372         }
373         return __pTableViewPresenter->LoadItem(groupIndex, itemIndex);
374 }
375
376 void
377 _TableView::RefreshItemLayout(int groupIndex, int itemIndex)
378 {
379         __pTableViewPresenter->RefreshItemLayout(groupIndex, itemIndex);
380 }
381
382 void
383 _TableView::GetFirstLoadedItemIndex(int& groupIndex, int& itemIndex) const
384 {
385         __pTableViewPresenter->GetFirstLoadedItemIndex(groupIndex, itemIndex);
386 }
387
388 void
389 _TableView::GetLastLoadedItemIndex(int& groupIndex, int& itemIndex) const
390 {
391         __pTableViewPresenter->GetLastLoadedItemIndex(groupIndex, itemIndex);
392 }
393
394 void
395 _TableView::ResetSweepItem(void)
396 {
397         __pTableViewPresenter->ResetSweepItem();
398 }
399
400 void
401 _TableView::GetSweepItemIndex(int& groupIndex, int& itemIndex) const
402 {
403         __pTableViewPresenter->GetSweepItemIndex(groupIndex, itemIndex);
404 }
405
406 int
407 _TableView::GetPressedItemCount(void)
408 {
409         return __pTableViewPresenter->GetPressedItemCount();
410 }
411
412 float
413 _TableView::GetTopMargin(void) const
414 {
415         return __pTableViewPresenter->GetTopMargin();
416 }
417
418 result
419 _TableView::SetTopMargin(float topMargin)
420 {
421         return __pTableViewPresenter->SetTopMargin(topMargin);
422 }
423
424 float
425 _TableView::GetBottomMargin(void) const
426 {
427         return __pTableViewPresenter->GetBottomMargin();
428 }
429
430 result
431 _TableView::SetBottomMargin(float bottomMargin)
432 {
433         return __pTableViewPresenter->SetBottomMargin(bottomMargin);
434 }
435
436 bool
437 _TableView::IsItemEnabled(int groupIndex, int itemIndex) const
438 {
439         return __pTableViewPresenter->IsItemEnabled(groupIndex, itemIndex);
440 }
441
442 result
443 _TableView::GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const
444 {
445         groupIndex = -1;
446         itemIndex = -1;
447
448         return __pTableViewPresenter->GetTopDrawnItemIndex(groupIndex, itemIndex);
449 }
450
451 result
452 _TableView::SetTopDrawnItemIndex(int groupIndex, int itemIndex)
453 {
454         if (IsOnProcessing())
455         {
456                 return E_INVALID_OPERATION;
457         }
458         return __pTableViewPresenter->SetTopDrawnItemIndex(groupIndex, itemIndex);
459 }
460
461 result
462 _TableView::GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const
463 {
464         groupIndex = -1;
465         itemIndex = -1;
466
467         return __pTableViewPresenter->GetBottomDrawnItemIndex(groupIndex, itemIndex);
468 }
469
470 result
471 _TableView::SetBottomDrawnItemIndex(int groupIndex, int itemIndex)
472 {
473         if (IsOnProcessing())
474         {
475                 return E_INVALID_OPERATION;
476         }
477         return __pTableViewPresenter->SetBottomDrawnItemIndex(groupIndex, itemIndex);
478 }
479
480 result
481 _TableView::ScrollByPixel(float scrollDistance)
482 {
483         return __pTableViewPresenter->ScrollByPixel(scrollDistance);
484 }
485
486 void
487 _TableView::SetScrollEnabled(bool enable)
488 {
489         __pTableViewPresenter->SetScrollEnabled(enable);
490 }
491
492 bool
493 _TableView::IsScrollEnabled(void) const
494 {
495         return __pTableViewPresenter->IsScrollEnabled();
496 }
497
498 result
499 _TableView::AddTableViewItemEventListener(const _ITableViewItemEventListener& listener)
500 {
501         result r = E_SUCCESS;
502
503         if (__pTableViewItemEvent == null)
504         {
505                 __pTableViewItemEvent = new (std::nothrow) _UiTableViewItemEvent();
506                 SysTryReturn(NID_UI_CTRL, __pTableViewItemEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
507
508                 r = __pTableViewItemEvent->Construct(this, TABLE_VIEW_STYLE_SIMPLE);
509                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to construct Item Event.");
510         }
511
512         r = __pTableViewItemEvent->AddListener(listener);
513         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
514
515         return E_SUCCESS;
516 }
517
518 result
519 _TableView::RemoveTableViewItemEventListener(const _ITableViewItemEventListener& listener)
520 {
521         SysTryReturn(NID_UI_CTRL, __pTableViewItemEvent != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] This instance isn't constructed.");
522
523         return __pTableViewItemEvent->RemoveListener(listener);
524 }
525
526 result
527 _TableView::AddGroupedTableViewItemEventListener(const _ITableViewItemEventListener& listener)
528 {
529         result r = E_SUCCESS;
530
531         if (__pTableViewItemEvent == null)
532         {
533                 __pTableViewItemEvent = new (std::nothrow) _UiTableViewItemEvent();
534                 SysTryReturn(NID_UI_CTRL, __pTableViewItemEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
535
536                 r = __pTableViewItemEvent->Construct(this, TABLE_VIEW_STYLE_GROUPED);
537                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to construct Item Event.");
538         }
539
540         r = __pTableViewItemEvent->AddListener(listener);
541         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
542
543         return E_SUCCESS;
544 }
545
546 result
547 _TableView::RemoveGroupedTableViewItemEventListener(const _ITableViewItemEventListener& listener)
548 {
549         SysTryReturn(NID_UI_CTRL, __pTableViewItemEvent != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] This instance isn't constructed.");
550
551         return __pTableViewItemEvent->RemoveListener(listener);
552 }
553
554 result
555 _TableView::AddSectionTableViewItemEventListener(const _ITableViewItemEventListener& listener)
556 {
557         result r = E_SUCCESS;
558
559         if (__pTableViewItemEvent == null)
560         {
561                 __pTableViewItemEvent = new (std::nothrow) _UiTableViewItemEvent();
562                 SysTryReturn(NID_UI_CTRL, __pTableViewItemEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
563
564                 r = __pTableViewItemEvent->Construct(this, TABLE_VIEW_STYLE_SECTION);
565                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to construct Item Event.");
566         }
567
568         r = __pTableViewItemEvent->AddListener(listener);
569         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
570
571         return E_SUCCESS;
572 }
573
574 result
575 _TableView::RemoveSectionTableViewItemEventListener(const _ITableViewItemEventListener& listener)
576 {
577         SysTryReturn(NID_UI_CTRL, __pTableViewItemEvent != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] This instance isn't constructed.");
578
579         return __pTableViewItemEvent->RemoveListener(listener);
580 }
581
582 result
583 _TableView::AddFastScrollListener(const _IUiFastScrollListener& listener)
584 {
585         SysTryReturn(NID_UI_CTRL, __pFastScroll != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] This instance isn't constructed.");
586         __pFastScroll->AddFastScrollEventListener(listener);
587
588         return E_SUCCESS;
589 }
590
591 result
592 _TableView::RemoveFastScrollListener(const _IUiFastScrollListener& listener)
593 {
594         SysTryReturn(NID_UI_CTRL, __pFastScroll != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] This instance isn't constructed.");
595         __pFastScroll->RemoveFastScrollEventListener(listener);
596
597         return E_SUCCESS;
598 }
599
600 _FastScroll*
601 _TableView::GetFastScrollBar(void) const
602 {
603         return __pFastScroll;
604 }
605
606 result
607 _TableView::SetFastScrollIndex(const String& text, bool useSearchIcon)
608 {
609         SysTryReturn(NID_UI_CTRL,
610                                 (__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL || __scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL_FIXED),
611                                 E_INVALID_OPERATION, E_INVALID_OPERATION, "[E_INVALID_OPERATION] The style of TableView scroll is not TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL");
612         SysTryReturn(NID_UI_CTRL, __pFastScroll != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] This instance isn't constructed.");
613         SysTryReturn(NID_UI_CTRL, (useSearchIcon || (!useSearchIcon && text.GetLength() > 0)), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid input argument.");
614
615         result r = E_SUCCESS;
616
617         const wchar_t* pIndexTextArray = text.GetPointer();
618         int indexLenth = 1;
619         int indexCount = text.GetLength();
620         int childOrder = 0;
621
622         // Set the primary index.
623         _FastScrollIndex* pRootIndex = __pFastScroll->GetIndex();
624         if (pRootIndex == null)
625         {
626                 pRootIndex = _FastScrollIndex::CreateFastScrollIndexN();
627                 r = GetLastResult();
628                 SysTryReturn(NID_UI_CTRL, pRootIndex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
629
630                 r = __pFastScroll->SetIndex(pRootIndex);
631                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
632         }
633         else
634         {
635                 pRootIndex->RemoveChildren(true);
636         }
637
638         if (useSearchIcon == true)
639         {
640                 Bitmap* pSearchIcon = null;
641                 String fastScrollSearchIconIndex(L"[SEARCH_ICON_INDEX]");
642
643                 r = GET_BITMAP_CONFIG_N(TABLEVIEW::SEARCH_ICON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSearchIcon);
644                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] SearchIcon image load failed");
645
646                 _FastScrollIndex* pIndex = pRootIndex->AddChildIndex(&fastScrollSearchIconIndex, pSearchIcon);
647                 SysTryReturn(NID_UI_CTRL, pIndex, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Failed to add text array to the primary index.");
648
649                 childOrder++;
650         }
651
652         r = pRootIndex->AddChildTextIndexArray(childOrder, pIndexTextArray, indexLenth, indexCount);
653         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
654
655         r = __pFastScroll->UpdateIndex();
656         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
657         return E_SUCCESS;
658 }
659
660 result
661 _TableView::SetScrollStyle(TableViewScrollBarStyle scrollStyle)
662 {
663         __scrollStyle = scrollStyle;
664
665         return E_SUCCESS;
666 }
667
668 TableViewStyle
669 _TableView::GetTableViewStyle(void) const
670 {
671         return __tableViewStyle;
672 }
673
674 void
675 _TableView::SetTableViewStyle(TableViewStyle style)
676 {
677         if(__tableViewStyle == style)
678         {
679                 return;
680         }
681
682         __tableViewStyle = style;
683
684         if (__tableViewStyle == TABLE_VIEW_STYLE_SECTION)
685         {
686                 int topMargin = 0;
687                 GET_FIXED_VALUE_CONFIG(TABLEVIEW::SECTIONITEM_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, topMargin);
688                 SetTopMargin(topMargin);
689
690                 int x = 0;
691                 GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, x);
692                 __pTableViewPresenter->SetLeftMargin(x);
693
694                 __groupedLookEnable = true;
695         }
696 }
697
698 TableViewScrollBarStyle
699 _TableView::GetScrollStyle(void) const
700 {
701         return __scrollStyle;
702 }
703
704 int
705 _TableView::GetGroupCount(void) const
706 {
707         return __pTableViewPresenter->GetGroupCount();
708 }
709
710 int
711 _TableView::GetItemCountAt(int groupIndex) const
712 {
713         SysTryReturn(NID_UI_CTRL, groupIndex >= 0 && groupIndex < GetGroupCount(), -1, E_INVALID_ARG, "[E_INVALID_ARG] Invalid group index.");
714
715         int itemCount = __pTableViewPresenter->GetItemCountAt(groupIndex);
716
717         if (GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
718         {
719                 // sub section footer
720                 if (__pTableViewPresenter->HasSectionFooter(groupIndex) == true)
721                 {
722                         itemCount--;
723                         if (itemCount < 0)
724                         {
725                                 itemCount = 0;
726                         }
727                 }
728         }
729
730         return itemCount;
731 }
732
733 result
734 _TableView::RefreshTableView(int groupIndex, int itemIndex, TableViewRefreshType type, bool animation)
735 {
736         if (IsOnProcessing())
737         {
738                 return E_INVALID_OPERATION;
739         }
740
741         return __pTableViewPresenter->RefreshTableView(groupIndex, itemIndex, type, animation);
742 }
743
744 result
745 _TableView::RefreshAllItems(void)
746 {
747         if (IsOnProcessing())
748         {
749                 return E_INVALID_OPERATION;
750         }
751
752         return __pTableViewPresenter->RefreshAllItems();
753 }
754
755
756 result
757 _TableView::UpdateTableView(void)
758 {
759         if (IsOnProcessing())
760         {
761                 return E_INVALID_OPERATION;
762         }
763         return __pTableViewPresenter->UpdateTableView();
764 }
765
766 result
767 _TableView::GetItemIndexFromPosition(const Point& position, int& groupIndex, int& itemIndex) const
768 {
769         return __pTableViewPresenter->GetItemIndexFromPosition(_CoordinateSystemUtils::ConvertToFloat(position), groupIndex, itemIndex);
770 }
771
772 result
773 _TableView::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& groupIndex, int& itemIndex) const
774 {
775         return __pTableViewPresenter->GetItemIndexFromPosition(position, groupIndex, itemIndex);
776 }
777
778
779 result
780 _TableView::SetPropertySectionColor(const Variant& sectionColor)
781 {
782         __sectionStyleColor = sectionColor.ToColor();
783
784         return E_SUCCESS;
785 }
786
787 result
788 _TableView::SetSectionColor(const Color& color)
789 {
790         if (GetTableViewStyle() != TABLE_VIEW_STYLE_SECTION)
791         {
792                 SysLog(NID_UI_CTRL, "[E_INVALID_OPERATION] The style of TableView is not TABLE_VIEW_STYLE_SECTION.");
793                 return E_INVALID_OPERATION;
794         }
795
796         if (__sectionStyleColor == color)
797         {
798                 return E_SUCCESS;
799         }
800
801         result r = SetProperty("sectionColor", Variant(color));
802         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
803
804         return __pTableViewPresenter->SetStatusChanged(true);
805 }
806
807 Variant
808 _TableView::GetPropertySectionColor(void) const
809 {
810         return Variant(__sectionStyleColor);
811 }
812
813 Color
814 _TableView::GetSectionColor(void) const
815 {
816         if (GetTableViewStyle() != TABLE_VIEW_STYLE_SECTION)
817         {
818                 SetLastResult(E_SUCCESS);
819                 return Color(0);
820         }
821
822         Variant sectionColor = GetProperty("sectionColor");
823
824         return sectionColor.ToColor();
825 }
826
827 Variant
828 _TableView::GetPropertyItemDividerColor(void) const
829 {
830         return Variant(__itemDividerColor);
831 }
832
833 Color
834 _TableView::GetItemDividerColor(void) const
835 {
836         Variant itemDividerColor = GetProperty("itemDividerColor");
837
838         return itemDividerColor.ToColor();
839 }
840
841 result
842 _TableView::SetPropertyItemDividerColor(const Variant& itemDividerColor)
843 {
844         if(__itemDividerColor == itemDividerColor.ToColor())
845         {
846                 return E_SUCCESS;
847         }
848
849         __itemDividerColor = itemDividerColor.ToColor();
850
851         return __pTableViewPresenter->SetStatusChanged(true);
852 }
853
854 result
855 _TableView::SetItemDividerColor(const Color& color)
856 {
857         return SetProperty("itemDividerColor", Variant(color));
858 }
859
860 bool
861 _TableView::IsItemDividerEnabled(void) const
862 {
863         return __itemDividerEnabled;
864 }
865
866 void
867 _TableView::SetItemDividerEnabled(bool enable)
868 {
869         __itemDividerEnabled = enable;
870 }
871
872 Bitmap*
873 _TableView::GetBitmapOfEmptyTableView(void) const
874 {
875         return __pBitmapOfEmptyTableView;
876 }
877
878 result
879 _TableView::SetBitmapOfEmptyTableView(const Bitmap* pBitmap)
880 {
881         Bitmap* pCloneBitmap = null;
882
883         if (pBitmap == null)
884         {
885                 delete __pBitmapOfEmptyTableView;
886                 __pBitmapOfEmptyTableView = null;
887
888                 return E_SUCCESS;
889         }
890         else
891         {
892                 pCloneBitmap = _BitmapImpl::CloneN(*pBitmap);
893                 SysTryReturn(NID_UI_CTRL, pCloneBitmap != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
894
895                 delete __pBitmapOfEmptyTableView;
896                 __pBitmapOfEmptyTableView = pCloneBitmap;
897         }
898
899         return __pTableViewPresenter->SetStatusChanged(true);
900 }
901
902 Variant
903 _TableView::GetPropertyTextColorOfEmptyTableView(void) const
904 {
905         return Variant(__textColorOfEmptyTableView);
906 }
907
908 Color
909 _TableView::GetTextColorOfEmptyTableView(void) const
910 {
911         Variant textColorOfEmptyTableView = GetProperty("textColorOfEmptyTableView");
912
913         return textColorOfEmptyTableView.ToColor();
914 }
915
916 result
917 _TableView::SetPropertyTextColorOfEmptyTableView(const Variant& textColorOfEmptyTableView)
918 {
919         __textColorOfEmptyTableView = textColorOfEmptyTableView.ToColor();
920
921         return E_SUCCESS;
922 }
923
924 result
925 _TableView::SetTextColorOfEmptyTableView(const Color& color)
926 {
927         if (__textColorOfEmptyTableView == color)
928         {
929                 return E_SUCCESS;
930         }
931
932         result r = SetProperty("textColorOfEmptyTableView", Variant(color));
933
934         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
935
936         return __pTableViewPresenter->SetStatusChanged(true);
937 }
938
939 Variant
940 _TableView::GetPropertyTextOfEmptyTableView(void) const
941 {
942         return Variant(__textOfEmptyTableView);
943 }
944
945 String
946 _TableView::GetTextOfEmptyTableView(void) const
947 {
948         Variant textOfEmptyTableView = GetProperty("textOfEmptyTableView");
949
950         return textOfEmptyTableView.ToString();
951 }
952
953 result
954 _TableView::SetPropertyTextOfEmptyTableView(const Variant& textOfEmptyTableView)
955 {
956         __textOfEmptyTableView = textOfEmptyTableView.ToString();
957
958         return E_SUCCESS;
959 }
960
961 result
962 _TableView::SetTextOfEmptyTableView(const String& text)
963 {
964         if (__textOfEmptyTableView == text)
965         {
966                 return E_SUCCESS;
967         }
968
969         result r = SetProperty("textOfEmptyTableView", Variant(text));
970
971         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
972
973         return __pTableViewPresenter->SetStatusChanged(true);
974 }
975
976 void
977 _TableView::FireTableViewItemEvent(int groupIndex, int itemIndex, TableViewNotifyType type, _TableViewItem* pItem)
978 {
979         if (type == TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK)
980         {
981                 __pTableViewPresenter->GetModel()->SetItemChecked(groupIndex, itemIndex, true);
982         }
983         else if (type == TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK)
984         {
985                 __pTableViewPresenter->GetModel()->SetItemChecked(groupIndex, itemIndex, false);
986         }
987
988         if (__pTableViewItemEvent != null)
989         {
990                 _TableViewItemEventArg* pArg = new (std::nothrow) _TableViewItemEventArg(groupIndex, itemIndex, 0, 0, pItem, type);
991                 SysTryReturnVoidResult(NID_UI_CTRL, pArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
992                 __pTableViewItemEvent->Fire(*pArg);
993         }
994 }
995
996 void
997 _TableView::FireTableViewItemSweepEvent(int groupIndex, int itemIndex, TableViewSweepDirection directioin)
998 {
999         if (__pTableViewItemEvent != null)
1000         {
1001                 _TableViewItemEventArg* pArg = new (std::nothrow) _TableViewItemEventArg(groupIndex, itemIndex, directioin, 0, null, TABLEVIEW_NOTIFY_TYPE_ITEM_SWEPT);
1002                 SysTryReturnVoidResult(NID_UI_CTRL, pArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1003                 __pTableViewItemEvent->Fire(*pArg);
1004         }
1005 }
1006
1007 void
1008 _TableView::FireTableViewItemReorderEvent(int fromItemIndex, int toItemIndex)
1009 {
1010         if (__pTableViewItemEvent != null)
1011         {
1012                 _TableViewItemEventArg* pArg = new (std::nothrow) _TableViewItemEventArg(fromItemIndex, toItemIndex, 0, 0, null, TABLEVIEW_NOTIFY_TYPE_REORDERED_ITEM);
1013                 SysTryReturnVoidResult(NID_UI_CTRL, pArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1014                 __pTableViewItemEvent->Fire(*pArg);
1015         }
1016 }
1017 void
1018 _TableView::FireTableViewItemReorderEvent(int fromGroupIndex, int fromItemIndex, int toGroupIndex, int toItemIndex)
1019 {
1020         if (__pTableViewItemEvent != null)
1021         {
1022                 _TableViewItemEventArg* pArg = new (std::nothrow) _TableViewItemEventArg(fromGroupIndex, fromItemIndex, toGroupIndex, toItemIndex, null, TABLEVIEW_NOTIFY_TYPE_REORDERED_ITEM);
1023                 SysTryReturnVoidResult(NID_UI_CTRL, pArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1024                 __pTableViewItemEvent->Fire(*pArg);
1025         }
1026 }
1027
1028 void
1029 _TableView::FireTableViewContextItemActivationEvent(int groupIndex, int itemIndex, _TableViewItem* pItem, bool activated)
1030 {
1031         if (__pTableViewItemEvent != null)
1032         {
1033                 _TableViewItemEventArg* pArg = new (std::nothrow) _TableViewItemEventArg(groupIndex, itemIndex, 0, 0, pItem, TABLEVIEW_NOTIFY_TYPE_CONTEXT_ITEM_ACTIVATION, activated);
1034                 SysTryReturnVoidResult(NID_UI_CTRL, pArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1035                 __pTableViewItemEvent->Fire(*pArg);
1036         }
1037 }
1038
1039 result
1040 _TableView::ExpandGroup(int groupIndex)
1041 {
1042         if (IsOnProcessing())
1043         {
1044                 return E_INVALID_OPERATION;
1045         }
1046         return __pTableViewPresenter->ExpandGroup(groupIndex, true);
1047 }
1048
1049 result
1050 _TableView::CollapseGroup(int groupIndex)
1051 {
1052         if (IsOnProcessing())
1053         {
1054                 return E_INVALID_OPERATION;
1055         }
1056         return __pTableViewPresenter->CollapseGroup(groupIndex, true);
1057 }
1058
1059 bool
1060 _TableView::IsGroupExpanded(int groupIndex) const
1061 {
1062         return __pTableViewPresenter->IsGroupExpanded(groupIndex);
1063 }
1064
1065 result
1066 _TableView::ExpandAllGroup(bool animation)
1067 {
1068         if (IsOnProcessing())
1069         {
1070                 return E_INVALID_OPERATION;
1071         }
1072
1073         int groupCount = GetGroupCount();
1074
1075         for (int i = 0; i < groupCount; i++)
1076         {
1077                  __pTableViewPresenter->ExpandGroup(i, false);
1078         }
1079
1080         return E_SUCCESS;
1081 }
1082
1083 result
1084 _TableView::CollapseAllGroup(bool animation)
1085 {
1086         if (IsOnProcessing())
1087         {
1088                 return E_INVALID_OPERATION;
1089         }
1090
1091         int groupCount = GetGroupCount();
1092
1093         for (int i = 0; i < groupCount; i++)
1094         {
1095                  __pTableViewPresenter->CollapseGroup(i, false);
1096         }
1097
1098         return E_SUCCESS;
1099 }
1100
1101 void
1102 _TableView::StopExpandCollapseAnimation(void)
1103 {
1104         __pTableViewPresenter->StopExpandCollapseAnimation();
1105 }
1106
1107 void
1108 _TableView::SetGroupedLookEnabled(bool enable)
1109 {
1110         __groupedLookEnable = enable;
1111
1112         if (__tableViewStyle == TABLE_VIEW_STYLE_SECTION && !__groupedLookEnable)
1113         {
1114                 __pTableViewPresenter->SetLeftMargin(0);
1115         }
1116 }
1117
1118 bool
1119 _TableView::IsGroupedLookEnabled(void) const
1120 {
1121         return __groupedLookEnable;
1122 }
1123
1124 bool
1125 _TableView::GetFirstDrawnFlag(void) const
1126 {
1127         return __pTableViewPresenter->GetFirstDrawnFlag();
1128 }
1129
1130 int
1131 _TableView::GetMaxItemCachingSize(void) const
1132 {
1133         return __pTableViewPresenter->GetMaxItemCachingSize();
1134 }
1135
1136 result
1137 _TableView::OpenContextItem(int groupIndex, int itemIndex)
1138 {
1139         return __pTableViewPresenter->OpenContextItem(groupIndex, itemIndex);
1140 }
1141 result
1142 _TableView::CloseContextItem(int groupIndex, int itemIndex)
1143 {
1144         return __pTableViewPresenter->CloseContextItem(groupIndex, itemIndex);
1145 }
1146 bool
1147 _TableView::IsContextItemOpened(int groupIndex, int itemIndex) const
1148 {
1149         return __pTableViewPresenter->IsContextItemOpened(groupIndex, itemIndex);
1150 }
1151
1152 result
1153 _TableView::SetSectionHeaderTextHorizontalAlignment(int sectionIndex, HorizontalAlignment alignment)
1154 {
1155         return __pTableViewPresenter->SetSectionHeaderTextHorizontalAlignment(sectionIndex, alignment);
1156 }
1157
1158 HorizontalAlignment
1159 _TableView::GetSectionHeaderTextHorizontalAlignment(int sectionIndex) const
1160 {
1161         return __pTableViewPresenter->GetSectionHeaderTextHorizontalAlignment(sectionIndex);
1162 }
1163
1164 result
1165 _TableView::SetSectionFooterTextHorizontalAlignment(int sectionIndex, HorizontalAlignment alignment)
1166 {
1167         return __pTableViewPresenter->SetSectionFooterTextHorizontalAlignment(sectionIndex, alignment);
1168 }
1169
1170 HorizontalAlignment
1171 _TableView::GetSectionFooterTextHorizontalAlignment(int sectionIndex) const
1172 {
1173         return __pTableViewPresenter->GetSectionFooterTextHorizontalAlignment(sectionIndex);
1174 }
1175
1176 void
1177 _TableView::FireItemTouchReleasedEventDuringPressing(int groupIndex, int itemIndex)
1178 {
1179         __pTableViewPresenter->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex);
1180 }
1181
1182 void
1183 _TableView::OnDraw(void)
1184 {
1185         __pTableViewPresenter->Draw();
1186 }
1187
1188 void
1189 _TableView::OnChildAttached(const _Control& child)
1190 {
1191         _ScrollPanel::OnChildAttached(child);
1192 }
1193
1194 void
1195 _TableView::OnChildDetached(const _Control& child)
1196 {
1197         _ScrollPanel::OnChildDetached(child);
1198 }
1199
1200 void
1201 _TableView::OnBoundsChanged(void)
1202 {
1203         if (__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL || __scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL_FIXED || __scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_NONE)
1204         {
1205                 _Scroll* pScroll = _ScrollPanel::GetScrollBar();
1206                 if (pScroll == null)
1207                 {
1208                         FloatRectangle bounds = GetBoundsF();
1209
1210                         pScroll = _Scroll::CreateScrollN(*this,
1211                                                                                         SCROLL_DIRECTION_VERTICAL,
1212                                                                                         false,
1213                                                                                         false,
1214                                                                                         false,
1215                                                                                         false,
1216                                                                                         bounds.height,
1217                                                                                         bounds.height,
1218                                                                                         0);
1219                         SysTryReturnVoidResult(NID_UI_CTRL, pScroll != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1220
1221                         pScroll->EnableScrollingEffect(false);
1222                         pScroll->SetVisibleState(false);
1223                         _ScrollPanel::SetScrollBar(pScroll);
1224
1225                         pScroll->AddScrollEventListener(*this);
1226                         AttachSystemChild(*pScroll);
1227                 }
1228
1229                 if (__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL || __scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL_FIXED)
1230                 {
1231                         if (__pFastScroll == null)
1232                         {
1233                                 if (__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL_FIXED)
1234                                 {
1235                                         __pFastScroll = _FastScroll::CreateFastScrollN(*this, false);
1236                                 }
1237                                 else
1238                                 {
1239                                         __pFastScroll = _FastScroll::CreateFastScrollN(*this);
1240                                 }
1241
1242                                 if (__pFastScroll != null)
1243                                 {
1244                                         AttachSystemChild(*__pFastScroll);
1245                                 }
1246                         }
1247                         else
1248                         {
1249                                 __pFastScroll->OnParentBoundsChanged();
1250                         }
1251                 }
1252         }
1253         else
1254         {
1255                 _Scroll* pScroll = _ScrollPanel::GetScrollBar();
1256
1257                 if (pScroll == null)
1258                 {
1259                         FloatRectangle bounds = GetBoundsF();
1260
1261                         pScroll = _Scroll::CreateScrollN(*this,
1262                                                                                         SCROLL_DIRECTION_VERTICAL,
1263                                                                                         ((__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FIXED) ? false : true),
1264                                                                                         ((__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_JUMP_TO_TOP) ? true : false),
1265                                                                                         ((__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_THUMB) ? true : false),
1266                                                                                         ((__scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FIXED) ? true : false),
1267                                                                                         bounds.height,
1268                                                                                         bounds.height,
1269                                                                                         0);
1270                         SysTryReturnVoidResult(NID_UI_CTRL, pScroll != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1271
1272                         pScroll->EnableScrollingEffect(true);
1273                         _ScrollPanel::SetScrollBar(pScroll);
1274
1275                         pScroll->AddScrollEventListener(*this);
1276                         AttachSystemChild(*pScroll);
1277                 }
1278         }
1279
1280         _ScrollPanel::OnBoundsChanged();
1281 }
1282
1283 _UiTouchEventDelivery
1284 _TableView::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1285 {
1286         return __pTableViewPresenter->OnPreviewTouchPressed(source, touchinfo);
1287 }
1288
1289 _UiTouchEventDelivery
1290 _TableView::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1291 {
1292         return __pTableViewPresenter->OnPreviewTouchMoved(source, touchinfo);
1293 }
1294
1295 _UiTouchEventDelivery
1296 _TableView::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1297 {
1298         return __pTableViewPresenter->OnPreviewTouchReleased(source, touchinfo);
1299 }
1300
1301 _UiTouchEventDelivery
1302 _TableView::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1303 {
1304         return __pTableViewPresenter->OnPreviewTouchCanceled(source, touchinfo);
1305 }
1306
1307 bool
1308 _TableView::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1309 {
1310         return __pTableViewPresenter->OnTouchPressed(source, touchinfo);
1311 }
1312
1313 bool
1314 _TableView::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1315 {
1316         return __pTableViewPresenter->OnTouchMoved(source, touchinfo);
1317 }
1318
1319 bool
1320 _TableView::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1321 {
1322         return __pTableViewPresenter->OnTouchReleased(source, touchinfo);
1323 }
1324
1325 bool
1326 _TableView::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1327 {
1328         return __pTableViewPresenter->OnTouchCanceled(source, touchinfo);
1329 }
1330
1331 bool
1332 _TableView::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
1333 {
1334         return __pTableViewPresenter->OnFlickGestureDetected(gesture);
1335 }
1336
1337 bool
1338 _TableView::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
1339 {
1340         return __pTableViewPresenter->OnFlickGestureCanceled(gesture);
1341 }
1342
1343 result
1344 _TableView::SetTableViewStatusChanged(bool changed)
1345 {
1346         return __pTableViewPresenter->SetStatusChanged(changed);
1347 }
1348
1349 bool
1350 _TableView::IsOnProcessing(void)
1351 {
1352         _TableViewItemProviderAdaptor* pProviderAdapter = __pTableViewPresenter->GetTableViewItemProviderAdaptor();
1353         if (pProviderAdapter != null)
1354         {
1355                 if (pProviderAdapter->IsOnProcessing())
1356                 {
1357                         return true;
1358                 }
1359         }
1360
1361         return false;
1362 }
1363
1364 VisualElementValueAnimation*
1365 _TableView::GetVisualElementValueAnimation(const Tizen::Base::String& keyName) const
1366 {
1367         ClearLastResult();
1368
1369         VisualElementValueAnimation* pAnimation = null;
1370
1371         if (keyName == L"EXPAND_GROUP_ANIMATION")
1372         {
1373                 pAnimation = __pExpandGroupAnimation;
1374         }
1375         else if (keyName == L"COLLAPSE_GROUP_ANIMATION")
1376         {
1377                 pAnimation = __pCollapseGroupAnimation;
1378         }
1379         else if (keyName == L"SWEEP_ITEM_ANIMATION")
1380         {
1381                 pAnimation = __pSweptAnimation;
1382         }
1383         else if (keyName == L"REMOVE_ITEM_ANIMATION")
1384         {
1385                 pAnimation = __pRemoveItemtAnimation;
1386         }
1387
1388         return pAnimation;
1389 }
1390
1391 bool
1392 _TableView::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1393 {
1394         return __pTableViewPresenter->OnKeyPressed(source, keyInfo);
1395 }
1396
1397 bool
1398 _TableView::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1399 {
1400         return __pTableViewPresenter->OnKeyReleased(source, keyInfo);
1401 }
1402
1403 bool
1404 _TableView::IsChildControlFocusManage(void) const
1405 {
1406         return true;
1407 }
1408
1409 void
1410 _TableView::OnDrawFocus(void)
1411 {
1412         return __pTableViewPresenter->OnDrawFocus();
1413 }
1414
1415 void
1416 _TableView::OnFocusModeStateChanged(void)
1417 {
1418         return __pTableViewPresenter->OnFocusModeStateChanged();
1419 }
1420 }}} // Tizen::Ui::Controls