replaced wxWindowGTK::m_isListBox with a virtual function
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15715 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -97,6 +97,8 @@ public:
|
|||||||
int m_prevSelection;
|
int m_prevSelection;
|
||||||
bool m_blockEvent;
|
bool m_blockEvent;
|
||||||
|
|
||||||
|
virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -172,6 +172,11 @@ public:
|
|||||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
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
|
// position and size of the window
|
||||||
int m_x, m_y;
|
int m_x, m_y;
|
||||||
int m_width, m_height;
|
int m_width, m_height;
|
||||||
@@ -252,7 +257,8 @@ public:
|
|||||||
virtual void DoSetToolTip( wxToolTip *tip );
|
virtual void DoSetToolTip( wxToolTip *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#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();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -97,6 +97,8 @@ public:
|
|||||||
int m_prevSelection;
|
int m_prevSelection;
|
||||||
bool m_blockEvent;
|
bool m_blockEvent;
|
||||||
|
|
||||||
|
virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -172,6 +172,11 @@ public:
|
|||||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
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
|
// position and size of the window
|
||||||
int m_x, m_y;
|
int m_x, m_y;
|
||||||
int m_width, m_height;
|
int m_width, m_height;
|
||||||
@@ -252,7 +257,8 @@ public:
|
|||||||
virtual void DoSetToolTip( wxToolTip *tip );
|
virtual void DoSetToolTip( wxToolTip *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#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();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -1064,4 +1064,13 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
return wxSize(lbWidth, lbHeight);
|
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
|
||||||
|
|
||||||
|
@@ -1361,13 +1361,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
|
|
||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// wxListBox actually get mouse events from the item, so we need to give it
|
||||||
|
// a chance to correct this
|
||||||
if (win->m_isListBox)
|
win->FixUpMouseEvent(widget, event.m_x, event.m_y);
|
||||||
{
|
|
||||||
event.m_x += widget->allocation.x;
|
|
||||||
event.m_y += widget->allocation.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some control don't have their own X window and thus cannot get
|
// Some control don't have their own X window and thus cannot get
|
||||||
// any events.
|
// any events.
|
||||||
@@ -1492,13 +1488,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
|
|
||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// same wxListBox hack as above
|
||||||
|
win->FixUpMouseEvent(widget, event.m_x, event.m_y);
|
||||||
if (win->m_isListBox)
|
|
||||||
{
|
|
||||||
event.m_x += widget->allocation.x;
|
|
||||||
event.m_y += widget->allocation.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some control don't have their own X window and thus cannot get
|
// Some control don't have their own X window and thus cannot get
|
||||||
// any events.
|
// any events.
|
||||||
@@ -2387,7 +2378,6 @@ void wxWindowGTK::Init()
|
|||||||
|
|
||||||
m_isStaticBox = FALSE;
|
m_isStaticBox = FALSE;
|
||||||
m_isRadioButton = FALSE;
|
m_isRadioButton = FALSE;
|
||||||
m_isListBox = FALSE;
|
|
||||||
m_isFrame = FALSE;
|
m_isFrame = FALSE;
|
||||||
m_acceptsFocus = FALSE;
|
m_acceptsFocus = FALSE;
|
||||||
m_hasFocus = FALSE;
|
m_hasFocus = FALSE;
|
||||||
|
@@ -1064,4 +1064,13 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
return wxSize(lbWidth, lbHeight);
|
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
|
||||||
|
|
||||||
|
@@ -1361,13 +1361,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
|
|
||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// wxListBox actually get mouse events from the item, so we need to give it
|
||||||
|
// a chance to correct this
|
||||||
if (win->m_isListBox)
|
win->FixUpMouseEvent(widget, event.m_x, event.m_y);
|
||||||
{
|
|
||||||
event.m_x += widget->allocation.x;
|
|
||||||
event.m_y += widget->allocation.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some control don't have their own X window and thus cannot get
|
// Some control don't have their own X window and thus cannot get
|
||||||
// any events.
|
// any events.
|
||||||
@@ -1492,13 +1488,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
|
|
||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// same wxListBox hack as above
|
||||||
|
win->FixUpMouseEvent(widget, event.m_x, event.m_y);
|
||||||
if (win->m_isListBox)
|
|
||||||
{
|
|
||||||
event.m_x += widget->allocation.x;
|
|
||||||
event.m_y += widget->allocation.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some control don't have their own X window and thus cannot get
|
// Some control don't have their own X window and thus cannot get
|
||||||
// any events.
|
// any events.
|
||||||
@@ -2387,7 +2378,6 @@ void wxWindowGTK::Init()
|
|||||||
|
|
||||||
m_isStaticBox = FALSE;
|
m_isStaticBox = FALSE;
|
||||||
m_isRadioButton = FALSE;
|
m_isRadioButton = FALSE;
|
||||||
m_isListBox = FALSE;
|
|
||||||
m_isFrame = FALSE;
|
m_isFrame = FALSE;
|
||||||
m_acceptsFocus = FALSE;
|
m_acceptsFocus = FALSE;
|
||||||
m_hasFocus = FALSE;
|
m_hasFocus = FALSE;
|
||||||
|
Reference in New Issue
Block a user