| 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_CORE_IFWL_PUSHBUTTON_H_ |
| 8 #define XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | 8 #define XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ |
| 9 | 9 |
| 10 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
| 11 #include "xfa/fwl/core/ifwl_dataprovider.h" |
| 11 #include "xfa/fwl/core/ifwl_widget.h" | 12 #include "xfa/fwl/core/ifwl_widget.h" |
| 12 | 13 |
| 14 #define FWL_CLASS_PushButton L"FWL_PUSHBUTTON" |
| 15 #define FWL_STYLEEXT_PSB_Left (0L << 0) |
| 16 #define FWL_STYLEEXT_PSB_Center (1L << 0) |
| 17 #define FWL_STYLEEXT_PSB_Right (2L << 0) |
| 18 #define FWL_STYLEEXT_PSB_Top (0L << 2) |
| 19 #define FWL_STYLEEXT_PSB_VCenter (1L << 2) |
| 20 #define FWL_STYLEEXT_PSB_Bottom (2L << 2) |
| 21 #define FWL_STYLEEXT_PSB_TextOnly (0L << 4) |
| 22 #define FWL_STYLEEXT_PSB_IconOnly (1L << 4) |
| 23 #define FWL_STYLEEXT_PSB_TextIcon (2L << 4) |
| 24 #define FWL_STYLEEXT_PSB_HLayoutMask (3L << 0) |
| 25 #define FWL_STYLEEXT_PSB_VLayoutMask (3L << 2) |
| 26 #define FWL_STYLEEXT_PSB_ModeMask (3L << 4) |
| 27 #define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX) |
| 28 #define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1)) |
| 29 #define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2)) |
| 30 |
| 13 class CFWL_MsgMouse; | 31 class CFWL_MsgMouse; |
| 32 class CFWL_PushButtonImpDelegate; |
| 14 class CFWL_WidgetImpProperties; | 33 class CFWL_WidgetImpProperties; |
| 15 class CFWL_PushButtonImpDelegate; | 34 class CFX_DIBitmap; |
| 16 class IFWL_Widget; | 35 class IFWL_Widget; |
| 17 | 36 |
| 18 class CFWL_PushButtonImp : public CFWL_WidgetImp { | 37 class IFWL_PushButtonDP : public IFWL_DataProvider { |
| 19 public: | 38 public: |
| 20 CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, | 39 virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0; |
| 21 IFWL_Widget* pOuter); | 40 }; |
| 22 ~CFWL_PushButtonImp() override; | |
| 23 | 41 |
| 24 // CFWL_WidgetImp | 42 class IFWL_PushButton : public IFWL_Widget { |
| 43 public: |
| 44 static IFWL_PushButton* Create(const CFWL_WidgetImpProperties& properties, |
| 45 IFWL_Widget* pOuter); |
| 46 |
| 47 IFWL_PushButton(const CFWL_WidgetImpProperties& properties, |
| 48 IFWL_Widget* pOuter); |
| 49 ~IFWL_PushButton() override; |
| 50 |
| 51 // IFWL_Widget |
| 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | 52 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
| 26 FWL_Type GetClassID() const override; | 53 FWL_Type GetClassID() const override; |
| 27 FWL_Error Initialize() override; | 54 FWL_Error Initialize() override; |
| 28 FWL_Error Finalize() override; | 55 FWL_Error Finalize() override; |
| 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 56 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 30 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; | 57 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
| 31 FWL_Error Update() override; | 58 FWL_Error Update() override; |
| 32 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 59 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 33 const CFX_Matrix* pMatrix = nullptr) override; | 60 const CFX_Matrix* pMatrix = nullptr) override; |
| 34 | 61 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 | 73 |
| 47 CFX_RectF m_rtClient; | 74 CFX_RectF m_rtClient; |
| 48 CFX_RectF m_rtCaption; | 75 CFX_RectF m_rtCaption; |
| 49 FX_BOOL m_bBtnDown; | 76 FX_BOOL m_bBtnDown; |
| 50 uint32_t m_dwTTOStyles; | 77 uint32_t m_dwTTOStyles; |
| 51 int32_t m_iTTOAlign; | 78 int32_t m_iTTOAlign; |
| 52 }; | 79 }; |
| 53 | 80 |
| 54 class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { | 81 class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { |
| 55 public: | 82 public: |
| 56 CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner); | 83 CFWL_PushButtonImpDelegate(IFWL_PushButton* pOwner); |
| 57 void OnProcessMessage(CFWL_Message* pMessage) override; | 84 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 58 void OnProcessEvent(CFWL_Event* pEvent) override; | 85 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 59 void OnDrawWidget(CFX_Graphics* pGraphics, | 86 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 60 const CFX_Matrix* pMatrix = nullptr) override; | 87 const CFX_Matrix* pMatrix = nullptr) override; |
| 61 | 88 |
| 62 protected: | 89 protected: |
| 63 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 90 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
| 64 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 91 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 65 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 92 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 66 void OnMouseMove(CFWL_MsgMouse* pMsg); | 93 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 67 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 94 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
| 68 void OnKeyDown(CFWL_MsgKey* pMsg); | 95 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 69 CFWL_PushButtonImp* m_pOwner; | 96 IFWL_PushButton* m_pOwner; |
| 70 }; | 97 }; |
| 71 | 98 |
| 72 #endif // XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | 99 #endif // XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ |
| OLD | NEW |