Fix applying header style of wxMSWHeaderCtrl
Call SetWindowStyleFlag when creating the control. Apply wxHD_BITMAP_ON_RIGHT style. Get rid of the helper function.
This commit is contained in:
@@ -72,10 +72,6 @@ private:
|
|||||||
// Events.
|
// Events.
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
// Style flag helper function.
|
|
||||||
long ApplyHeaderReorderFlagToStyle(long style);
|
|
||||||
|
|
||||||
|
|
||||||
// The native header control.
|
// The native header control.
|
||||||
wxMSWHeaderCtrl* m_nativeControl;
|
wxMSWHeaderCtrl* m_nativeControl;
|
||||||
friend class wxMSWHeaderCtrl;
|
friend class wxMSWHeaderCtrl;
|
||||||
|
@@ -1048,10 +1048,12 @@ bool wxHeaderCtrl::Create(wxWindow *parent,
|
|||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxDefaultSize,
|
wxDefaultSize,
|
||||||
ApplyHeaderReorderFlagToStyle(wxNO_BORDER),
|
wxNO_BORDER,
|
||||||
wxMSWHeaderCtrlNameStr) )
|
wxMSWHeaderCtrlNameStr) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
SetWindowStyle(newStyle);
|
||||||
|
|
||||||
Bind(wxEVT_SIZE, &wxHeaderCtrl::OnSize, this);
|
Bind(wxEVT_SIZE, &wxHeaderCtrl::OnSize, this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1136,16 +1138,18 @@ void wxHeaderCtrl::SetWindowStyleFlag(long style)
|
|||||||
|
|
||||||
// Update the native control style.
|
// Update the native control style.
|
||||||
long flags = m_nativeControl->GetWindowStyleFlag();
|
long flags = m_nativeControl->GetWindowStyleFlag();
|
||||||
flags = ApplyHeaderReorderFlagToStyle(flags);
|
|
||||||
m_nativeControl->SetWindowStyleFlag(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
long wxHeaderCtrl::ApplyHeaderReorderFlagToStyle(long style)
|
|
||||||
{
|
|
||||||
if ( HasFlag(wxHD_ALLOW_REORDER) )
|
if ( HasFlag(wxHD_ALLOW_REORDER) )
|
||||||
return style | wxHD_ALLOW_REORDER;
|
flags |= wxHD_ALLOW_REORDER;
|
||||||
|
else
|
||||||
|
flags &= ~wxHD_ALLOW_REORDER;
|
||||||
|
|
||||||
return style & ~wxHD_ALLOW_REORDER;
|
if ( HasFlag(wxHD_BITMAP_ON_RIGHT) )
|
||||||
|
flags |= wxHD_BITMAP_ON_RIGHT;
|
||||||
|
else
|
||||||
|
flags &= ~wxHD_BITMAP_ON_RIGHT;
|
||||||
|
|
||||||
|
m_nativeControl->SetWindowStyleFlag(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxHAS_GENERIC_HEADERCTRL
|
#endif // wxHAS_GENERIC_HEADERCTRL
|
||||||
|
Reference in New Issue
Block a user