Support for hover effect in header buttons

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49177 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-10-16 20:48:19 +00:00
parent 2a4f365c04
commit cc28f5ecd0

View File

@@ -204,6 +204,7 @@ protected:
bool m_isDragging;
bool m_dirty; // needs refresh?
int m_hover; // index of the column under the mouse
int m_column; // index of the column being resized
int m_currentX; // divider line position in logical (unscrolled) coords
int m_minX; // minimal position beyond which the divider line
@@ -224,6 +225,7 @@ protected:
m_isDragging = false;
m_dirty = false;
m_hover = wxNOT_FOUND;
m_column = wxNOT_FOUND;
m_currentX = 0;
m_minX = 0;
@@ -1599,13 +1601,23 @@ void wxGenericDataViewHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
sortArrow = wxHDR_SORT_ICON_DOWN;
}
int state = 0;
if (m_parent->IsEnabled())
{
if (i == m_hover)
state = wxCONTROL_CURRENT;
}
else
{
state = (int) wxCONTROL_DISABLED;
}
wxRendererNative::Get().DrawHeaderButton
(
this,
dc,
wxRect(xpos, 0, cw, ch-1),
m_parent->IsEnabled() ? 0
: (int)wxCONTROL_DISABLED,
state,
sortArrow
);
@@ -1716,6 +1728,13 @@ void wxGenericDataViewHeaderWindow::OnMouse( wxMouseEvent &event )
m_minX = xpos;
}
int old_hover = m_hover;
m_hover = m_column;
if (event.Leaving())
m_hover = wxNOT_FOUND;
if (old_hover != m_hover)
Refresh();
if (m_column == wxNOT_FOUND)
return;