1// Copyright 2014 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include <memory>
8
9#include "xfa/src/foxitlib.h"
10
11CFWL_Caret* CFWL_Caret::Create() {
12  return new CFWL_Caret;
13}
14FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) {
15  if (m_pIface)
16    return FWL_ERR_Indefinite;
17  if (pProperties) {
18    *m_pProperties = *pProperties;
19  }
20  std::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create(
21      m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
22  FWL_ERR ret = pCaret->Initialize();
23  if (ret != FWL_ERR_Succeeded) {
24    return ret;
25  }
26  m_pIface = pCaret.release();
27  CFWL_Widget::Initialize();
28  return FWL_ERR_Succeeded;
29}
30FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag) {
31  return static_cast<IFWL_Caret*>(m_pIface)->ShowCaret(bFlag);
32}
33FWL_ERR CFWL_Caret::GetFrequency(FX_DWORD& elapse) {
34  return static_cast<IFWL_Caret*>(m_pIface)->GetFrequency(elapse);
35}
36FWL_ERR CFWL_Caret::SetFrequency(FX_DWORD elapse) {
37  return static_cast<IFWL_Caret*>(m_pIface)->SetFrequency(elapse);
38}
39FWL_ERR CFWL_Caret::SetColor(CFX_Color crFill) {
40  return static_cast<IFWL_Caret*>(m_pIface)->SetColor(crFill);
41}
42CFWL_Caret::CFWL_Caret() {}
43CFWL_Caret::~CFWL_Caret() {}
44