Merge branch 'xrc-getposition-win'

Add windowToUse argument to wxXRC GetPosition() too.

See #23507.
This commit is contained in:
Vadim Zeitlin 2023-04-30 01:18:01 +02:00
commit 2acf999f39
4 changed files with 15 additions and 9 deletions

View file

@ -566,7 +566,8 @@ public:
wxWindow *windowToUse = nullptr) override;
// Gets the position (may be in dialog units).
wxPoint GetPosition(const wxString& param = wxT("pos")) override;
wxPoint GetPosition(const wxString& param = wxT("pos"),
wxWindow *windowToUse = nullptr) override;
// Gets a dimension (may be in dialog units).
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,

View file

@ -79,7 +79,8 @@ public:
const wxColour& defaultv = wxNullColour) = 0;
virtual wxSize GetSize(const wxString& param = wxT("size"),
wxWindow *windowToUse = nullptr) = 0;
virtual wxPoint GetPosition(const wxString& param = wxT("pos")) = 0;
virtual wxPoint GetPosition(const wxString& param = wxT("pos"),
wxWindow *windowToUse = nullptr) = 0;
virtual wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
wxWindow *windowToUse = nullptr) = 0;
virtual wxSize GetPairInts(const wxString& param) = 0;
@ -309,9 +310,10 @@ protected:
{
return GetImpl()->GetSize(param, windowToUse);
}
wxPoint GetPosition(const wxString& param = wxT("pos"))
wxPoint GetPosition(const wxString& param = wxT("pos"),
wxWindow *windowToUse = nullptr)
{
return GetImpl()->GetPosition(param);
return GetImpl()->GetPosition(param, windowToUse);
}
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
wxWindow *windowToUse = nullptr)

View file

@ -668,7 +668,7 @@ protected:
Gets a dimension (may be in dialog units).
*/
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
wxWindow* windowToUse = 0);
wxWindow* windowToUse = nullptr);
/**
Gets a direction.
@ -809,13 +809,15 @@ protected:
/**
Gets the position (may be in dialog units).
The @a windowToUse argument is only available since wxWidgets 3.3.0.
*/
wxPoint GetPosition(const wxString& param = "pos");
wxPoint GetPosition(const wxString& param = "pos", wxWindow* windowToUse = nullptr);
/**
Gets the size (may be in dialog units).
*/
wxSize GetSize(const wxString& param = "size", wxWindow* windowToUse = 0);
wxSize GetSize(const wxString& param = "size", wxWindow* windowToUse = nullptr);
/**
Gets style flags from text in form "flag | flag2| flag3 |..."

View file

@ -2385,9 +2385,10 @@ wxSize wxXmlResourceHandlerImpl::GetSize(const wxString& param,
wxPoint wxXmlResourceHandlerImpl::GetPosition(const wxString& param)
wxPoint wxXmlResourceHandlerImpl::GetPosition(const wxString& param,
wxWindow *windowToUse)
{
return ParseValueInPixels(this, param, wxDefaultPosition);
return ParseValueInPixels(this, param, wxDefaultPosition, windowToUse);
}