1 // Copyright 2016 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 #ifndef XFA_FWL_CFWL_MESSAGE_H_
8 #define XFA_FWL_CFWL_MESSAGE_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "core/fxcrt/observed_ptr.h"
15 #include "xfa/fwl/cfwl_widget.h"
16 
17 class CFWL_Message {
18  public:
19   enum class Type { Key, KillFocus, Mouse, MouseWheel, SetFocus };
20 
21   virtual ~CFWL_Message();
22 
GetType()23   Type GetType() const { return m_type; }
GetSrcTarget()24   CFWL_Widget* GetSrcTarget() const { return m_pSrcTarget.Get(); }
GetDstTarget()25   CFWL_Widget* GetDstTarget() const { return m_pDstTarget.Get(); }
SetSrcTarget(CFWL_Widget * pWidget)26   void SetSrcTarget(CFWL_Widget* pWidget) { m_pSrcTarget.Reset(pWidget); }
SetDstTarget(CFWL_Widget * pWidget)27   void SetDstTarget(CFWL_Widget* pWidget) { m_pDstTarget.Reset(pWidget); }
28 
29  protected:
30   CFWL_Message(Type type, CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget);
31   CFWL_Message(const CFWL_Message& that) = delete;
32   CFWL_Message& operator=(const CFWL_Message& that) = delete;
33 
34  private:
35   const Type m_type;
36   ObservedPtr<CFWL_Widget> m_pSrcTarget;
37   ObservedPtr<CFWL_Widget> m_pDstTarget;
38 };
39 
40 #endif  // XFA_FWL_CFWL_MESSAGE_H_
41