OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); | 46 CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); |
47 void OnProcessMessage(CFWL_Message* pMessage) override; | 47 void OnProcessMessage(CFWL_Message* pMessage) override; |
48 | 48 |
49 protected: | 49 protected: |
50 CFWL_ComboEditImp* m_pOwner; | 50 CFWL_ComboEditImp* m_pOwner; |
51 }; | 51 }; |
52 class CFWL_ComboListImp : public CFWL_ListBoxImp { | 52 class CFWL_ComboListImp : public CFWL_ListBoxImp { |
53 public: | 53 public: |
54 CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, | 54 CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, |
55 IFWL_Widget* pOuter); | 55 IFWL_Widget* pOuter); |
56 virtual FWL_Error Initialize(); | 56 |
57 virtual FWL_Error Finalize(); | 57 // CFWL_WidgetImp |
| 58 FWL_Error Initialize() override; |
| 59 FWL_Error Finalize() override; |
| 60 |
58 int32_t MatchItem(const CFX_WideString& wsMatch); | 61 int32_t MatchItem(const CFX_WideString& wsMatch); |
59 void ChangeSelected(int32_t iSel); | 62 void ChangeSelected(int32_t iSel); |
60 int32_t CountItems(); | 63 int32_t CountItems(); |
61 void GetItemRect(int32_t nIndex, CFX_RectF& rtItem); | 64 void GetItemRect(int32_t nIndex, CFX_RectF& rtItem); |
62 void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); | 65 void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); |
63 void SetFocus(FX_BOOL bSet); | 66 void SetFocus(FX_BOOL bSet); |
| 67 |
64 FX_BOOL m_bNotifyOwner; | 68 FX_BOOL m_bNotifyOwner; |
| 69 |
65 friend class CFWL_ComboListImpDelegate; | 70 friend class CFWL_ComboListImpDelegate; |
66 friend class CFWL_ComboBoxImp; | 71 friend class CFWL_ComboBoxImp; |
67 }; | 72 }; |
68 class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { | 73 class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { |
69 public: | 74 public: |
70 CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); | 75 CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); |
71 void OnProcessMessage(CFWL_Message* pMessage) override; | 76 void OnProcessMessage(CFWL_Message* pMessage) override; |
72 | 77 |
73 protected: | 78 protected: |
74 void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 79 void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
75 int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg); | 80 int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg); |
76 int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg); | 81 int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg); |
77 int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg); | 82 int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg); |
78 int32_t OnDropListKey(CFWL_MsgKey* pKey); | 83 int32_t OnDropListKey(CFWL_MsgKey* pKey); |
79 void OnDropListKeyDown(CFWL_MsgKey* pKey); | 84 void OnDropListKeyDown(CFWL_MsgKey* pKey); |
80 CFWL_ComboListImp* m_pOwner; | 85 CFWL_ComboListImp* m_pOwner; |
81 }; | 86 }; |
82 class CFWL_ComboBoxImp : public CFWL_WidgetImp { | 87 class CFWL_ComboBoxImp : public CFWL_WidgetImp { |
83 public: | 88 public: |
84 CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, | 89 CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, |
85 IFWL_Widget* pOuter); | 90 IFWL_Widget* pOuter); |
86 virtual ~CFWL_ComboBoxImp(); | 91 ~CFWL_ComboBoxImp() override; |
87 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; | 92 |
88 virtual uint32_t GetClassID() const; | 93 // CFWL_WidgetImp |
89 virtual FWL_Error Initialize(); | 94 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
90 virtual FWL_Error Finalize(); | 95 FWL_Type GetClassID() const override; |
91 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 96 FWL_Error Initialize() override; |
92 virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, | 97 FWL_Error Finalize() override; |
93 uint32_t dwStylesExRemoved); | 98 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
94 virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | 99 FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, |
95 virtual FWL_Error Update(); | 100 uint32_t dwStylesExRemoved) override; |
96 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 101 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
97 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 102 FWL_Error Update() override; |
98 const CFX_Matrix* pMatrix = NULL); | 103 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
99 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 104 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
100 virtual int32_t GetCurSel(); | 105 const CFX_Matrix* pMatrix = nullptr) override; |
101 virtual FWL_Error SetCurSel(int32_t iSel); | 106 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
102 virtual FWL_Error SetEditText(const CFX_WideString& wsText); | 107 |
103 virtual int32_t GetEditTextLength() const; | 108 int32_t GetCurSel(); |
104 virtual FWL_Error GetEditText(CFX_WideString& wsText, | 109 FWL_Error SetCurSel(int32_t iSel); |
105 int32_t nStart = 0, | 110 FWL_Error SetEditText(const CFX_WideString& wsText); |
106 int32_t nCount = -1) const; | 111 int32_t GetEditTextLength() const; |
107 virtual FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); | 112 FWL_Error GetEditText(CFX_WideString& wsText, |
108 virtual int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); | 113 int32_t nStart = 0, |
109 virtual int32_t GetEditLimit(); | 114 int32_t nCount = -1) const; |
110 virtual FWL_Error SetEditLimit(int32_t nLimit); | 115 FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); |
111 virtual FWL_Error EditDoClipboard(int32_t iCmd); | 116 int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); |
112 virtual FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); | 117 int32_t GetEditLimit(); |
113 virtual FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); | 118 FWL_Error SetEditLimit(int32_t nLimit); |
114 virtual IFWL_ListBox* GetListBoxt(); | 119 FWL_Error EditDoClipboard(int32_t iCmd); |
115 virtual FX_BOOL AfterFocusShowDropList(); | 120 FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); |
116 virtual FWL_Error OpenDropDownList(FX_BOOL bActivate); | 121 FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); |
117 virtual FX_BOOL EditCanUndo(); | 122 IFWL_ListBox* GetListBoxt(); |
118 virtual FX_BOOL EditCanRedo(); | 123 FX_BOOL AfterFocusShowDropList(); |
119 virtual FX_BOOL EditUndo(); | 124 FWL_Error OpenDropDownList(FX_BOOL bActivate); |
120 virtual FX_BOOL EditRedo(); | 125 FX_BOOL EditCanUndo(); |
121 virtual FX_BOOL EditCanCopy(); | 126 FX_BOOL EditCanRedo(); |
122 virtual FX_BOOL EditCanCut(); | 127 FX_BOOL EditUndo(); |
123 virtual FX_BOOL EditCanSelectAll(); | 128 FX_BOOL EditRedo(); |
124 virtual FX_BOOL EditCopy(CFX_WideString& wsCopy); | 129 FX_BOOL EditCanCopy(); |
125 virtual FX_BOOL EditCut(CFX_WideString& wsCut); | 130 FX_BOOL EditCanCut(); |
126 virtual FX_BOOL EditPaste(const CFX_WideString& wsPaste); | 131 FX_BOOL EditCanSelectAll(); |
127 virtual FX_BOOL EditSelectAll(); | 132 FX_BOOL EditCopy(CFX_WideString& wsCopy); |
128 virtual FX_BOOL EditDelete(); | 133 FX_BOOL EditCut(CFX_WideString& wsCut); |
129 virtual FX_BOOL EditDeSelect(); | 134 FX_BOOL EditPaste(const CFX_WideString& wsPaste); |
130 virtual FWL_Error GetBBox(CFX_RectF& rect); | 135 FX_BOOL EditSelectAll(); |
131 virtual FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, | 136 FX_BOOL EditDelete(); |
132 uint32_t dwStylesExRemoved); | 137 FX_BOOL EditDeSelect(); |
| 138 FWL_Error GetBBox(CFX_RectF& rect); |
| 139 FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, |
| 140 uint32_t dwStylesExRemoved); |
133 | 141 |
134 protected: | 142 protected: |
| 143 friend class CFWL_ComboListImp; |
| 144 friend class CFWL_ComboEditImp; |
| 145 friend class CFWL_ComboEditImpDelegate; |
| 146 friend class CFWL_ComboListImpDelegate; |
| 147 friend class CFWL_ComboBoxImpDelegate; |
| 148 friend class CFWL_ComboProxyImpDelegate; |
| 149 |
135 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); | 150 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); |
136 FX_FLOAT GetListHeight(); | 151 FX_FLOAT GetListHeight(); |
137 void ShowDropList(FX_BOOL bActivate); | 152 void ShowDropList(FX_BOOL bActivate); |
138 FX_BOOL IsDropListShowed(); | 153 FX_BOOL IsDropListShowed(); |
139 FX_BOOL IsDropDownStyle() const; | 154 FX_BOOL IsDropDownStyle() const; |
140 void MatchEditText(); | 155 void MatchEditText(); |
141 void SynchrEditText(int32_t iListItem); | 156 void SynchrEditText(int32_t iListItem); |
142 void Layout(); | 157 void Layout(); |
143 void ReSetTheme(); | 158 void ReSetTheme(); |
144 void ReSetEditAlignment(); | 159 void ReSetEditAlignment(); |
(...skipping 25 matching lines...) Expand all Loading... |
170 IFWL_Form* m_pForm; | 185 IFWL_Form* m_pForm; |
171 FX_BOOL m_bLButtonDown; | 186 FX_BOOL m_bLButtonDown; |
172 FX_BOOL m_bUpFormHandler; | 187 FX_BOOL m_bUpFormHandler; |
173 int32_t m_iCurSel; | 188 int32_t m_iCurSel; |
174 int32_t m_iBtnState; | 189 int32_t m_iBtnState; |
175 FX_FLOAT m_fComboFormHandler; | 190 FX_FLOAT m_fComboFormHandler; |
176 FX_FLOAT m_fItemHeight; | 191 FX_FLOAT m_fItemHeight; |
177 FX_BOOL m_bNeedShowList; | 192 FX_BOOL m_bNeedShowList; |
178 CFWL_FormProxyImp* m_pProxy; | 193 CFWL_FormProxyImp* m_pProxy; |
179 CFWL_ComboProxyImpDelegate* m_pListProxyDelegate; | 194 CFWL_ComboProxyImpDelegate* m_pListProxyDelegate; |
180 | |
181 friend class CFWL_ComboListImp; | |
182 friend class CFWL_ComboEditImp; | |
183 friend class CFWL_ComboEditImpDelegate; | |
184 friend class CFWL_ComboListImpDelegate; | |
185 friend class CFWL_ComboBoxImpDelegate; | |
186 friend class CFWL_ComboProxyImpDelegate; | |
187 }; | 195 }; |
188 class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { | 196 class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { |
189 public: | 197 public: |
190 CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner); | 198 CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner); |
191 void OnProcessMessage(CFWL_Message* pMessage) override; | 199 void OnProcessMessage(CFWL_Message* pMessage) override; |
192 void OnProcessEvent(CFWL_Event* pEvent) override; | 200 void OnProcessEvent(CFWL_Event* pEvent) override; |
193 void OnDrawWidget(CFX_Graphics* pGraphics, | 201 void OnDrawWidget(CFX_Graphics* pGraphics, |
194 const CFX_Matrix* pMatrix = NULL) override; | 202 const CFX_Matrix* pMatrix = NULL) override; |
195 | 203 |
196 protected: | 204 protected: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void OnDeactive(CFWL_MsgDeactivate* pMsg); | 236 void OnDeactive(CFWL_MsgDeactivate* pMsg); |
229 void OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet); | 237 void OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet); |
230 FX_BOOL m_bLButtonDown; | 238 FX_BOOL m_bLButtonDown; |
231 FX_BOOL m_bLButtonUpSelf; | 239 FX_BOOL m_bLButtonUpSelf; |
232 FX_FLOAT m_fStartPos; | 240 FX_FLOAT m_fStartPos; |
233 IFWL_Form* m_pForm; | 241 IFWL_Form* m_pForm; |
234 CFWL_ComboBoxImp* m_pComboBox; | 242 CFWL_ComboBoxImp* m_pComboBox; |
235 }; | 243 }; |
236 | 244 |
237 #endif // XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ | 245 #endif // XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ |
OLD | NEW |