bWidgets
Core widget toolkit designed for Blender
bwEvent.h
Go to the documentation of this file.
1#pragma once
2
3#include "bwDistance.h"
4#include "bwPoint.h"
5
6namespace bWidgets {
7
8class bwEvent {
9 public:
10 bwEvent(bwPoint _location);
11 virtual ~bwEvent() = default;
12
13 void swallow();
14 void unswallow();
15 auto isSwallowed() const -> bool;
16
19
20 private:
21 bool is_swallowed{false};
22};
23
25 public:
26 enum class Button {
27 LEFT,
28 RIGHT,
29 WHEEL,
30
31 UNKNOWN
32 };
33
34 bwMouseButtonEvent(Button _button, bwPoint _location);
35
37};
38
40 public:
41 enum DragState {
44 };
45
46 bwMouseButtonDragEvent(Button _button, bwPoint _location);
47
48 void addMouseMovement(bwPoint new_location);
49
50 const static short DRAG_THRESHOLD = 3;
51
54};
55
57 public:
58 enum class Direction { UP, DOWN };
59
60 bwMouseWheelEvent(Direction _direction, bwPoint _location);
61
62 auto getDirection() const -> Direction;
63
64 private:
65 Direction direction;
66};
67
68} // namespace bWidgets
Definition: bwEvent.h:8
void swallow()
Definition: bwEvent.cc:9
bwEvent(bwPoint _location)
Definition: bwEvent.cc:5
auto isSwallowed() const -> bool
Definition: bwEvent.cc:19
void unswallow()
Definition: bwEvent.cc:14
virtual ~bwEvent()=default
const bwPoint location
Definition: bwEvent.h:18
Definition: bwEvent.h:39
DragState drag_state
Definition: bwEvent.h:53
bwMouseButtonDragEvent(Button _button, bwPoint _location)
Definition: bwEvent.cc:29
static const short DRAG_THRESHOLD
Definition: bwEvent.h:50
void addMouseMovement(bwPoint new_location)
Definition: bwEvent.cc:34
bwDistance drag_distance
Definition: bwEvent.h:52
DragState
Definition: bwEvent.h:41
@ DRAGGING_BELOW_THRESHOLD
Definition: bwEvent.h:42
@ DRAGGING
Definition: bwEvent.h:43
Definition: bwEvent.h:24
Button
Definition: bwEvent.h:26
bwMouseButtonEvent(Button _button, bwPoint _location)
Definition: bwEvent.cc:24
const Button button
Definition: bwEvent.h:36
Definition: bwEvent.h:56
Direction
Definition: bwEvent.h:58
auto getDirection() const -> Direction
Definition: bwEvent.cc:49
bwMouseWheelEvent(Direction _direction, bwPoint _location)
Definition: bwEvent.cc:44
Definition: bwPoint.h:7
Definition: bwContext.h:3
Direction
Definition: bwPainter.h:33