• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The PDFium Authors
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_FWL_CFWL_THEMEPART_H_
8 #define XFA_FWL_CFWL_THEMEPART_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/fx_memory.h"
14 #include "core/fxcrt/mask.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 #include "xfa/fwl/theme/cfwl_utils.h"
17 
18 namespace pdfium {
19 
20 class CFWL_Widget;
21 
22 enum class CFWL_PartState : uint16_t {
23   kNormal = 0,
24   kChecked = 1 << 1,
25   kDefault = 1 << 2,
26   kDisabled = 1 << 3,
27   kFlagged = 1 << 4,
28   kFocused = 1 << 5,
29   kHightLight = 1 << 6,
30   kHovered = 1 << 7,
31   kNeutral = 1 << 9,
32   kPressed = 1 << 10,
33   kReadOnly = 1 << 11,
34   kLSelected = 1 << 12,
35   kRSelected = 1 << 13,
36   kSelected = 1 << 14
37 };
38 
39 class CFWL_ThemePart {
40  public:
41   enum class Part : uint8_t {
42     kNone = 0,
43 
44     kBackArrow,
45     kBackground,
46     kBorder,
47     kCaption,
48     kCheck,
49     kCheckBox,
50     kCloseBox,
51     kCombTextLine,
52     kDateInBK,
53     kDateInCircle,
54     kDatesIn,
55     kDatesOut,
56     kDownButton,
57     kDropDownButton,
58     kForeArrow,
59     kHSeparator,
60     kHeadText,
61     kHeader,
62     kIcon,
63     kImage,
64     kLBtn,
65     kListItem,
66     kLowerTrack,
67     kMinimizeBox,
68     kMaximizeBox,
69     kNarrowCaption,
70     kRBtn,
71     kThumb,
72     kThumbBackArrow,
73     kThumbForeArrow,
74     kThumbLowerTrack,
75     kThumbThumb,
76     kThumbUpperTrack,
77     kToday,
78     kTodayCircle,
79     kUpButton,
80     kUpperTrack,
81     kVSeparator,
82     kWeek,
83     kWeekNum,
84     kWeekNumSep
85   };
86 
87   FX_STACK_ALLOCATED();
88 
89   CFWL_ThemePart(Part iPart, CFWL_Widget* pWidget);
90   ~CFWL_ThemePart();
91 
GetPart()92   Part GetPart() const { return m_iPart; }
GetWidget()93   CFWL_Widget* GetWidget() const { return m_pWidget; }
94   FWLTHEME_STATE GetThemeState() const;
95 
96   CFX_Matrix m_matrix;
97   CFX_RectF m_PartRect;
98   UnownedPtr<const CFX_RectF> m_pRtData;
99   Mask<CFWL_PartState> m_dwStates = CFWL_PartState::kNormal;
100   bool m_bMaximize = false;
101   bool m_bStaticBackground = false;
102 
103  private:
104   const Part m_iPart;
105   UnownedPtr<CFWL_Widget> const m_pWidget;
106 };
107 
108 }  // namespace pdfium
109 
110 // TODO(crbug.com/42271761): Remove.
111 using pdfium::CFWL_PartState;
112 using pdfium::CFWL_ThemePart;
113 
114 #endif  // XFA_FWL_CFWL_THEMEPART_H_
115