blob: e9c2647aa24f2dbb762f7cbefa07f9fa41bdca94 [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/PDFWindow.h"
8#include "fpdfsdk/include/pdfwindow/PWL_Button.h"
9#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
10#include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011
Nico Weber9d8ec5a2015-08-04 13:00:21 -070012/* ------------------------------- CPWL_Button
13 * ---------------------------------- */
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070014
Nico Weber9d8ec5a2015-08-04 13:00:21 -070015CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {}
16
17CPWL_Button::~CPWL_Button() {
18 // PWL_TRACE("~CPWL_Button\n");
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070019}
20
Nico Weber9d8ec5a2015-08-04 13:00:21 -070021CFX_ByteString CPWL_Button::GetClassName() const {
22 return "CPWL_Button";
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070023}
24
Nico Weber9d8ec5a2015-08-04 13:00:21 -070025void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) {
26 cp.eCursorType = FXCT_HAND;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070027}
28
Nico Weber9d8ec5a2015-08-04 13:00:21 -070029FX_BOOL CPWL_Button::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) {
30 CPWL_Wnd::OnLButtonDown(point, nFlag);
31
32 m_bMouseDown = TRUE;
33 SetCapture();
34
35 return TRUE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070036}
37
Nico Weber9d8ec5a2015-08-04 13:00:21 -070038FX_BOOL CPWL_Button::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
39 CPWL_Wnd::OnLButtonUp(point, nFlag);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070040
Nico Weber9d8ec5a2015-08-04 13:00:21 -070041 ReleaseCapture();
42 m_bMouseDown = FALSE;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070043
Nico Weber9d8ec5a2015-08-04 13:00:21 -070044 return TRUE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070045}