Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpwl_cbbutton.cpp
Go to the documentation of this file.
1
// Copyright 2020 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_cbbutton.h"
8
9
#
include
<
utility
>
10
11
#
include
"core/fxge/cfx_fillrenderoptions.h"
12
#
include
"core/fxge/cfx_path.h"
13
#
include
"core/fxge/cfx_renderdevice.h"
14
15
CPWL_CBButton::
CPWL_CBButton
(
16
const
CreateParams
& cp,
17
std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
18
:
CPWL_Wnd
(cp,
std
::move(pAttachedData)) {}
19
20
CPWL_CBButton::~
CPWL_CBButton
() =
default
;
21
22
void
CPWL_CBButton::
DrawThisAppearance
(
CFX_RenderDevice
* pDevice,
23
const
CFX_Matrix
& mtUser2Device) {
24
CPWL_Wnd
::
DrawThisAppearance
(pDevice, mtUser2Device);
25
26
if
(!
IsVisible
())
27
return
;
28
29
CFX_FloatRect
window =
CPWL_Wnd
::
GetWindowRect
();
30
if
(window
.
IsEmpty
(
)
)
31
return
;
32
33
constexpr
float
kComboBoxTriangleLength = 6.0f;
34
constexpr
float
kComboBoxTriangleHalfLength = kComboBoxTriangleLength / 2;
35
constexpr
float
kComboBoxTriangleQuarterLength = kComboBoxTriangleLength / 4;
36
if
(!
FXSYS_IsFloatBigger
(window
.
right
- window
.
left
,
37
kComboBoxTriangleLength) ||
38
!
FXSYS_IsFloatBigger
(window
.
top
- window
.
bottom
,
39
kComboBoxTriangleHalfLength)) {
40
return
;
41
}
42
43
CFX_PointF
ptCenter = GetCenterPoint();
44
CFX_PointF
pt1(ptCenter.x - kComboBoxTriangleHalfLength,
45
ptCenter.y + kComboBoxTriangleQuarterLength);
46
CFX_PointF
pt2(ptCenter.x + kComboBoxTriangleHalfLength,
47
ptCenter.y + kComboBoxTriangleQuarterLength);
48
CFX_PointF
pt3(ptCenter.x, ptCenter.y - kComboBoxTriangleQuarterLength);
49
50
CFX_Path
path;
51
path
.
AppendPoint
(
pt1
,
CFX_Path
::
Point
::
Type
::
kMove
)
;
52
path
.
AppendPoint
(
pt2
,
CFX_Path
::
Point
::
Type
::
kLine
)
;
53
path
.
AppendPoint
(
pt3
,
CFX_Path
::
Point
::
Type
::
kLine
)
;
54
path
.
AppendPoint
(
pt1
,
CFX_Path
::
Point
::
Type
::
kLine
)
;
55
56
pDevice
->
DrawPath
(
path
,
&mtUser2Device
,
nullptr
,
57
kDefaultBlackColor
.
ToFXColor
(
GetTransparency
()
)
,
0
,
58
CFX_FillRenderOptions
::
EvenOddOptions
(
)
)
;
59
}
60
61
bool
CPWL_CBButton::
OnLButtonDown
(
Mask
<FWL_EVENTFLAG> nFlag,
62
const
CFX_PointF
& point) {
63
CPWL_Wnd
::
OnLButtonDown
(
nFlag
,
point
)
;
64
65
SetCapture
();
66
CPWL_Wnd
* pParent =
GetParentWindow
();
67
if
(pParent)
68
pParent
->
NotifyLButtonDown
(
this
, point);
69
70
return
true
;
71
}
72
73
bool
CPWL_CBButton::
OnLButtonUp
(
Mask
<FWL_EVENTFLAG> nFlag,
74
const
CFX_PointF
& point) {
75
CPWL_Wnd
::
OnLButtonUp
(
nFlag
,
point
)
;
76
77
ReleaseCapture
();
78
return
true
;
79
}
CFX_FloatRect
Definition
fx_coordinates.h:185
CFX_FloatRect::IsEmpty
bool IsEmpty() const
Definition
fx_coordinates.h:200
CFX_FloatRect::left
float left
Definition
fx_coordinates.h:269
CFX_FloatRect::bottom
float bottom
Definition
fx_coordinates.h:270
CFX_FloatRect::right
float right
Definition
fx_coordinates.h:271
CFX_FloatRect::top
float top
Definition
fx_coordinates.h:272
CFX_Matrix
Definition
fx_coordinates.h:440
CFX_Path::Point
Definition
cfx_path.h:20
CFX_Path::Point::Type
Type
Definition
cfx_path.h:22
CFX_Path::Point::Type::kMove
@ kMove
Definition
cfx_path.h:22
CFX_Path::Point::Type::kLine
@ kLine
Definition
cfx_path.h:22
CFX_Path
Definition
cfx_path.h:18
CFX_Path::AppendPoint
void AppendPoint(const CFX_PointF &point, Point::Type type)
Definition
cfx_path.cpp:290
CFX_RenderDevice
Definition
cfx_renderdevice.h:39
CFX_RenderDevice::DrawPath
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options)
Definition
cfx_renderdevice.cpp:600
CPWL_CBButton::DrawThisAppearance
void DrawThisAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device) override
Definition
cpwl_cbbutton.cpp:22
CPWL_CBButton::OnLButtonDown
bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
Definition
cpwl_cbbutton.cpp:61
CPWL_CBButton::CPWL_CBButton
CPWL_CBButton(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
Definition
cpwl_cbbutton.cpp:15
CPWL_CBButton::OnLButtonUp
bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
Definition
cpwl_cbbutton.cpp:73
CPWL_CBButton::~CPWL_CBButton
~CPWL_CBButton() override
CPWL_Wnd::CreateParams
Definition
cpwl_wnd.h:96
CPWL_Wnd
Definition
cpwl_wnd.h:77
CPWL_Wnd::SetCapture
void SetCapture()
Definition
cpwl_wnd.cpp:519
CPWL_Wnd::GetWindowRect
CFX_FloatRect GetWindowRect() const
Definition
cpwl_wnd.cpp:441
CPWL_Wnd::ReleaseCapture
void ReleaseCapture()
Definition
cpwl_wnd.cpp:525
CPWL_Wnd::GetParentWindow
CPWL_Wnd * GetParentWindow() const
Definition
cpwl_wnd.h:249
CPWL_Wnd::NotifyLButtonDown
virtual void NotifyLButtonDown(CPWL_Wnd *child, const CFX_PointF &pos)
Definition
cpwl_wnd.cpp:435
CPWL_Wnd::OnLButtonUp
virtual bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
CPWL_Wnd::IsVisible
bool IsVisible() const
Definition
cpwl_wnd.h:204
CPWL_Wnd::GetTransparency
int32_t GetTransparency()
Definition
cpwl_wnd.cpp:725
CPWL_Wnd::DrawThisAppearance
virtual void DrawThisAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
Definition
cpwl_wnd.cpp:250
CPWL_Wnd::kDefaultBlackColor
static const CFX_Color kDefaultBlackColor
Definition
cpwl_wnd.h:79
CPWL_Wnd::OnLButtonDown
virtual bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point)
fxcrt::Mask
Definition
mask.h:15
CFX_PointF
CFX_PTemplate< float > CFX_PointF
Definition
fx_coordinates.h:51
FXSYS_IsFloatBigger
#define FXSYS_IsFloatBigger(fa, fb)
Definition
fx_system.h:37
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
CFX_Color::ToFXColor
FX_COLORREF ToFXColor(int32_t nTransparency) const
Definition
cfx_color.cpp:131
CFX_FillRenderOptions
Definition
cfx_fillrenderoptions.h:11
CFX_FillRenderOptions::EvenOddOptions
static constexpr CFX_FillRenderOptions EvenOddOptions()
Definition
cfx_fillrenderoptions.h:26
qtwebengine
src
3rdparty
chromium
third_party
pdfium
fpdfsdk
pwl
cpwl_cbbutton.cpp
Generated on
for Qt by
1.18.0