blob: baf9ef0f26d0e7295bcba8b6339a35ae4cafe4ba [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
Nico Weber9d8ec5a2015-08-04 13:00:21 -070011CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {}
12
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
Tom Sepez281a9ea2016-02-26 14:24:28 -080023FX_BOOL CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point,
tsepezc3255f52016-03-25 14:52:27 -070024 uint32_t nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070025 CPWL_Wnd::OnLButtonDown(point, nFlag);
26
27 m_bMouseDown = TRUE;
28 SetCapture();
29
30 return TRUE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070031}
32
tsepezc3255f52016-03-25 14:52:27 -070033FX_BOOL CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070034 CPWL_Wnd::OnLButtonUp(point, nFlag);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070035
Nico Weber9d8ec5a2015-08-04 13:00:21 -070036 ReleaseCapture();
37 m_bMouseDown = FALSE;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070038
Nico Weber9d8ec5a2015-08-04 13:00:21 -070039 return TRUE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070040}