Centralized wxDefaultSize & wxDefaultPosition values.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-05-19 09:12:08 +00:00
parent 2c990ba6d4
commit c751d26abc

View File

@@ -121,9 +121,9 @@ wxWindowBase::wxWindowBase()
// no constraints on the minimal window size // no constraints on the minimal window size
m_minWidth = m_minWidth =
m_maxWidth = wxDefaultSize.x;
m_minHeight = m_minHeight =
m_maxWidth = m_maxHeight = wxDefaultSize.y;
m_maxHeight = -1;
// window are created enabled and visible by default // window are created enabled and visible by default
m_isShown = m_isShown =
@@ -180,9 +180,9 @@ wxWindowBase::wxWindowBase()
m_virtualSize = wxDefaultSize; m_virtualSize = wxDefaultSize;
m_minVirtualWidth = m_minVirtualWidth =
m_maxVirtualWidth = wxDefaultSize.x;
m_minVirtualHeight = m_minVirtualHeight =
m_maxVirtualWidth = m_maxVirtualHeight = wxDefaultSize.y;
m_maxVirtualHeight = -1;
m_windowVariant = wxWINDOW_VARIANT_NORMAL; m_windowVariant = wxWINDOW_VARIANT_NORMAL;
@@ -432,8 +432,8 @@ void wxWindowBase::Centre(int direction)
int width, height; int width, height;
GetSize(&width, &height); GetSize(&width, &height);
int xNew = -1, int xNew = wxDefaultPosition.x,
yNew = -1; yNew = wxDefaultPosition.y;
if ( direction & wxHORIZONTAL ) if ( direction & wxHORIZONTAL )
xNew = (widthParent - width)/2; xNew = (widthParent - width)/2;
@@ -590,9 +590,9 @@ wxSize wxWindowBase::DoGetBestSize() const
// if the window hadn't been positioned yet, assume that it is in // if the window hadn't been positioned yet, assume that it is in
// the origin // the origin
if ( wx == -1 ) if ( wx == wxDefaultPosition.x )
wx = 0; wx = 0;
if ( wy == -1 ) if ( wy == wxDefaultPosition.y )
wy = 0; wy = 0;
win->GetSize(&ww, &wh); win->GetSize(&ww, &wh);
@@ -624,12 +624,12 @@ void wxWindowBase::SetBestSize(const wxSize& size)
{ {
// If the given size is incomplete then merge with the best size. // If the given size is incomplete then merge with the best size.
wxSize sizeBest; wxSize sizeBest;
if ( size.x == -1 || size.y == -1 ) if ( size.x == wxDefaultSize.x || size.y == wxDefaultSize.y )
{ {
sizeBest = DoGetBestSize(); sizeBest = DoGetBestSize();
if ( size.x != -1 ) if ( size.x != wxDefaultSize.x )
sizeBest.x = size.x; sizeBest.x = size.x;
if ( size.y != -1 ) if ( size.y != wxDefaultSize.y )
sizeBest.y = size.y; sizeBest.y = size.y;
} }
else // have complete explicit size else // have complete explicit size
@@ -659,8 +659,8 @@ void wxWindowBase::SetSizeHints(int minW, int minH,
{ {
// setting min width greater than max width leads to infinite loops under // setting min width greater than max width leads to infinite loops under
// X11 and generally doesn't make any sense, so don't allow it // X11 and generally doesn't make any sense, so don't allow it
wxCHECK_RET( (minW == -1 || maxW == -1 || minW <= maxW) && wxCHECK_RET( (minW == wxDefaultSize.x || maxW == wxDefaultSize.x || minW <= maxW) &&
(minH == -1 || maxH == -1 || minH <= maxH), (minH == wxDefaultSize.y || maxH == wxDefaultSize.y || minH <= maxH),
_T("min width/height must be less than max width/height!") ); _T("min width/height must be less than max width/height!") );
m_minWidth = minW; m_minWidth = minW;
@@ -725,13 +725,13 @@ void wxWindowBase::SetVirtualSizeHints( int minW, int minH,
void wxWindowBase::DoSetVirtualSize( int x, int y ) void wxWindowBase::DoSetVirtualSize( int x, int y )
{ {
if ( m_minVirtualWidth != -1 && m_minVirtualWidth > x ) if ( m_minVirtualWidth != wxDefaultSize.x && m_minVirtualWidth > x )
x = m_minVirtualWidth; x = m_minVirtualWidth;
if ( m_maxVirtualWidth != -1 && m_maxVirtualWidth < x ) if ( m_maxVirtualWidth != wxDefaultSize.x && m_maxVirtualWidth < x )
x = m_maxVirtualWidth; x = m_maxVirtualWidth;
if ( m_minVirtualHeight != -1 && m_minVirtualHeight > y ) if ( m_minVirtualHeight != wxDefaultSize.y && m_minVirtualHeight > y )
y = m_minVirtualHeight; y = m_minVirtualHeight;
if ( m_maxVirtualHeight != -1 && m_maxVirtualHeight < y ) if ( m_maxVirtualHeight != wxDefaultSize.y && m_maxVirtualHeight < y )
y = m_maxVirtualHeight; y = m_maxVirtualHeight;
m_virtualSize = wxSize(x, y); m_virtualSize = wxSize(x, y);
@@ -1886,22 +1886,22 @@ void wxWindowBase::SetSizeConstraint(int x, int y, int w, int h)
wxLayoutConstraints *constr = GetConstraints(); wxLayoutConstraints *constr = GetConstraints();
if ( constr ) if ( constr )
{ {
if ( x != -1 ) if ( x != wxDefaultPosition.x )
{ {
constr->left.SetValue(x); constr->left.SetValue(x);
constr->left.SetDone(true); constr->left.SetDone(true);
} }
if ( y != -1 ) if ( y != wxDefaultPosition.y )
{ {
constr->top.SetValue(y); constr->top.SetValue(y);
constr->top.SetDone(true); constr->top.SetDone(true);
} }
if ( w != -1 ) if ( w != wxDefaultSize.x )
{ {
constr->width.SetValue(w); constr->width.SetValue(w);
constr->width.SetDone(true); constr->width.SetDone(true);
} }
if ( h != -1 ) if ( h != wxDefaultSize.y )
{ {
constr->height.SetValue(h); constr->height.SetValue(h);
constr->height.SetDone(true); constr->height.SetDone(true);
@@ -1914,12 +1914,12 @@ void wxWindowBase::MoveConstraint(int x, int y)
wxLayoutConstraints *constr = GetConstraints(); wxLayoutConstraints *constr = GetConstraints();
if ( constr ) if ( constr )
{ {
if ( x != -1 ) if ( x != wxDefaultPosition.x )
{ {
constr->left.SetValue(x); constr->left.SetValue(x);
constr->left.SetDone(true); constr->left.SetDone(true);
} }
if ( y != -1 ) if ( y != wxDefaultPosition.y )
{ {
constr->top.SetValue(y); constr->top.SetValue(y);
constr->top.SetDone(true); constr->top.SetDone(true);