xref: /aosp_15_r20/external/pdfium/fpdfsdk/pwl/cpwl_button.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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_button.h"
8 
9 #include <utility>
10 
CPWL_Button(const CreateParams & cp,std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)11 CPWL_Button::CPWL_Button(
12     const CreateParams& cp,
13     std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
14     : CPWL_Wnd(cp, std::move(pAttachedData)) {
15   GetCreationParams()->eCursorType = IPWL_FillerNotify::CursorStyle::kHand;
16 }
17 
18 CPWL_Button::~CPWL_Button() = default;
19 
OnLButtonDown(Mask<FWL_EVENTFLAG> nFlag,const CFX_PointF & point)20 bool CPWL_Button::OnLButtonDown(Mask<FWL_EVENTFLAG> nFlag,
21                                 const CFX_PointF& point) {
22   CPWL_Wnd::OnLButtonDown(nFlag, point);
23   m_bMouseDown = true;
24   SetCapture();
25   return true;
26 }
27 
OnLButtonUp(Mask<FWL_EVENTFLAG> nFlag,const CFX_PointF & point)28 bool CPWL_Button::OnLButtonUp(Mask<FWL_EVENTFLAG> nFlag,
29                               const CFX_PointF& point) {
30   CPWL_Wnd::OnLButtonUp(nFlag, point);
31   ReleaseCapture();
32   m_bMouseDown = false;
33   return true;
34 }
35