| 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 #ifndef XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ |
| 8 #define XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ |
| 9 | 9 |
| 10 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 11 #include "xfa/fwl/core/ifwl_widget.h" |
| 11 | 12 |
| 12 class CFWL_MsgMouse; | 13 class CFWL_MsgMouse; |
| 13 class CFWL_WidgetImpProperties; | 14 class CFWL_WidgetImpProperties; |
| 14 class CFWL_PushButtonImpDelegate; | 15 class CFWL_PushButtonImpDelegate; |
| 15 class IFWL_Widget; | 16 class IFWL_Widget; |
| 16 | 17 |
| 17 class CFWL_PushButtonImp : public CFWL_WidgetImp { | 18 class CFWL_PushButtonImp : public CFWL_WidgetImp { |
| 18 public: | 19 public: |
| 19 CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, | 20 CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, |
| 20 IFWL_Widget* pOuter); | 21 IFWL_Widget* pOuter); |
| 21 virtual ~CFWL_PushButtonImp(); | 22 ~CFWL_PushButtonImp() override; |
| 22 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; | 23 |
| 23 virtual uint32_t GetClassID() const; | 24 // CFWL_WidgetImp |
| 24 virtual FWL_Error Initialize(); | 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
| 25 virtual FWL_Error Finalize(); | 26 FWL_Type GetClassID() const override; |
| 26 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 27 FWL_Error Initialize() override; |
| 27 virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | 28 FWL_Error Finalize() override; |
| 28 virtual FWL_Error Update(); | 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 29 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 30 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
| 30 const CFX_Matrix* pMatrix = NULL); | 31 FWL_Error Update() override; |
| 32 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 33 const CFX_Matrix* pMatrix = nullptr) override; |
| 31 | 34 |
| 32 protected: | 35 protected: |
| 36 friend class CFWL_PushButtonImpDelegate; |
| 37 |
| 33 void DrawBkground(CFX_Graphics* pGraphics, | 38 void DrawBkground(CFX_Graphics* pGraphics, |
| 34 IFWL_ThemeProvider* pTheme, | 39 IFWL_ThemeProvider* pTheme, |
| 35 const CFX_Matrix* pMatrix); | 40 const CFX_Matrix* pMatrix); |
| 36 void DrawText(CFX_Graphics* pGraphics, | 41 void DrawText(CFX_Graphics* pGraphics, |
| 37 IFWL_ThemeProvider* pTheme, | 42 IFWL_ThemeProvider* pTheme, |
| 38 const CFX_Matrix* pMatrix); | 43 const CFX_Matrix* pMatrix); |
| 39 uint32_t GetPartStates(); | 44 uint32_t GetPartStates(); |
| 40 void UpdateTextOutStyles(); | 45 void UpdateTextOutStyles(); |
| 46 |
| 41 CFX_RectF m_rtClient; | 47 CFX_RectF m_rtClient; |
| 42 CFX_RectF m_rtCaption; | 48 CFX_RectF m_rtCaption; |
| 43 FX_BOOL m_bBtnDown; | 49 FX_BOOL m_bBtnDown; |
| 44 uint32_t m_dwTTOStyles; | 50 uint32_t m_dwTTOStyles; |
| 45 int32_t m_iTTOAlign; | 51 int32_t m_iTTOAlign; |
| 46 friend class CFWL_PushButtonImpDelegate; | |
| 47 }; | 52 }; |
| 48 | 53 |
| 49 class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { | 54 class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { |
| 50 public: | 55 public: |
| 51 CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner); | 56 CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner); |
| 52 void OnProcessMessage(CFWL_Message* pMessage) override; | 57 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 53 void OnProcessEvent(CFWL_Event* pEvent) override; | 58 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 54 void OnDrawWidget(CFX_Graphics* pGraphics, | 59 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 55 const CFX_Matrix* pMatrix = NULL) override; | 60 const CFX_Matrix* pMatrix = NULL) override; |
| 56 | 61 |
| 57 protected: | 62 protected: |
| 58 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 63 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
| 59 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 64 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 60 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 65 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 61 void OnMouseMove(CFWL_MsgMouse* pMsg); | 66 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 62 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 67 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
| 63 void OnKeyDown(CFWL_MsgKey* pMsg); | 68 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 64 CFWL_PushButtonImp* m_pOwner; | 69 CFWL_PushButtonImp* m_pOwner; |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 #endif // XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | 72 #endif // XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ |
| OLD | NEW |