John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | c411eb9 | 2017-07-25 09:39:30 -0400 | [diff] [blame] | 7 | #ifndef FPDFSDK_PWL_CPWL_WND_H_ |
| 8 | #define FPDFSDK_PWL_CPWL_WND_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
weili | 2d5b020 | 2016-08-03 11:06:49 -0700 | [diff] [blame] | 10 | #include <memory> |
Tom Sepez | ab27768 | 2016-02-17 10:07:21 -0800 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 13 | #include "core/fpdfdoc/cpdf_formcontrol.h" |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 14 | #include "core/fxcrt/cfx_observable.h" |
Tom Sepez | d0409af | 2017-05-25 15:53:57 -0700 | [diff] [blame] | 15 | #include "core/fxcrt/cfx_unowned_ptr.h" |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 16 | #include "core/fxcrt/fx_basic.h" |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 17 | #include "core/fxge/cfx_color.h" |
Lei Zhang | 60fa2fc | 2017-07-21 17:42:19 -0700 | [diff] [blame] | 18 | #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 19 | #include "fpdfsdk/cpdfsdk_widget.h" |
Dan Sinclair | c411eb9 | 2017-07-25 09:39:30 -0400 | [diff] [blame] | 20 | #include "fpdfsdk/pwl/cpwl_timer.h" |
| 21 | #include "fpdfsdk/pwl/cpwl_timer_handler.h" |
Tom Sepez | 870292c | 2015-04-07 16:12:46 -0700 | [diff] [blame] | 22 | |
Lei Zhang | 4183f20 | 2017-07-07 16:10:06 -0700 | [diff] [blame] | 23 | class CPWL_Edit; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 24 | class CPWL_MsgControl; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 25 | class CPWL_ScrollBar; |
Tom Sepez | 870292c | 2015-04-07 16:12:46 -0700 | [diff] [blame] | 26 | class CPWL_Wnd; |
dsinclair | b959010 | 2016-04-27 06:38:59 -0700 | [diff] [blame] | 27 | class CFX_SystemHandler; |
dsinclair | c7a7349 | 2016-04-05 12:01:42 -0700 | [diff] [blame] | 28 | class IPVT_FontMap; |
Tom Sepez | 870292c | 2015-04-07 16:12:46 -0700 | [diff] [blame] | 29 | class IPWL_Provider; |
Dan Sinclair | fb00ec2 | 2017-07-05 09:28:15 -0400 | [diff] [blame] | 30 | struct PWL_SCROLL_INFO; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 31 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 32 | // window styles |
| 33 | #define PWS_CHILD 0x80000000L |
| 34 | #define PWS_BORDER 0x40000000L |
| 35 | #define PWS_BACKGROUND 0x20000000L |
| 36 | #define PWS_HSCROLL 0x10000000L |
| 37 | #define PWS_VSCROLL 0x08000000L |
| 38 | #define PWS_VISIBLE 0x04000000L |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 39 | #define PWS_READONLY 0x01000000L |
| 40 | #define PWS_AUTOFONTSIZE 0x00800000L |
| 41 | #define PWS_AUTOTRANSPARENT 0x00400000L |
| 42 | #define PWS_NOREFRESHCLIP 0x00200000L |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 43 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 44 | // edit and label styles |
| 45 | #define PES_MULTILINE 0x0001L |
| 46 | #define PES_PASSWORD 0x0002L |
| 47 | #define PES_LEFT 0x0004L |
| 48 | #define PES_RIGHT 0x0008L |
| 49 | #define PES_MIDDLE 0x0010L |
| 50 | #define PES_TOP 0x0020L |
| 51 | #define PES_BOTTOM 0x0040L |
| 52 | #define PES_CENTER 0x0080L |
| 53 | #define PES_CHARARRAY 0x0100L |
| 54 | #define PES_AUTOSCROLL 0x0200L |
| 55 | #define PES_AUTORETURN 0x0400L |
| 56 | #define PES_UNDO 0x0800L |
| 57 | #define PES_RICH 0x1000L |
| 58 | #define PES_SPELLCHECK 0x2000L |
| 59 | #define PES_TEXTOVERFLOW 0x4000L |
| 60 | #define PES_NOREAD 0x8000L |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 61 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 62 | // listbox styles |
| 63 | #define PLBS_MULTIPLESEL 0x0001L |
| 64 | #define PLBS_HOVERSEL 0x0008L |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 65 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 66 | // combobox styles |
| 67 | #define PCBS_ALLOWCUSTOMTEXT 0x0001L |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 68 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 69 | #define PWL_CLASSNAME_EDIT "CPWL_Edit" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 70 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 71 | struct CPWL_Dash { |
weili | 625ad66 | 2016-06-15 11:21:33 -0700 | [diff] [blame] | 72 | CPWL_Dash() : nDash(0), nGap(0), nPhase(0) {} |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 73 | CPWL_Dash(int32_t dash, int32_t gap, int32_t phase) |
| 74 | : nDash(dash), nGap(gap), nPhase(phase) {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 75 | |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 76 | void Reset() { |
| 77 | nDash = 0; |
| 78 | nGap = 0; |
| 79 | nPhase = 0; |
| 80 | } |
| 81 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 82 | int32_t nDash; |
| 83 | int32_t nGap; |
| 84 | int32_t nPhase; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 87 | inline bool operator==(const CFX_Color& c1, const CFX_Color& c2) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 88 | return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 && |
| 89 | c1.fColor1 - c2.fColor1 > -0.0001 && |
| 90 | c1.fColor2 - c2.fColor2 < 0.0001 && |
| 91 | c1.fColor2 - c2.fColor2 > -0.0001 && |
| 92 | c1.fColor3 - c2.fColor3 < 0.0001 && |
| 93 | c1.fColor3 - c2.fColor3 > -0.0001 && |
| 94 | c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 97 | inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) { |
Tom Sepez | 007e6c0 | 2016-02-26 14:31:56 -0800 | [diff] [blame] | 98 | return !(c1 == c2); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 101 | #define PWL_SCROLLBAR_WIDTH 12.0f |
Dan Sinclair | fc54e05 | 2017-02-23 09:59:05 -0500 | [diff] [blame] | 102 | #define PWL_SCROLLBAR_TRANSPARENCY 150 |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 103 | #define PWL_DEFAULT_SELBACKCOLOR \ |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 104 | CFX_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f) |
| 105 | #define PWL_DEFAULT_BLACKCOLOR CFX_Color(COLORTYPE_GRAY, 0) |
| 106 | #define PWL_DEFAULT_WHITECOLOR CFX_Color(COLORTYPE_GRAY, 1) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 107 | |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 108 | class IPWL_Provider : public CFX_Observable<IPWL_Provider> { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 109 | public: |
| 110 | virtual ~IPWL_Provider() {} |
Tom Sepez | e5b59ca | 2015-01-09 11:46:17 -0800 | [diff] [blame] | 111 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 112 | // get a matrix which map user space to CWnd client space |
Tom Sepez | 60d909e | 2015-12-10 15:34:55 -0800 | [diff] [blame] | 113 | virtual CFX_Matrix GetWindowMatrix(void* pAttachedData) = 0; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 114 | }; |
| 115 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 116 | class IPWL_FocusHandler { |
| 117 | public: |
| 118 | virtual ~IPWL_FocusHandler() {} |
Lei Zhang | 4183f20 | 2017-07-07 16:10:06 -0700 | [diff] [blame] | 119 | virtual void OnSetFocus(CPWL_Edit* pEdit) = 0; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 120 | }; |
| 121 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 122 | struct PWL_CREATEPARAM { |
| 123 | public: |
weili | 625ad66 | 2016-06-15 11:21:33 -0700 | [diff] [blame] | 124 | PWL_CREATEPARAM(); |
| 125 | PWL_CREATEPARAM(const PWL_CREATEPARAM& other); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 126 | |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 127 | void Reset() { |
| 128 | rcRectWnd.Reset(); |
| 129 | pSystemHandler = nullptr; |
| 130 | pFontMap = nullptr; |
| 131 | pProvider.Reset(); |
| 132 | pFocusHandler = nullptr; |
| 133 | dwFlags = 0; |
| 134 | sBackgroundColor.Reset(); |
| 135 | pAttachedWidget.Reset(); |
| 136 | nBorderStyle = BorderStyle::SOLID; |
| 137 | dwBorderWidth = 0; |
| 138 | sBorderColor.Reset(); |
| 139 | sTextColor.Reset(); |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 140 | nTransparency = 0; |
| 141 | fFontSize = 0.0f; |
| 142 | sDash.Reset(); |
| 143 | pAttachedData = nullptr; |
| 144 | pParentWnd = nullptr; |
| 145 | pMsgControl = nullptr; |
| 146 | eCursorType = 0; |
| 147 | mtChild.SetIdentity(); |
| 148 | } |
| 149 | |
Lei Zhang | 633a3b7 | 2017-06-02 15:27:22 -0700 | [diff] [blame] | 150 | CFX_FloatRect rcRectWnd; // required |
| 151 | CFX_SystemHandler* pSystemHandler; // required |
| 152 | IPVT_FontMap* pFontMap; // required |
| 153 | IPWL_Provider::ObservedPtr pProvider; // required |
| 154 | IPWL_FocusHandler* pFocusHandler; // optional |
| 155 | uint32_t dwFlags; // optional |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 156 | CFX_Color sBackgroundColor; // optional |
Dan Sinclair | bc8dcc3 | 2017-01-19 13:53:02 -0500 | [diff] [blame] | 157 | CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required |
Lei Zhang | 633a3b7 | 2017-06-02 15:27:22 -0700 | [diff] [blame] | 158 | BorderStyle nBorderStyle; // optional |
| 159 | int32_t dwBorderWidth; // optional |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 160 | CFX_Color sBorderColor; // optional |
| 161 | CFX_Color sTextColor; // optional |
Lei Zhang | 633a3b7 | 2017-06-02 15:27:22 -0700 | [diff] [blame] | 162 | int32_t nTransparency; // optional |
| 163 | float fFontSize; // optional |
| 164 | CPWL_Dash sDash; // optional |
| 165 | void* pAttachedData; // optional |
| 166 | CPWL_Wnd* pParentWnd; // ignore |
| 167 | CPWL_MsgControl* pMsgControl; // ignore |
| 168 | int32_t eCursorType; // ignore |
| 169 | CFX_Matrix mtChild; // ignore |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 170 | }; |
| 171 | |
Tom Sepez | 77417ec | 2017-07-19 16:46:22 -0700 | [diff] [blame] | 172 | class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 173 | public: |
| 174 | CPWL_Wnd(); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 175 | ~CPWL_Wnd() override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 176 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 177 | virtual CFX_ByteString GetClassName() const; |
Lei Zhang | 33c0300 | 2017-08-15 11:18:19 -0700 | [diff] [blame] | 178 | virtual void InvalidateRect(CFX_FloatRect* pRect); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 179 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 180 | virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 181 | virtual bool OnChar(uint16_t nChar, uint32_t nFlag); |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 182 | virtual bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag); |
| 183 | virtual bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag); |
| 184 | virtual bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag); |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 185 | virtual bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); |
| 186 | virtual bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); |
| 187 | virtual bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 188 | virtual bool OnMouseWheel(short zDelta, |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 189 | const CFX_PointF& point, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 190 | uint32_t nFlag); |
Dan Sinclair | fb00ec2 | 2017-07-05 09:28:15 -0400 | [diff] [blame] | 191 | virtual void SetScrollInfo(const PWL_SCROLL_INFO& info); |
Dan Sinclair | 7e0336e | 2017-07-05 09:39:50 -0400 | [diff] [blame] | 192 | virtual void SetScrollPosition(float pos); |
Dan Sinclair | 63fbd8d | 2017-07-05 14:10:36 -0400 | [diff] [blame] | 193 | virtual void ScrollWindowVertically(float pos); |
Dan Sinclair | 7f6bec9 | 2017-07-05 14:13:16 -0400 | [diff] [blame] | 194 | virtual void NotifyLButtonDown(CPWL_Wnd* child, const CFX_PointF& pos); |
| 195 | virtual void NotifyLButtonUp(CPWL_Wnd* child, const CFX_PointF& pos); |
| 196 | virtual void NotifyMouseMove(CPWL_Wnd* child, const CFX_PointF& pos); |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 197 | virtual void SetFocus(); |
| 198 | virtual void KillFocus(); |
| 199 | virtual void SetCursor(); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 200 | virtual void SetVisible(bool bVisible); |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 201 | virtual void SetFontSize(float fFontSize); |
| 202 | virtual float GetFontSize() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 203 | |
Diana Gage | dce2d72 | 2017-06-20 11:17:11 -0700 | [diff] [blame] | 204 | virtual CFX_WideString GetSelectedText(); |
Diana Gage | ab39097 | 2017-07-28 17:07:39 -0700 | [diff] [blame] | 205 | virtual void ReplaceSelection(const CFX_WideString& text); |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 206 | virtual CFX_FloatRect GetFocusRect() const; |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 207 | virtual CFX_FloatRect GetClientRect() const; |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 208 | |
| 209 | void InvalidateFocusHandler(IPWL_FocusHandler* handler); |
| 210 | void InvalidateProvider(IPWL_Provider* provider); |
| 211 | void Create(const PWL_CREATEPARAM& cp); |
| 212 | void Destroy(); |
| 213 | void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh); |
| 214 | |
| 215 | void SetCapture(); |
| 216 | void ReleaseCapture(); |
| 217 | |
Lei Zhang | eb14e04 | 2017-08-15 13:56:43 -0700 | [diff] [blame] | 218 | void DrawAppearance(CFX_RenderDevice* pDevice, |
| 219 | const CFX_Matrix& mtUser2Device); |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 220 | |
Dan Sinclair | 7f55a54 | 2017-07-13 14:17:10 -0400 | [diff] [blame] | 221 | CFX_Color GetBackgroundColor() const; |
| 222 | void SetBackgroundColor(const CFX_Color& color); |
| 223 | CFX_Color GetBorderColor() const; |
| 224 | CFX_Color GetTextColor() const; |
| 225 | void SetTextColor(const CFX_Color& color); |
| 226 | CFX_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const; |
| 227 | CFX_Color GetBorderRightBottomColor(BorderStyle nBorderStyle) const; |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 228 | |
| 229 | void SetBorderStyle(BorderStyle eBorderStyle); |
| 230 | BorderStyle GetBorderStyle() const; |
| 231 | const CPWL_Dash& GetBorderDash() const; |
| 232 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 233 | int32_t GetBorderWidth() const; |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 234 | int32_t GetInnerBorderWidth() const; |
| 235 | CFX_FloatRect GetWindowRect() const; |
| 236 | CFX_PointF GetCenterPoint() const; |
| 237 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 238 | bool IsVisible() const { return m_bVisible; } |
| 239 | bool HasFlag(uint32_t dwFlags) const; |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 240 | void AddFlag(uint32_t dwFlags); |
| 241 | void RemoveFlag(uint32_t dwFlags); |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 242 | |
| 243 | void SetClipRect(const CFX_FloatRect& rect); |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 244 | const CFX_FloatRect& GetClipRect() const; |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 245 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 246 | CPWL_Wnd* GetParentWindow() const; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 247 | void* GetAttachedData() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 248 | |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 249 | bool WndHitTest(const CFX_PointF& point) const; |
| 250 | bool ClientHitTest(const CFX_PointF& point) const; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 251 | bool IsCaptureMouse() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 252 | |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 253 | void EnableWindow(bool bEnable); |
| 254 | bool IsEnabled() const { return m_bEnabled; } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 255 | const CPWL_Wnd* GetFocused() const; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 256 | bool IsFocused() const; |
| 257 | bool IsReadOnly() const; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 258 | CPWL_ScrollBar* GetVScrollBar() const; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 259 | |
dsinclair | c7a7349 | 2016-04-05 12:01:42 -0700 | [diff] [blame] | 260 | IPVT_FontMap* GetFontMap() const; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 261 | IPWL_Provider* GetProvider() const; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 262 | IPWL_FocusHandler* GetFocusHandler() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 263 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 264 | int32_t GetTransparency(); |
| 265 | void SetTransparency(int32_t nTransparency); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 266 | |
Tom Sepez | 60d909e | 2015-12-10 15:34:55 -0800 | [diff] [blame] | 267 | CFX_Matrix GetChildToRoot() const; |
| 268 | CFX_Matrix GetChildMatrix() const; |
| 269 | void SetChildMatrix(const CFX_Matrix& mt); |
| 270 | CFX_Matrix GetWindowMatrix() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 271 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 272 | protected: |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 273 | friend class CPWL_MsgControl; |
| 274 | |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 275 | // CPWL_TimerHandler |
dsinclair | b959010 | 2016-04-27 06:38:59 -0700 | [diff] [blame] | 276 | CFX_SystemHandler* GetSystemHandler() const override; |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 277 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 278 | virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); |
| 279 | virtual void RePosChildWnd(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 280 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 281 | virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, |
Lei Zhang | eb14e04 | 2017-08-15 13:56:43 -0700 | [diff] [blame] | 282 | const CFX_Matrix& mtUser2Device); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 283 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 284 | virtual void OnCreate(PWL_CREATEPARAM& cp); |
| 285 | virtual void OnCreated(); |
| 286 | virtual void OnDestroy(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 287 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 288 | virtual void OnSetFocus(); |
| 289 | virtual void OnKillFocus(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 290 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 291 | void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; } |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 292 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 293 | bool IsValid() const; |
Lei Zhang | 7457e38 | 2016-01-06 23:00:34 -0800 | [diff] [blame] | 294 | const PWL_CREATEPARAM& GetCreationParam() const; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 295 | bool IsNotifying() const { return m_bNotifying; } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 296 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 297 | void InvalidateRectMove(const CFX_FloatRect& rcOld, |
| 298 | const CFX_FloatRect& rcNew); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 299 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 300 | bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; |
| 301 | bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 302 | const CPWL_Wnd* GetRootWnd() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 303 | |
Lei Zhang | 60fa2fc | 2017-07-21 17:42:19 -0700 | [diff] [blame] | 304 | static bool IsCTRLpressed(uint32_t nFlag) { |
| 305 | return CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag); |
| 306 | } |
| 307 | static bool IsSHIFTpressed(uint32_t nFlag) { |
| 308 | return CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag); |
| 309 | } |
| 310 | static bool IsALTpressed(uint32_t nFlag) { |
| 311 | return CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag); |
| 312 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 313 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 314 | private: |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 315 | CFX_PointF ParentToChild(const CFX_PointF& point) const; |
| 316 | CFX_FloatRect ParentToChild(const CFX_FloatRect& rect) const; |
| 317 | |
Lei Zhang | eb14e04 | 2017-08-15 13:56:43 -0700 | [diff] [blame] | 318 | void DrawChildAppearance(CFX_RenderDevice* pDevice, |
| 319 | const CFX_Matrix& mtUser2Device); |
Dan Sinclair | 90b7326 | 2017-02-23 14:38:48 -0500 | [diff] [blame] | 320 | |
Lei Zhang | 77f9bff | 2017-08-29 11:34:12 -0700 | [diff] [blame^] | 321 | CFX_FloatRect PWLtoWnd(const CFX_FloatRect& rect) const; |
Dan Sinclair | 1f403ce | 2017-02-21 12:56:24 -0500 | [diff] [blame] | 322 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 323 | void AddChild(CPWL_Wnd* pWnd); |
| 324 | void RemoveChild(CPWL_Wnd* pWnd); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 325 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 326 | void CreateScrollBar(const PWL_CREATEPARAM& cp); |
| 327 | void CreateVScrollBar(const PWL_CREATEPARAM& cp); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 328 | |
Lei Zhang | 62b2e91 | 2015-08-14 21:49:19 -0700 | [diff] [blame] | 329 | void AdjustStyle(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 330 | void CreateMsgControl(); |
| 331 | void DestroyMsgControl(); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 332 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 333 | CPWL_MsgControl* GetMsgControl() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 334 | |
tsepez | 6745f96 | 2017-01-04 10:09:45 -0800 | [diff] [blame] | 335 | std::vector<CPWL_Wnd*> m_Children; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 336 | PWL_CREATEPARAM m_sPrivateParam; |
Tom Sepez | d0409af | 2017-05-25 15:53:57 -0700 | [diff] [blame] | 337 | CFX_UnownedPtr<CPWL_ScrollBar> m_pVScrollBar; |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 338 | CFX_FloatRect m_rcWindow; |
| 339 | CFX_FloatRect m_rcClip; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 340 | bool m_bCreated; |
| 341 | bool m_bVisible; |
| 342 | bool m_bNotifying; |
| 343 | bool m_bEnabled; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 344 | }; |
| 345 | |
Dan Sinclair | c411eb9 | 2017-07-25 09:39:30 -0400 | [diff] [blame] | 346 | #endif // FPDFSDK_PWL_CPWL_WND_H_ |