--- a/src/widget/widget.h Fri Mar 02 22:29:20 2007 +0000
+++ b/src/widget/widget.h Fri Mar 02 22:31:08 2007 +0000
@@ -237,8 +237,10 @@
static const int16 DEFAULT_HEIGHT = 14;
protected:
- StringID m_text;
- byte m_text_color;
+ StringID m_text;
+ byte m_text_color;
+ Point16 m_moving_offset;
+ CaptureTicket m_ticket_moving;
public:
CaptionBar()
@@ -256,6 +258,8 @@
/*virtual*/ void DrawBackground(EvtPaint &ev);
/*virtual*/ void OnPaint(EvtPaint &ev);
+ /*virtual*/ void OnLeftClick(EvtClick &ev);
+ void OnCapturePressed(EvtMouseOver &e);
};
--- a/src/widget/widget_caption.cpp Fri Mar 02 22:29:20 2007 +0000
+++ b/src/widget/widget_caption.cpp Fri Mar 02 22:31:08 2007 +0000
@@ -51,4 +51,28 @@
ev.SetHandled();
}
+/*virtual*/ void CaptionBar::OnLeftClick(EvtClick &ev)
+{
+ m_moving_offset = ev.m_pt/* - GetWindow()->TopLeft()*/;
+ ev.SetHandled();
+ m_ticket_moving = CaptureEventsT(this, &CaptionBar::OnCapturePressed);
+ Invalidate();
+}
+
+void CaptionBar::OnCapturePressed(EvtMouseOver &e)
+{
+ if (!_left_button_down) {
+ m_ticket_moving.Release();
+
+ EvtClick ev(Point(0, 0));
+ ev.m_widget = this;
+ CallHandlers(ev);
+ return;
+ }
+ GetWindow()->SetTopLeft(e.m_pt - m_moving_offset);
+ e.SetHandled();
+ Invalidate();
+}
+
+
}; // namespace gui