2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
19 * @file FGrp_TextTextSimple.h
20 * @brief This is the header file for the TextSimple class.
22 * This header file contains the declarations of the TextSimple class.
25 #ifndef _FGRP_INTERNAL_TEXT_SIMPLE_H_
26 #define _FGRP_INTERNAL_TEXT_SIMPLE_H_
29 #include "FGrp_TextCommon.h"
30 #include "FGrp_TextTextElement.h"
32 namespace Tizen { namespace Graphics
47 class _OSP_EXPORT_ TextSimple
51 TextSimple(const wchar_t* pText, int length, TextElementSourceType sourceType = TEXT_ELEMENT_SOURCE_TYPE_INTERNAL, Font* pFont = null,
52 const Color& foregroundColor = Color::GetColor(COLOR_ID_BLACK), const Color& backgroundColor = Color::GetColor(COLOR_ID_WHITE),
53 const Color& outlineColor = 0);
55 virtual ~TextSimple(void);
58 virtual result Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength,
59 const TextObjectAlignment alignment, const TextObjectActionType action);
61 virtual result Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength,
62 const TextObjectAlignment alignment, const TextObjectActionType action);
64 virtual int ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
65 int& actualLength, int& width, int& height);
67 virtual int ForwardAnalyze(int startTextIndex, int textLength, float maxWidth, TextObjectWrapType wrap,
68 int& actualLength, float& width, float& height);
70 virtual TextElement* CloneN(TextComponentInfoValueType type, unsigned int value);
72 virtual TextElement* CopyN(int startTextIndex, int textLength);
74 virtual result GetRegion(int textIndex, int textLength, int& width, int& height) const;
76 virtual result GetRegion(int textIndex, int textLength, float& width, float& height) const;
78 virtual int GetHeight(void) const;
80 virtual float GetHeightF(void) const;
82 virtual unsigned int GetValue(TextComponentInfoValueType type) const;
84 virtual result SetValue(TextComponentInfoValueType type, unsigned int value);
86 virtual result ChangeTextOffset(wchar_t* pText, int gap);
88 virtual result SetTextOffset(int offset);
90 virtual int GetBaseline(void) const;
92 virtual float GetBaselineF(void) const;
94 int GetTextOffset(void) const;
96 result SetFont(const Font* pFont);
98 virtual const Font* GetFont(void) const;
100 virtual void SetForegroundColor(const Color& color);
102 virtual Color GetForegroundColor(void) const;
104 virtual void SetBackgroundColor(const Color& color);
106 virtual Color GetBackgroundColor(void) const;
108 void SetOutlineColor(const Color& color);
110 Color GetOutlineColor(void) const;
112 virtual void SetBackGroundDrawingModeEnabled(bool enable);
114 virtual bool IsBackGroundDrawingModeEnable(void) const;
116 const wchar_t* GetTextSource(void) const;
118 const wchar_t* GetText(void) const;
120 bool IsSame(wchar_t* pText, Font* pFont, const Color& foregroundColor,
121 const Color& backgroundColor, const Color& outlineColor, const bool isBitmapDisplayMode) const;
123 void SetUserWrap(TextObjectWrapType userWrap);
125 int GetWordLength(int textIndex, int& wordLength) const;
127 result SetBitmap(const Bitmap& bitmap);
129 result SetBitmap(BitmapDisplayProperty bitmapDisplayProperty);
131 const Bitmap* GetBitmap(void) const;
133 bool IsBitmapDisplayMode(void) const;
136 static int ConvertEnterToSpace(wchar_t* pDstText, const wchar_t* pSrcText, int textLength);
138 bool IsKorean(const wchar_t* ch) const;
140 bool IsChinese(const wchar_t* ch) const;
142 bool IsJapanese(const wchar_t* ch) const;
144 int GetSentenceLength(const wchar_t* pText, int textLength, int& actualLength) const;
146 int GetWordWrapLength(const wchar_t* pText, int textLength, int& actualLength) const;
148 int GetWordWrapLengthEx(const wchar_t* pText, int textLength, int& actualLength) const;
150 int GetGlyphedLength(const wchar_t* pText, int textLength, int& actualLength) const;
153 virtual Font* GetCurrentFont(void) const;
155 virtual Color GetCurrentForegroundColor(void) const;
157 virtual Color GetCurrentBackgroundColor(void) const;
159 virtual Color GetCurrentOutlineColor(void) const;
162 const wchar_t* _pText;
164 TextObjectWrapType _userWrap;
165 Color _foregroundColor;
166 Color _backgroundColor;
170 bool _isBackgroundDrawingModeEnabled;
173 BitmapDisplayProperty __bitmapProperty;
176 TextSimple(const TextSimple& other); // NOT IMPLMENTED
178 TextSimple& operator =(const TextSimple& rhs); // NOT IMPLMENTED
182 }}} // Tizen::Graphics::_Text
184 #endif // _FGRP_INTERNAL_TEXT_SIMPLE_H_