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