blob: 2c6c36c047c7cd800b3808c0a58ab5ae284d9778 [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
Lei Zhangbde53d22015-11-12 22:21:30 -08007#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
8#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
9#include "fpdfsdk/include/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
13CPWL_Button::~CPWL_Button() {
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070014}
15
Nico Weber9d8ec5a2015-08-04 13:00:21 -070016CFX_ByteString CPWL_Button::GetClassName() const {
17 return "CPWL_Button";
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070018}
19
Nico Weber9d8ec5a2015-08-04 13:00:21 -070020void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) {
21 cp.eCursorType = FXCT_HAND;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070022}
23
Tom Sepez281a9ea2016-02-26 14:24:28 -080024FX_BOOL CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point,
25 FX_DWORD nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070026 CPWL_Wnd::OnLButtonDown(point, nFlag);
27
28 m_bMouseDown = TRUE;
29 SetCapture();
30
31 return TRUE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070032}
33
Tom Sepez281a9ea2016-02-26 14:24:28 -080034FX_BOOL CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070035 CPWL_Wnd::OnLButtonUp(point, nFlag);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070036
Nico Weber9d8ec5a2015-08-04 13:00:21 -070037 ReleaseCapture();
38 m_bMouseDown = FALSE;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070039
Nico Weber9d8ec5a2015-08-04 13:00:21 -070040 return TRUE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070041}