Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_ListViewContextItem.h
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_ListViewContextItem.h
20  * @brief       This is the header file for the FUiCtrl_ListViewContextItem class.
21  *
22  * This header file contains the declarations of the FUiCtrl_ListViewContextItem class.
23  */
24
25 #ifndef _FUI_CTRL_INTERNAL_LIST_VIEW_CONTEXT_ITEM_H_
26 #define _FUI_CTRL_INTERNAL_LIST_VIEW_CONTEXT_ITEM_H_
27
28 #include "FUi_Control.h"
29 #include "FUiCtrl_Button.h"
30 #include "FUiCtrl_IActionEventListener.h"
31 #include "FUiCtrl_LinkedList.h"
32 #include "FUiCtrl_TableViewItem.h"
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36
37 struct _ListViewContextItemElement
38 {
39         int elementId;
40         Tizen::Ui::Controls::_Button* pButton;
41 };
42
43 class _ListViewContextItem
44         : public Tizen::Ui::Controls::_TableViewItem
45 {
46 public:
47         _ListViewContextItem(int itemHeight);
48
49         virtual ~_ListViewContextItem(void);
50
51         static _ListViewContextItem* CreateListViewContextItemN(int itemHeight);
52
53         bool AddElement(int elementId, const Tizen::Base::String& text, bool enable = true);
54
55         bool AddElement(int elementId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap,
56                         const Tizen::Graphics::Bitmap* pHighlightedBitmap, bool enable = true);
57
58         bool AddElement(int elementId, const Tizen::Base::String& text, const Tizen::Graphics::Bitmap* pNormalBitmap,
59                         const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, bool enable = true);
60
61         int GetElementIdFromPosition(const Tizen::Graphics::Point& position) const;
62
63         void AddContextItemEventListener(Tizen::Ui::Controls::_IActionEventListener& listener);
64
65         void RemoveContextItemEventListener(Tizen::Ui::Controls::_IActionEventListener& listener);
66
67         void AdjustItemBounds(Tizen::Graphics::Rectangle& bounds);
68
69         virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
70
71 private:
72         _ListViewContextItem(const _ListViewContextItem& rhs);
73
74         _ListViewContextItem& operator =(const _ListViewContextItem& rhs);
75
76         _ListViewContextItemElement* GetElement(int elementId) const;
77
78         bool HasElement(int elementId);
79
80         void AdjustElementLayout(void);
81
82 private:
83         _LinkedList <_ListViewContextItemElement> __elements;
84
85         int __margin;
86         int __elementSpacing;
87         int __elementHeight;
88         int __textSize;
89 }; // _ListContextItem
90
91 }}} // Tizen::Ui::Controls
92
93 #endif // _FUI_CTRL_INTERNAL_LIST_VIEW_CONTEXT_ITEM_H_