KiCad PCB EDA Suite
tool_event.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 CERN
5  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #ifndef __TOOL_EVENT_H
28 #define __TOOL_EVENT_H
29 
30 #include <cstdio>
31 #include <deque>
32 #include <iterator>
33 
34 #include <math/vector2d.h>
35 #include <core/optional.h>
36 
37 #ifdef WX_COMPATIBILITY
38 #include <wx/debug.h>
39 #else
40 #include <cassert>
41 #endif
42 
43 
44 class TOOL_ACTION;
45 class TOOL_MANAGER;
46 class TOOL_BASE;
47 
52 {
53  TC_NONE = 0x00,
54  TC_MOUSE = 0x01,
55  TC_KEYBOARD = 0x02,
56  TC_COMMAND = 0x04,
57  TC_MESSAGE = 0x08,
58  TC_VIEW = 0x10,
59  TC_ANY = 0xffffffff
60 };
61 
63 {
64  // UI input events
65  TA_NONE = 0x0000,
66  TA_MOUSE_CLICK = 0x0001,
68  TA_MOUSE_UP = 0x0004,
69  TA_MOUSE_DOWN = 0x0008,
70  TA_MOUSE_DRAG = 0x0010,
71  TA_MOUSE_MOTION = 0x0020,
72  TA_MOUSE_WHEEL = 0x0040,
73  TA_MOUSE = 0x007f,
74 
75  TA_KEY_PRESSED = 0x0080,
77 
78  // View related events
79  TA_VIEW_REFRESH = 0x0100,
80  TA_VIEW_ZOOM = 0x0200,
81  TA_VIEW_PAN = 0x0400,
82  TA_VIEW_DIRTY = 0x0800,
83  TA_VIEW = 0x0f00,
84 
85  TA_CHANGE_LAYER = 0x1000,
86 
87  // Tool cancel event. Issued automagically when the user hits escape or selects End Tool from
88  // the context menu.
89  TA_CANCEL_TOOL = 0x2000,
90 
91  // Context menu update. Issued whenever context menu is open and the user hovers the mouse
92  // over one of choices. Used in dynamic highlighting in disambiguation menu
94 
95  // Context menu choice. Sent if the user picked something from the context menu or
96  // closed it without selecting anything.
98 
99  // Context menu is closed, no matter whether anything has been chosen or not.
101 
103 
104  // This event is sent *before* undo/redo command is performed.
105  TA_UNDO_REDO_PRE = 0x20000,
106 
107  // This event is sent *after* undo/redo command is performed.
108  TA_UNDO_REDO_POST = 0x40000,
109 
110  // Tool action (allows one to control tools).
111  TA_ACTION = 0x80000,
112 
113  // Tool activation event.
114  TA_ACTIVATE = 0x100000,
115 
116  // Model has changed (partial update).
117  TA_MODEL_CHANGE = 0x200000,
118 
119  // Tool priming event (a special mouse click)
120  TA_PRIME = 0x400001,
121 
122  TA_ANY = 0xffffffff
123 };
124 
126 {
127  BUT_NONE = 0x0,
128  BUT_LEFT = 0x1,
129  BUT_RIGHT = 0x2,
130  BUT_MIDDLE = 0x4,
132  BUT_ANY = 0xffffffff
133 };
134 
136 {
137  MD_SHIFT = 0x1000,
138  MD_CTRL = 0x2000,
139  MD_ALT = 0x4000,
141 };
142 
145 {
149 };
150 
153 {
154  AF_NONE = 0,
157 };
158 
161 {
162  CMENU_BUTTON = 0, // On the right button
163  CMENU_NOW, // Right now (after TOOL_INTERACTIVE::SetContextMenu)
164  CMENU_OFF // Never
165 };
166 
171 {
172 public:
178  const std::string Format() const;
179 
181  TOOL_ACTION_SCOPE aScope = AS_GLOBAL, void* aParameter = nullptr ) :
182  m_category( aCategory ),
183  m_actions( aAction ),
184  m_scope( aScope ),
185  m_mouseButtons( 0 ),
186  m_keyCode( 0 ),
187  m_modifiers( 0 ),
188  m_param( aParameter ),
189  m_firstResponder( nullptr )
190  {
191  init();
192  }
193 
194  TOOL_EVENT( TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam,
195  TOOL_ACTION_SCOPE aScope = AS_GLOBAL, void* aParameter = nullptr ) :
196  m_category( aCategory ),
197  m_actions( aAction ),
198  m_scope( aScope ),
199  m_mouseButtons( 0 ),
200  m_keyCode( 0 ),
201  m_modifiers( 0 ),
202  m_param( aParameter ),
203  m_firstResponder( nullptr )
204  {
205  if( aCategory == TC_MOUSE )
206  {
207  setMouseButtons( aExtraParam & BUT_BUTTON_MASK );
208  }
209  else if( aCategory == TC_KEYBOARD )
210  {
211  m_keyCode = aExtraParam & ~MD_MODIFIER_MASK; // Filter out modifiers
212  }
213  else if( aCategory == TC_COMMAND )
214  {
215  m_commandId = aExtraParam;
216  }
217 
218  if( aCategory & ( TC_MOUSE | TC_KEYBOARD ) )
219  {
220  m_modifiers = aExtraParam & MD_MODIFIER_MASK;
221  }
222 
223  init();
224  }
225 
227  const std::string& aExtraParam, TOOL_ACTION_SCOPE aScope = AS_GLOBAL,
228  void* aParameter = nullptr ) :
229  m_category( aCategory ),
230  m_actions( aAction ),
231  m_scope( aScope ),
232  m_mouseButtons( 0 ),
233  m_keyCode( 0 ),
234  m_modifiers( 0 ),
235  m_param( aParameter ),
236  m_firstResponder( nullptr )
237  {
238  if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE )
239  m_commandStr = aExtraParam;
240 
241  init();
242  }
243 
246 
248  TOOL_ACTIONS Action() const { return m_actions; }
249 
253  bool PassEvent() const { return m_passEvent; }
254  void SetPassEvent( bool aPass = true ) { m_passEvent = aPass; }
255 
258  bool HasPosition() const { return m_hasPosition; }
259  void SetHasPosition( bool aHasPosition ) { m_hasPosition = aHasPosition; }
260 
262  void SetFirstResponder( TOOL_BASE* aTool ) { m_firstResponder = aTool; }
263 
266  const VECTOR2D Delta() const
267  {
269  }
270 
272  const VECTOR2D Position() const
273  {
275  }
276 
278  const VECTOR2D DragOrigin() const
279  {
281  }
282 
284  int Buttons() const
285  {
286  assert( m_category == TC_MOUSE ); // this should be used only with mouse events
287  return m_mouseButtons;
288  }
289 
290  bool IsClick( int aButtonMask = BUT_ANY ) const;
291 
292  bool IsDblClick( int aButtonMask = BUT_ANY ) const;
293 
294  bool IsDrag( int aButtonMask = BUT_ANY ) const
295  {
296  return m_actions == TA_MOUSE_DRAG && ( m_mouseButtons & aButtonMask ) == m_mouseButtons;
297  }
298 
299  bool IsMouseUp( int aButtonMask = BUT_ANY ) const
300  {
301  return m_actions == TA_MOUSE_UP && ( m_mouseButtons & aButtonMask ) == m_mouseButtons;
302  }
303 
304  bool IsMotion() const
305  {
306  return m_actions == TA_MOUSE_MOTION;
307  }
308 
309  bool IsMouseAction() const
310  {
311  return ( m_actions & TA_MOUSE );
312  }
313 
314  bool IsCancel() const
315  {
316  return m_actions == TA_CANCEL_TOOL;
317  }
318 
319  bool IsActivate() const
320  {
321  return m_actions == TA_ACTIVATE;
322  }
323 
324  bool IsUndoRedo() const
325  {
327  }
328 
329  bool IsChoiceMenu() const
330  {
331  return m_actions & TA_CHOICE_MENU;
332  }
333 
334  bool IsPrime() const
335  {
336  return m_actions == TA_PRIME;
337  }
338 
340  int Modifier( int aMask = MD_MODIFIER_MASK ) const
341  {
342  return m_modifiers & aMask;
343  }
344 
345  int KeyCode() const
346  {
347  return m_keyCode;
348  }
349 
350  bool IsKeyPressed() const
351  {
352  return m_actions == TA_KEY_PRESSED;
353  }
354 
361  bool Matches( const TOOL_EVENT& aEvent ) const
362  {
363  if( !( m_category & aEvent.m_category ) )
364  return false;
365 
367  {
368  if( (bool) m_commandStr && (bool) aEvent.m_commandStr )
369  return *m_commandStr == *aEvent.m_commandStr;
370 
371  if( (bool) m_commandId && (bool) aEvent.m_commandId )
372  return *m_commandId == *aEvent.m_commandId;
373  }
374 
375  // BUGFIX: TA_ANY should match EVERYTHING, even TA_NONE (for TC_MESSAGE)
376  if( m_actions == TA_ANY && aEvent.m_actions == TA_NONE && aEvent.m_category == TC_MESSAGE )
377  return true;
378 
379  // BUGFIX: This check must happen after the TC_COMMAND check because otherwise events of
380  // the form { TC_COMMAND, TA_NONE } will be incorrectly skipped
381  if( !( m_actions & aEvent.m_actions ) )
382  return false;
383 
384  return true;
385  }
386 
393  bool IsAction( const TOOL_ACTION* aAction ) const;
394 
399  bool IsCancelInteractive() const;
400 
404  bool IsSelectionEvent() const;
405 
412  bool IsPointEditor() const;
413 
419  bool IsMoveTool() const;
420 
425  template<typename T>
426  inline T Parameter() const
427  {
428  // Exhibit #798 on why I love to hate C++
429  // - reinterpret_cast needs to be used for pointers
430  // - static_cast must be used for enums
431  // - templates can't usefully distinguish between pointer and non-pointer types
432  // Fortunately good old C's cast can be a reinterpret_cast or a static_cast, and
433  // C99 gave us intptr_t which is guaranteed to be round-trippable with a pointer.
434  return (T) reinterpret_cast<intptr_t>( m_param );
435  }
436 
443  template<typename T>
444  void SetParameter(T aParam)
445  {
446  m_param = (void*) aParam;
447  }
448 
450  {
451  return m_commandId;
452  }
453 
455  {
456  return m_commandStr;
457  }
458 
459  void SetMousePosition( const VECTOR2D& aP )
460  {
461  m_mousePos = aP;
462  }
463 
464 private:
465  friend class TOOL_DISPATCHER;
466 
467  void init();
468 
469  void setMouseDragOrigin( const VECTOR2D& aP )
470  {
471  m_mouseDragOrigin = aP;
472  }
473 
474  void setMouseDelta( const VECTOR2D& aP )
475  {
476  m_mouseDelta = aP;
477  }
478 
479  void setMouseButtons( int aButtons )
480  {
481  assert( ( aButtons & ~BUT_BUTTON_MASK ) == 0 );
482  m_mouseButtons = aButtons;
483  }
484 
485  void setModifiers( int aMods )
486  {
487  assert( ( aMods & ~MD_MODIFIER_MASK ) == 0 );
488  m_modifiers = aMods;
489  }
490 
502  {
503  #ifdef WX_COMPATIBILITY
504  wxCHECK_MSG( HasPosition(), VECTOR2D(),
505  "Attempted to get position from non-position event" );
506  #else
507  assert( HasPosition() );
508  #endif
509 
510  return aPos;
511  }
512 
518 
522 
525 
528 
531 
534 
537 
539  void* m_param;
540 
543 
546 };
547 
549 
555 {
556 public:
558  typedef std::deque<TOOL_EVENT>::iterator iterator;
559  typedef std::deque<TOOL_EVENT>::const_iterator const_iterator;
560 
563  {}
564 
566  TOOL_EVENT_LIST( const TOOL_EVENT& aSingleEvent )
567  {
568  m_events.push_back( aSingleEvent );
569  }
570 
572  TOOL_EVENT_LIST( const TOOL_EVENT_LIST& aEventList ) = default;
573 
580  const std::string Format() const;
581 
583  {
584  for( const TOOL_EVENT& event : m_events )
585  {
586  if( event.Matches( aEvent ) )
587  return event;
588  }
589 
590  return OPT<const TOOL_EVENT&>();
591  }
592 
598  void Add( const TOOL_EVENT& aEvent )
599  {
600  m_events.push_back( aEvent );
601  }
602 
604  {
605  return m_events.begin();
606  }
607 
609  {
610  return m_events.end();
611  }
612 
614  {
615  return m_events.begin();
616  }
617 
619  {
620  return m_events.end();
621  }
622 
623  int size() const
624  {
625  return m_events.size();
626  }
627 
628  void clear()
629  {
630  m_events.clear();
631  }
632 
634  {
635  m_events.clear();
636 
637  for( const TOOL_EVENT& event : aEventList.m_events )
638  m_events.push_back( event );
639 
640  return *this;
641  }
642 
644  {
645  m_events.clear();
646  m_events.push_back( aEvent );
647  return *this;
648  }
649 
651  {
652  Add( aEvent );
653  return *this;
654  }
655 
657  {
658  std::copy( aEvent.m_events.begin(), aEvent.m_events.end(), std::back_inserter( m_events ) );
659  return *this;
660  }
661 
662 private:
663  std::deque<TOOL_EVENT> m_events;
664 };
665 
666 
667 inline const TOOL_EVENT_LIST operator||( const TOOL_EVENT& aEventA, const TOOL_EVENT& aEventB )
668 {
669  TOOL_EVENT_LIST l;
670 
671  l.Add( aEventA );
672  l.Add( aEventB );
673 
674  return l;
675 }
676 
677 
678 inline const TOOL_EVENT_LIST operator||( const TOOL_EVENT& aEvent,
679  const TOOL_EVENT_LIST& aEventList )
680 {
681  TOOL_EVENT_LIST l( aEventList );
682 
683  l.Add( aEvent );
684  return l;
685 }
686 
687 
688 #endif
int Buttons() const
Definition: tool_event.h:284
bool IsCancel() const
Definition: tool_event.h:314
void setMouseButtons(int aButtons)
Definition: tool_event.h:479
bool m_hasPosition
Difference between mouse cursor position and the point where dragging event has started.
Definition: tool_event.h:517
OPT< int > GetCommandId() const
Definition: tool_event.h:449
void setModifiers(int aMods)
Definition: tool_event.h:485
TOOL_EVENT(TOOL_EVENT_CATEGORY aCategory=TC_NONE, TOOL_ACTIONS aAction=TA_NONE, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=nullptr)
Definition: tool_event.h:180
void setMouseDelta(const VECTOR2D &aP)
Definition: tool_event.h:474
TOOL_EVENT value_type
Definition: tool_event.h:557
const std::string Format() const
Return information about event in form of a human-readable string.
Definition: tool_event.cpp:73
void SetPassEvent(bool aPass=true)
Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based...
Definition: tool_event.h:254
bool IsSelectionEvent() const
Indicate an selection-changed notification event.
Definition: tool_event.cpp:200
iterator begin()
Definition: tool_event.h:603
void init()
Definition: tool_event.cpp:54
TOOL_EVENT(TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=nullptr)
Definition: tool_event.h:194
OPT< const TOOL_EVENT & > Matches(const TOOL_EVENT &aEvent) const
Definition: tool_event.h:582
Action belongs to a particular tool (i.e. a part of a pop-up menu)
Definition: tool_event.h:146
TOOL_ACTIONS Action() const
These give a tool a method of informing the TOOL_MANAGER that a particular event should be passed on ...
Definition: tool_event.h:248
int m_modifiers
Generic parameter used for passing non-standard data.
Definition: tool_event.h:536
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:178
bool IsMouseAction() const
Definition: tool_event.h:309
TOOL_ACTIONS m_actions
Definition: tool_event.h:514
TOOL_ACTIONS
Definition: tool_event.h:62
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:530
Action is a notification (it is by default passed to all tools)
Definition: tool_event.h:156
bool IsMotion() const
Definition: tool_event.h:304
bool IsKeyPressed() const
Definition: tool_event.h:350
TOOL_EVENT_CATEGORY Category() const
Returns more specific information about the type of an event.
Definition: tool_event.h:245
VECTOR2D returnCheckedPosition(const VECTOR2D &aPos) const
Ensure that the event is a type that has a position before returning a position, otherwise return a n...
Definition: tool_event.h:501
OPT< std::string > m_commandStr
Definition: tool_event.h:545
VECTOR2D m_mouseDelta
Current mouse cursor position.
Definition: tool_event.h:521
TOOL_EVENT_CATEGORY
Internal (GUI-independent) event definitions.
Definition: tool_event.h:51
bool IsMoveTool() const
Indicate if the event is from one of the move tools.
Definition: tool_event.cpp:217
TOOL_ACTION_SCOPE
Scope of tool actions.
Definition: tool_event.h:144
int m_keyCode
State of key modifiers (Ctrl/Alt/etc.)
Definition: tool_event.h:533
TOOL_EVENT_LIST & operator=(const TOOL_EVENT &aEvent)
Definition: tool_event.h:643
VECTOR2D m_mouseDragOrigin
State of mouse buttons.
Definition: tool_event.h:527
TOOL_EVENT_LIST & operator||(const TOOL_EVENT_LIST &aEvent)
Definition: tool_event.h:656
OPT< int > m_commandId
Definition: tool_event.h:544
TOOL_ACTION_FLAGS
Flags for tool actions.
Definition: tool_event.h:152
void SetMousePosition(const VECTOR2D &aP)
Definition: tool_event.h:459
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:190
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:67
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:663
TOOL_EVENT_LIST()
Constructor for a list containing only one TOOL_EVENT.
Definition: tool_event.h:562
TOOL_EVENT(TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, const std::string &aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=nullptr)
Returns the category (eg. mouse/keyboard/action) of an event..
Definition: tool_event.h:226
Master controller class:
Definition: tool_manager.h:52
void SetParameter(T aParam)
Set a non-standard parameter assigned to the event.
Definition: tool_event.h:444
bool m_passEvent
Definition: tool_event.h:516
Action activates a tool.
Definition: tool_event.h:155
A list of TOOL_EVENTs, with overloaded || operators allowing for concatenating TOOL_EVENTs with littl...
Definition: tool_event.h:554
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:294
All active tools.
Definition: tool_event.h:147
const VECTOR2D Delta() const
Returns mouse cursor position in world coordinates.
Definition: tool_event.h:266
VECTOR2< double > VECTOR2D
Definition: vector2d.h:629
TOOL_ACTION_SCOPE m_scope
Definition: tool_event.h:515
bool IsDblClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:184
TOOL_EVENT_LIST & operator||(const TOOL_EVENT &aEvent)
Definition: tool_event.h:650
CONTEXT_MENU_TRIGGER
Defines when a context menu is opened.
Definition: tool_event.h:160
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:426
Generic, UI-independent tool event.
Definition: tool_event.h:170
TOOL_EVENT_LIST(const TOOL_EVENT &aSingleEvent)
y Copy an existing TOOL_EVENT_LIST
Definition: tool_event.h:566
bool IsPointEditor() const
Indicate if the event is from one of the point editors.
Definition: tool_event.cpp:208
const VECTOR2D DragOrigin() const
Returns information about mouse buttons state.
Definition: tool_event.h:278
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:361
std::deque< TOOL_EVENT >::const_iterator const_iterator
Default constructor. Creates an empty list.
Definition: tool_event.h:559
Global action (toolbar/main menu event, global shortcut)
Definition: tool_event.h:148
bool IsMouseUp(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:299
const std::string Format() const
Function Format() Returns information about event in form of a human-readable string.
Definition: tool_event.cpp:167
int Modifier(int aMask=MD_MODIFIER_MASK) const
Definition: tool_event.h:340
bool IsPrime() const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:334
TOOL_MOUSE_BUTTONS
Definition: tool_event.h:125
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:454
const_iterator cend() const
Definition: tool_event.h:618
bool IsActivate() const
Definition: tool_event.h:319
bool IsUndoRedo() const
Definition: tool_event.h:324
bool PassEvent() const
Definition: tool_event.h:253
void Add(const TOOL_EVENT &aEvent)
Add a tool event to the list.
Definition: tool_event.h:598
TOOL_BASE * m_firstResponder
Definition: tool_event.h:542
const_iterator cbegin() const
Definition: tool_event.h:613
int size() const
Definition: tool_event.h:623
void SetFirstResponder(TOOL_BASE *aTool)
Returns information about difference between current mouse cursor position and the place where draggi...
Definition: tool_event.h:262
Base abstract interface for all kinds of tools.
Definition: tool_base.h:66
Represent a single user action.
Definition: tool_action.h:49
TOOL_EVENT_LIST & operator=(const TOOL_EVENT_LIST &aEventList)
Definition: tool_event.h:633
bool IsChoiceMenu() const
Definition: tool_event.h:329
void * m_param
The first tool to receive the event.
Definition: tool_event.h:539
boost::optional< T > OPT
Definition: optional.h:7
TOOL_MODIFIERS
Definition: tool_event.h:135
TOOL_BASE * FirstResponder() const
Definition: tool_event.h:261
bool HasPosition() const
Definition: tool_event.h:258
std::deque< TOOL_EVENT >::iterator iterator
Definition: tool_event.h:558
void setMouseDragOrigin(const VECTOR2D &aP)
Definition: tool_event.h:469
int KeyCode() const
Definition: tool_event.h:345
iterator end()
Definition: tool_event.h:608
VECTOR2D m_mousePos
Point where dragging has started.
Definition: tool_event.h:524
const TOOL_EVENT_LIST operator||(const TOOL_EVENT &aEventA, const TOOL_EVENT &aEventB)
Definition: tool_event.h:667
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:513
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:272
void SetHasPosition(bool aHasPosition)
Definition: tool_event.h:259
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:548