KiCad PCB EDA Suite
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. More...
 
typedef std::function< void(const VECTOR2D &)> MOTION_HANDLER
 
typedef std::function< void(void)> CANCEL_HANDLER
 
typedef std::function< void(const int &)> FINALIZE_HANDLER
 

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

EDA_DRAW_FRAMEm_frame
 
KICURSOR m_cursor
 
bool m_snap
 
OPT< CLICK_HANDLERm_clickHandler
 
OPT< MOTION_HANDLERm_motionHandler
 
OPT< CANCEL_HANDLERm_cancelHandler
 
OPT< FINALIZE_HANDLERm_finalizeHandler
 
OPT< VECTOR2Dm_picked
 

Detailed Description

Definition at line 36 of file picker_tool.h.

Member Typedef Documentation

◆ CANCEL_HANDLER

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

Definition at line 42 of file picker_tool.h.

◆ CLICK_HANDLER

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

< Event handler types.

Definition at line 40 of file picker_tool.h.

◆ FINALIZE_HANDLER

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

Definition at line 43 of file picker_tool.h.

◆ MOTION_HANDLER

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

Definition at line 41 of file picker_tool.h.

Member Enumeration Documentation

◆ pickerEndState

Enumerator
WAIT_CANCEL 
CLICK_CANCEL 
END_ACTIVATE 
EVT_CANCEL 
EXCEPTION_CANCEL 

Definition at line 45 of file picker_tool.h.

Constructor & Destructor Documentation

◆ PICKER_TOOL_BASE()

PICKER_TOOL_BASE::PICKER_TOOL_BASE ( )
inline

Definition at line 54 of file picker_tool.h.

54  :
55  m_frame( nullptr )
56  {
57  reset();
58  }
virtual void reset()
< Reinitializes tool to its initial state.
Definition: picker_tool.cpp:31
EDA_DRAW_FRAME * m_frame
Definition: picker_tool.h:112

References reset().

◆ ~PICKER_TOOL_BASE()

virtual PICKER_TOOL_BASE::~PICKER_TOOL_BASE ( )
virtualdefault

Member Function Documentation

◆ reset()

void PICKER_TOOL_BASE::reset ( )
protectedvirtual

< Reinitializes tool to its initial state.

Reimplemented in PCB_PICKER_TOOL.

Definition at line 31 of file picker_tool.cpp.

32 {
34  m_snap = true;
35 
36  m_picked = NULLOPT;
41 }
KICURSOR m_cursor
Definition: picker_tool.h:113
OPT< VECTOR2D > m_picked
Definition: picker_tool.h:121
OPT< CANCEL_HANDLER > m_cancelHandler
Definition: picker_tool.h:118
OPT< FINALIZE_HANDLER > m_finalizeHandler
Definition: picker_tool.h:119
const auto NULLOPT
Definition: optional.h:9
OPT< CLICK_HANDLER > m_clickHandler
Definition: picker_tool.h:116
OPT< MOTION_HANDLER > m_motionHandler
Definition: picker_tool.h:117

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

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

◆ SetCancelHandler()

void PICKER_TOOL_BASE::SetCancelHandler ( CANCEL_HANDLER  aHandler)
inline

Set a handler for cancel events (ESC or context-menu Cancel).

Definition at line 91 of file picker_tool.h.

92  {
93  wxASSERT( !m_cancelHandler );
94  m_cancelHandler = aHandler;
95  }
OPT< CANCEL_HANDLER > m_cancelHandler
Definition: picker_tool.h:118

References m_cancelHandler.

Referenced by GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), and POSITION_RELATIVE_TOOL::SelectPositionRelativeItem().

◆ SetClickHandler()

void PICKER_TOOL_BASE::SetClickHandler ( CLICK_HANDLER  aHandler)
inline

◆ SetCursor()

void PICKER_TOOL_BASE::SetCursor ( KICURSOR  aCursor)
inline

◆ SetFinalizeHandler()

void PICKER_TOOL_BASE::SetFinalizeHandler ( FINALIZE_HANDLER  aHandler)
inline

◆ SetMotionHandler()

void PICKER_TOOL_BASE::SetMotionHandler ( MOTION_HANDLER  aHandler)
inline

Set a handler for mouse motion.

This is used for roll-over highlighting.

Definition at line 82 of file picker_tool.h.

83  {
84  wxASSERT( !m_motionHandler );
85  m_motionHandler = aHandler;
86  }
OPT< MOTION_HANDLER > m_motionHandler
Definition: picker_tool.h:117

References m_motionHandler.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), and POSITION_RELATIVE_TOOL::SelectPositionRelativeItem().

◆ SetSnapping()

void PICKER_TOOL_BASE::SetSnapping ( bool  aSnap)
inline

Definition at line 64 of file picker_tool.h.

64 { m_snap = aSnap; }

References m_snap.

Referenced by SCH_EDIT_TOOL::DeleteItemCursor(), and SCH_EDITOR_CONTROL::HighlightNetCursor().

Member Data Documentation

◆ m_cancelHandler

OPT<CANCEL_HANDLER> PICKER_TOOL_BASE::m_cancelHandler
protected

Definition at line 118 of file picker_tool.h.

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

◆ m_clickHandler

OPT<CLICK_HANDLER> PICKER_TOOL_BASE::m_clickHandler
protected

Definition at line 116 of file picker_tool.h.

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

◆ m_cursor

KICURSOR PICKER_TOOL_BASE::m_cursor
protected

Definition at line 113 of file picker_tool.h.

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

◆ m_finalizeHandler

OPT<FINALIZE_HANDLER> PICKER_TOOL_BASE::m_finalizeHandler
protected

Definition at line 119 of file picker_tool.h.

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

◆ m_frame

EDA_DRAW_FRAME* PICKER_TOOL_BASE::m_frame
protected

Definition at line 112 of file picker_tool.h.

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

◆ m_motionHandler

OPT<MOTION_HANDLER> PICKER_TOOL_BASE::m_motionHandler
protected

Definition at line 117 of file picker_tool.h.

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

◆ m_picked

OPT<VECTOR2D> PICKER_TOOL_BASE::m_picked
protected

Definition at line 121 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

Definition at line 114 of file picker_tool.h.

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


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