• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FXFA_CXFA_FWLTHEME_H_
8 #define XFA_FXFA_CXFA_FWLTHEME_H_
9 
10 #include <memory>
11 
12 #include "xfa/fwl/ifwl_themeprovider.h"
13 #include "xfa/fwl/theme/cfwl_barcodetp.h"
14 #include "xfa/fwl/theme/cfwl_carettp.h"
15 #include "xfa/fwl/theme/cfwl_checkboxtp.h"
16 #include "xfa/fwl/theme/cfwl_comboboxtp.h"
17 #include "xfa/fwl/theme/cfwl_datetimepickertp.h"
18 #include "xfa/fwl/theme/cfwl_edittp.h"
19 #include "xfa/fwl/theme/cfwl_listboxtp.h"
20 #include "xfa/fwl/theme/cfwl_monthcalendartp.h"
21 #include "xfa/fwl/theme/cfwl_pictureboxtp.h"
22 #include "xfa/fwl/theme/cfwl_pushbuttontp.h"
23 #include "xfa/fwl/theme/cfwl_scrollbartp.h"
24 #include "xfa/fwl/theme/cfwl_widgettp.h"
25 #include "xfa/fxfa/cxfa_ffapp.h"
26 
27 class CXFA_FWLTheme final : public IFWL_ThemeProvider {
28  public:
29   explicit CXFA_FWLTheme(CXFA_FFApp* pApp);
30   ~CXFA_FWLTheme() override;
31 
32   bool LoadCalendarFont(CXFA_FFDoc* doc);
33 
34   // IFWL_ThemeProvider:
35   void DrawBackground(const CFWL_ThemeBackground& pParams) override;
36   void DrawText(const CFWL_ThemeText& pParams) override;
37   void CalcTextRect(const CFWL_ThemeText& pParams, CFX_RectF* pRect) override;
38   float GetCXBorderSize() const override;
39   float GetCYBorderSize() const override;
40   CFX_RectF GetUIMargin(const CFWL_ThemePart& pThemePart) const override;
41   float GetFontSize(const CFWL_ThemePart& pThemePart) const override;
42   RetainPtr<CFGAS_GEFont> GetFont(
43       const CFWL_ThemePart& pThemePart) const override;
44   float GetLineHeight(const CFWL_ThemePart& pThemePart) const override;
45   float GetScrollBarWidth() const override;
46   FX_COLORREF GetTextColor(const CFWL_ThemePart& pThemePart) const override;
47   CFX_SizeF GetSpaceAboveBelow(const CFWL_ThemePart& pThemePart) const override;
48 
49  private:
50   CFWL_WidgetTP* GetTheme(CFWL_Widget* pWidget) const;
51 
52   std::unique_ptr<CFWL_CheckBoxTP> m_pCheckBoxTP;
53   std::unique_ptr<CFWL_ListBoxTP> m_pListBoxTP;
54   std::unique_ptr<CFWL_PictureBoxTP> m_pPictureBoxTP;
55   std::unique_ptr<CFWL_ScrollBarTP> m_pSrollBarTP;
56   std::unique_ptr<CFWL_EditTP> m_pEditTP;
57   std::unique_ptr<CFWL_ComboBoxTP> m_pComboBoxTP;
58   std::unique_ptr<CFWL_MonthCalendarTP> m_pMonthCalendarTP;
59   std::unique_ptr<CFWL_DateTimePickerTP> m_pDateTimePickerTP;
60   std::unique_ptr<CFWL_PushButtonTP> m_pPushButtonTP;
61   std::unique_ptr<CFWL_CaretTP> m_pCaretTP;
62   std::unique_ptr<CFWL_BarcodeTP> m_pBarcodeTP;
63   std::unique_ptr<CFDE_TextOut> m_pTextOut;
64   RetainPtr<CFGAS_GEFont> m_pCalendarFont;
65   WideString m_wsResource;
66   UnownedPtr<CXFA_FFApp> const m_pApp;
67   CFX_RectF m_Rect;
68 };
69 
70 #endif  // XFA_FXFA_CXFA_FWLTHEME_H_
71