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_CORE_IFWL_PUSHBUTTON_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ |
8 #define XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ | 8 #define XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ |
9 | 9 |
10 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 10 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #define FWL_STYLEEXT_PSB_IconOnly (1L << 4) | 21 #define FWL_STYLEEXT_PSB_IconOnly (1L << 4) |
22 #define FWL_STYLEEXT_PSB_TextIcon (2L << 4) | 22 #define FWL_STYLEEXT_PSB_TextIcon (2L << 4) |
23 #define FWL_STYLEEXT_PSB_HLayoutMask (3L << 0) | 23 #define FWL_STYLEEXT_PSB_HLayoutMask (3L << 0) |
24 #define FWL_STYLEEXT_PSB_VLayoutMask (3L << 2) | 24 #define FWL_STYLEEXT_PSB_VLayoutMask (3L << 2) |
25 #define FWL_STYLEEXT_PSB_ModeMask (3L << 4) | 25 #define FWL_STYLEEXT_PSB_ModeMask (3L << 4) |
26 #define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX) | 26 #define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX) |
27 #define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1)) | 27 #define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1)) |
28 #define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2)) | 28 #define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2)) |
29 | 29 |
30 class CFWL_MsgMouse; | 30 class CFWL_MsgMouse; |
31 class CFWL_PushButtonImpDelegate; | |
32 class CFWL_WidgetImpProperties; | 31 class CFWL_WidgetImpProperties; |
33 class CFX_DIBitmap; | 32 class CFX_DIBitmap; |
34 class IFWL_Widget; | 33 class IFWL_Widget; |
35 | 34 |
36 class IFWL_PushButtonDP : public IFWL_DataProvider { | 35 class IFWL_PushButtonDP : public IFWL_DataProvider { |
37 public: | 36 public: |
38 virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0; | 37 virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0; |
39 }; | 38 }; |
40 | 39 |
41 class IFWL_PushButton : public IFWL_Widget { | 40 class IFWL_PushButton : public IFWL_Widget { |
42 public: | 41 public: |
43 IFWL_PushButton(const IFWL_App* app, | 42 IFWL_PushButton(const IFWL_App* app, |
44 const CFWL_WidgetImpProperties& properties); | 43 const CFWL_WidgetImpProperties& properties); |
45 ~IFWL_PushButton() override; | 44 ~IFWL_PushButton() override; |
46 | 45 |
47 // IFWL_Widget | 46 // IFWL_Widget |
48 FWL_Type GetClassID() const override; | 47 FWL_Type GetClassID() const override; |
49 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 48 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
50 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; | 49 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
51 FWL_Error Update() override; | 50 FWL_Error Update() override; |
52 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 51 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
53 const CFX_Matrix* pMatrix = nullptr) override; | 52 const CFX_Matrix* pMatrix = nullptr) override; |
| 53 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 54 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 55 const CFX_Matrix* pMatrix) override; |
54 | 56 |
55 protected: | 57 protected: |
56 friend class CFWL_PushButtonImpDelegate; | |
57 | |
58 void DrawBkground(CFX_Graphics* pGraphics, | 58 void DrawBkground(CFX_Graphics* pGraphics, |
59 IFWL_ThemeProvider* pTheme, | 59 IFWL_ThemeProvider* pTheme, |
60 const CFX_Matrix* pMatrix); | 60 const CFX_Matrix* pMatrix); |
61 void DrawText(CFX_Graphics* pGraphics, | 61 void DrawText(CFX_Graphics* pGraphics, |
62 IFWL_ThemeProvider* pTheme, | 62 IFWL_ThemeProvider* pTheme, |
63 const CFX_Matrix* pMatrix); | 63 const CFX_Matrix* pMatrix); |
64 uint32_t GetPartStates(); | 64 uint32_t GetPartStates(); |
65 void UpdateTextOutStyles(); | 65 void UpdateTextOutStyles(); |
66 | 66 |
67 CFX_RectF m_rtClient; | 67 CFX_RectF m_rtClient; |
68 CFX_RectF m_rtCaption; | 68 CFX_RectF m_rtCaption; |
69 FX_BOOL m_bBtnDown; | 69 FX_BOOL m_bBtnDown; |
70 uint32_t m_dwTTOStyles; | 70 uint32_t m_dwTTOStyles; |
71 int32_t m_iTTOAlign; | 71 int32_t m_iTTOAlign; |
72 }; | |
73 | 72 |
74 class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { | 73 private: |
75 public: | 74 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); |
76 CFWL_PushButtonImpDelegate(IFWL_PushButton* pOwner); | |
77 void OnProcessMessage(CFWL_Message* pMessage) override; | |
78 void OnProcessEvent(CFWL_Event* pEvent) override; | |
79 void OnDrawWidget(CFX_Graphics* pGraphics, | |
80 const CFX_Matrix* pMatrix = nullptr) override; | |
81 | |
82 protected: | |
83 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | |
84 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 75 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
85 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 76 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
86 void OnMouseMove(CFWL_MsgMouse* pMsg); | 77 void OnMouseMove(CFWL_MsgMouse* pMsg); |
87 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 78 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
88 void OnKeyDown(CFWL_MsgKey* pMsg); | 79 void OnKeyDown(CFWL_MsgKey* pMsg); |
89 IFWL_PushButton* m_pOwner; | |
90 }; | 80 }; |
91 | 81 |
92 #endif // XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ | 82 #endif // XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ |
OLD | NEW |