KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PICKER_TOOL_BASE Class Reference

#include <picker_tool.h>

Inheritance diagram for PICKER_TOOL_BASE:
PCB_PICKER_TOOL PICKER_TOOL

Public Types

enum  pickerEndState {
  WAIT_CANCEL , CLICK_CANCEL , END_ACTIVATE , EVT_CANCEL ,
  EXCEPTION_CANCEL
}
 
typedef std::function< bool(const VECTOR2D &)> CLICK_HANDLER
 Event handler types.
 
typedef std::function< void(const VECTOR2D &)> MOTION_HANDLER
 
typedef std::function< void(void)> CANCEL_HANDLER
 
typedef std::function< void(const int &)> FINALIZE_HANDLER
 
typedef std::function< bool(void)> AREA_HANDLER
 Called once a rubber-band drag has left its result in the selection.
 

Public Member Functions

 PICKER_TOOL_BASE ()
 
virtual ~PICKER_TOOL_BASE ()=default
 
void SetCursor (KICURSOR aCursor)
 
void SetSnapping (bool aSnap)
 
void ClearHandlers ()
 
void SetClickHandler (CLICK_HANDLER aHandler)
 Set a handler for mouse click event.
 
void SetMotionHandler (MOTION_HANDLER aHandler)
 Set a handler for mouse motion.
 
void SetAreaHandler (AREA_HANDLER aHandler)
 Set a handler for a rubber-band drag.
 
void SetCancelHandler (CANCEL_HANDLER aHandler)
 Set a handler for cancel events (ESC or context-menu Cancel).
 
void SetFinalizeHandler (FINALIZE_HANDLER aHandler)
 Set a handler for the finalize event.
 
int CurrentModifiers () const
 

Protected Member Functions

virtual void reset ()
 Reinitializes tool to its initial state.
 

Protected Attributes

EDA_DRAW_FRAMEm_frame
 
KICURSOR m_cursor
 
bool m_snap
 
int m_modifiers
 
std::optional< CLICK_HANDLERm_clickHandler
 
std::optional< MOTION_HANDLERm_motionHandler
 
std::optional< AREA_HANDLERm_areaHandler
 
std::optional< CANCEL_HANDLERm_cancelHandler
 
std::optional< FINALIZE_HANDLERm_finalizeHandler
 
std::optional< VECTOR2Dm_picked
 

Detailed Description

Definition at line 32 of file picker_tool.h.

Member Typedef Documentation

◆ AREA_HANDLER

typedef std::function<bool(void)> PICKER_TOOL_BASE::AREA_HANDLER

Called once a rubber-band drag has left its result in the selection.

Definition at line 42 of file picker_tool.h.

◆ CANCEL_HANDLER

typedef std::function<void(void)> PICKER_TOOL_BASE::CANCEL_HANDLER

Definition at line 38 of file picker_tool.h.

◆ CLICK_HANDLER

typedef std::function<bool(const VECTOR2D&)> PICKER_TOOL_BASE::CLICK_HANDLER

Event handler types.

Definition at line 36 of file picker_tool.h.

◆ FINALIZE_HANDLER

typedef std::function<void(const int&)> PICKER_TOOL_BASE::FINALIZE_HANDLER

Definition at line 39 of file picker_tool.h.

◆ MOTION_HANDLER

typedef std::function<void(const VECTOR2D&)> PICKER_TOOL_BASE::MOTION_HANDLER

Definition at line 37 of file picker_tool.h.

Member Enumeration Documentation

◆ pickerEndState

Enumerator
WAIT_CANCEL 
CLICK_CANCEL 
END_ACTIVATE 
EVT_CANCEL 
EXCEPTION_CANCEL 

Definition at line 44 of file picker_tool.h.

Constructor & Destructor Documentation

◆ PICKER_TOOL_BASE()

PICKER_TOOL_BASE::PICKER_TOOL_BASE ( )
inline

◆ ~PICKER_TOOL_BASE()

virtual PICKER_TOOL_BASE::~PICKER_TOOL_BASE ( )
virtualdefault

Member Function Documentation

◆ ClearHandlers()

◆ CurrentModifiers()

int PICKER_TOOL_BASE::CurrentModifiers ( ) const
inline

Definition at line 130 of file picker_tool.h.

References m_modifiers.

Referenced by PCB_PICKER_TOOL::SelectPointInteractively().

◆ reset()

void PICKER_TOOL_BASE::reset ( )
protectedvirtual

Reinitializes tool to its initial state.

Reimplemented in PCB_PICKER_TOOL.

Definition at line 28 of file picker_tool.cpp.

References ARROW, m_areaHandler, m_cancelHandler, m_clickHandler, m_cursor, m_finalizeHandler, m_motionHandler, m_picked, and m_snap.

Referenced by PICKER_TOOL::Main(), PICKER_TOOL_BASE(), and PCB_PICKER_TOOL::reset().

◆ SetAreaHandler()

void PICKER_TOOL_BASE::SetAreaHandler ( AREA_HANDLER aHandler)
inline

Set a handler for a rubber-band drag.

The picker otherwise swallows it.

The drag runs the selection tool's own area loop, so the selection already holds what the box caught. Return true to stay armed, as with the click handler.

Definition at line 104 of file picker_tool.h.

References m_areaHandler.

Referenced by MATCH_PROPERTIES_TOOL::runInteractive().

◆ SetCancelHandler()

void PICKER_TOOL_BASE::SetCancelHandler ( CANCEL_HANDLER aHandler)
inline

◆ SetClickHandler()

◆ SetCursor()

◆ SetFinalizeHandler()

◆ SetMotionHandler()

◆ SetSnapping()

Member Data Documentation

◆ m_areaHandler

std::optional<AREA_HANDLER> PICKER_TOOL_BASE::m_areaHandler
protected

Definition at line 143 of file picker_tool.h.

Referenced by ClearHandlers(), PCB_PICKER_TOOL::Main(), reset(), and SetAreaHandler().

◆ m_cancelHandler

std::optional<CANCEL_HANDLER> PICKER_TOOL_BASE::m_cancelHandler
protected

◆ m_clickHandler

std::optional<CLICK_HANDLER> PICKER_TOOL_BASE::m_clickHandler
protected

◆ m_cursor

KICURSOR PICKER_TOOL_BASE::m_cursor
protected

Definition at line 137 of file picker_tool.h.

Referenced by PCB_PICKER_TOOL::Main(), PICKER_TOOL::Main(), reset(), and SetCursor().

◆ m_finalizeHandler

std::optional<FINALIZE_HANDLER> PICKER_TOOL_BASE::m_finalizeHandler
protected

◆ m_frame

EDA_DRAW_FRAME* PICKER_TOOL_BASE::m_frame
protected

Definition at line 136 of file picker_tool.h.

Referenced by PICKER_TOOL::Init(), PICKER_TOOL::Main(), and PICKER_TOOL_BASE().

◆ m_modifiers

int PICKER_TOOL_BASE::m_modifiers
protected

Definition at line 139 of file picker_tool.h.

Referenced by CurrentModifiers(), PICKER_TOOL::Main(), and PICKER_TOOL_BASE().

◆ m_motionHandler

std::optional<MOTION_HANDLER> PICKER_TOOL_BASE::m_motionHandler
protected

◆ m_picked

std::optional<VECTOR2D> PICKER_TOOL_BASE::m_picked
protected

Definition at line 147 of file picker_tool.h.

Referenced by PCB_PICKER_TOOL::Main(), PICKER_TOOL::Main(), and reset().

◆ m_snap

bool PICKER_TOOL_BASE::m_snap
protected

The documentation for this class was generated from the following files: