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 41 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 43 of file tool_dispatcher.cpp.

44  :
45  dragging( false ),
46  pressed( false ),
47  dragMaxDelta( 0.0f ),
48  button( aButton ),
49  downEvent( aDownEvent ),
50  upEvent( aUpEvent ),
51  dblClickEvent( aDblClickEvent )
52  {};
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 93 of file tool_dispatcher.cpp.

References BUT_LEFT, BUT_MIDDLE, and BUT_RIGHT.

Referenced by TOOL_DISPATCHER::handleMouseButton().

94  {
95  wxMouseState mouseState = wxGetMouseState();
96 
97  switch( button )
98  {
99  case BUT_LEFT:
100  return mouseState.LeftIsDown();
101 
102  case BUT_MIDDLE:
103  return mouseState.MiddleIsDown();
104 
105  case BUT_RIGHT:
106  return mouseState.RightIsDown();
107 
108  default:
109  assert( false );
110  break;
111  }
112 
113  return false;
114  }
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 86 of file tool_dispatcher.cpp.

87  {
88  dragging = false;
89  pressed = false;
90  }
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 71 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 80 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 74 of file tool_dispatcher.cpp.

VECTOR2D TOOL_DISPATCHER::BUTTON_STATE::downPosition

Point where click event has occurred.

Definition at line 64 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 83 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 52 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 68 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 61 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 58 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 77 of file tool_dispatcher.cpp.


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