Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fwl / src / lightwidget / caret.cpp
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #include "../../../foxitlib.h"\r
8 CFWL_Caret* CFWL_Caret::Create()\r
9 {\r
10     return FX_NEW CFWL_Caret;\r
11 }\r
12 FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties *pProperties )\r
13 {\r
14     _FWL_RETURN_VALUE_IF_FAIL(!m_pImp, FWL_ERR_Indefinite);\r
15     if (pProperties) {\r
16         *m_pProperties = *pProperties;\r
17     }\r
18     CFWL_WidgetImpProperties prop;\r
19     prop.m_ctmOnParent = m_pProperties->m_ctmOnParent;\r
20     prop.m_rtWidget = m_pProperties->m_rtWidget;\r
21     prop.m_dwStyles = m_pProperties->m_dwStyles;\r
22     prop.m_dwStyleExes = m_pProperties->m_dwStyleExes;\r
23     prop.m_dwStates = m_pProperties->m_dwStates;\r
24     if (m_pProperties->m_pParent) {\r
25         prop.m_pParent = m_pProperties->m_pParent->GetWidget();\r
26     }\r
27     if (m_pProperties->m_pOwner) {\r
28         prop.m_pOwner = m_pProperties->m_pOwner->GetWidget();\r
29     }\r
30     m_pImp = IFWL_Caret::Create();\r
31     FWL_ERR ret = ((IFWL_Caret*)m_pImp)->Initialize(prop);\r
32     if (ret == FWL_ERR_Succeeded) {\r
33         CFWL_Widget::Initialize();\r
34     }\r
35     return ret;\r
36 }\r
37 FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag)\r
38 {\r
39     return ((IFWL_Caret*)m_pImp)->ShowCaret(bFlag);\r
40 }\r
41 FWL_ERR CFWL_Caret::GetFrequency(FX_DWORD &elapse)\r
42 {\r
43     return ((IFWL_Caret*)m_pImp)->GetFrequency(elapse);\r
44 }\r
45 FWL_ERR CFWL_Caret::SetFrequency(FX_DWORD elapse)\r
46 {\r
47     return ((IFWL_Caret*)m_pImp)->SetFrequency(elapse);\r
48 }\r
49 FWL_ERR CFWL_Caret::SetColor(CFX_Color crFill)\r
50 {\r
51     return ((IFWL_Caret*)m_pImp)->SetColor(crFill);\r
52 }\r
53 CFWL_Caret::CFWL_Caret()\r
54 {\r
55 }\r
56 CFWL_Caret::~CFWL_Caret()\r
57 {\r
58 }\r