Fix appearance of wxMSW wxToggleButtons with bitmaps in pressed state.
Correct the "pushed" state determination in our own drawn code, it didn't work for wxToggleButton which doesn't return BST_PUSHED from BM_GETSTATE. But it does have BM_GETCHECK returning its state directly, so add a new virtual MSWIsPushed() method and implement it differently for it. Closes #13755. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78251 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -105,6 +105,7 @@ wxMSW:
|
|||||||
|
|
||||||
- Improve wxMimeTypesManager open command detection (Eric Jensen).
|
- Improve wxMimeTypesManager open command detection (Eric Jensen).
|
||||||
- Make wxFILTER_INCLUDE_LIST in wxTextValidator actually usable.
|
- Make wxFILTER_INCLUDE_LIST in wxTextValidator actually usable.
|
||||||
|
- Fix appearance of toggled wxToggleButtons with bitmap (tm).
|
||||||
- Fix setting menu item bitmaps after appending them (Artur Wieczorek).
|
- Fix setting menu item bitmaps after appending them (Artur Wieczorek).
|
||||||
- Fix setting label of submenu items (Artur Wieczorek).
|
- Fix setting label of submenu items (Artur Wieczorek).
|
||||||
- Fix handling of selected images in wxBitmapButton (Artur Wieczorek).
|
- Fix handling of selected images in wxBitmapButton (Artur Wieczorek).
|
||||||
|
@@ -73,6 +73,8 @@ protected:
|
|||||||
void MakeOwnerDrawn();
|
void MakeOwnerDrawn();
|
||||||
bool IsOwnerDrawn() const;
|
bool IsOwnerDrawn() const;
|
||||||
|
|
||||||
|
virtual bool MSWIsPushed() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
|
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
|
||||||
};
|
};
|
||||||
|
@@ -56,6 +56,8 @@ protected:
|
|||||||
|
|
||||||
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
||||||
|
|
||||||
|
virtual bool MSWIsPushed() const;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
// current state of the button (when owner-drawn)
|
// current state of the button (when owner-drawn)
|
||||||
|
@@ -1204,6 +1204,11 @@ bool wxAnyButton::SetForegroundColour(const wxColour &colour)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxAnyButton::MSWIsPushed() const
|
||||||
|
{
|
||||||
|
return (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
||||||
{
|
{
|
||||||
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis;
|
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis;
|
||||||
@@ -1225,7 +1230,7 @@ bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0;
|
bool pushed = MSWIsPushed();
|
||||||
|
|
||||||
RECT rectBtn;
|
RECT rectBtn;
|
||||||
CopyRect(&rectBtn, &lpDIS->rcItem);
|
CopyRect(&rectBtn, &lpDIS->rcItem);
|
||||||
|
@@ -135,6 +135,11 @@ WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
return msStyle;
|
return msStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxToggleButton::MSWIsPushed() const
|
||||||
|
{
|
||||||
|
return GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
void wxToggleButton::SetValue(bool val)
|
void wxToggleButton::SetValue(bool val)
|
||||||
{
|
{
|
||||||
m_state = val;
|
m_state = val;
|
||||||
|
Reference in New Issue
Block a user