| 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/cfwl_pushbutton.h" | 9 #include "xfa/fwl/core/cfwl_pushbutton.h" |
| 10 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 10 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); | 43 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); |
| 44 RenderHighlightCaption(pGS, &mtRotate); | 44 RenderHighlightCaption(pGS, &mtRotate); |
| 45 CFX_RectF rtWidget; | 45 CFX_RectF rtWidget; |
| 46 GetRectWithoutRotate(rtWidget); | 46 GetRectWithoutRotate(rtWidget); |
| 47 CFX_Matrix mt; | 47 CFX_Matrix mt; |
| 48 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); | 48 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); |
| 49 mt.Concat(mtRotate); | 49 mt.Concat(mtRotate); |
| 50 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), | 50 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), |
| 51 pGS, &mt); | 51 pGS, &mt); |
| 52 } | 52 } |
| 53 FX_BOOL CXFA_FFPushButton::LoadWidget() { | 53 bool CXFA_FFPushButton::LoadWidget() { |
| 54 ASSERT(!m_pNormalWidget); | 54 ASSERT(!m_pNormalWidget); |
| 55 CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp()); | 55 CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp()); |
| 56 pPushButton->Initialize(); | 56 pPushButton->Initialize(); |
| 57 | 57 |
| 58 m_pOldDelegate = pPushButton->GetDelegate(); | 58 m_pOldDelegate = pPushButton->GetDelegate(); |
| 59 pPushButton->SetDelegate(this); | 59 pPushButton->SetDelegate(this); |
| 60 | 60 |
| 61 m_pNormalWidget = pPushButton; | 61 m_pNormalWidget = pPushButton; |
| 62 m_pNormalWidget->SetLayoutItem(this); | 62 m_pNormalWidget->SetLayoutItem(this); |
| 63 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 63 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 92 m_pRolloverTextLayout = nullptr; | 92 m_pRolloverTextLayout = nullptr; |
| 93 delete m_pDownTextLayout; | 93 delete m_pDownTextLayout; |
| 94 m_pDownTextLayout = nullptr; | 94 m_pDownTextLayout = nullptr; |
| 95 delete m_pDownProvider; | 95 delete m_pDownProvider; |
| 96 m_pDownProvider = nullptr; | 96 m_pDownProvider = nullptr; |
| 97 delete m_pRollProvider; | 97 delete m_pRollProvider; |
| 98 m_pRollProvider = nullptr; | 98 m_pRollProvider = nullptr; |
| 99 CXFA_FFField::UnloadWidget(); | 99 CXFA_FFField::UnloadWidget(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 FX_BOOL CXFA_FFPushButton::PerformLayout() { | 102 bool CXFA_FFPushButton::PerformLayout() { |
| 103 CXFA_FFWidget::PerformLayout(); | 103 CXFA_FFWidget::PerformLayout(); |
| 104 CFX_RectF rtWidget; | 104 CFX_RectF rtWidget; |
| 105 GetRectWithoutRotate(rtWidget); | 105 GetRectWithoutRotate(rtWidget); |
| 106 m_rtUI = rtWidget; | 106 m_rtUI = rtWidget; |
| 107 if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { | 107 if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { |
| 108 XFA_RectWidthoutMargin(rtWidget, mgWidget); | 108 XFA_RectWidthoutMargin(rtWidget, mgWidget); |
| 109 } | 109 } |
| 110 CXFA_Caption caption = m_pDataAcc->GetCaption(); | 110 CXFA_Caption caption = m_pDataAcc->GetCaption(); |
| 111 m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height); | 111 m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height); |
| 112 if (CXFA_Margin mgCap = caption.GetMargin()) { | 112 if (CXFA_Margin mgCap = caption.GetMargin()) { |
| 113 XFA_RectWidthoutMargin(m_rtCaption, mgCap); | 113 XFA_RectWidthoutMargin(m_rtCaption, mgCap); |
| 114 } | 114 } |
| 115 LayoutHighlightCaption(); | 115 LayoutHighlightCaption(); |
| 116 SetFWLRect(); | 116 SetFWLRect(); |
| 117 if (m_pNormalWidget) { | 117 if (m_pNormalWidget) { |
| 118 m_pNormalWidget->Update(); | 118 m_pNormalWidget->Update(); |
| 119 } | 119 } |
| 120 return TRUE; | 120 return true; |
| 121 } | 121 } |
| 122 FX_FLOAT CXFA_FFPushButton::GetLineWidth() { | 122 FX_FLOAT CXFA_FFPushButton::GetLineWidth() { |
| 123 CXFA_Border border = m_pDataAcc->GetBorder(); | 123 CXFA_Border border = m_pDataAcc->GetBorder(); |
| 124 if (border && border.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { | 124 if (border && border.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { |
| 125 CXFA_Edge edge = border.GetEdge(0); | 125 CXFA_Edge edge = border.GetEdge(0); |
| 126 return edge.GetThickness(); | 126 return edge.GetThickness(); |
| 127 } | 127 } |
| 128 return 0; | 128 return 0; |
| 129 } | 129 } |
| 130 FX_ARGB CXFA_FFPushButton::GetLineColor() { | 130 FX_ARGB CXFA_FFPushButton::GetLineColor() { |
| 131 return 0xFF000000; | 131 return 0xFF000000; |
| 132 } | 132 } |
| 133 FX_ARGB CXFA_FFPushButton::GetFillColor() { | 133 FX_ARGB CXFA_FFPushButton::GetFillColor() { |
| 134 return 0xFFFFFFFF; | 134 return 0xFFFFFFFF; |
| 135 } | 135 } |
| 136 void CXFA_FFPushButton::LoadHighlightCaption() { | 136 void CXFA_FFPushButton::LoadHighlightCaption() { |
| 137 CXFA_Caption caption = m_pDataAcc->GetCaption(); | 137 CXFA_Caption caption = m_pDataAcc->GetCaption(); |
| 138 if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { | 138 if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { |
| 139 { | 139 { |
| 140 CFX_WideString wsRollover; | 140 CFX_WideString wsRollover; |
| 141 FX_BOOL bRichText; | 141 bool bRichText; |
| 142 if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) { | 142 if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) { |
| 143 if (!m_pRollProvider) { | 143 if (!m_pRollProvider) { |
| 144 m_pRollProvider = | 144 m_pRollProvider = |
| 145 new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover); | 145 new CXFA_TextProvider(m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover); |
| 146 } | 146 } |
| 147 m_pRolloverTextLayout = new CXFA_TextLayout(m_pRollProvider); | 147 m_pRolloverTextLayout = new CXFA_TextLayout(m_pRollProvider); |
| 148 } | 148 } |
| 149 CFX_WideString wsDown; | 149 CFX_WideString wsDown; |
| 150 if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) { | 150 if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) { |
| 151 if (!m_pDownProvider) { | 151 if (!m_pDownProvider) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 pGraphics->SetLineWidth(fLineWidth); | 238 pGraphics->SetLineWidth(fLineWidth); |
| 239 CFX_Path path; | 239 CFX_Path path; |
| 240 path.Create(); | 240 path.Create(); |
| 241 CFX_RectF rect; | 241 CFX_RectF rect; |
| 242 m_pNormalWidget->GetWidgetRect(rect); | 242 m_pNormalWidget->GetWidgetRect(rect); |
| 243 path.AddRectangle(0, 0, rect.width, rect.height); | 243 path.AddRectangle(0, 0, rect.width, rect.height); |
| 244 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); | 244 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 } | 247 } |
| OLD | NEW |