]> git.tdb.fi Git - libs/gltk.git/blob - source/draghandle.h
Use the override specifier when overriding a virtual function
[libs/gltk.git] / source / draghandle.h
1 #ifndef MSP_GLTK_DRAGHANDLE_H_
2 #define MSP_GLTK_DRAGHANDLE_H_
3
4 #include "mspgltk_api.h"
5 #include "widget.h"
6
7 namespace Msp {
8 namespace GLtk {
9
10 /**
11 Moves its parent widget when dragged.  This allows turning a Panel or Dialog
12 into a movable window.
13 */
14 class MSPGLTK_API DragHandle: public Widget
15 {
16 private:
17         bool dragging = false;
18         int drag_x = 0;
19         int drag_y = 0;
20
21 public:
22         const char *get_class() const override { return "draghandle"; }
23
24         void button_press(int, int, unsigned) override;
25         void button_release(int, int, unsigned) override;
26         void pointer_motion(int, int) override;
27 private:
28         void on_reparent() override;
29 };
30
31 } // namespace GLtk
32 } // namespace Msp
33
34 #endif