0032433: Visualization, TKService - introduce Wasm_Window implementing Aspect_Window...
[occt.git] / src / Aspect / Aspect_ScrollDelta.hxx
1 // Copyright (c) 2019 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _Aspect_ScrollDelta_HeaderFile
15 #define _Aspect_ScrollDelta_HeaderFile
16
17 #include <Aspect_VKeyFlags.hxx>
18 #include <NCollection_Vec2.hxx>
19 #include <Standard_Real.hxx>
20
21 //! Parameters for mouse scroll action.
22 struct Aspect_ScrollDelta
23 {
24
25   NCollection_Vec2<int> Point; //!< scale position
26   Standard_Real         Delta; //!< delta in pixels
27   Aspect_VKeyFlags      Flags; //!< key flags
28
29   //! Return true if action has point defined.
30   bool HasPoint() const
31   {
32     return Point.x() >= 0
33         && Point.y() >= 0;
34   }
35
36   //! Reset at point.
37   void ResetPoint()
38   {
39     Point.SetValues (-1, -1);
40   }
41
42   //! Empty constructor.
43   Aspect_ScrollDelta()
44   : Point (-1, -1), Delta (0.0), Flags (Aspect_VKeyFlags_NONE) {}
45
46   //! Constructor.
47   Aspect_ScrollDelta (const NCollection_Vec2<int>& thePnt,
48                       Standard_Real theValue,
49                       Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE)
50   : Point (thePnt), Delta (theValue), Flags (theFlags) {}
51
52   //! Constructor with undefined point.
53   Aspect_ScrollDelta (Standard_Real theValue,
54                       Aspect_VKeyFlags theFlags = Aspect_VKeyFlags_NONE)
55   : Point (-1, -1), Delta (theValue), Flags (theFlags) {}
56
57 };
58
59 #endif // _Aspect_ScrollDelta_HeaderFile