KiCad PCB EDA Suite
tool_event.h File Reference
#include <cstdio>
#include <deque>
#include <iterator>
#include <math/vector2d.h>
#include <cassert>
#include <core/optional.h>

Go to the source code of this file.

Classes

class  TOOL_EVENT
 Class TOOL_EVENT. More...
 
class  TOOL_EVENT_LIST
 Class TOOL_EVENT_LIST. More...
 

Typedefs

typedef OPT< TOOL_EVENTOPT_TOOL_EVENT
 

Enumerations

enum  TOOL_EVENT_CATEGORY {
  TC_NONE = 0x00, TC_MOUSE = 0x01, TC_KEYBOARD = 0x02, TC_COMMAND = 0x04,
  TC_MESSAGE = 0x08, TC_VIEW = 0x10, TC_ANY = 0xffffffff
}
 Internal (GUI-independent) event definitions. More...
 
enum  TOOL_ACTIONS {
  TA_NONE = 0x0000, TA_MOUSE_CLICK = 0x0001, TA_MOUSE_DBLCLICK = 0x0002, TA_MOUSE_UP = 0x0004,
  TA_MOUSE_DOWN = 0x0008, TA_MOUSE_DRAG = 0x0010, TA_MOUSE_MOTION = 0x0020, TA_MOUSE_WHEEL = 0x0040,
  TA_MOUSE = 0x007f, TA_KEY_PRESSED = 0x0080, TA_KEYBOARD = TA_KEY_PRESSED, TA_VIEW_REFRESH = 0x0100,
  TA_VIEW_ZOOM = 0x0200, TA_VIEW_PAN = 0x0400, TA_VIEW_DIRTY = 0x0800, TA_VIEW = 0x0f00,
  TA_CHANGE_LAYER = 0x1000, TA_CANCEL_TOOL = 0x2000, TA_CONTEXT_MENU_UPDATE = 0x4000, TA_CONTEXT_MENU_CHOICE = 0x8000,
  TA_CONTEXT_MENU_CLOSED = 0x10000, TA_CONTEXT_MENU = TA_CONTEXT_MENU_UPDATE | TA_CONTEXT_MENU_CHOICE | TA_CONTEXT_MENU_CLOSED, TA_UNDO_REDO_PRE = 0x20000, TA_UNDO_REDO_POST = 0x40000,
  TA_ACTION = 0x80000, TA_ACTIVATE = 0x100000, TA_MODEL_CHANGE = 0x200000, TA_ANY = 0xffffffff
}
 
enum  TOOL_MOUSE_BUTTONS {
  BUT_NONE = 0x0, BUT_LEFT = 0x1, BUT_RIGHT = 0x2, BUT_MIDDLE = 0x4,
  BUT_BUTTON_MASK = BUT_LEFT | BUT_RIGHT | BUT_MIDDLE, BUT_ANY = 0xffffffff
}
 
enum  TOOL_MODIFIERS { MD_SHIFT = 0x1000, MD_CTRL = 0x2000, MD_ALT = 0x4000, MD_MODIFIER_MASK = MD_SHIFT | MD_CTRL | MD_ALT }
 
enum  TOOL_ACTION_SCOPE { AS_CONTEXT = 1, AS_ACTIVE, AS_GLOBAL }
 Scope of tool actions. More...
 
enum  TOOL_ACTION_FLAGS { AF_NONE = 0, AF_ACTIVATE = 1, AF_NOTIFY = 2 }
 Flags for tool actions. More...
 
enum  CONTEXT_MENU_TRIGGER { CMENU_BUTTON = 0, CMENU_NOW, CMENU_OFF }
 Defines when a context menu is opened. More...
 

Functions

const TOOL_EVENT_LIST operator|| (const TOOL_EVENT &aEventA, const TOOL_EVENT &aEventB)
 
const TOOL_EVENT_LIST operator|| (const TOOL_EVENT &aEvent, const TOOL_EVENT_LIST &aEventList)
 

Typedef Documentation

Definition at line 460 of file tool_event.h.

Enumeration Type Documentation

Defines when a context menu is opened.

Enumerator
CMENU_BUTTON 
CMENU_NOW 
CMENU_OFF 

Definition at line 150 of file tool_event.h.

151 {
152  CMENU_BUTTON = 0, // On the right button
153  CMENU_NOW, // Right now (after TOOL_INTERACTIVE::SetContextMenu)
154  CMENU_OFF // Never
155 };

Flags for tool actions.

Enumerator
AF_NONE 
AF_ACTIVATE 
AF_NOTIFY 

Action activates a tool

Definition at line 142 of file tool_event.h.

143 {
144  AF_NONE = 0,
145  AF_ACTIVATE = 1,
146  AF_NOTIFY = 2
147 };
Action activates a tool
Definition: tool_event.h:146

Scope of tool actions.

Enumerator
AS_CONTEXT 
AS_ACTIVE 

Action belongs to a particular tool (i.e. a part of a pop-up menu)

AS_GLOBAL 

All active tools

Global action (toolbar/main menu event, global shortcut)

Definition at line 134 of file tool_event.h.

135 {
136  AS_CONTEXT = 1,
137  AS_ACTIVE,
138  AS_GLOBAL
139 };
Action belongs to a particular tool (i.e. a part of a pop-up menu)
Definition: tool_event.h:137
All active tools
Definition: tool_event.h:138
Enumerator
TA_NONE 
TA_MOUSE_CLICK 
TA_MOUSE_DBLCLICK 
TA_MOUSE_UP 
TA_MOUSE_DOWN 
TA_MOUSE_DRAG 
TA_MOUSE_MOTION 
TA_MOUSE_WHEEL 
TA_MOUSE 
TA_KEY_PRESSED 
TA_KEYBOARD 
TA_VIEW_REFRESH 
TA_VIEW_ZOOM 
TA_VIEW_PAN 
TA_VIEW_DIRTY 
TA_VIEW 
TA_CHANGE_LAYER 
TA_CANCEL_TOOL 
TA_CONTEXT_MENU_UPDATE 
TA_CONTEXT_MENU_CHOICE 
TA_CONTEXT_MENU_CLOSED 
TA_CONTEXT_MENU 
TA_UNDO_REDO_PRE 
TA_UNDO_REDO_POST 
TA_ACTION 
TA_ACTIVATE 
TA_MODEL_CHANGE 
TA_ANY 

Definition at line 55 of file tool_event.h.

56 {
57  // UI input events
58  TA_NONE = 0x0000,
59  TA_MOUSE_CLICK = 0x0001,
60  TA_MOUSE_DBLCLICK = 0x0002,
61  TA_MOUSE_UP = 0x0004,
62  TA_MOUSE_DOWN = 0x0008,
63  TA_MOUSE_DRAG = 0x0010,
64  TA_MOUSE_MOTION = 0x0020,
65  TA_MOUSE_WHEEL = 0x0040,
66  TA_MOUSE = 0x007f,
67 
68  TA_KEY_PRESSED = 0x0080,
70 
71  // View related events
72  TA_VIEW_REFRESH = 0x0100,
73  TA_VIEW_ZOOM = 0x0200,
74  TA_VIEW_PAN = 0x0400,
75  TA_VIEW_DIRTY = 0x0800,
76  TA_VIEW = 0x0f00,
77 
78  TA_CHANGE_LAYER = 0x1000,
79 
80  // Tool cancel event. Issued automagically when the user hits escape or selects End Tool from
81  // the context menu.
82  TA_CANCEL_TOOL = 0x2000,
83 
84  // Context menu update. Issued whenever context menu is open and the user hovers the mouse
85  // over one of choices. Used in dynamic highligting in disambiguation menu
86  TA_CONTEXT_MENU_UPDATE = 0x4000,
87 
88  // Context menu choice. Sent if the user picked something from the context menu or
89  // closed it without selecting anything.
90  TA_CONTEXT_MENU_CHOICE = 0x8000,
91 
92  // Context menu is closed, no matter whether anything has been chosen or not.
93  TA_CONTEXT_MENU_CLOSED = 0x10000,
94 
96 
97  // This event is sent *before* undo/redo command is performed.
98  TA_UNDO_REDO_PRE = 0x20000,
99 
100  // This event is sent *after* undo/redo command is performed.
101  TA_UNDO_REDO_POST = 0x40000,
102 
103  // Tool action (allows to control tools).
104  TA_ACTION = 0x80000,
105 
106  // Tool activation event.
107  TA_ACTIVATE = 0x100000,
108 
109  // Model has changed (partial update).
110  TA_MODEL_CHANGE = 0x200000,
111 
112  TA_ANY = 0xffffffff
113 };

Internal (GUI-independent) event definitions.

Enums are mostly self-explanatory.

Enumerator
TC_NONE 
TC_MOUSE 
TC_KEYBOARD 
TC_COMMAND 
TC_MESSAGE 
TC_VIEW 
TC_ANY 

Definition at line 44 of file tool_event.h.

45 {
46  TC_NONE = 0x00,
47  TC_MOUSE = 0x01,
48  TC_KEYBOARD = 0x02,
49  TC_COMMAND = 0x04,
50  TC_MESSAGE = 0x08,
51  TC_VIEW = 0x10,
52  TC_ANY = 0xffffffff
53 };
Enumerator
MD_SHIFT 
MD_CTRL 
MD_ALT 
MD_MODIFIER_MASK 

Definition at line 125 of file tool_event.h.

126 {
127  MD_SHIFT = 0x1000,
128  MD_CTRL = 0x2000,
129  MD_ALT = 0x4000,
131 };
Enumerator
BUT_NONE 
BUT_LEFT 
BUT_RIGHT 
BUT_MIDDLE 
BUT_BUTTON_MASK 
BUT_ANY 

Definition at line 115 of file tool_event.h.

116 {
117  BUT_NONE = 0x0,
118  BUT_LEFT = 0x1,
119  BUT_RIGHT = 0x2,
120  BUT_MIDDLE = 0x4,
122  BUT_ANY = 0xffffffff
123 };

Function Documentation

const TOOL_EVENT_LIST operator|| ( const TOOL_EVENT aEventA,
const TOOL_EVENT aEventB 
)
inline

Definition at line 578 of file tool_event.h.

References TOOL_EVENT_LIST::Add().

579 {
580  TOOL_EVENT_LIST l;
581 
582  l.Add( aEventA );
583  l.Add( aEventB );
584 
585  return l;
586 }
Class TOOL_EVENT_LIST.
Definition: tool_event.h:468
void Add(const TOOL_EVENT &aEvent)
Function Add() Adds a tool event to the list.
Definition: tool_event.h:507
const TOOL_EVENT_LIST operator|| ( const TOOL_EVENT aEvent,
const TOOL_EVENT_LIST aEventList 
)
inline

Definition at line 588 of file tool_event.h.

References TOOL_EVENT_LIST::Add().

590 {
591  TOOL_EVENT_LIST l( aEventList );
592 
593  l.Add( aEvent );
594  return l;
595 }
Class TOOL_EVENT_LIST.
Definition: tool_event.h:468