Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_IconListItemDrawingProperty.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
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_IconListItemDrawingProperty.cpp
20  * @brief               This is the implementation file for the _IconListItemDrawingProperty class.
21  */
22
23 //Includes
24 #include <FBaseSysLog.h>
25 #include <FGrp_BitmapImpl.h>
26
27 #include "FUi_ResourceManager.h"
28 #include "FUiCtrl_IconListItemDrawingProperty.h"
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Graphics;
32 using namespace Tizen::Ui;
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36
37 _IconListItemDrawingProperty::_IconListItemDrawingProperty(void)
38         : __textSize(0)
39         , __pFont(null)
40         , __normalTextColor(0)
41         , __pressedTextColor(0)
42         , __highlightedTextColor(0)
43         , __size(0, 0)
44         , __bitmapBounds(0, 0, 0, 0)
45         , __pDropShadowBitmap(null)
46         , __pFocusDropShadowBitmap(null)
47         , __pDropShadowBitmapWithReplacementColor(null)
48         , __dropShadowBorderWidth(0)
49         , __dropShadowMargin(0)
50         , __pCheckBitmap(null)
51         , __pCheckedBackgroundBitmap(null)
52         , __pUnCheckedBackgroundBitmap(null)
53         , __pDisabledCheckBitmap(null)
54         , __checkMargin(0)
55         , __overlayMargin(0)
56         , __pressedBackgroundColor(0)
57         , __normalBorderColor(0)
58         , __focusBorderColor(0)
59         , __inTextBackgroundColor(0)
60         , __textYPos(0)
61         , __2LineTextYPos(0)
62         , __checkBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT)
63         , __borderStyle(ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE)
64         , __textHorizontalAlignment(ALIGNMENT_CENTER)
65         , __textVerticalAlignment(ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_INSIDE_BOTTOM)
66         , __refCount(1)
67         , __changed(true)
68         , __asAspectRatio(true)
69         , __checkedStyle(false)
70         , __verticalExtent(0)
71         , __insideOneLineTextHeight(0)
72         , __insideTwoLineTextHeight(0)
73         , __selectBackgroundMargin(0)
74         , __itemTextHorizontalMargin(0)
75         , __itemTextVerticalMargin(0)
76 {
77         // Do nothing
78 }
79
80 _IconListItemDrawingProperty::~_IconListItemDrawingProperty(void)
81 {
82         delete __pDropShadowBitmap;
83         __pDropShadowBitmap = null;
84
85         delete __pFocusDropShadowBitmap;
86         __pFocusDropShadowBitmap = null;
87
88         delete __pDropShadowBitmapWithReplacementColor;
89         __pDropShadowBitmapWithReplacementColor = null;
90
91         delete __pCheckBitmap;
92         __pCheckBitmap = null;
93
94         delete __pCheckedBackgroundBitmap;
95         __pCheckedBackgroundBitmap = null;
96
97         delete __pUnCheckedBackgroundBitmap;
98         __pUnCheckedBackgroundBitmap = null;
99
100         delete __pDisabledCheckBitmap;
101         __pDisabledCheckBitmap = null;
102 }
103
104 _IconListItemDrawingProperty*
105 _IconListItemDrawingProperty::CreateInstanceN(void)
106 {
107         _IconListItemDrawingProperty* pProperty = new (std::nothrow) _IconListItemDrawingProperty;
108         SysTryReturn(NID_UI_CTRL, (pProperty != null), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
109
110         result r = pProperty->Initialize();
111         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
112
113         return pProperty;
114
115 CATCH:
116         delete pProperty;
117
118         return null;
119 }
120
121 result
122 _IconListItemDrawingProperty::Initialize(void)
123 {
124         result r = E_SUCCESS;
125
126         int width = 0;
127         int height = 0;
128
129         // Load Drop Shadow Bitmap
130         GET_FIXED_VALUE_CONFIG(ICONLIST::DROP_SHADOW_BORDER, _CONTROL_ORIENTATION_PORTRAIT, __dropShadowBorderWidth);
131         GET_FIXED_VALUE_CONFIG(ICONLIST::DROP_SHADOW_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __dropShadowMargin);
132         GET_FIXED_VALUE_CONFIG(ICONLIST::DROP_SHADOW_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, width);
133         GET_FIXED_VALUE_CONFIG(ICONLIST::DROP_SHADOW_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, height);
134
135         if (width > 0 && height > 0)
136         {
137                 r = GET_BITMAP_CONFIG_N(ICONLIST::ITEM_BORDER_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDropShadowBitmap);
138                 if (r != E_SUCCESS)
139                 {
140                         delete __pDropShadowBitmap;
141                         __pDropShadowBitmap = null;
142
143                         SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
144                         return r;
145                 }
146
147                 r = GET_BITMAP_CONFIG_N(ICONLIST::ITEM_BORDER_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pFocusDropShadowBitmap);
148                 if (r != E_SUCCESS)
149                 {
150                         delete __pFocusDropShadowBitmap;
151                         __pFocusDropShadowBitmap = null;
152
153                         SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
154                         return r;
155                 }
156         }
157
158         // Load Check Bitmap
159         GET_FIXED_VALUE_CONFIG(ICONLIST::CHECKBOX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __checkMargin);
160
161         Dimension dimension(0, 0);
162         GET_DIMENSION_CONFIG(ICONLIST::CHECKBOX_SIZE, _CONTROL_ORIENTATION_PORTRAIT, dimension);
163         width = dimension.width;
164         height = dimension.height;
165
166         if (width > 0 && height > 0)
167         {
168                 r = GET_BITMAP_CONFIG_N(ICONLIST::CHECK_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pCheckBitmap);
169                 if (r != E_SUCCESS)
170                 {
171                         delete __pCheckBitmap;
172                         __pCheckBitmap = null;
173
174                         SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
175                         return r;
176                 }
177
178                 r = GET_BITMAP_CONFIG_N(ICONLIST::CHECK_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pCheckedBackgroundBitmap);
179                 if (r != E_SUCCESS)
180                 {
181                         delete __pCheckedBackgroundBitmap;
182                         __pCheckedBackgroundBitmap = null;
183
184                         SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
185                         return r;
186                 }
187
188                 r = GET_BITMAP_CONFIG_N(ICONLIST::CHECK_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pUnCheckedBackgroundBitmap);
189                 if (r != E_SUCCESS)
190                 {
191                         delete __pUnCheckedBackgroundBitmap;
192                         __pUnCheckedBackgroundBitmap = null;
193
194                         SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
195                         return r;
196                 }
197         }
198
199         // Load overaly bitmap margin
200         GET_FIXED_VALUE_CONFIG(ICONLIST::OVERLAY_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __overlayMargin);
201
202         // Load item press state background color
203         GET_COLOR_CONFIG(ICONLIST::ITEM_BG_PRESSED, __pressedBackgroundColor);
204         __pressedBackgroundColor.SetAlpha(0x80);
205
206         // Load border color
207         GET_COLOR_CONFIG(ICONLIST::ITEM_BORDER_NORMAL, __normalBorderColor);
208         GET_COLOR_CONFIG(ICONLIST::ITEM_BORDER_HIGHLIGHTED, __focusBorderColor);
209
210         // Load Drop Shadow Bitmap with Replacement Color
211         if (__pDropShadowBitmap != null)
212         {
213                 __pDropShadowBitmapWithReplacementColor = _BitmapImpl::GetColorReplacedBitmapN(*__pDropShadowBitmap,
214                                 Color::GetColor(COLOR_ID_MAGENTA), __normalBorderColor);
215                 SysTryReturn(NID_UI_CTRL, (__pDropShadowBitmapWithReplacementColor != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
216         }
217
218         // Load Item Text Size & color
219         GET_SHAPE_CONFIG(ICONLIST::FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __textSize);
220
221         GET_COLOR_CONFIG(ICONLIST::TEXT_NORMAL, __normalTextColor);
222         GET_COLOR_CONFIG(ICONLIST::TEXT_PRESSED, __pressedTextColor);
223         GET_COLOR_CONFIG(ICONLIST::TEXT_HIGHLIGHTED, __highlightedTextColor);
224
225         GET_COLOR_CONFIG(ICONLIST::INNER_TEXT_BG_NORMAL, __inTextBackgroundColor);
226         __inTextBackgroundColor.SetAlpha(0x80);
227
228         // Load Item text height
229         GET_SHAPE_CONFIG(ICONLIST::VERTICAL_EXTENT, _CONTROL_ORIENTATION_PORTRAIT, __verticalExtent);
230         GET_SHAPE_CONFIG(ICONLIST::INSIDE_ONE_LINE_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __insideOneLineTextHeight);
231         GET_SHAPE_CONFIG(ICONLIST::INSIDE_TWO_LINE_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __insideTwoLineTextHeight);
232
233         // Load item margin
234         GET_FIXED_VALUE_CONFIG(ICONLIST::SELECT_BG_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __selectBackgroundMargin);
235         GET_FIXED_VALUE_CONFIG(ICONLIST::TEXT_HORIZONTAL_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __itemTextHorizontalMargin);
236         GET_FIXED_VALUE_CONFIG(ICONLIST::TEXT_VERTICAL_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __itemTextVerticalMargin);
237
238         return r;
239 }
240
241 const Color
242 _IconListItemDrawingProperty::GetBackgroundColor(IconListViewItemDrawingStatus status) const
243 {
244         SysTryReturn(NID_UI_CTRL,
245                                 (status >= ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL && status <= ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED),
246                                 Color(0), E_INVALID_ARG, "[E_INVALID_ARG] Invalid value of drawing status is used.");
247
248         ClearLastResult();
249         if (status == ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED)
250         {
251                 return __pressedBackgroundColor;
252         }
253         return Color(0, 0, 0, 0);
254 }
255
256 result
257 _IconListItemDrawingProperty::SetTextSize(int size)
258 {
259         int minSize = 0;
260         GET_FIXED_VALUE_CONFIG(ICONLIST::MINIMUM_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, minSize);
261         SysTryReturn(NID_UI_CTRL, (size >= minSize), E_INVALID_ARG, E_INVALID_ARG,
262                                 "[E_INVALID_ARG] Invalid argument is used. Font size should be greater than or equal to the minimum size.");
263
264         if (__textSize != size)
265         {
266                 __textSize = size;
267         }
268
269         return E_SUCCESS;
270 }
271
272 int
273 _IconListItemDrawingProperty::GetTextSize(void) const
274 {
275         ClearLastResult();
276         return __textSize;
277 }
278
279 result
280 _IconListItemDrawingProperty::SetFont(Font* pFont)
281 {
282         SysTryReturn(NID_UI_CTRL, pFont != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used.");
283
284         if (pFont == __pFont)
285         {
286                 return E_SUCCESS;
287         }
288
289         __pFont = pFont;
290
291         int oldVerticalExtent = __verticalExtent;
292         int defaultTextSize = 0;
293         GET_SHAPE_CONFIG(ICONLIST::FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, defaultTextSize);
294
295         if (__textSize != defaultTextSize)
296         {
297                 int leading = _FontImpl::GetInstance(*__pFont)->GetLeading();
298                 __insideOneLineTextHeight = leading + __itemTextVerticalMargin * 2;
299                 __insideTwoLineTextHeight = (leading << 1) + __itemTextVerticalMargin * 2;
300                 __verticalExtent = __insideTwoLineTextHeight;
301         }
302         else
303         {
304                 GET_SHAPE_CONFIG(ICONLIST::VERTICAL_EXTENT, _CONTROL_ORIENTATION_PORTRAIT, __verticalExtent);
305                 GET_SHAPE_CONFIG(ICONLIST::INSIDE_ONE_LINE_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __insideOneLineTextHeight);
306                 GET_SHAPE_CONFIG(ICONLIST::INSIDE_TWO_LINE_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __insideTwoLineTextHeight);
307         }
308
309         if (__textVerticalAlignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
310         {
311                 __size.height -= oldVerticalExtent;
312                 __size.height = __size.height + __insideTwoLineTextHeight;
313         }
314
315         __changed = true;
316
317         // Adjust layout of Item.
318         return SetItemLayout();
319 }
320
321 Font*
322 _IconListItemDrawingProperty::GetFont(void) const
323 {
324         return __pFont;
325 }
326
327 result
328 _IconListItemDrawingProperty::SetTextColor(IconListViewItemDrawingStatus status, const Color color)
329 {
330         SysTryReturn(NID_UI_CTRL,
331                                 (status >= ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL && status <= ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED),
332                                 E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Invalid value of drawing status.");
333
334         if (status == ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL)
335         {
336                 __normalTextColor = color;
337         }
338         else if (status == ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED)
339         {
340                 __pressedTextColor = color;
341         }
342         else
343         {
344                 __highlightedTextColor = color;
345         }
346
347         __changed = true;
348         return E_SUCCESS;
349 }
350
351 const Color
352 _IconListItemDrawingProperty::GetTextColor(IconListViewItemDrawingStatus status) const
353 {
354         SysTryReturn(NID_UI_CTRL,
355                                 (status >= ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL && status <= ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED),
356                                 Color(0), E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Invalid value of drawing status.");
357
358         ClearLastResult();
359
360         if (status == ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL)
361         {
362                 return __normalTextColor;
363         }
364         else if (status == ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED)
365         {
366                 return __pressedTextColor;
367         }
368         else
369         {
370                 return __highlightedTextColor;
371         }
372 }
373
374 const Color
375 _IconListItemDrawingProperty::GetTextBackgroundColor(void) const
376 {
377         if (__textVerticalAlignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
378         {
379                 return Color(0, 0, 0, 0);
380         }
381         return __inTextBackgroundColor;
382 }
383
384 const Color
385 _IconListItemDrawingProperty::GetBorderColor(bool isFocused) const
386 {
387         return isFocused ? __focusBorderColor : __normalBorderColor;
388 }
389
390 result
391 _IconListItemDrawingProperty::SetItemLayout(void)
392 {
393         SysTryReturn(
394                         NID_UI_CTRL,
395                         (__textVerticalAlignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_INSIDE_TOP && __textVerticalAlignment <=
396                                         ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_BOTTOM), E_SYSTEM, E_SYSTEM,
397                                         "[E_SYSTEM] A system error has been occurred. The current state of vertical text alignment is not valid.");
398
399         switch (__textVerticalAlignment)
400         {
401         case ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_INSIDE_TOP:
402                 __textYPos = 0;
403                 __2LineTextYPos = __textYPos;
404                 break;
405
406         case ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_INSIDE_MIDDLE:
407                 __textYPos = (__size.height - __insideOneLineTextHeight) >> 1;
408                 __2LineTextYPos = (__size.height - __insideTwoLineTextHeight) >> 1;
409                 break;
410
411         case ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_INSIDE_BOTTOM:
412                 __textYPos = __size.height - __insideOneLineTextHeight;
413                 __2LineTextYPos = __size.height - __insideTwoLineTextHeight;
414                 break;
415
416         case ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP:
417                 __textYPos = __insideOneLineTextHeight - __itemTextVerticalMargin;
418                 __2LineTextYPos = 0;
419                 break;
420
421         case ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_BOTTOM:
422                 __textYPos = __size.height - __verticalExtent;
423                 __2LineTextYPos = __textYPos;
424                 break;
425         }
426         __changed = true;
427
428         return E_SUCCESS;
429 }
430
431 result
432 _IconListItemDrawingProperty::SetItemBitmapBounds(const Rectangle bounds)
433 {
434         SysTryReturn(NID_UI_CTRL, (bounds.x >= 0 && bounds.y >= 0), E_INVALID_ARG, E_INVALID_ARG,
435                                 "[E_INVALID_ARG] Invalid argument is used. X and Y must be a non negative integer.");
436         SysTryReturn(NID_UI_CTRL, (bounds.width > 0 && bounds.height > 0), E_INVALID_ARG, E_INVALID_ARG,
437                                 "[E_INVALID_ARG] Invalid argument is used. Width and Height size should be larger than 0.");
438
439         __bitmapBounds = bounds;
440         __size.width = bounds.width;
441         __size.height = bounds.height;
442
443         if (__textVerticalAlignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
444         {
445                 __size.height += __insideTwoLineTextHeight;
446
447         }
448
449         return SetItemLayout();
450 }
451
452 const Rectangle
453 _IconListItemDrawingProperty::GetItemBitmapBounds(void) const
454 {
455         ClearLastResult();
456
457         Rectangle bounds(__bitmapBounds);
458         if (__textVerticalAlignment == ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
459         {
460                 bounds.y += __verticalExtent;
461         }
462
463         return bounds;
464 }
465
466 const Tizen::Graphics::Dimension
467 _IconListItemDrawingProperty::GetItemBitmapSize(void) const
468 {
469         ClearLastResult();
470         return Dimension(__bitmapBounds.width, __bitmapBounds.height);
471 }
472
473 result
474 _IconListItemDrawingProperty::SetItemSize(const Tizen::Graphics::Dimension size)
475 {
476         SysTryReturn(NID_UI_CTRL, (size.width > 0 && size.height > 0), E_INVALID_ARG, E_INVALID_ARG,
477                                 "[E_INVALID_ARG] Invalid argument is used. Width and Height size should be larger than 0.");
478
479         __size = size;
480         return E_SUCCESS;
481 }
482
483 const Tizen::Graphics::Dimension
484 _IconListItemDrawingProperty::GetItemSize(void) const
485 {
486         ClearLastResult();
487         return __size;
488 }
489
490 const int
491 _IconListItemDrawingProperty::GetTextXPosition(void) const
492 {
493         return __itemTextHorizontalMargin;
494 }
495
496 const int
497 _IconListItemDrawingProperty::GetTextYPosition(void) const
498 {
499         return __textYPos;
500 }
501
502 const int
503 _IconListItemDrawingProperty::GetTwoLineTextYPosition(void) const
504 {
505         return __2LineTextYPos;
506 }
507
508 const int
509 _IconListItemDrawingProperty::GetTextAreaWidth(void) const
510 {
511         return __bitmapBounds.width - __itemTextHorizontalMargin * 2;
512 }
513
514 const int
515 _IconListItemDrawingProperty::GetTextVerticalMargin(void) const
516 {
517         return __itemTextVerticalMargin;
518 }
519
520 result
521 _IconListItemDrawingProperty::SetCheckBoxPosition(IconListViewCheckBoxPosition position)
522 {
523         SysTryReturn(
524                 NID_UI_CTRL,
525                 (position >= ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT && position <= ICON_LIST_VIEW_CHECK_BOX_POSITION_BOTTOM_RIGHT),
526                 E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Invalid position of CheckBox is used.");
527
528         __checkBoxPosition = position;
529         __changed = true;
530
531         return E_SUCCESS;
532 }
533
534 IconListViewCheckBoxPosition
535 _IconListItemDrawingProperty::GetCheckBoxPosition(void) const
536 {
537         return __checkBoxPosition;
538 }
539
540 result
541 _IconListItemDrawingProperty::SetBorderStyle(IconListViewItemBorderStyle style)
542 {
543         SysTryReturn(NID_UI_CTRL, (style >= ICON_LIST_VIEW_ITEM_BORDER_STYLE_NONE && style <= ICON_LIST_VIEW_ITEM_BORDER_STYLE_SHADOW),
544                         E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Invalid item border style is used.");
545
546         __borderStyle = style;
547         __changed = true;
548
549         return E_SUCCESS;
550 }
551
552 IconListViewItemBorderStyle
553 _IconListItemDrawingProperty::GetBorderStyle(void) const
554 {
555         ClearLastResult();
556         return __borderStyle;
557 }
558
559 result
560 _IconListItemDrawingProperty::SetTextHorizontalAlignment(HorizontalAlignment alignment)
561 {
562         SysTryReturn(NID_UI_CTRL, (alignment >= ALIGNMENT_LEFT && alignment <= ALIGNMENT_RIGHT), E_SYSTEM, E_SYSTEM,
563                                 "[E_SYSTEM] A system error has been occurred. Invalid horizontal text alignment is used.");
564
565         __textHorizontalAlignment = alignment;
566         __changed = true;
567
568         return E_SUCCESS;
569 }
570
571 HorizontalAlignment
572 _IconListItemDrawingProperty::GetTextHorizontalAlignment(void) const
573 {
574         return __textHorizontalAlignment;
575 }
576
577 result
578 _IconListItemDrawingProperty::SetTextVerticalAlignment(IconListViewItemTextVerticalAlignment alignment)
579 {
580         SysTryReturn(
581                         NID_UI_CTRL,
582                         (alignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_INSIDE_TOP && alignment <=
583                                         ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_BOTTOM),
584                                         E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Invalid vertical text alignment is used.");
585
586         if (alignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP
587                         && __textVerticalAlignment < ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
588         {
589                 __size.height = __size.height + __verticalExtent;
590         }
591         else if (alignment < ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP
592                         && __textVerticalAlignment >= ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
593         {
594                 __size.height -= __verticalExtent;
595         }
596
597         __textVerticalAlignment = alignment;
598         __changed = true;
599
600         // Adjust layout of Item.
601         return SetItemLayout();
602 }
603
604 IconListViewItemTextVerticalAlignment
605 _IconListItemDrawingProperty::GetTextVerticalAlignment(void) const
606 {
607         return __textVerticalAlignment;
608 }
609
610 const Tizen::Graphics::Bitmap*
611 _IconListItemDrawingProperty::GetDropShadowBitmap(void) const
612 {
613         return __pDropShadowBitmapWithReplacementColor;
614 }
615
616 const Tizen::Graphics::Bitmap*
617 _IconListItemDrawingProperty::GetFocusDropShadowBitmap(void) const
618 {
619         return __pFocusDropShadowBitmap;
620 }
621
622 int
623 _IconListItemDrawingProperty::GetDropShadowBorderWidth(void) const
624 {
625         return __dropShadowBorderWidth;
626 }
627
628 int
629 _IconListItemDrawingProperty::GetDropShadowMargin(void) const
630 {
631         return __dropShadowMargin;
632 }
633
634 const Rectangle
635 _IconListItemDrawingProperty::GetDropShadowBitmapBounds(void) const
636 {
637         Rectangle bounds(__bitmapBounds);
638         if (__textVerticalAlignment == ICON_LIST_VIEW_ITEM_TEXT_VERTICAL_ALIGNMENT_OUTSIDE_TOP)
639         {
640                 bounds.y += __verticalExtent;
641         }
642
643         return bounds;
644 }
645
646 const Tizen::Graphics::Bitmap*
647 _IconListItemDrawingProperty::GetCheckBitmap(void) const
648 {
649         return __pCheckBitmap;
650 }
651
652 const Tizen::Graphics::Bitmap*
653 _IconListItemDrawingProperty::GetCheckedBackgroundBitmap(void) const
654 {
655         return __pCheckedBackgroundBitmap;
656 }
657
658 const Tizen::Graphics::Bitmap*
659 _IconListItemDrawingProperty::GetUnCheckedBackgroundBitmap(void) const
660 {
661         return __pUnCheckedBackgroundBitmap;
662 }
663
664 const Tizen::Graphics::Bitmap*
665 _IconListItemDrawingProperty::GetDisabledCheckBitmap(void) const
666 {
667         return __pDisabledCheckBitmap;
668 }
669
670 void
671 _IconListItemDrawingProperty::SetItemCheckedStyle(bool checkStyle)
672 {
673         __checkedStyle = checkStyle;
674 }
675
676 bool
677 _IconListItemDrawingProperty::IsItemCheckedStyle(void) const
678 {
679         return __checkedStyle;
680 }
681
682 int
683 _IconListItemDrawingProperty::GetCheckMargin(void) const
684 {
685         return __checkMargin;
686 }
687
688 int
689 _IconListItemDrawingProperty::GetOverlayMargin(void) const
690 {
691         return __overlayMargin;
692 }
693
694 int
695 _IconListItemDrawingProperty::GetSelectBackgroundMargin(void) const
696 {
697         return __selectBackgroundMargin;
698 }
699
700 void
701 _IconListItemDrawingProperty::SetDrawingFlag(void)
702 {
703         __changed = false;
704 }
705
706 bool
707 _IconListItemDrawingProperty::IsChanged(void) const
708 {
709         return __changed;
710 }
711
712 int
713 _IconListItemDrawingProperty::AddRef(void)
714 {
715         return ++__refCount;
716 }
717
718 int
719 _IconListItemDrawingProperty::Release(void)
720 {
721         --__refCount;
722         if (__refCount <= 0)
723         {
724                 delete this;
725                 return 0;
726         }
727
728         return __refCount;
729 }
730
731 void
732 _IconListItemDrawingProperty::SetItemBitmapAsAspectRatio(bool isAspect)
733 {
734         __asAspectRatio = isAspect;
735 }
736
737 bool
738 _IconListItemDrawingProperty::IsItemBitmapAsAspectRatio(void) const
739 {
740         return __asAspectRatio;
741 }
742
743 }}} // Tizen::Ui::Controls