Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpwl_wnd.cpp
Go to the documentation of this file.
1// Copyright 2014 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#include "fpdfsdk/pwl/cpwl_wnd.h"
8
9#include <sstream>
10#include <utility>
11#include <vector>
12
13#include "build/build_config.h"
14#include "core/fxcrt/stl_util.h"
15#include "core/fxge/cfx_renderdevice.h"
16#include "fpdfsdk/pwl/cpwl_scroll_bar.h"
17#include "public/fpdf_fwlevent.h"
18#include "third_party/base/check.h"
19#include "third_party/base/check_op.h"
20#include "third_party/base/containers/contains.h"
21
22namespace {
23
24constexpr float kDefaultFontSize = 9.0f;
25
26} // namespace
27
28// static
31
32// static
35
37 IPWL_FillerNotify* filler_notify,
38 ProviderIface* provider)
42 fFontSize(kDefaultFontSize),
43 sDash(3, 0, 0) {}
44
45CPWL_Wnd::CreateParams::CreateParams(const CreateParams& other) = default;
46
48
49// For a compound window (a window containing a child window as occurs in a
50// list box, combo box, or even a scroll bar), this class contains information
51// shared amongst the parent and children.
52class CPWL_Wnd::SharedCaptureFocusState final : public Observable {
53 public:
54 explicit SharedCaptureFocusState(const CPWL_Wnd* pOwnerWnd)
57
58 bool IsOwnedByWnd(const CPWL_Wnd* pWnd) const { return m_pOwnerWnd == pWnd; }
59
60 bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const {
61 return pWnd && pdfium::Contains(m_MousePaths, pWnd);
62 }
63
64 bool IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const {
65 return pWnd == m_pMainKeyboardWnd;
66 }
67
68 bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const {
69 return pWnd && pdfium::Contains(m_KeyboardPaths, pWnd);
70 }
71
72 void SetCapture(CPWL_Wnd* pWnd) { m_MousePaths = pWnd->GetAncestors(); }
73 void ReleaseCapture() { m_MousePaths.clear(); }
74
75 void SetFocus(CPWL_Wnd* pWnd) {
76 m_KeyboardPaths = pWnd->GetAncestors();
77 m_pMainKeyboardWnd = pWnd;
78
79 // Note, pWnd may get destroyed in the OnSetFocus call.
81 }
82
83 void ReleaseFocus() {
84 ObservedPtr<SharedCaptureFocusState> observed_ptr(this);
85 if (!m_KeyboardPaths.empty()) {
86 CPWL_Wnd* pWnd = m_KeyboardPaths.front();
87 if (pWnd)
89 }
90 if (!observed_ptr)
91 return;
92
93 m_pMainKeyboardWnd = nullptr;
94 m_KeyboardPaths.clear();
95 }
96
97 void RemoveWnd(CPWL_Wnd* pWnd) {
98 if (pWnd == m_pOwnerWnd) {
99 m_pOwnerWnd = nullptr;
100 }
101 if (pWnd == m_pMainKeyboardWnd) {
102 m_pMainKeyboardWnd = nullptr;
103 }
104 auto mouse_it = std::find(m_MousePaths.begin(), m_MousePaths.end(), pWnd);
105 if (mouse_it != m_MousePaths.end()) {
106 m_MousePaths.erase(mouse_it);
107 }
108 auto keyboard_it =
109 std::find(m_KeyboardPaths.begin(), m_KeyboardPaths.end(), pWnd);
110 if (keyboard_it != m_KeyboardPaths.end()) {
111 m_KeyboardPaths.erase(keyboard_it);
112 }
113 }
114
115 private:
116 UnownedPtr<const CPWL_Wnd> m_pOwnerWnd;
117 UnownedPtr<const CPWL_Wnd> m_pMainKeyboardWnd;
118 std::vector<UnownedPtr<CPWL_Wnd>> m_MousePaths;
119 std::vector<UnownedPtr<CPWL_Wnd>> m_KeyboardPaths;
120};
121
122// static
123bool CPWL_Wnd::IsSHIFTKeyDown(Mask<FWL_EVENTFLAG> nFlag) {
124 return !!(nFlag & FWL_EVENTFLAG_ShiftKey);
125}
126
127// static
128bool CPWL_Wnd::IsCTRLKeyDown(Mask<FWL_EVENTFLAG> nFlag) {
129 return !!(nFlag & FWL_EVENTFLAG_ControlKey);
130}
131
132// static
133bool CPWL_Wnd::IsALTKeyDown(Mask<FWL_EVENTFLAG> nFlag) {
134 return !!(nFlag & FWL_EVENTFLAG_AltKey);
135}
136
137// static
138bool CPWL_Wnd::IsMETAKeyDown(Mask<FWL_EVENTFLAG> nFlag) {
139 return !!(nFlag & FWL_EVENTFLAG_MetaKey);
140}
141
142// static
143bool CPWL_Wnd::IsPlatformShortcutKey(Mask<FWL_EVENTFLAG> nFlag) {
144#if BUILDFLAG(IS_APPLE)
145 return IsMETAKeyDown(nFlag);
146#else
147 return IsCTRLKeyDown(nFlag);
148#endif
149}
150
152 const CreateParams& cp,
153 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
155
157 DCHECK(!m_bCreated);
158}
159
161 DCHECK(!m_bCreated);
162
163 m_CreationParams.rcRectWnd.Normalize();
164 m_rcWindow = m_CreationParams.rcRectWnd;
165 m_rcClip = m_rcWindow;
166 if (!m_rcClip.IsEmpty()) {
167 m_rcClip.Inflate(1.0f, 1.0f);
168 m_rcClip.Normalize();
169 }
170 CreateSharedCaptureFocusState();
171
172 CreateParams ccp = m_CreationParams;
173 ccp.dwFlags &= 0xFFFF0000L; // remove sub styles
174 CreateVScrollBar(ccp);
176 m_bVisible = HasFlag(PWS_VISIBLE);
179 return;
180 }
181
182 m_bCreated = true;
183}
184
186
188
190 if (m_CreationParams.pProvider.Get() == provider)
191 m_CreationParams.pProvider.Reset();
192}
193
197 if (m_bCreated) {
198 m_pVScrollBar = nullptr;
199 while (!m_Children.empty()) {
200 std::unique_ptr<CPWL_Wnd> pChild = std::move(m_Children.back());
201 m_Children.pop_back();
202 pChild->Destroy();
203 }
204 if (m_pParent)
205 m_pParent->RemoveChild(this);
206 m_bCreated = false;
207 }
208 DestroySharedCaptureFocusState();
209}
210
211bool CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) {
212 if (!IsValid())
213 return true;
214
216 m_rcWindow = rcNew;
217 m_rcWindow.Normalize();
218
219 if (bReset) {
220 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right ||
221 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) {
223 return false;
224 }
225 }
226 }
227 if (bRefresh && !InvalidateRectMove(rcOld, rcNew))
228 return false;
229
230 m_CreationParams.rcRectWnd = m_rcWindow;
231 return true;
232}
233
235 const CFX_FloatRect& rcNew) {
236 CFX_FloatRect rcUnion = rcOld;
237 rcUnion.Union(rcNew);
238
239 return InvalidateRect(&rcUnion);
240}
241
243 const CFX_Matrix& mtUser2Device) {
244 if (IsValid() && IsVisible()) {
245 DrawThisAppearance(pDevice, mtUser2Device);
246 DrawChildAppearance(pDevice, mtUser2Device);
247 }
248}
249
251 const CFX_Matrix& mtUser2Device) {
253 if (rectWnd.IsEmpty())
254 return;
255
257 float width = static_cast<float>(GetBorderWidth() + GetInnerBorderWidth());
258 pDevice->DrawFillRect(&mtUser2Device, rectWnd.GetDeflated(width, width),
260 }
261
263 pDevice->DrawBorder(&mtUser2Device, rectWnd,
264 static_cast<float>(GetBorderWidth()), GetBorderColor(),
268 }
269}
270
271void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice,
272 const CFX_Matrix& mtUser2Device) {
273 for (const auto& pChild : m_Children) {
274 pChild->DrawAppearance(pDevice, mtUser2Device);
275 }
276}
277
279 if (!IsValid())
280 return true;
281
282 ObservedPtr<CPWL_Wnd> this_observed(this);
283 CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect();
286 if (!rcClip.IsEmpty())
287 rcRefresh.Intersect(rcClip);
288 }
289
290 CFX_FloatRect rcWin = PWLtoWnd(rcRefresh);
291 rcWin.Inflate(1, 1);
292 rcWin.Normalize();
293 GetFillerNotify()->InvalidateRect(m_pAttachedData.get(), rcWin);
294 return !!this_observed;
295}
296
297bool CPWL_Wnd::OnKeyDown(FWL_VKEYCODE nKeyCode, Mask<FWL_EVENTFLAG> nFlag) {
298 if (!IsValid() || !IsVisible())
299 return false;
300 if (!IsWndCaptureKeyboard(this))
301 return false;
302 for (const auto& pChild : m_Children) {
303 if (IsWndCaptureKeyboard(pChild.get()))
304 return pChild->OnKeyDown(nKeyCode, nFlag);
305 }
306 return false;
307}
308
309bool CPWL_Wnd::OnChar(uint16_t nChar, Mask<FWL_EVENTFLAG> nFlag) {
310 if (!IsValid() || !IsVisible())
311 return false;
312 if (!IsWndCaptureKeyboard(this))
313 return false;
314 for (const auto& pChild : m_Children) {
315 if (IsWndCaptureKeyboard(pChild.get()))
316 return pChild->OnChar(nChar, nFlag);
317 }
318 return false;
319}
320
321#define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)
322 bool CPWL_Wnd::mouse_method_name(Mask<FWL_EVENTFLAG> nFlag,
323 const CFX_PointF& point) {
324 if (!IsValid() || !IsVisible())
325 return false;
326 if (IsWndCaptureMouse(this)) {
327 for (const auto& pChild : m_Children) {
328 if (IsWndCaptureMouse(pChild.get())) {
329 return pChild->mouse_method_name(nFlag, point);
330 }
331 }
332 SetCursor();
333 return false;
334 }
335 for (const auto& pChild : m_Children) {
336 if (pChild->WndHitTest(point)) {
337 return pChild->mouse_method_name(nFlag, point);
338 }
339 }
340 if (WndHitTest(point))
341 SetCursor();
342 return false;
343 }
344
345PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk)
346PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown)
349#undef PWL_IMPLEMENT_MOUSE_METHOD
350
351// Unlike their FWL counterparts, PWL windows don't handle right clicks.
352bool CPWL_Wnd::OnRButtonDown(Mask<FWL_EVENTFLAG> nFlag,
353 const CFX_PointF& point) {
354 return false;
355}
356
357bool CPWL_Wnd::OnRButtonUp(Mask<FWL_EVENTFLAG> nFlag, const CFX_PointF& point) {
358 return false;
359}
360
361WideString CPWL_Wnd::GetText() {
362 return WideString();
363}
364
366 return WideString();
367}
368
369void CPWL_Wnd::ReplaceAndKeepSelection(const WideString& text) {}
370
371void CPWL_Wnd::ReplaceSelection(const WideString& text) {}
372
374 return false;
375}
376
378 return false;
379}
380
382 return false;
383}
384
385bool CPWL_Wnd::Undo() {
386 return false;
387}
388
389bool CPWL_Wnd::Redo() {
390 return false;
391}
392
393bool CPWL_Wnd::OnMouseWheel(Mask<FWL_EVENTFLAG> nFlag,
394 const CFX_PointF& point,
395 const CFX_Vector& delta) {
396 if (!IsValid() || !IsVisible())
397 return false;
398
400 if (!IsWndCaptureKeyboard(this))
401 return false;
402
403 for (const auto& pChild : m_Children) {
404 if (IsWndCaptureKeyboard(pChild.get()))
405 return pChild->OnMouseWheel(nFlag, point, delta);
406 }
407 return false;
408}
409
410void CPWL_Wnd::AddChild(std::unique_ptr<CPWL_Wnd> pWnd) {
411 DCHECK(!pWnd->m_pParent);
412 pWnd->m_pParent = this;
413 m_Children.push_back(std::move(pWnd));
414}
415
417 DCHECK_EQ(pWnd->m_pParent, this);
418 auto it =
419 std::find(m_Children.begin(), m_Children.end(), MakeFakeUniquePtr(pWnd));
420 if (it == m_Children.end())
421 return;
422
423 // TODO(tsepez): murky ownership.
424 it->release();
425 m_Children.erase(it);
426}
427
429
430void CPWL_Wnd::SetScrollPosition(float pos) {}
431
433
434void CPWL_Wnd::NotifyLButtonDown(CPWL_Wnd* child, const CFX_PointF& pos) {}
435
436void CPWL_Wnd::NotifyLButtonUp(CPWL_Wnd* child, const CFX_PointF& pos) {}
437
438void CPWL_Wnd::NotifyMouseMove(CPWL_Wnd* child, const CFX_PointF& pos) {}
439
441 return m_rcWindow;
442}
443
446
447 float width = static_cast<float>(GetBorderWidth() + GetInnerBorderWidth());
448 CFX_FloatRect rcClient = rcWindow.GetDeflated(width, width);
449 if (CPWL_ScrollBar* pVSB = GetVScrollBar())
450 rcClient.right -= pVSB->GetScrollBarWidth();
451
452 rcClient.Normalize();
453 return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect();
454}
455
456CFX_PointF CPWL_Wnd::GetCenterPoint() const {
458 return CFX_PointF((rcClient.left + rcClient.right) * 0.5f,
459 (rcClient.top + rcClient.bottom) * 0.5f);
460}
461
462bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const {
463 return (m_CreationParams.dwFlags & dwFlags) != 0;
464}
465
466void CPWL_Wnd::RemoveFlag(uint32_t dwFlags) {
467 m_CreationParams.dwFlags &= ~dwFlags;
468}
469
471 return m_CreationParams.sBackgroundColor;
472}
473
475 return m_CreationParams.sTextColor;
476}
477
479 return m_CreationParams.nBorderStyle;
480}
481
482int32_t CPWL_Wnd::GetBorderWidth() const {
483 return HasFlag(PWS_BORDER) ? m_CreationParams.dwBorderWidth : 0;
484}
485
487 return 0;
488}
489
491 return HasFlag(PWS_BORDER) ? m_CreationParams.sBorderColor : CFX_Color();
492}
493
495 return m_CreationParams.sDash;
496}
497
498CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const {
499 return HasFlag(PWS_VSCROLL) ? m_pVScrollBar : nullptr;
500}
501
502void CPWL_Wnd::CreateVScrollBar(const CreateParams& cp) {
503 if (m_pVScrollBar || !HasFlag(PWS_VSCROLL))
504 return;
505
506 CreateParams scp = cp;
510 scp.nTransparency = CPWL_ScrollBar::kTransparency;
511
512 auto pBar = std::make_unique<CPWL_ScrollBar>(scp, CloneAttachedData());
513 m_pVScrollBar = pBar.get();
514 AddChild(std::move(pBar));
515 m_pVScrollBar->Realize();
516}
517
519 if (SharedCaptureFocusState* pSharedState = GetSharedCaptureFocusState()) {
520 pSharedState->SetCapture(this);
521 }
522}
523
525 for (const auto& pChild : m_Children)
526 pChild->ReleaseCapture();
527
528 if (SharedCaptureFocusState* pSharedState = GetSharedCaptureFocusState()) {
529 pSharedState->ReleaseCapture();
530 }
531}
532
534 if (SharedCaptureFocusState* pSharedState = GetSharedCaptureFocusState()) {
535 if (!pSharedState->IsMainCaptureKeyboard(this)) {
536 pSharedState->ReleaseFocus();
537 }
538 pSharedState->SetFocus(this);
539 }
540}
541
543 if (SharedCaptureFocusState* pSharedState = GetSharedCaptureFocusState()) {
544 if (pSharedState->IsWndCaptureKeyboard(this)) {
545 pSharedState->ReleaseFocus();
546 }
547 }
548}
549
551
553
555 const {
556 return m_pAttachedData ? m_pAttachedData->Clone() : nullptr;
557}
558
560 std::vector<UnownedPtr<CPWL_Wnd>> results;
561 for (CPWL_Wnd* pWnd = this; pWnd; pWnd = pWnd->GetParentWindow()) {
562 results.emplace_back(pWnd);
563 }
564 return results;
565}
566
567bool CPWL_Wnd::WndHitTest(const CFX_PointF& point) const {
569}
570
571bool CPWL_Wnd::ClientHitTest(const CFX_PointF& point) const {
573}
574
575bool CPWL_Wnd::SetVisible(bool bVisible) {
576 if (!IsValid())
577 return true;
578
579 ObservedPtr<CPWL_Wnd> this_observed(this);
580 for (const auto& pChild : m_Children) {
581 if (!pChild->SetVisible(bVisible)) {
582 return false;
583 }
584 if (!this_observed) {
585 return false;
586 }
587 }
588
589 if (bVisible != m_bVisible) {
590 m_bVisible = bVisible;
592 return false;
593 }
594
595 if (!InvalidateRect(nullptr))
596 return false;
597 }
598 return true;
599}
600
602 m_rcClip = rect;
603 m_rcClip.Normalize();
604}
605
607 return m_rcClip;
608}
609
610bool CPWL_Wnd::IsReadOnly() const {
612}
613
615 CPWL_ScrollBar* pVSB = GetVScrollBar();
616 if (!pVSB)
617 return true;
618
619 CFX_FloatRect rcContent = GetWindowRect();
620 if (!rcContent.IsEmpty()) {
621 float width = static_cast<float>(GetBorderWidth() + GetInnerBorderWidth());
622 rcContent.Deflate(width, width);
623 rcContent.Normalize();
624 }
625 CFX_FloatRect rcVScroll =
626 CFX_FloatRect(rcContent.right - CPWL_ScrollBar::kWidth, rcContent.bottom,
627 rcContent.right - 1.0f, rcContent.top);
628
629 ObservedPtr<CPWL_Wnd> this_observed(this);
630 pVSB->Move(rcVScroll, true, false);
631 if (!this_observed) {
632 return false;
633 }
634
635 return true;
636}
637
639
644
645void CPWL_Wnd::CreateSharedCaptureFocusState() {
646 if (!m_CreationParams.pSharedCaptureFocusState) {
647 m_CreationParams.pSharedCaptureFocusState =
648 new SharedCaptureFocusState(this);
649 }
650}
651
652void CPWL_Wnd::DestroySharedCaptureFocusState() {
653 SharedCaptureFocusState* pSharedCaptureFocusState =
654 GetSharedCaptureFocusState();
655 if (!pSharedCaptureFocusState) {
656 return;
657 }
658 const bool owned = pSharedCaptureFocusState->IsOwnedByWnd(this);
659 pSharedCaptureFocusState->RemoveWnd(this);
660 if (owned) {
661 delete pSharedCaptureFocusState;
662 }
663}
664
665CPWL_Wnd::SharedCaptureFocusState* CPWL_Wnd::GetSharedCaptureFocusState()
666 const {
667 return m_CreationParams.pSharedCaptureFocusState;
668}
669
671 return IsWndCaptureMouse(this);
672}
673
674bool CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const {
675 SharedCaptureFocusState* pCtrl = GetSharedCaptureFocusState();
676 return pCtrl && pCtrl->IsWndCaptureMouse(pWnd);
677}
678
679bool CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const {
680 SharedCaptureFocusState* pCtrl = GetSharedCaptureFocusState();
681 return pCtrl && pCtrl->IsWndCaptureKeyboard(pWnd);
682}
683
684bool CPWL_Wnd::IsFocused() const {
685 SharedCaptureFocusState* pCtrl = GetSharedCaptureFocusState();
686 return pCtrl && pCtrl->IsMainCaptureKeyboard(this);
687}
688
691 if (!rect.IsEmpty()) {
692 rect.Inflate(1.0f, 1.0f);
693 rect.Normalize();
694 }
695 return rect;
696}
697
698float CPWL_Wnd::GetFontSize() const {
699 return m_CreationParams.fFontSize;
700}
701
702void CPWL_Wnd::SetFontSize(float fFontSize) {
703 m_CreationParams.fFontSize = fFontSize;
704}
705
707 switch (nBorderStyle) {
712 default:
713 return CFX_Color();
714 }
715}
716
718 switch (nBorderStyle) {
720 return GetBackgroundColor() / 2.0f;
723 default:
724 return CFX_Color();
725 }
726}
727
729 return m_CreationParams.nTransparency;
730}
731
732void CPWL_Wnd::SetTransparency(int32_t nTransparency) {
733 for (const auto& pChild : m_Children)
734 pChild->SetTransparency(nTransparency);
735
736 m_CreationParams.nTransparency = nTransparency;
737}
738
740 CFX_Matrix mt;
741 if (ProviderIface* pProvider = GetProvider())
743 return mt;
744}
745
746CFX_FloatRect CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const {
748 return mt.TransformRect(rect);
749}
BorderStyle
bool Contains(const CFX_PointF &point) const
constexpr CFX_FloatRect(float l, float b, float r, float t)
constexpr CFX_FloatRect()=default
bool IsEmpty() const
void Intersect(const CFX_FloatRect &other_rect)
void Inflate(float x, float y)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
void Deflate(float x, float y)
bool Contains(const CFX_FloatRect &other_rect) const
CFX_FloatRect GetDeflated(float x, float y) const
void Union(const CFX_FloatRect &other_rect)
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
void Concat(const CFX_Matrix &right)
void DrawBorder(const CFX_Matrix *pUser2Device, const CFX_FloatRect &rect, float fWidth, const CFX_Color &color, const CFX_Color &crLeftTop, const CFX_Color &crRightBottom, BorderStyle nStyle, int32_t nTransparency)
void DrawFillRect(const CFX_Matrix *pUser2Device, const CFX_FloatRect &rect, const CFX_Color &color, int32_t nTransparency)
static constexpr uint8_t kTransparency
static constexpr float kWidth
float GetScrollBarWidth() const
CreateParams(const CreateParams &other)
IPWL_FillerNotify::CursorStyle eCursorType
Definition cpwl_wnd.h:126
CreateParams(CFX_Timer::HandlerIface *timer_handler, IPWL_FillerNotify *filler_notify, ProviderIface *provider)
Definition cpwl_wnd.cpp:36
CFX_Color sBackgroundColor
Definition cpwl_wnd.h:113
virtual CFX_Matrix GetWindowMatrix(const IPWL_FillerNotify::PerWindowData *pAttached)=0
bool IsOwnedByWnd(const CPWL_Wnd *pWnd) const
Definition cpwl_wnd.cpp:58
void RemoveWnd(CPWL_Wnd *pWnd)
Definition cpwl_wnd.cpp:97
SharedCaptureFocusState(const CPWL_Wnd *pOwnerWnd)
Definition cpwl_wnd.cpp:54
void SetCapture(CPWL_Wnd *pWnd)
Definition cpwl_wnd.cpp:72
bool IsMainCaptureKeyboard(const CPWL_Wnd *pWnd) const
Definition cpwl_wnd.cpp:64
bool IsWndCaptureKeyboard(const CPWL_Wnd *pWnd) const
Definition cpwl_wnd.cpp:68
bool IsWndCaptureMouse(const CPWL_Wnd *pWnd) const
Definition cpwl_wnd.cpp:60
void SetFocus(CPWL_Wnd *pWnd)
Definition cpwl_wnd.cpp:75
CFX_Matrix GetWindowMatrix() const
Definition cpwl_wnd.cpp:739
static bool IsPlatformShortcutKey(Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:143
virtual void KillFocus()
Definition cpwl_wnd.cpp:542
static bool IsCTRLKeyDown(Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:128
virtual bool OnMouseWheel(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point, const CFX_Vector &delta)
Definition cpwl_wnd.cpp:393
virtual bool SelectAllText()
Definition cpwl_wnd.cpp:373
virtual void ScrollWindowVertically(float pos)
Definition cpwl_wnd.cpp:432
virtual bool OnRButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
Definition cpwl_wnd.cpp:352
bool InvalidateRectMove(const CFX_FloatRect &rcOld, const CFX_FloatRect &rcNew)
Definition cpwl_wnd.cpp:234
bool ClientHitTest(const CFX_PointF &point) const
Definition cpwl_wnd.cpp:571
void SetCapture()
Definition cpwl_wnd.cpp:518
static bool IsALTKeyDown(Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:133
CFX_Color GetBorderColor() const
Definition cpwl_wnd.cpp:490
const CFX_FloatRect & GetClipRect() const
Definition cpwl_wnd.cpp:606
BorderStyle GetBorderStyle() const
Definition cpwl_wnd.cpp:478
virtual void NotifyMouseMove(CPWL_Wnd *child, const CFX_PointF &pos)
Definition cpwl_wnd.cpp:438
virtual bool OnChar(uint16_t nChar, Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:309
bool WndHitTest(const CFX_PointF &point) const
Definition cpwl_wnd.cpp:567
virtual void SetCursor()
Definition cpwl_wnd.cpp:640
virtual void ReplaceAndKeepSelection(const WideString &text)
Definition cpwl_wnd.cpp:369
CFX_PointF GetCenterPoint() const
Definition cpwl_wnd.cpp:456
void RemoveFlag(uint32_t dwFlags)
Definition cpwl_wnd.cpp:466
CFX_Color GetBackgroundColor() const
Definition cpwl_wnd.cpp:470
std::vector< UnownedPtr< CPWL_Wnd > > GetAncestors()
Definition cpwl_wnd.cpp:559
IPWL_FillerNotify * GetFillerNotify() const
Definition cpwl_wnd.h:245
virtual bool Redo()
Definition cpwl_wnd.cpp:389
bool HasFlag(uint32_t dwFlags) const
Definition cpwl_wnd.cpp:462
virtual CFX_FloatRect GetClientRect() const
Definition cpwl_wnd.cpp:444
virtual WideString GetSelectedText()
Definition cpwl_wnd.cpp:365
CFX_FloatRect GetWindowRect() const
Definition cpwl_wnd.cpp:440
void ReleaseCapture()
Definition cpwl_wnd.cpp:524
bool IsFocused() const
Definition cpwl_wnd.cpp:684
bool IsCaptureMouse() const
Definition cpwl_wnd.cpp:670
CPWL_Wnd * GetParentWindow() const
Definition cpwl_wnd.h:249
virtual void NotifyLButtonDown(CPWL_Wnd *child, const CFX_PointF &pos)
Definition cpwl_wnd.cpp:434
void SetTransparency(int32_t nTransparency)
Definition cpwl_wnd.cpp:732
CPWL_Wnd(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
Definition cpwl_wnd.cpp:151
virtual bool RepositionChildWnd()
Definition cpwl_wnd.cpp:614
void InvalidateProvider(ProviderIface *provider)
Definition cpwl_wnd.cpp:189
static bool IsSHIFTKeyDown(Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:123
virtual bool OnRButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
Definition cpwl_wnd.cpp:357
virtual ~CPWL_Wnd()
Definition cpwl_wnd.cpp:156
virtual bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:297
int32_t GetBorderWidth() const
Definition cpwl_wnd.cpp:482
CreateParams * GetCreationParams()
Definition cpwl_wnd.h:238
virtual float GetFontSize() const
Definition cpwl_wnd.cpp:698
CFX_Color GetBorderRightBottomColor(BorderStyle nBorderStyle) const
Definition cpwl_wnd.cpp:717
virtual void SetScrollInfo(const PWL_SCROLL_INFO &info)
Definition cpwl_wnd.cpp:428
virtual bool InvalidateRect(const CFX_FloatRect *pRect)
Definition cpwl_wnd.cpp:278
virtual void SetFocus()
Definition cpwl_wnd.cpp:533
virtual void CreateChildWnd(const CreateParams &cp)
Definition cpwl_wnd.cpp:638
bool IsVisible() const
Definition cpwl_wnd.h:204
virtual CFX_FloatRect GetFocusRect() const
Definition cpwl_wnd.cpp:689
virtual void OnDestroy()
Definition cpwl_wnd.cpp:187
virtual bool SetVisible(bool bVisible)
Definition cpwl_wnd.cpp:575
virtual void ReplaceSelection(const WideString &text)
Definition cpwl_wnd.cpp:371
IPWL_FillerNotify::PerWindowData * GetAttachedData() const
Definition cpwl_wnd.h:209
const CPWL_Dash & GetBorderDash() const
Definition cpwl_wnd.cpp:494
virtual void OnSetFocus()
Definition cpwl_wnd.cpp:550
virtual void SetFontSize(float fFontSize)
Definition cpwl_wnd.cpp:702
void Realize()
Definition cpwl_wnd.cpp:160
int32_t GetInnerBorderWidth() const
Definition cpwl_wnd.cpp:486
int32_t GetTransparency()
Definition cpwl_wnd.cpp:728
virtual bool CanUndo()
Definition cpwl_wnd.cpp:377
bool IsWndCaptureMouse(const CPWL_Wnd *pWnd) const
Definition cpwl_wnd.cpp:674
virtual void SetScrollPosition(float pos)
Definition cpwl_wnd.cpp:430
virtual void DrawThisAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
Definition cpwl_wnd.cpp:250
ProviderIface * GetProvider() const
Definition cpwl_wnd.h:239
bool Move(const CFX_FloatRect &rcNew, bool bReset, bool bRefresh)
Definition cpwl_wnd.cpp:211
virtual void OnCreated()
Definition cpwl_wnd.cpp:185
void SetClipRect(const CFX_FloatRect &rect)
Definition cpwl_wnd.cpp:601
bool IsWndCaptureKeyboard(const CPWL_Wnd *pWnd) const
Definition cpwl_wnd.cpp:679
virtual bool CanRedo()
Definition cpwl_wnd.cpp:381
CFX_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const
Definition cpwl_wnd.cpp:706
virtual bool Undo()
Definition cpwl_wnd.cpp:385
static const CFX_Color kDefaultWhiteColor
Definition cpwl_wnd.h:80
virtual void OnKillFocus()
Definition cpwl_wnd.cpp:552
std::unique_ptr< IPWL_FillerNotify::PerWindowData > CloneAttachedData() const
Definition cpwl_wnd.cpp:554
CFX_Color GetTextColor() const
Definition cpwl_wnd.cpp:474
virtual void NotifyLButtonUp(CPWL_Wnd *child, const CFX_PointF &pos)
Definition cpwl_wnd.cpp:436
void Destroy()
Definition cpwl_wnd.cpp:194
CPWL_ScrollBar * GetVScrollBar() const
Definition cpwl_wnd.cpp:498
static const CFX_Color kDefaultBlackColor
Definition cpwl_wnd.h:79
bool IsValid() const
Definition cpwl_wnd.h:237
static bool IsMETAKeyDown(Mask< FWL_EVENTFLAG > nFlag)
Definition cpwl_wnd.cpp:138
void AddChild(std::unique_ptr< CPWL_Wnd > pWnd)
Definition cpwl_wnd.cpp:410
bool IsReadOnly() const
Definition cpwl_wnd.cpp:610
void DrawAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
Definition cpwl_wnd.cpp:242
void RemoveChild(CPWL_Wnd *pWnd)
Definition cpwl_wnd.cpp:416
virtual WideString GetText()
Definition cpwl_wnd.cpp:361
virtual void SetCursor(CursorStyle nCursorStyle)=0
#define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)
Definition cpwl_wnd.cpp:321
#define PWS_READONLY
Definition cpwl_wnd.h:34
#define PWS_BACKGROUND
Definition cpwl_wnd.h:31
#define PWS_VSCROLL
Definition cpwl_wnd.h:32
#define PWS_VISIBLE
Definition cpwl_wnd.h:33
#define PWS_BORDER
Definition cpwl_wnd.h:30
#define PWS_AUTOTRANSPARENT
Definition cpwl_wnd.h:36
#define PWS_NOREFRESHCLIP
Definition cpwl_wnd.h:37
@ FWL_EVENTFLAG_ShiftKey
@ FWL_EVENTFLAG_MetaKey
@ FWL_EVENTFLAG_AltKey
@ FWL_EVENTFLAG_ControlKey
CFX_Color operator/(float fColorDivide) const
CFX_Color & operator=(const CFX_Color &that)=default
constexpr CFX_Color(Type type=CFX_Color::Type::kTransparent, float color1=0.0f, float color2=0.0f, float color3=0.0f, float color4=0.0f)
Definition cfx_color.h:27
CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)
Definition cpwl_wnd.h:63