#ifndef __PCB_TEST_SELECTION_TOOL_H #define __PCB_TEST_SELECTION_TOOL_H #include #include #include #include #include #include class PCB_TEST_FRAME_BASE; class PCB_TEST_SELECTION_TOOL : public SELECTION_TOOL { public: PCB_TEST_SELECTION_TOOL(); virtual ~PCB_TEST_SELECTION_TOOL(); /// @copydoc TOOL_BASE::Init() bool Init() override; /// @copydoc TOOL_BASE::Reset() void Reset( RESET_REASON aReason ) override; int Main( const TOOL_EVENT& aEvent ); PCB_SELECTION& GetSelection() { return m_selection; } void ClearSelection(); void SetSelectionHook( std::function aHook ) { m_selectionHook = aHook; } void SetSelectableItemTypes( const std::vector aTypes ); protected: const GENERAL_COLLECTORS_GUIDE getCollectorsGuide() const; bool selectPoint( const VECTOR2I& aWhere ); void setTransitions() override; KIGFX::PCB_VIEW* view() const { return static_cast( getView() ); } KIGFX::VIEW_CONTROLS* controls() const { return getViewControls(); } PCB_TEST_FRAME_BASE* frame() const { return getEditFrame(); } BOARD* board() const { return getModel(); } PCB_DRAW_PANEL_GAL* canvas() const { return static_cast( frame()->GetPanel().get() ); } SELECTION& selection() override { return m_selection; } void highlightInternal( EDA_ITEM* aItem, int aMode, bool aUsingOverlay ); void unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup ) override; void unhighlightInternal( EDA_ITEM* aItem, int aMode, bool aUsingOverlay ); void highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup ) override; void select( EDA_ITEM* aItem ) override; void unselect( EDA_ITEM* aItem ) override; private: std::function m_selectionHook; PCB_SELECTION m_selection; // Current state of selection std::vector m_selectableTypes; }; #endif