blob: 96be4694548dc376c1d00b3cc4d529b0d6e77cb2 [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 sinclair89e904b2016-03-23 19:29:15 -04007#include "fpdfsdk/pdfwindow/PWL_Button.h"
8#include "fpdfsdk/pdfwindow/PWL_Utils.h"
9#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070010
tsepez4cf55152016-11-02 14:37:54 -070011CPWL_Button::CPWL_Button() : m_bMouseDown(false) {}
Nico Weber9d8ec5a2015-08-04 13:00:21 -070012
Dan Sinclairf766ad22016-03-14 13:51:24 -040013CPWL_Button::~CPWL_Button() {}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070014
Nico Weber9d8ec5a2015-08-04 13:00:21 -070015CFX_ByteString CPWL_Button::GetClassName() const {
16 return "CPWL_Button";
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070017}
18
Nico Weber9d8ec5a2015-08-04 13:00:21 -070019void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) {
20 cp.eCursorType = FXCT_HAND;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070021}
22
Dan Sinclairf528eee2017-02-14 11:52:07 -050023bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070024 CPWL_Wnd::OnLButtonDown(point, nFlag);
25
tsepez4cf55152016-11-02 14:37:54 -070026 m_bMouseDown = true;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070027 SetCapture();
28
tsepez4cf55152016-11-02 14:37:54 -070029 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070030}
31
Dan Sinclairf528eee2017-02-14 11:52:07 -050032bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070033 CPWL_Wnd::OnLButtonUp(point, nFlag);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070034
Nico Weber9d8ec5a2015-08-04 13:00:21 -070035 ReleaseCapture();
tsepez4cf55152016-11-02 14:37:54 -070036 m_bMouseDown = false;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070037
tsepez4cf55152016-11-02 14:37:54 -070038 return true;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070039}