Implement wxWindow::GetWindowBorderSize() in wxQt

This notably fixes the appearance of wxSearchCtrl in this port.

Closes #24318.
This commit is contained in:
Alex Shvartzkop 2024-02-18 08:39:20 +03:00 committed by Vadim Zeitlin
parent 9a27e206ce
commit e10bf0c344
2 changed files with 26 additions and 0 deletions

View file

@ -112,6 +112,8 @@ public:
virtual int GetScrollThumb( int orient ) const override;
virtual int GetScrollRange( int orient ) const override;
virtual wxSize GetWindowBorderSize() const override;
// scroll window to the specified position
virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = nullptr ) override;

View file

@ -959,6 +959,30 @@ void wxWindowQt::SetWindowStyleFlag( long style )
GetHandle()->setWindowFlags( qtFlags );
}
wxSize wxWindowQt::GetWindowBorderSize() const
{
wxCoord border;
switch ( GetBorder() )
{
case wxBORDER_STATIC:
case wxBORDER_SIMPLE:
case wxBORDER_SUNKEN:
case wxBORDER_RAISED:
case wxBORDER_THEME:
border = 1;
break;
default:
wxFAIL_MSG( wxT("unknown border style") );
wxFALLTHROUGH;
case wxBORDER_NONE:
border = 0;
}
return 2 * wxSize(border, border);
}
void wxWindowQt::SetExtraStyle( long exStyle )
{
long exStyleOld = GetExtraStyle();