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 ()
 

Restores initial state.

More...
 
bool GetState () const
 

Checks the current state of the button.

More...
 

Public Attributes

bool dragging
 

Flag indicating that dragging is active for the given button.

More...
 
bool pressed
 

Flag indicating that the given button is pressed.

More...
 
VECTOR2D dragOrigin
 

Point where dragging has started (in world coordinates).

More...
 
VECTOR2D downPosition
 

Point where click event has occurred.

More...
 
double dragMaxDelta
 

Difference between drag origin point and current mouse position (expressed as distance in pixels).

More...
 
TOOL_MOUSE_BUTTONS button
 

Determines the mouse button for which information are stored.

More...
 
wxEventType downEvent
 

The type of wxEvent that determines mouse button press.

More...
 
wxEventType upEvent
 

The type of wxEvent that determines mouse button release.

More...
 
wxEventType dblClickEvent
 

The type of wxEvent that determines mouse button double click.

More...
 
wxLongLong downTimestamp
 

Time stamp for the last mouse button press event.

More...
 

Detailed Description

Stores information about a mouse button state

Definition at line 40 of file tool_dispatcher.cpp.

Constructor & Destructor Documentation

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

Definition at line 42 of file tool_dispatcher.cpp.

43  :
44  dragging( false ),
45  pressed( false ),
46  dragMaxDelta( 0.0f ),
47  button( aButton ),
48  downEvent( aDownEvent ),
49  upEvent( aUpEvent ),
50  dblClickEvent( aDblClickEvent )
51  {};
double dragMaxDelta
Difference between drag origin point and current mouse position (expressed as distance in pixels)...
bool dragging
Flag indicating that dragging is active for the given button.
wxEventType dblClickEvent
The type of wxEvent that determines mouse button double click.
wxEventType downEvent
The type of wxEvent that determines mouse button press.
bool pressed
Flag indicating that the given button is pressed.
wxEventType upEvent
The type of wxEvent that determines mouse button release.
TOOL_MOUSE_BUTTONS button
Determines the mouse button for which information are stored.

Member Function Documentation

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

Checks the current state of the button.

Definition at line 92 of file tool_dispatcher.cpp.

References BUT_LEFT, BUT_MIDDLE, and BUT_RIGHT.

Referenced by TOOL_DISPATCHER::handleMouseButton().

93  {
94  wxMouseState mouseState = wxGetMouseState();
95 
96  switch( button )
97  {
98  case BUT_LEFT:
99  return mouseState.LeftIsDown();
100 
101  case BUT_MIDDLE:
102  return mouseState.MiddleIsDown();
103 
104  case BUT_RIGHT:
105  return mouseState.RightIsDown();
106 
107  default:
108  assert( false );
109  break;
110  }
111 
112  return false;
113  }
TOOL_MOUSE_BUTTONS button
Determines the mouse button for which information are stored.
void TOOL_DISPATCHER::BUTTON_STATE::Reset ( )
inline

Restores initial state.

Definition at line 85 of file tool_dispatcher.cpp.

86  {
87  dragging = false;
88  pressed = false;
89  }
bool dragging
Flag indicating that dragging is active for the given button.
bool pressed
Flag indicating that the given button is pressed.

Member Data Documentation

TOOL_MOUSE_BUTTONS TOOL_DISPATCHER::BUTTON_STATE::button

Determines the mouse button for which information are stored.

Definition at line 70 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

wxEventType TOOL_DISPATCHER::BUTTON_STATE::dblClickEvent

The type of wxEvent that determines mouse button double click.

Definition at line 79 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

wxEventType TOOL_DISPATCHER::BUTTON_STATE::downEvent

The type of wxEvent that determines mouse button press.

Definition at line 73 of file tool_dispatcher.cpp.

VECTOR2D TOOL_DISPATCHER::BUTTON_STATE::downPosition

Point where click event has occurred.

Definition at line 63 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

wxLongLong TOOL_DISPATCHER::BUTTON_STATE::downTimestamp

Time stamp for the last mouse button press event.

Definition at line 82 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

bool TOOL_DISPATCHER::BUTTON_STATE::dragging

Flag indicating that dragging is active for the given button.

Definition at line 51 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

double TOOL_DISPATCHER::BUTTON_STATE::dragMaxDelta

Difference between drag origin point and current mouse position (expressed as distance in pixels).

Definition at line 67 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

VECTOR2D TOOL_DISPATCHER::BUTTON_STATE::dragOrigin

Point where dragging has started (in world coordinates).

Definition at line 60 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

bool TOOL_DISPATCHER::BUTTON_STATE::pressed

Flag indicating that the given button is pressed.

Definition at line 57 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::handleMouseButton().

wxEventType TOOL_DISPATCHER::BUTTON_STATE::upEvent

The type of wxEvent that determines mouse button release.

Definition at line 76 of file tool_dispatcher.cpp.


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