KiCad PCB EDA Suite
TOOL_DISPATCHER::BUTTON_STATE Struct Reference

< Stores information about a mouse button state More...

Public Member Functions

 BUTTON_STATE (TOOL_MOUSE_BUTTONS aButton, const wxEventType &aDownEvent, const wxEventType &aUpEvent, const wxEventType &aDblClickEvent)
 
void Reset ()
 Checks the current state of the button. More...
 
bool GetState () const
 

Public Attributes

bool dragging
 Flag indicating that dragging is active for the given button. More...
 
bool pressed
 Point where dragging has started (in world coordinates). More...
 
VECTOR2D dragOrigin
 Point where dragging has started (in screen coordinates). More...
 
VECTOR2D dragOriginScreen
 Point where click event has occurred. More...
 
VECTOR2D downPosition
 Determines the mouse button for which information are stored. More...
 
TOOL_MOUSE_BUTTONS button
 The type of wxEvent that determines mouse button press. More...
 
wxEventType downEvent
 The type of wxEvent that determines mouse button release. More...
 
wxEventType upEvent
 The type of wxEvent that determines mouse button double click. More...
 
wxEventType dblClickEvent
 Time stamp for the last mouse button press event. More...
 
wxLongLong downTimestamp
 Restores initial state. More...
 

Detailed Description

< Stores information about a mouse button state

Definition at line 46 of file tool_dispatcher.cpp.

Constructor & Destructor Documentation

◆ BUTTON_STATE()

TOOL_DISPATCHER::BUTTON_STATE::BUTTON_STATE ( TOOL_MOUSE_BUTTONS  aButton,
const wxEventType &  aDownEvent,
const wxEventType &  aUpEvent,
const wxEventType &  aDblClickEvent 
)
inline

Definition at line 48 of file tool_dispatcher.cpp.

49 :
50 dragging( false ),
51 pressed( false ),
52 button( aButton ),
53 downEvent( aDownEvent ),
54 upEvent( aUpEvent ),
55 dblClickEvent( aDblClickEvent )
56 {};
wxEventType dblClickEvent
Time stamp for the last mouse button press event.
wxEventType upEvent
The type of wxEvent that determines mouse button double click.
bool dragging
Flag indicating that dragging is active for the given button.
bool pressed
Point where dragging has started (in world coordinates).
TOOL_MOUSE_BUTTONS button
The type of wxEvent that determines mouse button press.
wxEventType downEvent
The type of wxEvent that determines mouse button release.

Member Function Documentation

◆ GetState()

bool TOOL_DISPATCHER::BUTTON_STATE::GetState ( ) const
inline

Definition at line 96 of file tool_dispatcher.cpp.

97 {
98 wxMouseState mouseState = wxGetMouseState();
99
100 switch( button )
101 {
102 case BUT_LEFT:
103 return mouseState.LeftIsDown();
104
105 case BUT_MIDDLE:
106 return mouseState.MiddleIsDown();
107
108 case BUT_RIGHT:
109 return mouseState.RightIsDown();
110
111 case BUT_AUX1:
112 return mouseState.Aux1IsDown();
113
114 case BUT_AUX2:
115 return mouseState.Aux2IsDown();
116
117 default:
118 assert( false );
119 break;
120 }
121
122 return false;
123 }
@ BUT_AUX1
Definition: tool_event.h:130
@ BUT_MIDDLE
Definition: tool_event.h:129
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128
@ BUT_AUX2
Definition: tool_event.h:131

References BUT_AUX1, BUT_AUX2, BUT_LEFT, BUT_MIDDLE, BUT_RIGHT, and button.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ Reset()

void TOOL_DISPATCHER::BUTTON_STATE::Reset ( )
inline

Checks the current state of the button.

Definition at line 89 of file tool_dispatcher.cpp.

References dragging, and pressed.

Member Data Documentation

◆ button

TOOL_MOUSE_BUTTONS TOOL_DISPATCHER::BUTTON_STATE::button

The type of wxEvent that determines mouse button press.

Definition at line 74 of file tool_dispatcher.cpp.

Referenced by GetState(), and TOOL_DISPATCHER::handleMouseButton().

◆ dblClickEvent

wxEventType TOOL_DISPATCHER::BUTTON_STATE::dblClickEvent

Time stamp for the last mouse button press event.

Definition at line 83 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ downEvent

wxEventType TOOL_DISPATCHER::BUTTON_STATE::downEvent

The type of wxEvent that determines mouse button release.

Definition at line 77 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ downPosition

VECTOR2D TOOL_DISPATCHER::BUTTON_STATE::downPosition

Determines the mouse button for which information are stored.

Definition at line 71 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ downTimestamp

wxLongLong TOOL_DISPATCHER::BUTTON_STATE::downTimestamp

Restores initial state.

Definition at line 86 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ dragging

bool TOOL_DISPATCHER::BUTTON_STATE::dragging

Flag indicating that dragging is active for the given button.

Flag indicating that the given button is pressed.

Definition at line 59 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton(), and Reset().

◆ dragOrigin

VECTOR2D TOOL_DISPATCHER::BUTTON_STATE::dragOrigin

Point where dragging has started (in screen coordinates).

Definition at line 65 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ dragOriginScreen

VECTOR2D TOOL_DISPATCHER::BUTTON_STATE::dragOriginScreen

Point where click event has occurred.

Definition at line 68 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

◆ pressed

bool TOOL_DISPATCHER::BUTTON_STATE::pressed

Point where dragging has started (in world coordinates).

Definition at line 62 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton(), and Reset().

◆ upEvent

wxEventType TOOL_DISPATCHER::BUTTON_STATE::upEvent

The type of wxEvent that determines mouse button double click.

Definition at line 80 of file tool_dispatcher.cpp.


The documentation for this struct was generated from the following file: