1 // Copyright 2014 The PDFium Authors 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_THEME_CFWL_WIDGETTP_H_ 8 #define XFA_FWL_THEME_CFWL_WIDGETTP_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_coordinates.h" 13 #include "core/fxcrt/fx_system.h" 14 #include "core/fxcrt/retain_ptr.h" 15 #include "core/fxge/dib/fx_dib.h" 16 #include "v8/include/cppgc/garbage-collected.h" 17 #include "xfa/fwl/theme/cfwl_utils.h" 18 19 class CFDE_TextOut; 20 class CFGAS_GEGraphics; 21 class CFWL_ThemeBackground; 22 class CFWL_ThemeText; 23 class IFWL_ThemeProvider; 24 25 class CFWL_WidgetTP : public cppgc::GarbageCollected<CFWL_WidgetTP> { 26 public: 27 virtual ~CFWL_WidgetTP(); 28 29 virtual void DrawBackground(const CFWL_ThemeBackground& pParams); 30 virtual void DrawText(const CFWL_ThemeText& pParams); 31 32 // Non-virtual, nothing to trace in subclasses at present. 33 void Trace(cppgc::Visitor* visitor) const; 34 35 protected: 36 struct CColorData { 37 FX_ARGB clrBorder[4]; // Indexed by enum FWLTHEME_STATE - 1. 38 FX_ARGB clrStart[4]; // Indexed by enum FWLTHEME_STATE - 1. 39 FX_ARGB clrEnd[4]; // Indexed by enum FWLTHEME_STATE - 1. 40 FX_ARGB clrSign[4]; // Indexed by enum FWLTHEME_STATE - 1. 41 }; 42 43 CFWL_WidgetTP(); 44 45 void InitializeArrowColorData(); 46 void EnsureTTOInitialized(IFWL_ThemeProvider* pProvider); 47 48 void DrawBorder(CFGAS_GEGraphics* pGraphics, 49 const CFX_RectF& rect, 50 const CFX_Matrix& matrix); 51 void FillBackground(CFGAS_GEGraphics* pGraphics, 52 const CFX_RectF& rect, 53 const CFX_Matrix& matrix); 54 void FillSolidRect(CFGAS_GEGraphics* pGraphics, 55 FX_ARGB fillColor, 56 const CFX_RectF& rect, 57 const CFX_Matrix& matrix); 58 void DrawFocus(CFGAS_GEGraphics* pGraphics, 59 const CFX_RectF& rect, 60 const CFX_Matrix& matrix); 61 void DrawArrow(CFGAS_GEGraphics* pGraphics, 62 const CFX_RectF& rect, 63 FWLTHEME_DIRECTION eDict, 64 FX_ARGB argSign, 65 const CFX_Matrix& matrix); 66 void DrawBtn(CFGAS_GEGraphics* pGraphics, 67 const CFX_RectF& rect, 68 FWLTHEME_STATE eState, 69 const CFX_Matrix& matrix); 70 void DrawArrowBtn(CFGAS_GEGraphics* pGraphics, 71 const CFX_RectF& rect, 72 FWLTHEME_DIRECTION eDict, 73 FWLTHEME_STATE eState, 74 const CFX_Matrix& matrix); 75 76 std::unique_ptr<CFDE_TextOut> m_pTextOut; 77 std::unique_ptr<CColorData> m_pColorData; 78 }; 79 80 #endif // XFA_FWL_THEME_CFWL_WIDGETTP_H_ 81