Implement setting foreground colour for wxRadioButton in wxMSW.

Native radio buttons don't support changing their foreground colour, so use
owner drawn buttons if SetForegroundColour() was called, similarly to what was
already done for wxCheckBox.

Closes #10137.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-04 22:13:12 +00:00
parent 3fc6738025
commit fd65d4b4f5
3 changed files with 151 additions and 3 deletions

View File

@@ -47,18 +47,37 @@ public:
// implementation only from now on
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual void Command(wxCommandEvent& event);
virtual bool SetForegroundColour(const wxColour& colour);
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
virtual bool HasTransparentBackground() { return true; }
// make the radiobutton owner drawn or reset it to normal style
void MSWMakeOwnerDrawn(bool ownerDrawn);
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
protected:
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
virtual wxSize DoGetBestSize() const;
virtual void MSWDrawButtonBitmap(wxWindow *win, wxDC& dc,
const wxRect& rect, int flags);
// return true if this checkbox is owner drawn
bool IsOwnerDrawn() const;
private:
// common part of all ctors
void Init();
// event handlers used by owner-drawn radiobutton
void OnMouseEnterOrLeave(wxMouseEvent& event);
void OnMouseLeft(wxMouseEvent& event);
void OnFocus(wxFocusEvent& event);
// true if the radio button is currently pressed
bool m_isPressed;
// we need to store the state internally as the result of GetValue()
// sometimes gets out of sync in WM_COMMAND handler
bool m_isChecked;