"As is" means the current size (or position) not the best size.
Factored out AsIs size calculations to an inline so it can be experimented with further if desired. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,6 +48,32 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline void wxGetAsIs(wxWindowBase* win, int* w, int* h)
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
// The old way. Works for me.
|
||||||
|
win->GetSize(w, h);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Vadim's change. Breaks wxPython's LayoutAnchors
|
||||||
|
win->GetBestSize(w, h);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Proposed compromise. Doesn't work.
|
||||||
|
int sw, sh, bw, bh;
|
||||||
|
win->GetSize(&sw, &sh);
|
||||||
|
win->GetBestSize(&bw, &bh);
|
||||||
|
if (w)
|
||||||
|
*w = wxMax(sw, bw);
|
||||||
|
if (h)
|
||||||
|
*h = wxMax(sh, bh);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
|
wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
|
||||||
{
|
{
|
||||||
myEdge = wxTop;
|
myEdge = wxTop;
|
||||||
@@ -300,7 +326,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
int w, h;
|
int w, h;
|
||||||
win->GetBestSize(&w, &h);
|
wxGetAsIs(win, &w, &h);
|
||||||
win->GetPosition(&x, &y);
|
win->GetPosition(&x, &y);
|
||||||
value = x + w;
|
value = x + w;
|
||||||
done = true;
|
done = true;
|
||||||
@@ -453,7 +479,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
int w, h;
|
int w, h;
|
||||||
win->GetBestSize(&w, &h);
|
wxGetAsIs(win, &w, &h);
|
||||||
win->GetPosition(&x, &y);
|
win->GetPosition(&x, &y);
|
||||||
value = h + y;
|
value = h + y;
|
||||||
done = true;
|
done = true;
|
||||||
@@ -621,7 +647,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
if (win)
|
if (win)
|
||||||
{
|
{
|
||||||
int h;
|
int h;
|
||||||
win->GetBestSize(&value, &h);
|
wxGetAsIs(win, &value, &h);
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -679,7 +705,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
|
|||||||
if (win)
|
if (win)
|
||||||
{
|
{
|
||||||
int w;
|
int w;
|
||||||
win->GetBestSize(&w, &value);
|
wxGetAsIs(win, &w, &value);
|
||||||
done = true;
|
done = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user