fixed dialog units in toplevel windows (bug #1170234)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -389,7 +389,7 @@ protected:
|
||||
|
||||
// Gets an integer value from the parameter.
|
||||
long GetLong(const wxString& param, long defaultv = 0);
|
||||
|
||||
|
||||
// Gets a float value from the parameter.
|
||||
float GetFloat(const wxString& param, float defaultv = 0);
|
||||
|
||||
@@ -397,13 +397,15 @@ protected:
|
||||
wxColour GetColour(const wxString& param);
|
||||
|
||||
// Gets the size (may be in dialog units).
|
||||
wxSize GetSize(const wxString& param = wxT("size"));
|
||||
wxSize GetSize(const wxString& param = wxT("size"),
|
||||
wxWindow *windowToUse = NULL);
|
||||
|
||||
// Gets the position (may be in dialog units).
|
||||
wxPoint GetPosition(const wxString& param = wxT("pos"));
|
||||
|
||||
// Gets a dimension (may be in dialog units).
|
||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
|
||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
|
||||
wxWindow *windowToUse = NULL);
|
||||
|
||||
// Gets a bitmap.
|
||||
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
|
||||
|
@@ -66,7 +66,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
|
||||
GetName());
|
||||
|
||||
if (HasParam(wxT("size")))
|
||||
dlg->SetClientSize(GetSize());
|
||||
dlg->SetClientSize(GetSize(wxT("size"), dlg));
|
||||
if (HasParam(wxT("pos")))
|
||||
dlg->Move(GetPosition());
|
||||
if (HasParam(wxT("icon")))
|
||||
|
@@ -69,7 +69,7 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
|
||||
GetName());
|
||||
|
||||
if (HasParam(wxT("size")))
|
||||
frame->SetClientSize(GetSize());
|
||||
frame->SetClientSize(GetSize(wxT("size"), frame));
|
||||
if (HasParam(wxT("pos")))
|
||||
frame->Move(GetPosition());
|
||||
if (HasParam(wxT("icon")))
|
||||
|
@@ -1092,7 +1092,8 @@ wxString wxXmlResourceHandler::GetParamValue(const wxString& param)
|
||||
|
||||
|
||||
|
||||
wxSize wxXmlResourceHandler::GetSize(const wxString& param)
|
||||
wxSize wxXmlResourceHandler::GetSize(const wxString& param,
|
||||
wxWindow *windowToUse)
|
||||
{
|
||||
wxString s = GetParamValue(param);
|
||||
if (s.empty()) s = wxT("-1,-1");
|
||||
@@ -1111,8 +1112,14 @@ wxSize wxXmlResourceHandler::GetSize(const wxString& param)
|
||||
|
||||
if (is_dlg)
|
||||
{
|
||||
if (m_parentAsWindow)
|
||||
if (windowToUse)
|
||||
{
|
||||
return wxDLG_UNIT(windowToUse, wxSize(sx, sy));
|
||||
}
|
||||
else if (m_parentAsWindow)
|
||||
{
|
||||
return wxDLG_UNIT(m_parentAsWindow, wxSize(sx, sy));
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(_("Cannot convert dialog units: dialog unknown."));
|
||||
@@ -1133,7 +1140,9 @@ wxPoint wxXmlResourceHandler::GetPosition(const wxString& param)
|
||||
|
||||
|
||||
|
||||
wxCoord wxXmlResourceHandler::GetDimension(const wxString& param, wxCoord defaultv)
|
||||
wxCoord wxXmlResourceHandler::GetDimension(const wxString& param,
|
||||
wxCoord defaultv,
|
||||
wxWindow *windowToUse)
|
||||
{
|
||||
wxString s = GetParamValue(param);
|
||||
if (s.empty()) return defaultv;
|
||||
@@ -1151,8 +1160,14 @@ wxCoord wxXmlResourceHandler::GetDimension(const wxString& param, wxCoord defaul
|
||||
|
||||
if (is_dlg)
|
||||
{
|
||||
if (m_parentAsWindow)
|
||||
if (windowToUse)
|
||||
{
|
||||
return wxDLG_UNIT(windowToUse, wxSize(sx, 0)).x;
|
||||
}
|
||||
else if (m_parentAsWindow)
|
||||
{
|
||||
return wxDLG_UNIT(m_parentAsWindow, wxSize(sx, 0)).x;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(_("Cannot convert dialog units: dialog unknown."));
|
||||
|
Reference in New Issue
Block a user