OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | |
8 #define XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | |
9 | |
10 #include "xfa/fwl/core/fwl_widgetimp.h" | |
11 #include "xfa/fwl/core/ifwl_widget.h" | |
12 | |
13 class CFWL_MsgMouse; | |
14 class CFWL_WidgetImpProperties; | |
15 class CFWL_PushButtonImpDelegate; | |
16 class IFWL_Widget; | |
17 | |
18 class CFWL_PushButtonImp : public CFWL_WidgetImp { | |
19 public: | |
20 CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, | |
21 IFWL_Widget* pOuter); | |
22 ~CFWL_PushButtonImp() override; | |
23 | |
24 // CFWL_WidgetImp | |
25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | |
26 FWL_Type GetClassID() const override; | |
27 FWL_Error Initialize() override; | |
28 FWL_Error Finalize() override; | |
29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | |
30 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; | |
31 FWL_Error Update() override; | |
32 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | |
33 const CFX_Matrix* pMatrix = nullptr) override; | |
34 | |
35 protected: | |
36 friend class CFWL_PushButtonImpDelegate; | |
37 | |
38 void DrawBkground(CFX_Graphics* pGraphics, | |
39 IFWL_ThemeProvider* pTheme, | |
40 const CFX_Matrix* pMatrix); | |
41 void DrawText(CFX_Graphics* pGraphics, | |
42 IFWL_ThemeProvider* pTheme, | |
43 const CFX_Matrix* pMatrix); | |
44 uint32_t GetPartStates(); | |
45 void UpdateTextOutStyles(); | |
46 | |
47 CFX_RectF m_rtClient; | |
48 CFX_RectF m_rtCaption; | |
49 FX_BOOL m_bBtnDown; | |
50 uint32_t m_dwTTOStyles; | |
51 int32_t m_iTTOAlign; | |
52 }; | |
53 | |
54 class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { | |
55 public: | |
56 CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner); | |
57 void OnProcessMessage(CFWL_Message* pMessage) override; | |
58 void OnProcessEvent(CFWL_Event* pEvent) override; | |
59 void OnDrawWidget(CFX_Graphics* pGraphics, | |
60 const CFX_Matrix* pMatrix = nullptr) override; | |
61 | |
62 protected: | |
63 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | |
64 void OnLButtonDown(CFWL_MsgMouse* pMsg); | |
65 void OnLButtonUp(CFWL_MsgMouse* pMsg); | |
66 void OnMouseMove(CFWL_MsgMouse* pMsg); | |
67 void OnMouseLeave(CFWL_MsgMouse* pMsg); | |
68 void OnKeyDown(CFWL_MsgKey* pMsg); | |
69 CFWL_PushButtonImp* m_pOwner; | |
70 }; | |
71 | |
72 #endif // XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_ | |
OLD | NEW |