Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fwl / src / lightwidget / barcode.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_Barcode* CFWL_Barcode::Create()\r
9 {\r
10     return FX_NEW CFWL_Barcode;\r
11 }\r
12 FWL_ERR CFWL_Barcode::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     prop.m_pDataProvider = &m_barcodeData;\r
25     if (m_pProperties->m_pParent) {\r
26         prop.m_pParent = m_pProperties->m_pParent->GetWidget();\r
27     }\r
28     if (m_pProperties->m_pOwner) {\r
29         prop.m_pOwner = m_pProperties->m_pOwner->GetWidget();\r
30     }\r
31     m_pImp = IFWL_Barcode::Create();\r
32     FWL_ERR ret = ((IFWL_Barcode*)m_pImp)->Initialize(prop);\r
33     if (ret == FWL_ERR_Succeeded) {\r
34         CFWL_Widget::Initialize();\r
35     }\r
36     return ret;\r
37 }\r
38 CFWL_Barcode::CFWL_Barcode()\r
39 {\r
40 }\r
41 CFWL_Barcode::~CFWL_Barcode()\r
42 {\r
43 }\r
44 void CFWL_Barcode::SetType(BC_TYPE type)\r
45 {\r
46     _FWL_RETURN_IF_FAIL(m_pImp);\r
47     ((IFWL_Barcode*)m_pImp)->SetType(type);\r
48 }\r
49 FX_BOOL CFWL_Barcode::IsProtectedType()\r
50 {\r
51     _FWL_RETURN_VALUE_IF_FAIL(m_pImp, 0);\r
52     return ((IFWL_Barcode*)m_pImp)->IsProtectedType();\r
53 }\r
54 FWL_ERR CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget *pWidget, CFX_WideString &wsCaption)\r
55 {\r
56     return FWL_ERR_Succeeded;\r
57 }\r