Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: xfa/fwl/lightwidget/cfwl_picturebox.cpp

Issue 1834323003: Move xfa/include/fwl/{theme,lightwidget} to xfa/fwl (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/include/fwl/lightwidget/picturebox.h" 7 #include "xfa/fwl/lightwidget/cfwl_picturebox.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 CFWL_PictureBox* CFWL_PictureBox::Create() { 11 CFWL_PictureBox* CFWL_PictureBox::Create() {
12 return new CFWL_PictureBox; 12 return new CFWL_PictureBox;
13 } 13 }
14
14 FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) { 15 FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
15 if (m_pIface) 16 if (m_pIface)
16 return FWL_ERR_Indefinite; 17 return FWL_ERR_Indefinite;
17 if (pProperties) { 18 if (pProperties) {
18 *m_pProperties = *pProperties; 19 *m_pProperties = *pProperties;
19 } 20 }
20 std::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create( 21 std::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create(
21 m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr)); 22 m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr));
22 FWL_ERR ret = pPictureBox->Initialize(); 23 FWL_ERR ret = pPictureBox->Initialize();
23 if (ret != FWL_ERR_Succeeded) { 24 if (ret != FWL_ERR_Succeeded) {
24 return ret; 25 return ret;
25 } 26 }
26 m_pIface = pPictureBox.release(); 27 m_pIface = pPictureBox.release();
27 CFWL_Widget::Initialize(); 28 CFWL_Widget::Initialize();
28 return FWL_ERR_Succeeded; 29 return FWL_ERR_Succeeded;
29 } 30 }
31
30 CFX_DIBitmap* CFWL_PictureBox::GetPicture() { 32 CFX_DIBitmap* CFWL_PictureBox::GetPicture() {
31 return m_PictureBoxDP.m_pBitmap; 33 return m_PictureBoxDP.m_pBitmap;
32 } 34 }
35
33 FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { 36 FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) {
34 m_PictureBoxDP.m_pBitmap = pBitmap; 37 m_PictureBoxDP.m_pBitmap = pBitmap;
35 return FWL_ERR_Succeeded; 38 return FWL_ERR_Succeeded;
36 } 39 }
40
37 FX_FLOAT CFWL_PictureBox::GetRotation() { 41 FX_FLOAT CFWL_PictureBox::GetRotation() {
38 return m_PictureBoxDP.m_fRotation; 42 return m_PictureBoxDP.m_fRotation;
39 } 43 }
44
40 FWL_ERR CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) { 45 FWL_ERR CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) {
41 m_PictureBoxDP.m_fRotation = fRotation; 46 m_PictureBoxDP.m_fRotation = fRotation;
42 return FWL_ERR_Succeeded; 47 return FWL_ERR_Succeeded;
43 } 48 }
49
44 int32_t CFWL_PictureBox::GetFlipMode() { 50 int32_t CFWL_PictureBox::GetFlipMode() {
45 return m_PictureBoxDP.GetFlipMode(m_pIface); 51 return m_PictureBoxDP.GetFlipMode(m_pIface);
46 } 52 }
53
47 FWL_ERR CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) { 54 FWL_ERR CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) {
48 m_PictureBoxDP.m_iFlipMode = iFlipMode; 55 m_PictureBoxDP.m_iFlipMode = iFlipMode;
49 return FWL_ERR_Succeeded; 56 return FWL_ERR_Succeeded;
50 } 57 }
58
51 int32_t CFWL_PictureBox::GetOpacity() { 59 int32_t CFWL_PictureBox::GetOpacity() {
52 return m_PictureBoxDP.GetOpacity(m_pIface); 60 return m_PictureBoxDP.GetOpacity(m_pIface);
53 } 61 }
62
54 FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) { 63 FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
55 m_PictureBoxDP.m_iOpacity = iOpacity; 64 m_PictureBoxDP.m_iOpacity = iOpacity;
56 return FWL_ERR_Succeeded; 65 return FWL_ERR_Succeeded;
57 } 66 }
67
58 FWL_ERR CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) { 68 FWL_ERR CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) {
59 CFX_Matrix matrix; 69 CFX_Matrix matrix;
60 m_PictureBoxDP.GetMatrix(m_pIface, matrix); 70 m_PictureBoxDP.GetMatrix(m_pIface, matrix);
61 matrix.Scale(fScaleX, fScaleY); 71 matrix.Scale(fScaleX, fScaleY);
62 return FWL_ERR_Succeeded; 72 return FWL_ERR_Succeeded;
63 } 73 }
74
64 FWL_ERR CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) { 75 FWL_ERR CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) {
65 m_PictureBoxDP.m_fScaleX = fScaleX; 76 m_PictureBoxDP.m_fScaleX = fScaleX;
66 m_PictureBoxDP.m_fScaleY = fScaleY; 77 m_PictureBoxDP.m_fScaleY = fScaleY;
67 return FWL_ERR_Succeeded; 78 return FWL_ERR_Succeeded;
68 } 79 }
80
69 FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) { 81 FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
70 CFX_Matrix matrix; 82 CFX_Matrix matrix;
71 m_PictureBoxDP.GetMatrix(m_pIface, matrix); 83 m_PictureBoxDP.GetMatrix(m_pIface, matrix);
72 fx = matrix.e; 84 fx = matrix.e;
73 fy = matrix.f; 85 fy = matrix.f;
74 return FWL_ERR_Succeeded; 86 return FWL_ERR_Succeeded;
75 } 87 }
88
76 FWL_ERR CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) { 89 FWL_ERR CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) {
77 m_PictureBoxDP.m_fOffSetX = fx; 90 m_PictureBoxDP.m_fOffSetX = fx;
78 m_PictureBoxDP.m_fOffSetY = fy; 91 m_PictureBoxDP.m_fOffSetY = fy;
79 return FWL_ERR_Succeeded; 92 return FWL_ERR_Succeeded;
80 } 93 }
94
81 CFWL_PictureBox::CFWL_PictureBox() {} 95 CFWL_PictureBox::CFWL_PictureBox() {}
96
82 CFWL_PictureBox::~CFWL_PictureBox() {} 97 CFWL_PictureBox::~CFWL_PictureBox() {}
98
83 FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption( 99 FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption(
84 IFWL_Widget* pWidget, 100 IFWL_Widget* pWidget,
85 CFX_WideString& wsCaption) { 101 CFX_WideString& wsCaption) {
86 return FWL_ERR_Succeeded; 102 return FWL_ERR_Succeeded;
87 } 103 }
104
88 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture( 105 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture(
89 IFWL_Widget* pWidget) { 106 IFWL_Widget* pWidget) {
90 return m_pBitmap; 107 return m_pBitmap;
91 } 108 }
109
92 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture( 110 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetErrorPicture(
93 IFWL_Widget* pWidget) { 111 IFWL_Widget* pWidget) {
94 return m_pBitmap; 112 return m_pBitmap;
95 } 113 }
114
96 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture( 115 CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetInitialPicture(
97 IFWL_Widget* pWidget) { 116 IFWL_Widget* pWidget) {
98 return m_pBitmap; 117 return m_pBitmap;
99 } 118 }
119
100 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) { 120 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) {
101 return m_iOpacity; 121 return m_iOpacity;
102 } 122 }
123
103 FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget, 124 FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget,
104 CFX_Matrix& matrix) { 125 CFX_Matrix& matrix) {
105 CFX_RectF rect; 126 CFX_RectF rect;
106 pWidget->GetClientRect(rect); 127 pWidget->GetClientRect(rect);
107 FX_FLOAT fLen = rect.width / 2; 128 FX_FLOAT fLen = rect.width / 2;
108 FX_FLOAT fWid = rect.height / 2; 129 FX_FLOAT fWid = rect.height / 2;
109 matrix.SetIdentity(); 130 matrix.SetIdentity();
110 matrix.Translate(-fLen, -fWid); 131 matrix.Translate(-fLen, -fWid);
111 matrix.Rotate(m_fRotation); 132 matrix.Rotate(m_fRotation);
112 matrix.Translate(fLen, fWid); 133 matrix.Translate(fLen, fWid);
113 matrix.Scale(m_fScaleX, m_fScaleY); 134 matrix.Scale(m_fScaleX, m_fScaleY);
114 matrix.Translate(m_fOffSetX, m_fOffSetY); 135 matrix.Translate(m_fOffSetX, m_fOffSetY);
115 return FWL_ERR_Succeeded; 136 return FWL_ERR_Succeeded;
116 } 137 }
138
117 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) { 139 int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) {
118 return m_iFlipMode; 140 return m_iFlipMode;
119 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698