Revert " modify license, permission and remove ^M char"
[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       2.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         virtual Tizen::Graphics::FloatDimension GetContentSizeF(void) const;
85
86 public:
87         result SetText(const Tizen::Base::String& text);
88         Tizen::Base::String GetText(void) const;
89
90         result SetTextConfig(int size, LabelTextStyle style);
91         result SetTextConfig(float size, LabelTextStyle style);
92         int GetTextSize(void) const;
93         float GetTextSizeF(void) const;
94         LabelTextStyle GetTextStyle(void) const;
95
96         result SetTextHorizontalAlignment(HorizontalAlignment alignment);
97         HorizontalAlignment GetTextHorizontalAlignment(void) const;
98         result SetTextVerticalAlignment(VerticalAlignment alignment);
99         VerticalAlignment GetTextVerticalAlignment(void) const;
100
101         result SetTextColor(const Tizen::Graphics::Color& color);
102         Tizen::Graphics::Color GetTextColor(void) const;
103
104         result SetBackgroundBitmap(const Tizen::Graphics::Bitmap& bitmap);
105         Tizen::Graphics::Bitmap* GetBackgroundBitmap(void) const;
106
107         result SetBackgroundEffectBitmap(const Tizen::Graphics::Bitmap& bitmap);
108         Tizen::Graphics::Bitmap* GetBackgroundEffectBitmap(void) const;
109
110         unsigned long GetFontStyle(void) const;
111
112         result SetMargin(int topMargin, int leftMargin);
113         result SetMargin(int leftMargin, int topMargin, int rightMargin, int bottomMargin);
114         int GetLeftMargin(void) const;
115         int GetTopMargin(void) const;
116         int GetRightMargin(void) const;
117         int GetBottomMargin(void) const;
118
119         result SetMargin(float topMargin, float leftMargin);
120         result SetMargin(float leftMargin, float topMargin, float rightMargin, float bottomMargin);
121         float GetLeftMarginF(void) const;
122         float GetTopMarginF(void) const;
123         float GetRightMarginF(void) const;
124         float GetBottomMarginF(void) const;
125
126         Tizen::Graphics::FloatDimension GetContentSizeInternalF(void) const;
127
128 protected:
129         result SetPresenter(const _LabelPresenter& labelPresenter);
130
131 private:
132         void InitializeAccessibilityElement(void);
133
134         _Label(void);
135         _Label(const _Label& rhs);
136         _Label& operator =(const _Label& rhs);
137
138 private:
139         _LabelPresenter* __pLabelPresenter;
140
141         Tizen::Base::String __text;
142         float __textSize;
143
144         HorizontalAlignment __horizontalAlignment;
145         VerticalAlignment __verticalAlignment;
146
147         Tizen::Graphics::Color __textColor;
148
149         Tizen::Graphics::Bitmap* __pBackgroundBitmap;
150         Tizen::Graphics::Bitmap* __pBackgroundEffectBitmap;
151
152         float __leftMargin;
153         float __topMargin;
154         float __rightMargin;
155         float __bottomMargin;
156
157         Tizen::Ui::_AccessibilityElement* __pTextElement;
158
159         static const float SENSITIVE = 0.08f;
160 }; // _Label
161
162 }}} // Tizen::Ui::Controls
163
164 #endif  // _FUI_CTRL_INTERNAL_LABEL_H_