2 Copyright (C) 2011 Samsung Electronics
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "ewk_text_style.h"
23 #include <WebCore/IntPoint.h>
25 struct _Ewk_Text_Style {
26 Ewk_Text_Style_State underlineState;
27 Ewk_Text_Style_State italicState;
28 Ewk_Text_Style_State boldState;
31 Evas_Point startPoint;
36 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
37 Ewk_Text_Style* ewkTextStyleCreate(int underlineState, int italicState, int boldState, const WebCore::IntPoint& startPoint, const WebCore::IntPoint& endPoint)
40 Ewk_Text_Style* textStyle = new Ewk_Text_Style;
42 textStyle->underlineState = static_cast<Ewk_Text_Style_State>(underlineState);
43 textStyle->italicState = static_cast<Ewk_Text_Style_State>(italicState);
44 textStyle->boldState = static_cast<Ewk_Text_Style_State>(boldState);
46 textStyle->position.startPoint.x = startPoint.x();
47 textStyle->position.startPoint.y = startPoint.y();
48 textStyle->position.endPoint.x = endPoint.x();
49 textStyle->position.endPoint.y = endPoint.y();
54 void ewkTextStyleDelete(Ewk_Text_Style* textStyle)
56 EINA_SAFETY_ON_NULL_RETURN(textStyle);
62 Ewk_Text_Style_State ewk_text_style_underline_get(Ewk_Text_Style* textStyle)
64 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
65 EINA_SAFETY_ON_NULL_RETURN_VAL(textStyle, EWK_TEXT_STYLE_STATE_FALSE);
67 return textStyle->underlineState;
69 return EWK_TEXT_STYLE_STATE_FALSE;
73 Ewk_Text_Style_State ewk_text_style_italic_get(Ewk_Text_Style* textStyle)
75 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
76 EINA_SAFETY_ON_NULL_RETURN_VAL(textStyle, EWK_TEXT_STYLE_STATE_FALSE);
78 return textStyle->italicState;
80 return EWK_TEXT_STYLE_STATE_FALSE;
84 Ewk_Text_Style_State ewk_text_style_bold_get(Ewk_Text_Style* textStyle)
86 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
87 EINA_SAFETY_ON_NULL_RETURN_VAL(textStyle, EWK_TEXT_STYLE_STATE_FALSE);
89 return textStyle->boldState;
91 return EWK_TEXT_STYLE_STATE_FALSE;
95 Eina_Bool ewk_text_style_position_get(Ewk_Text_Style* textStyle, Evas_Point* startPoint, Evas_Point* endPoint)
97 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
98 EINA_SAFETY_ON_NULL_RETURN_VAL(textStyle, false);
100 startPoint->x = textStyle->position.startPoint.x;
101 startPoint->y = textStyle->position.startPoint.y;
103 endPoint->x = textStyle->position.endPoint.x;
104 endPoint->y = textStyle->position.endPoint.y;