Home | History | Annotate | Download | only in pdfwindow
      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 
     11 CPWL_Button::CPWL_Button() : m_bMouseDown(false) {}
     12 
     13 CPWL_Button::~CPWL_Button() {}
     14 
     15 CFX_ByteString CPWL_Button::GetClassName() const {
     16   return "CPWL_Button";
     17 }
     18 
     19 void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) {
     20   cp.eCursorType = FXCT_HAND;
     21 }
     22 
     23 bool 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 
     32 bool 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