int m_prevSelection;
bool m_blockEvent;
+ virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
+
protected:
virtual wxSize DoGetBestSize() const;
// (i.e. in idle time, implemented in OnInternalIdle() ).
void GtkUpdateSize() { m_sizeSet = FALSE; }
+ // fix up the mouse event coords, used by wxListBox only so far
+ virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
+ wxCoord& WXUNUSED(x),
+ wxCoord& WXUNUSED(y)) { }
+
// position and size of the window
int m_x, m_y;
int m_width, m_height;
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
- // common part of all ctors (can't be virtual because called from ctor)
+protected:
+ // common part of all ctors (not virtual because called from ctor)
void Init();
private:
int m_prevSelection;
bool m_blockEvent;
+ virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
+
protected:
virtual wxSize DoGetBestSize() const;
// (i.e. in idle time, implemented in OnInternalIdle() ).
void GtkUpdateSize() { m_sizeSet = FALSE; }
+ // fix up the mouse event coords, used by wxListBox only so far
+ virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
+ wxCoord& WXUNUSED(x),
+ wxCoord& WXUNUSED(y)) { }
+
// position and size of the window
int m_x, m_y;
int m_width, m_height;
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
- // common part of all ctors (can't be virtual because called from ctor)
+protected:
+ // common part of all ctors (not virtual because called from ctor)
void Init();
private:
return wxSize(lbWidth, lbHeight);
}
-#endif
+void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y)
+{
+ // the mouse event coords are relative to the listbox items, we need to
+ // translate them to the normal client coords
+ x += widget->allocation.x;
+ y += widget->allocation.y;
+}
+
+#endif // wxUSE_LISTBOX
+
AdjustEventButtonState(event);
- // wxListBox actually get mouse events from the item
-
- if (win->m_isListBox)
- {
- event.m_x += widget->allocation.x;
- event.m_y += widget->allocation.y;
- }
+ // wxListBox actually get mouse events from the item, so we need to give it
+ // a chance to correct this
+ win->FixUpMouseEvent(widget, event.m_x, event.m_y);
// Some control don't have their own X window and thus cannot get
// any events.
AdjustEventButtonState(event);
- // wxListBox actually get mouse events from the item
-
- if (win->m_isListBox)
- {
- event.m_x += widget->allocation.x;
- event.m_y += widget->allocation.y;
- }
+ // same wxListBox hack as above
+ win->FixUpMouseEvent(widget, event.m_x, event.m_y);
// Some control don't have their own X window and thus cannot get
// any events.
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
- m_isListBox = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;
m_hasFocus = FALSE;
return wxSize(lbWidth, lbHeight);
}
-#endif
+void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y)
+{
+ // the mouse event coords are relative to the listbox items, we need to
+ // translate them to the normal client coords
+ x += widget->allocation.x;
+ y += widget->allocation.y;
+}
+
+#endif // wxUSE_LISTBOX
+
AdjustEventButtonState(event);
- // wxListBox actually get mouse events from the item
-
- if (win->m_isListBox)
- {
- event.m_x += widget->allocation.x;
- event.m_y += widget->allocation.y;
- }
+ // wxListBox actually get mouse events from the item, so we need to give it
+ // a chance to correct this
+ win->FixUpMouseEvent(widget, event.m_x, event.m_y);
// Some control don't have their own X window and thus cannot get
// any events.
AdjustEventButtonState(event);
- // wxListBox actually get mouse events from the item
-
- if (win->m_isListBox)
- {
- event.m_x += widget->allocation.x;
- event.m_y += widget->allocation.y;
- }
+ // same wxListBox hack as above
+ win->FixUpMouseEvent(widget, event.m_x, event.m_y);
// Some control don't have their own X window and thus cannot get
// any events.
m_isStaticBox = FALSE;
m_isRadioButton = FALSE;
- m_isListBox = FALSE;
m_isFrame = FALSE;
m_acceptsFocus = FALSE;
m_hasFocus = FALSE;