SHAPER  9.15.0
PartSet_MouseProcessor.h
1 // Copyright (C) 2014-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef PartSet_MouseProcessor_H
21 #define PartSet_MouseProcessor_H
22 
23 #include "PartSet.h"
24 
25 #include <memory>
26 
27 #ifdef _MSC_VER
28 #pragma warning(disable: 4100)
29 #endif
30 
35 class QMouseEvent;
36 class QPoint;
37 
40 {
41 public:
45  PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow* theWindow,
46  QMouseEvent* theEvent) {}
50  PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow* theWindow,
51  QMouseEvent* theEvent) {}
55  PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow,
56  QMouseEvent* theEvent) {}
60  PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow,
61  QMouseEvent* theEvent) {}
62 
64  virtual void setPreSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePreSelected,
65  ModuleBase_IViewWindow* theWnd,
66  QMouseEvent* theEvent) {}
67 
76  static bool convertPointToLocal(
77  ModuleBase_IWorkshop* theWorkshop,
78  const std::shared_ptr<ModelAPI_CompositeFeature>& theSketch, // Passing by reference is intentionally.
79  ModuleBase_IViewWindow* theWindow,
80  const QPoint& theEventPos,
81  double& theX, double& theY,
82  bool theSnap = true,
83  bool theHighlight = false,
84  bool theAddOffset = false
85  );
86 };
87 
88 #endif
Feature that consists of other features: like sketcher with edges inside.
Definition: ModelAPI_CompositeFeature.h:33
Interface to ViewWindow object which contains 3d scene.
Definition: ModuleBase_IViewWindow.h:34
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
Interface for mouse events processing.
Definition: PartSet_MouseProcessor.h:40
virtual void mouseDoubleClick(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent)
Processing the mouse double click event in the viewer.
Definition: PartSet_MouseProcessor.h:60
static bool convertPointToLocal(ModuleBase_IWorkshop *theWorkshop, const std::shared_ptr< ModelAPI_CompositeFeature > &theSketch, ModuleBase_IViewWindow *theWindow, const QPoint &theEventPos, double &theX, double &theY, bool theSnap=true, bool theHighlight=false, bool theAddOffset=false)
Converts position of mouse cursor to local coordinates on sketch plane.
Definition: PartSet_MouseProcessor.cpp:50
virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent)
Processing the mouse move event in the viewer.
Definition: PartSet_MouseProcessor.h:45
virtual void mousePressed(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent)
Processing the mouse press event in the viewer.
Definition: PartSet_MouseProcessor.h:50
virtual void setPreSelection(const std::shared_ptr< ModuleBase_ViewerPrs > &thePreSelected, ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent)
Fill preselection used in mouseReleased.
Definition: PartSet_MouseProcessor.h:64
virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent)
Processing the mouse release event in the viewer.
Definition: PartSet_MouseProcessor.h:55