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/fwl/basewidget/fwl_pushbuttonimp.h" | 7 #include "xfa/fwl/basewidget/fwl_pushbuttonimp.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/basewidget/ifwl_pushbutton.h" | 10 #include "xfa/fwl/basewidget/ifwl_pushbutton.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 FWL_Error CFWL_PushButtonImp::Finalize() { | 61 FWL_Error CFWL_PushButtonImp::Finalize() { |
62 delete m_pDelegate; | 62 delete m_pDelegate; |
63 m_pDelegate = nullptr; | 63 m_pDelegate = nullptr; |
64 return CFWL_WidgetImp::Finalize(); | 64 return CFWL_WidgetImp::Finalize(); |
65 } | 65 } |
66 FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, | 66 FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, |
67 FX_BOOL bAutoSize) { | 67 FX_BOOL bAutoSize) { |
68 if (bAutoSize) { | 68 if (bAutoSize) { |
69 rect.Set(0, 0, 0, 0); | 69 rect.Set(0, 0, 0, 0); |
70 if (m_pProperties->m_pThemeProvider == NULL) { | 70 if (!m_pProperties->m_pThemeProvider) { |
71 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 71 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
72 } | 72 } |
73 CFX_WideString wsCaption; | 73 CFX_WideString wsCaption; |
74 IFWL_PushButtonDP* pData = | 74 IFWL_PushButtonDP* pData = |
75 static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); | 75 static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); |
76 if (pData) { | 76 if (pData) { |
77 pData->GetCaption(m_pInterface, wsCaption); | 77 pData->GetCaption(m_pInterface, wsCaption); |
78 } | 78 } |
79 int32_t iLen = wsCaption.GetLength(); | 79 int32_t iLen = wsCaption.GetLength(); |
80 if (iLen > 0) { | 80 if (iLen > 0) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return FWL_Error::Succeeded; | 115 return FWL_Error::Succeeded; |
116 } | 116 } |
117 FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, | 117 FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, |
118 const CFX_Matrix* pMatrix) { | 118 const CFX_Matrix* pMatrix) { |
119 if (!pGraphics) | 119 if (!pGraphics) |
120 return FWL_Error::Indefinite; | 120 return FWL_Error::Indefinite; |
121 if (!m_pProperties->m_pThemeProvider) | 121 if (!m_pProperties->m_pThemeProvider) |
122 return FWL_Error::Indefinite; | 122 return FWL_Error::Indefinite; |
123 IFWL_PushButtonDP* pData = | 123 IFWL_PushButtonDP* pData = |
124 static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); | 124 static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); |
125 CFX_DIBitmap* pPicture = NULL; | 125 CFX_DIBitmap* pPicture = nullptr; |
126 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 126 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
127 if (HasBorder()) { | 127 if (HasBorder()) { |
128 DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, | 128 DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, |
129 pMatrix); | 129 pMatrix); |
130 } | 130 } |
131 if (HasEdge()) { | 131 if (HasEdge()) { |
132 DrawEdge(pGraphics, CFWL_Part::Edge, m_pProperties->m_pThemeProvider, | 132 DrawEdge(pGraphics, CFWL_Part::Edge, m_pProperties->m_pThemeProvider, |
133 pMatrix); | 133 pMatrix); |
134 } | 134 } |
135 DrawBkground(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); | 135 DrawBkground(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 CFWL_EvtClick wmClick; | 555 CFWL_EvtClick wmClick; |
556 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; | 556 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; |
557 m_pOwner->DispatchEvent(&wmClick); | 557 m_pOwner->DispatchEvent(&wmClick); |
558 return; | 558 return; |
559 } | 559 } |
560 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { | 560 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { |
561 return; | 561 return; |
562 } | 562 } |
563 m_pOwner->DispatchKeyEvent(pMsg); | 563 m_pOwner->DispatchKeyEvent(pMsg); |
564 } | 564 } |
OLD | NEW |