OLD | NEW |
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/fxfa/app/xfa_ffpushbutton.h" | 7 #include "xfa/fxfa/app/xfa_ffpushbutton.h" |
8 | 8 |
9 #include "xfa/fwl/core/ifwl_notedriver.h" | 9 #include "xfa/fwl/core/ifwl_notedriver.h" |
10 #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" | 10 #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 m_pRolloverTextLayout(NULL), | 24 m_pRolloverTextLayout(NULL), |
25 m_pDownTextLayout(NULL), | 25 m_pDownTextLayout(NULL), |
26 m_pDownProvider(NULL), | 26 m_pDownProvider(NULL), |
27 m_pRollProvider(NULL), | 27 m_pRollProvider(NULL), |
28 m_pOldDelegate(NULL) {} | 28 m_pOldDelegate(NULL) {} |
29 CXFA_FFPushButton::~CXFA_FFPushButton() { | 29 CXFA_FFPushButton::~CXFA_FFPushButton() { |
30 CXFA_FFPushButton::UnloadWidget(); | 30 CXFA_FFPushButton::UnloadWidget(); |
31 } | 31 } |
32 void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS, | 32 void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS, |
33 CFX_Matrix* pMatrix, | 33 CFX_Matrix* pMatrix, |
34 FX_DWORD dwStatus, | 34 uint32_t dwStatus, |
35 int32_t iRotate) { | 35 int32_t iRotate) { |
36 if (!IsMatchVisibleStatus(dwStatus)) { | 36 if (!IsMatchVisibleStatus(dwStatus)) { |
37 return; | 37 return; |
38 } | 38 } |
39 CFX_Matrix mtRotate; | 39 CFX_Matrix mtRotate; |
40 GetRotateMatrix(mtRotate); | 40 GetRotateMatrix(mtRotate); |
41 if (pMatrix) { | 41 if (pMatrix) { |
42 mtRotate.Concat(*pMatrix); | 42 mtRotate.Concat(*pMatrix); |
43 } | 43 } |
44 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); | 44 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); |
(...skipping 18 matching lines...) Expand all Loading... |
63 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); | 63 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); |
64 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); | 64 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); |
65 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 65 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
66 m_pNormalWidget->LockUpdate(); | 66 m_pNormalWidget->LockUpdate(); |
67 UpdateWidgetProperty(); | 67 UpdateWidgetProperty(); |
68 LoadHighlightCaption(); | 68 LoadHighlightCaption(); |
69 m_pNormalWidget->UnlockUpdate(); | 69 m_pNormalWidget->UnlockUpdate(); |
70 return CXFA_FFField::LoadWidget(); | 70 return CXFA_FFField::LoadWidget(); |
71 } | 71 } |
72 void CXFA_FFPushButton::UpdateWidgetProperty() { | 72 void CXFA_FFPushButton::UpdateWidgetProperty() { |
73 FX_DWORD dwStyleEx = 0; | 73 uint32_t dwStyleEx = 0; |
74 switch (m_pDataAcc->GetButtonHighlight()) { | 74 switch (m_pDataAcc->GetButtonHighlight()) { |
75 case XFA_ATTRIBUTEENUM_Inverted: | 75 case XFA_ATTRIBUTEENUM_Inverted: |
76 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteInverted; | 76 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteInverted; |
77 break; | 77 break; |
78 case XFA_ATTRIBUTEENUM_Outline: | 78 case XFA_ATTRIBUTEENUM_Outline: |
79 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteOutLine; | 79 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteOutLine; |
80 break; | 80 break; |
81 case XFA_ATTRIBUTEENUM_Push: | 81 case XFA_ATTRIBUTEENUM_Push: |
82 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HilitePush; | 82 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HilitePush; |
83 break; | 83 break; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 GetRectWithoutRotate(rtWidget); | 183 GetRectWithoutRotate(rtWidget); |
184 CFX_RectF rtClip = m_rtCaption; | 184 CFX_RectF rtClip = m_rtCaption; |
185 rtClip.Intersect(rtWidget); | 185 rtClip.Intersect(rtWidget); |
186 CFX_Matrix mt; | 186 CFX_Matrix mt; |
187 mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); | 187 mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); |
188 if (pMatrix) { | 188 if (pMatrix) { |
189 pMatrix->TransformRect(rtClip); | 189 pMatrix->TransformRect(rtClip); |
190 mt.Concat(*pMatrix); | 190 mt.Concat(*pMatrix); |
191 } | 191 } |
192 { | 192 { |
193 FX_DWORD dwState = m_pNormalWidget->GetStates(); | 193 uint32_t dwState = m_pNormalWidget->GetStates(); |
194 if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) && | 194 if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) && |
195 (dwState & FWL_STATE_PSB_Hovered)) { | 195 (dwState & FWL_STATE_PSB_Hovered)) { |
196 if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip)) { | 196 if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip)) { |
197 return; | 197 return; |
198 } | 198 } |
199 } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) { | 199 } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) { |
200 if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip)) { | 200 if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip)) { |
201 return; | 201 return; |
202 } | 202 } |
203 } | 203 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 path.Create(); | 243 path.Create(); |
244 CFX_RectF rect; | 244 CFX_RectF rect; |
245 m_pNormalWidget->GetWidgetRect(rect); | 245 m_pNormalWidget->GetWidgetRect(rect); |
246 path.AddRectangle(0, 0, rect.width, rect.height); | 246 path.AddRectangle(0, 0, rect.width, rect.height); |
247 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); | 247 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); |
248 } | 248 } |
249 } else if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HilitePush) { | 249 } else if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HilitePush) { |
250 } | 250 } |
251 return FWL_ERR_Succeeded; | 251 return FWL_ERR_Succeeded; |
252 } | 252 } |
OLD | NEW |