Home | History | Annotate | Download | only in theme
      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 _FWL_FORM_THEMEPROVIDER_H
      8 #define _FWL_FORM_THEMEPROVIDER_H
      9 class CFWL_WidgetTP;
     10 class CFWL_FormTP;
     11 class CFWL_FormTP : public CFWL_WidgetTP {
     12  public:
     13   CFWL_FormTP();
     14   virtual ~CFWL_FormTP();
     15 
     16   virtual FWL_ERR Initialize();
     17   virtual FWL_ERR Finalize();
     18   virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget);
     19   virtual FX_DWORD SetThemeID(IFWL_Widget* pWidget,
     20                               FX_DWORD dwThemeID,
     21                               FX_BOOL bChildren = TRUE);
     22   virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams);
     23   virtual FX_BOOL DrawText(CFWL_ThemeText* pParams);
     24   virtual void* GetCapacity(CFWL_ThemePart* pThemePart, FX_DWORD dwCapacity);
     25   virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart);
     26 
     27  protected:
     28   void CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect);
     29   void CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect);
     30   void CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect);
     31   void CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect);
     32   void CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect);
     33 
     34   void DrawFormBorder(CFX_Graphics* pGraphics,
     35                       const CFX_RectF* pRect,
     36                       FWLTHEME_STATE eState,
     37                       CFX_Matrix* pMatrix,
     38                       int32_t iActive = 0);
     39   void DrawCaption(CFX_Graphics* pGraphics,
     40                    const CFX_RectF* pRect,
     41                    FWLTHEME_STATE eState,
     42                    CFX_Matrix* pMatrix,
     43                    int32_t iActive = 0);
     44   void DrawNarrowCaption(CFX_Graphics* pGraphics,
     45                          const CFX_RectF* pRect,
     46                          FWLTHEME_STATE eState,
     47                          CFX_Matrix* pMatrix,
     48                          int32_t iActive = 0);
     49   void DrawCloseBox(CFX_Graphics* pGraphics,
     50                     const CFX_RectF* pRect,
     51                     FWLTHEME_STATE eState,
     52                     CFX_Matrix* pMatrix,
     53                     int32_t iActive = 0);
     54   void DrawMinMaxBoxCommon(CFX_Graphics* pGraphics,
     55                            const CFX_RectF* pRect,
     56                            FWLTHEME_STATE eState,
     57                            CFX_Matrix* pMatrix,
     58                            int32_t iActive = 0);
     59   void DrawMinimizeBox(CFX_Graphics* pGraphics,
     60                        const CFX_RectF* pRect,
     61                        FWLTHEME_STATE eState,
     62                        CFX_Matrix* pMatrix,
     63                        int32_t iActive = 0);
     64   void DrawMaximizeBox(CFX_Graphics* pGraphics,
     65                        const CFX_RectF* pRect,
     66                        FWLTHEME_STATE eState,
     67                        FX_BOOL bMax,
     68                        CFX_Matrix* pMatrix,
     69                        int32_t iActive = 0);
     70   void DrawIconImage(CFX_Graphics* pGraphics,
     71                      CFX_DIBitmap* pDIBitmap,
     72                      const CFX_RectF* pRect,
     73                      FWLTHEME_STATE eState,
     74                      CFX_Matrix* pMatrix,
     75                      int32_t iActive = 0);
     76   void SetThemeData(FX_DWORD dwID);
     77   void TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack);
     78   void DeactiveForm();
     79   void InitCaption(FX_BOOL bActive);
     80   CFX_DIBitmap* m_pActiveBitmap;
     81   CFX_DIBitmap* m_pDeactivebitmap;
     82   CFX_RectF m_rtDisCaption;
     83   CFX_RectF m_rtDisLBorder;
     84   CFX_RectF m_rtDisRBorder;
     85   CFX_RectF m_rtDisBBorder;
     86   struct SBThemeData {
     87     FX_ARGB clrHeadBK[2][4];
     88     FX_ARGB clrHeadEdgeLeft[2][3];
     89     FX_ARGB clrHeadEdgeRight[2][3];
     90     FX_ARGB clrHeadEdgeTop[2][3];
     91     FX_ARGB clrHeadEdgeBottom[2][3];
     92     FX_ARGB clrCloseBtBKStart[2][3];
     93     FX_ARGB clrCloseBtBKEnd[2][3];
     94     FX_ARGB clrCloseBtEdgeLight[2][3];
     95     FX_ARGB clrCloseBtEdgeDark[2][3];
     96     FX_ARGB clrNormalBtBKStart[2][3];
     97     FX_ARGB clrNormalBtBKEnd[2][3];
     98     FX_ARGB clrNormalBtEdgeLight[2][3];
     99     FX_ARGB clrNormalBtEdgeDark[2][3];
    100     FX_ARGB clrBtnEdgeOut[2];
    101     FX_ARGB clrBtnCornerLight[2][3];
    102     FX_ARGB clrHeadText[2];
    103     FX_ARGB clrFormBorder[2][5];
    104     FX_ARGB clrFormBorderLight[2];
    105     FX_ARGB clrTransWhite;
    106   } * m_pThemeData;
    107 };
    108 #endif
    109