OLD | NEW |
(Empty) | |
| 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_CORE_CFWL_EVENT_H_ |
| 8 #define XFA_FWL_CORE_CFWL_EVENT_H_ |
| 9 |
| 10 #include "core/fxcrt/include/fx_coordinates.h" |
| 11 #include "core/fxcrt/include/fx_string.h" |
| 12 #include "core/fxcrt/include/fx_system.h" |
| 13 #include "xfa/fwl/core/cfwl_note.h" |
| 14 #include "xfa/fwl/core/fwl_error.h" |
| 15 |
| 16 #define FWL_EVT_Mouse L"FWL_EVENT_Mouse" |
| 17 #define FWL_EVT_MouseWheel L"FWL_EVENT_MouseWheel" |
| 18 #define FWL_EVT_Key L"FWL_EVENT_Key" |
| 19 #define FWL_EVT_SetFocus L"FWL_EVENT_SetFocus" |
| 20 #define FWL_EVT_KillFocus L"FWL_EVENT_KillFocus" |
| 21 #define FWL_EVT_Click L"FWL_EVENT_Click" |
| 22 #define FWL_EVT_Draw L"FWL_EVENT_Draw" |
| 23 #define FWL_EVT_Scroll L"FWL_EVENT_Scroll" |
| 24 #define FWL_EVT_Close L"FWL_EVENT_Close" |
| 25 #define FWL_EVT_ContextMenu L"FWL_EVENT_ContextMenu" |
| 26 #define FWL_EVT_MenuCommand L"FWL_EVENT_MenuCommand" |
| 27 #define FWL_EVT_SizeChanged L"FWL_EVENT_SizeChanged" |
| 28 |
| 29 #define FWL_EVTHASH_Mouse 1765258002 |
| 30 #define FWL_EVTHASH_MouseWheel 3907114407 |
| 31 #define FWL_EVTHASH_Key 2408354450 |
| 32 #define FWL_EVTHASH_SetFocus 3909721269 |
| 33 #define FWL_EVTHASH_KillFocus 1779363253 |
| 34 #define FWL_EVTHASH_Draw 2430713303 |
| 35 #define FWL_EVTHASH_Click 4026328783 |
| 36 #define FWL_EVTHASH_Scroll 2965158968 |
| 37 #define FWL_EVTHASH_Close 4036693599 |
| 38 #define FWL_EVTHASH_ContextMenu 2717307715 |
| 39 #define FWL_EVTHASH_MenuCommand 497763741 |
| 40 #define FWL_EVTHASH_SizeChanged 3083958510 |
| 41 #define FWL_EVTHASH_Idle 839546759 |
| 42 |
| 43 typedef enum { |
| 44 FWL_EVENT_MOUSE_MASK = 1 << 0, |
| 45 FWL_EVENT_MOUSEWHEEL_MASK = 1 << 1, |
| 46 FWL_EVENT_KEY_MASK = 1 << 2, |
| 47 FWL_EVENT_FOCUSCHANGED_MASK = 1 << 3, |
| 48 FWL_EVENT_DRAW_MASK = 1 << 4, |
| 49 FWL_EVENT_CLOSE_MASK = 1 << 5, |
| 50 FWL_EVENT_SIZECHANGED_MASK = 1 << 6, |
| 51 FWL_EVENT_IDLE_MASK = 1 << 7, |
| 52 FWL_EVENT_CONTROL_MASK = 1 << 8, |
| 53 FWL_EVENT_ALL_MASK = 0xFF |
| 54 } FWLEventMask; |
| 55 |
| 56 class CFX_Graphics; |
| 57 class IFWL_Widget; |
| 58 |
| 59 class CFWL_Event : public CFWL_Note { |
| 60 public: |
| 61 CFWL_Event() : CFWL_Note(TRUE) {} |
| 62 virtual ~CFWL_Event() {} |
| 63 }; |
| 64 |
| 65 #define BEGIN_FWL_EVENT_DEF(classname, eventhashcode) \ |
| 66 class classname : public CFWL_Event { \ |
| 67 public: \ |
| 68 classname() : CFWL_Event() {} \ |
| 69 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { \ |
| 70 wsClass = L## #classname; \ |
| 71 return FWL_ERR_Succeeded; \ |
| 72 } \ |
| 73 virtual FX_DWORD GetClassID() const { return eventhashcode; } |
| 74 |
| 75 #define END_FWL_EVENT_DEF \ |
| 76 } \ |
| 77 ; // NOLINT |
| 78 |
| 79 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouse, FWL_EVTHASH_Mouse) |
| 80 FX_FLOAT m_fx; |
| 81 FX_FLOAT m_fy; |
| 82 FX_DWORD m_dwFlags; |
| 83 FX_DWORD m_dwCmd; |
| 84 END_FWL_EVENT_DEF |
| 85 |
| 86 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouseWheel, FWL_EVTHASH_MouseWheel) |
| 87 FX_FLOAT m_fx; |
| 88 FX_FLOAT m_fy; |
| 89 FX_FLOAT m_fDeltaX; |
| 90 FX_FLOAT m_fDeltaY; |
| 91 FX_DWORD m_dwFlags; |
| 92 END_FWL_EVENT_DEF |
| 93 |
| 94 BEGIN_FWL_EVENT_DEF(CFWL_EvtKey, FWL_EVTHASH_Key) |
| 95 FX_DWORD m_dwKeyCode; |
| 96 FX_DWORD m_dwFlags; |
| 97 FX_DWORD m_dwCmd; |
| 98 END_FWL_EVENT_DEF |
| 99 |
| 100 BEGIN_FWL_EVENT_DEF(CFWL_EvtSetFocus, FWL_EVTHASH_SetFocus) |
| 101 IFWL_Widget* m_pSetFocus; |
| 102 END_FWL_EVENT_DEF |
| 103 |
| 104 BEGIN_FWL_EVENT_DEF(CFWL_EvtKillFocus, FWL_EVTHASH_KillFocus) |
| 105 IFWL_Widget* m_pKillFocus; |
| 106 END_FWL_EVENT_DEF |
| 107 |
| 108 BEGIN_FWL_EVENT_DEF(CFWL_EvtDraw, FWL_EVTHASH_Draw) |
| 109 CFX_Graphics* m_pGraphics; |
| 110 IFWL_Widget* m_pWidget; |
| 111 END_FWL_EVENT_DEF |
| 112 |
| 113 BEGIN_FWL_EVENT_DEF(CFWL_EvtClick, FWL_EVTHASH_Click) |
| 114 END_FWL_EVENT_DEF |
| 115 |
| 116 BEGIN_FWL_EVENT_DEF(CFWL_EvtScroll, FWL_EVTHASH_Scroll) |
| 117 FX_DWORD m_iScrollCode; |
| 118 FX_FLOAT m_fPos; |
| 119 FX_BOOL* m_pRet; |
| 120 END_FWL_EVENT_DEF |
| 121 |
| 122 BEGIN_FWL_EVENT_DEF(CFWL_EvtClose, FWL_EVTHASH_Close) |
| 123 END_FWL_EVENT_DEF |
| 124 |
| 125 BEGIN_FWL_EVENT_DEF(CFWL_EvtContextMenu, FWL_EVTHASH_ContextMenu) |
| 126 FX_FLOAT m_fPosX; |
| 127 FX_FLOAT m_fPosY; |
| 128 IFWL_Widget* m_pOwner; |
| 129 END_FWL_EVENT_DEF |
| 130 |
| 131 BEGIN_FWL_EVENT_DEF(CFWL_EvtMenuCommand, FWL_EVTHASH_MenuCommand) |
| 132 int32_t m_iCommand; |
| 133 void* m_pData; |
| 134 END_FWL_EVENT_DEF |
| 135 |
| 136 BEGIN_FWL_EVENT_DEF(CFWL_EvtSizeChanged, FWL_EVTHASH_SizeChanged) |
| 137 IFWL_Widget* m_pWidget; |
| 138 CFX_RectF m_rtOld; |
| 139 CFX_RectF m_rtNew; |
| 140 END_FWL_EVENT_DEF |
| 141 |
| 142 BEGIN_FWL_EVENT_DEF(CFWL_EvtIdle, FWL_EVTHASH_Idle) |
| 143 END_FWL_EVENT_DEF |
| 144 |
| 145 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ |
OLD | NEW |