summaryrefslogtreecommitdiff
path: root/xfa/fwl/theme/cfwl_formtp.h
blob: 24eaed8f85cd5978500b643424a091e1a36d2aa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef XFA_FWL_THEME_CFWL_FORMTP_H_
#define XFA_FWL_THEME_CFWL_FORMTP_H_

#include "xfa/fwl/theme/cfwl_utils.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"

class CFWL_FormTP : public CFWL_WidgetTP {
 public:
  CFWL_FormTP();
  ~CFWL_FormTP() override;

  FWL_ERR Initialize() override;
  FWL_ERR Finalize() override;
  FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override;
  uint32_t SetThemeID(IFWL_Widget* pWidget,
                      uint32_t dwThemeID,
                      FX_BOOL bChildren = TRUE) override;
  FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override;
  FX_BOOL DrawText(CFWL_ThemeText* pParams) override;
  void* GetCapacity(CFWL_ThemePart* pThemePart,
                    CFWL_WidgetCapacity dwCapacity) override;
  FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override;

 protected:
  void CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect);
  void CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect);
  void CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect);
  void CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect);
  void CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect);

  void DrawFormBorder(CFX_Graphics* pGraphics,
                      const CFX_RectF* pRect,
                      FWLTHEME_STATE eState,
                      CFX_Matrix* pMatrix,
                      int32_t iActive = 0);
  void DrawCaption(CFX_Graphics* pGraphics,
                   const CFX_RectF* pRect,
                   FWLTHEME_STATE eState,
                   CFX_Matrix* pMatrix,
                   int32_t iActive = 0);
  void DrawNarrowCaption(CFX_Graphics* pGraphics,
                         const CFX_RectF* pRect,
                         FWLTHEME_STATE eState,
                         CFX_Matrix* pMatrix,
                         int32_t iActive = 0);
  void DrawCloseBox(CFX_Graphics* pGraphics,
                    const CFX_RectF* pRect,
                    FWLTHEME_STATE eState,
                    CFX_Matrix* pMatrix,
                    int32_t iActive = 0);
  void DrawMinMaxBoxCommon(CFX_Graphics* pGraphics,
                           const CFX_RectF* pRect,
                           FWLTHEME_STATE eState,
                           CFX_Matrix* pMatrix,
                           int32_t iActive = 0);
  void DrawMinimizeBox(CFX_Graphics* pGraphics,
                       const CFX_RectF* pRect,
                       FWLTHEME_STATE eState,
                       CFX_Matrix* pMatrix,
                       int32_t iActive = 0);
  void DrawMaximizeBox(CFX_Graphics* pGraphics,
                       const CFX_RectF* pRect,
                       FWLTHEME_STATE eState,
                       FX_BOOL bMax,
                       CFX_Matrix* pMatrix,
                       int32_t iActive = 0);
  void DrawIconImage(CFX_Graphics* pGraphics,
                     CFX_DIBitmap* pDIBitmap,
                     const CFX_RectF* pRect,
                     FWLTHEME_STATE eState,
                     CFX_Matrix* pMatrix,
                     int32_t iActive = 0);
  void SetThemeData(uint32_t dwID);
  void TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack);
  void DeactiveForm();
  void InitCaption(FX_BOOL bActive);
  CFX_DIBitmap* m_pActiveBitmap;
  CFX_DIBitmap* m_pDeactivebitmap;
  CFX_RectF m_rtDisCaption;
  CFX_RectF m_rtDisLBorder;
  CFX_RectF m_rtDisRBorder;
  CFX_RectF m_rtDisBBorder;
  struct SBThemeData {
    FX_ARGB clrHeadBK[2][4];
    FX_ARGB clrHeadEdgeLeft[2][3];
    FX_ARGB clrHeadEdgeRight[2][3];
    FX_ARGB clrHeadEdgeTop[2][3];
    FX_ARGB clrHeadEdgeBottom[2][3];
    FX_ARGB clrCloseBtBKStart[2][3];
    FX_ARGB clrCloseBtBKEnd[2][3];
    FX_ARGB clrCloseBtEdgeLight[2][3];
    FX_ARGB clrCloseBtEdgeDark[2][3];
    FX_ARGB clrNormalBtBKStart[2][3];
    FX_ARGB clrNormalBtBKEnd[2][3];
    FX_ARGB clrNormalBtEdgeLight[2][3];
    FX_ARGB clrNormalBtEdgeDark[2][3];
    FX_ARGB clrBtnEdgeOut[2];
    FX_ARGB clrBtnCornerLight[2][3];
    FX_ARGB clrHeadText[2];
    FX_ARGB clrFormBorder[2][5];
    FX_ARGB clrFormBorderLight[2];
    FX_ARGB clrTransWhite;
  } * m_pThemeData;
};

#endif  // XFA_FWL_THEME_CFWL_FORMTP_H_