Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUiCtrl_Label.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  * @file                FUiCtrl_Label.h
19  * @brief               This is the header file for the _Label class.
20  *
21  * This header file contains the declarations of the %_Label class.
22  */
23 #ifndef _FUI_CTRL_INTERNAL_LABEL_H_
24 #define _FUI_CTRL_INTERNAL_LABEL_H_
25
26 #include <FUiCtrlLabel.h>
27 #include "FUi_Control.h"
28
29 namespace Tizen { namespace Ui
30 {
31 class _AccessibilityElement;
32 }} // Tizen::Ui
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36 class _LabelPresenter;
37
38 /**
39  * @class _Label
40  * @brief
41  * @since       1.0
42  *
43  *
44  *
45  *
46  */
47
48 class _OSP_EXPORT_ _Label
49         : public Tizen::Ui::_Control
50         , virtual public Tizen::Base::Runtime::IEventListener
51         , virtual public Tizen::Ui::_IUiEventListener
52         , virtual public Tizen::Ui::_IUiEventPreviewer
53 {
54         DECLARE_CLASS_BEGIN(_Label, _Control);
55         DECLARE_PROPERTY("text", GetPropertyText, SetPropertyText);
56         DECLARE_PROPERTY("textColor", GetPropertyTextColor, SetPropertyTextColor);
57         DECLARE_PROPERTY("textSize", GetPropertyTextSize, SetPropertyTextSize);
58         DECLARE_CLASS_END();
59
60         result SetPropertyText(const Variant& text);
61         Variant GetPropertyText(void) const;
62         result SetPropertyTextColor(const Variant& color);
63         Variant GetPropertyTextColor(void) const;
64         result SetPropertyTextSize(const Variant& textSize);
65         Variant GetPropertyTextSize(void) const;
66
67 public:
68         virtual ~_Label(void);
69
70 public:
71         static _Label* CreateLabelN(void);
72
73         virtual void OnDraw(void);
74         virtual result OnAttachedToMainTree(void);
75         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
76         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
77         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
78         virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
79         virtual void OnTouchMoveHandled(const _Control& control);
80         virtual void OnBoundsChanged(void);
81         virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
82         virtual void OnFontInfoRequested(unsigned long& style, int& size);
83         virtual Tizen::Graphics::Dimension GetContentSize(void) const;
84
85 public:
86         result SetText(const Tizen::Base::String& text);
87         Tizen::Base::String GetText(void) const;
88
89         result SetTextConfig(int size, LabelTextStyle style);
90         int GetTextSize(void) const;
91         LabelTextStyle GetTextStyle(void) const;
92
93         result SetTextHorizontalAlignment(HorizontalAlignment alignment);
94         HorizontalAlignment GetTextHorizontalAlignment(void) const;
95         result SetTextVerticalAlignment(VerticalAlignment alignment);
96         VerticalAlignment GetTextVerticalAlignment(void) const;
97
98         result SetTextColor(const Tizen::Graphics::Color& color);
99         Tizen::Graphics::Color GetTextColor(void) const;
100
101         result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
102         Tizen::Graphics::Bitmap* GetBackgroundBitmap(void) const;
103
104         result SetBackgroundEffectBitmap(const Tizen::Graphics::Bitmap& bitmap);
105         Tizen::Graphics::Bitmap* GetBackgroundEffectBitmap(void) const;
106
107         unsigned long GetFontStyle(void) const;
108
109         result SetMargin(int topMargin, int leftMargin);
110         int GetTopMargin(void) const;
111         int GetLeftMargin(void) const;
112
113         Tizen::Graphics::Dimension GetContentSizeInternal(void) const;
114
115 protected:
116         result SetPresenter(const _LabelPresenter& labelPresenter);
117
118 private:
119         void InitializeAccessibilityElement(void);
120
121         _Label(void);
122         _Label(const _Label& rhs);
123         _Label& operator =(const _Label& rhs);
124
125 private:
126         _LabelPresenter* __pLabelPresenter;
127
128         Tizen::Base::String __text;
129         int __textSize;
130
131         HorizontalAlignment __horizontalAlignment;
132         VerticalAlignment __verticalAlignment;
133
134         Tizen::Graphics::Color __textColor;
135
136         Tizen::Graphics::Bitmap* __pBackgroundBitmap;
137         Tizen::Graphics::Bitmap* __pBackgroundEffectBitmap;
138
139         int __topMargin;
140         int __leftMargin;
141
142         Tizen::Ui::_AccessibilityElement* __pTextElement;
143 }; // _Label
144
145 }}} // Tizen::Ui::Controls
146
147 #endif  // _FUI_CTRL_INTERNAL_LABEL_H_