fixed wxBitmapButton to use focus and hover bitmaps correctly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52007 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -152,6 +152,7 @@ wxGTK:
|
|||||||
with other applications.
|
with other applications.
|
||||||
- Fix wxNotebook::GetPage{Text,Image}() when they were called from the page
|
- Fix wxNotebook::GetPage{Text,Image}() when they were called from the page
|
||||||
change event handler for the first added page (Mikkel S).
|
change event handler for the first added page (Mikkel S).
|
||||||
|
- Fixed wxBitmapButton to use focus and hover bitmaps correctly.
|
||||||
|
|
||||||
wxMac:
|
wxMac:
|
||||||
|
|
||||||
|
@@ -68,6 +68,8 @@ protected:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnFocusChange(wxFocusEvent& event);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -163,6 +163,13 @@ bool wxBitmapButton::Create( wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
|
Connect(wxEVT_SET_FOCUS,
|
||||||
|
wxFocusEventHandler(wxBitmapButton::OnFocusChange),
|
||||||
|
NULL, this);
|
||||||
|
Connect(wxEVT_KILL_FOCUS,
|
||||||
|
wxFocusEventHandler(wxBitmapButton::OnFocusChange),
|
||||||
|
NULL, this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,6 +208,12 @@ void wxBitmapButton::OnSetBitmap()
|
|||||||
else if (m_isSelected)
|
else if (m_isSelected)
|
||||||
the_one = m_bmpSelected;
|
the_one = m_bmpSelected;
|
||||||
else if (m_hasFocus)
|
else if (m_hasFocus)
|
||||||
|
{
|
||||||
|
// NB: this is misnomer, m_hasFocus doesn't mean "has focus", but
|
||||||
|
// "mouse is over the window"
|
||||||
|
the_one = m_bmpHover;
|
||||||
|
}
|
||||||
|
else if (FindFocus() == this)
|
||||||
the_one = m_bmpFocus;
|
the_one = m_bmpFocus;
|
||||||
else
|
else
|
||||||
the_one = m_bmpNormal;
|
the_one = m_bmpNormal;
|
||||||
@@ -264,4 +277,10 @@ void wxBitmapButton::EndSelect()
|
|||||||
OnSetBitmap();
|
OnSetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxBitmapButton::OnFocusChange(wxFocusEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
OnSetBitmap();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_BMPBUTTON
|
#endif // wxUSE_BMPBUTTON
|
||||||
|
Reference in New Issue
Block a user