Home | History | Annotate | Download | only in fxfa
      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   // 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   RetainPtr<CFGAS_GEFont> GetFont(CFWL_ThemePart* pThemePart) const override;
     41   float GetLineHeight(CFWL_ThemePart* pThemePart) const override;
     42   float GetScrollBarWidth() const override;
     43   FX_COLORREF GetTextColor(CFWL_ThemePart* pThemePart) const override;
     44   CFX_SizeF GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const override;
     45 
     46  private:
     47   CFWL_WidgetTP* GetTheme(CFWL_Widget* pWidget) const;
     48 
     49   std::unique_ptr<CFWL_CheckBoxTP> m_pCheckBoxTP;
     50   std::unique_ptr<CFWL_ListBoxTP> m_pListBoxTP;
     51   std::unique_ptr<CFWL_PictureBoxTP> m_pPictureBoxTP;
     52   std::unique_ptr<CFWL_ScrollBarTP> m_pSrollBarTP;
     53   std::unique_ptr<CFWL_EditTP> m_pEditTP;
     54   std::unique_ptr<CFWL_ComboBoxTP> m_pComboBoxTP;
     55   std::unique_ptr<CFWL_MonthCalendarTP> m_pMonthCalendarTP;
     56   std::unique_ptr<CFWL_DateTimePickerTP> m_pDateTimePickerTP;
     57   std::unique_ptr<CFWL_PushButtonTP> m_pPushButtonTP;
     58   std::unique_ptr<CFWL_CaretTP> m_pCaretTP;
     59   std::unique_ptr<CFWL_BarcodeTP> m_pBarcodeTP;
     60   std::unique_ptr<CFDE_TextOut> m_pTextOut;
     61   RetainPtr<CFGAS_GEFont> m_pCalendarFont;
     62   WideString m_wsResource;
     63   UnownedPtr<CXFA_FFApp> const m_pApp;
     64   CFX_RectF m_Rect;
     65 };
     66 
     67 CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget);
     68 
     69 #endif  // XFA_FXFA_CXFA_FWLTHEME_H_
     70