• 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_APP_XFA_FWLTHEME_H_
8 #define XFA_FXFA_APP_XFA_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/xfa_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   // IFWL_ThemeProvider:
33   void DrawBackground(CFWL_ThemeBackground* pParams) override;
34   void DrawText(CFWL_ThemeText* pParams) override;
35   void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override;
36   float GetCXBorderSize() const override;
37   float GetCYBorderSize() const override;
38   CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const override;
39   float GetFontSize(CFWL_ThemePart* pThemePart) const override;
40   CFX_RetainPtr<CFGAS_GEFont> GetFont(
41       CFWL_ThemePart* pThemePart) const override;
42   float GetLineHeight(CFWL_ThemePart* pThemePart) const override;
43   float GetScrollBarWidth() const override;
44   FX_COLORREF GetTextColor(CFWL_ThemePart* pThemePart) const override;
45   CFX_SizeF GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const override;
46 
47  private:
48   CFWL_WidgetTP* GetTheme(CFWL_Widget* pWidget) const;
49 
50   std::unique_ptr<CFWL_CheckBoxTP> m_pCheckBoxTP;
51   std::unique_ptr<CFWL_ListBoxTP> m_pListBoxTP;
52   std::unique_ptr<CFWL_PictureBoxTP> m_pPictureBoxTP;
53   std::unique_ptr<CFWL_ScrollBarTP> m_pSrollBarTP;
54   std::unique_ptr<CFWL_EditTP> m_pEditTP;
55   std::unique_ptr<CFWL_ComboBoxTP> m_pComboBoxTP;
56   std::unique_ptr<CFWL_MonthCalendarTP> m_pMonthCalendarTP;
57   std::unique_ptr<CFWL_DateTimePickerTP> m_pDateTimePickerTP;
58   std::unique_ptr<CFWL_PushButtonTP> m_pPushButtonTP;
59   std::unique_ptr<CFWL_CaretTP> m_pCaretTP;
60   std::unique_ptr<CFWL_BarcodeTP> m_pBarcodeTP;
61   std::unique_ptr<CFDE_TextOut> m_pTextOut;
62   CFX_RetainPtr<CFGAS_GEFont> m_pCalendarFont;
63   CFX_WideString m_wsResource;
64   CXFA_FFApp* const m_pApp;
65   CFX_RectF m_Rect;
66 };
67 
68 CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget);
69 
70 #endif  // XFA_FXFA_APP_XFA_FWLTHEME_H_
71