1// 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.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "fpdfsdk/pdfwindow/PWL_Button.h"
8#include "fpdfsdk/pdfwindow/PWL_Utils.h"
9#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
10
11CPWL_Button::CPWL_Button() : m_bMouseDown(false) {}
12
13CPWL_Button::~CPWL_Button() {}
14
15CFX_ByteString CPWL_Button::GetClassName() const {
16  return "CPWL_Button";
17}
18
19void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) {
20  cp.eCursorType = FXCT_HAND;
21}
22
23bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
24  CPWL_Wnd::OnLButtonDown(point, nFlag);
25
26  m_bMouseDown = true;
27  SetCapture();
28
29  return true;
30}
31
32bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
33  CPWL_Wnd::OnLButtonUp(point, nFlag);
34
35  ReleaseCapture();
36  m_bMouseDown = false;
37
38  return true;
39}
40