blob: 5c06a98fa6a8fa8b7feba2fffe2d08c901f1d506 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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 Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclairc411eb92017-07-25 09:39:30 -04007#include "fpdfsdk/pwl/cpwl_button.h"
8#include "fpdfsdk/pwl/cpwl_wnd.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
tsepez4cf55152016-11-02 14:37:54 -070010CPWL_Button::CPWL_Button() : m_bMouseDown(false) {}
Nico Weber9d8ec5a2015-08-04 13:00:21 -070011
Dan Sinclairf766ad22016-03-14 13:51:24 -040012CPWL_Button::~CPWL_Button() {}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070013
Ryan Harrison275e2602017-09-18 14:23:18 -040014ByteString CPWL_Button::GetClassName() const {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070015 return "CPWL_Button";
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070016}
17
Tom Sepezbf157302017-09-15 13:26:32 -070018void CPWL_Button::OnCreate(CreateParams* pParamsToAdjust) {
19 pParamsToAdjust->eCursorType = FXCT_HAND;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020}
21
Dan Sinclairf528eee2017-02-14 11:52:07 -050022bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070023 CPWL_Wnd::OnLButtonDown(point, nFlag);
tsepez4cf55152016-11-02 14:37:54 -070024 m_bMouseDown = true;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070025 SetCapture();
tsepez4cf55152016-11-02 14:37:54 -070026 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070027}
28
Dan Sinclairf528eee2017-02-14 11:52:07 -050029bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070030 CPWL_Wnd::OnLButtonUp(point, nFlag);
Nico Weber9d8ec5a2015-08-04 13:00:21 -070031 ReleaseCapture();
tsepez4cf55152016-11-02 14:37:54 -070032 m_bMouseDown = false;
tsepez4cf55152016-11-02 14:37:54 -070033 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070034}