--- a/src/widget/widget_button.cpp Mon Mar 26 20:50:18 2007 +0000
+++ b/src/widget/widget_button.cpp Mon Mar 26 21:00:16 2007 +0000
@@ -25,9 +25,10 @@
BaseWindow *w = GetWindow();
assert(w != NULL);
+ /* translate the global coordinates to our parent space */
+ Point pt_local = e.m_pt - (w->TopLeft() + GetTopLeftInWindow());
+
if (_left_button_down) {
- /* translate the global coordinates to our window space */
- Point16 pt_local = e.m_pt - w->TopLeft();
/* determine the new button push state (is cursor inside button?) */
bool pushed = (WidgetFromPt(pt_local) != NULL);
/* did the push state change */
@@ -49,7 +50,7 @@
Invalidate();
/* issue click event */
- EvtLeftClick ev(e.m_pt - w->TopLeft());
+ EvtLeftClick ev(pt_local);
ev.m_widget = this;
OnLeftClick(ev);
}
@@ -57,7 +58,7 @@
/*virtual*/ void Button::DrawBackground(EvtPaint &ev)
{
- DrawFrameRect(m_color, m_pushed ? FR_LOWERED : FR_NONE);
+ DrawFrameRect(GetBkColor(), m_pushed ? FR_LOWERED : FR_NONE);
}
/*virtual*/ void Button::OnLeftButtonDown(EvtLeftButtonDown &e)