Fix setting layout direction for wxComboBox in wxMSW.
The EDIT control used by the native combobox is different from normal EDIT controls and has to be handled specially. We also need to explicitly forward WS_EX_LAYOUTRTL to the dropdown window as it doesn't inherit it from the combobox itself automatically. See #11583. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -707,4 +707,38 @@ wxWindow *wxComboBox::MSWFindItem(long id, WXHWND hWnd) const
|
||||
return wxChoice::MSWFindItem(id, hWnd);
|
||||
}
|
||||
|
||||
void wxComboBox::SetLayoutDirection(wxLayoutDirection dir)
|
||||
{
|
||||
#ifndef __WXWINCE__
|
||||
// Edit field and drop-down list must be handled explicitly.
|
||||
|
||||
// Edit field is a special EDIT control (e.g. it always returns null
|
||||
// extended style flags), so its layout direction should be set using the
|
||||
// same extended flag as for ordinary window but reset simply with
|
||||
// alignment flags.
|
||||
if ( dir == wxLayout_RightToLeft )
|
||||
{
|
||||
wxUpdateLayoutDirection(GetEditHWND(), dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
LONG_PTR style = ::GetWindowLongPtr(GetEditHWND(), GWL_STYLE);
|
||||
if ( !(style & ES_CENTER) )
|
||||
{
|
||||
style &= ~ES_RIGHT;
|
||||
::SetWindowLongPtr(GetEditHWND(), GWL_STYLE, style);
|
||||
}
|
||||
}
|
||||
|
||||
// Layout for the drop-down list also must be set explicitly.
|
||||
WinStruct<COMBOBOXINFO> info;
|
||||
if ( ::GetComboBoxInfo(GetHwnd(), &info) )
|
||||
{
|
||||
wxUpdateLayoutDirection(info.hwndList, dir);
|
||||
}
|
||||
#endif // !__WXWINCE__
|
||||
|
||||
wxChoice::SetLayoutDirection(dir);
|
||||
}
|
||||
|
||||
#endif // wxUSE_COMBOBOX
|
||||
|
Reference in New Issue
Block a user