Extended patch #942204, centralized wxDefaultSize, wxDefaultPosition and wxID_ANY values.

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

View File

@@ -292,9 +292,9 @@ wxBEGIN_PROPERTIES_TABLE(wxWindow)
// Always constructor Properties first // Always constructor Properties first
wxREADONLY_PROPERTY( Parent,wxWindow*, GetParent, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) wxREADONLY_PROPERTY( Parent,wxWindow*, GetParent, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY( Id,wxWindowID, SetId, GetId, -1, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) wxPROPERTY( Id,wxWindowID, SetId, GetId, wxID_ANY, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
wxPROPERTY( Position,wxPoint, SetPosition , GetPosition, wxPoint(-1,-1) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos wxPROPERTY( Position,wxPoint, SetPosition , GetPosition, wxDefaultPosition , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos
wxPROPERTY( Size,wxSize, SetSize, GetSize, wxSize(-1,-1) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size wxPROPERTY( Size,wxSize, SetSize, GetSize, wxDefaultSize , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size
wxPROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style wxPROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
// Then all relations of the object graph // Then all relations of the object graph
@@ -1530,15 +1530,15 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
return; return;
} }
if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) if ( x == wxDefaultPosition.x && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
x = currentX; x = currentX;
if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) if ( y == wxDefaultPosition.y && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
y = currentY; y = currentY;
AdjustForParentClientOrigin(x, y, sizeFlags); AdjustForParentClientOrigin(x, y, sizeFlags);
wxSize size(-1, -1); wxSize size = wxDefaultSize;
if ( width == -1 ) if ( width == wxDefaultSize.x )
{ {
if ( sizeFlags & wxSIZE_AUTO_WIDTH ) if ( sizeFlags & wxSIZE_AUTO_WIDTH )
{ {
@@ -1552,11 +1552,11 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
} }
} }
if ( height == -1 ) if ( height == wxDefaultSize.y )
{ {
if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
{ {
if ( size.x == -1 ) if ( size.x == wxDefaultSize.x )
{ {
size = DoGetBestSize(); size = DoGetBestSize();
} }
@@ -1594,8 +1594,8 @@ void wxWindowMSW::DoSetClientSize(int width, int height)
::GetClientRect(GetHwnd(), &rectClient); ::GetClientRect(GetHwnd(), &rectClient);
// if the size is already ok, stop here (rectClient.left = top = 0) // if the size is already ok, stop here (rectClient.left = top = 0)
if ( (rectClient.right == width || width == -1) && if ( (rectClient.right == width || width == wxDefaultSize.x) &&
(rectClient.bottom == height || height == -1) ) (rectClient.bottom == height || height == wxDefaultSize.y) )
{ {
break; break;
} }
@@ -3005,7 +3005,7 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
bool nonDefault = false; bool nonDefault = false;
if ( pos.x == -1 ) if ( pos.x == wxDefaultPosition.x )
{ {
// if x is set to CW_USEDEFAULT, y parameter is ignored anyhow so we // if x is set to CW_USEDEFAULT, y parameter is ignored anyhow so we
// can just as well set it to CW_USEDEFAULT as well // can just as well set it to CW_USEDEFAULT as well
@@ -3018,7 +3018,7 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
// neither because it is not handled as a special value by Windows then // neither because it is not handled as a special value by Windows then
// and so we have to choose some default value for it // and so we have to choose some default value for it
x = pos.x; x = pos.x;
y = pos.y == -1 ? DEFAULT_Y : pos.y; y = pos.y == wxDefaultPosition.y ? DEFAULT_Y : pos.y;
nonDefault = true; nonDefault = true;
} }
@@ -3062,16 +3062,16 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
// However, on PocketPC devices, we must use the default // However, on PocketPC devices, we must use the default
// size if possible. // size if possible.
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
if (size.x == -1) if (size.x == wxDefaultSize.x)
w = CW_USEDEFAULT; w = CW_USEDEFAULT;
else else
w = size.x; w = size.x;
if (size.y == -1) if (size.y == wxDefaultSize.y)
h = CW_USEDEFAULT; h = CW_USEDEFAULT;
else else
h = size.y; h = size.y;
#else #else
if ( size.x == -1 || size.y == -1) if ( size.x == wxDefaultSize.x || size.y == wxDefaultSize.y)
{ {
nonDefault = true; nonDefault = true;
} }
@@ -3321,7 +3321,7 @@ bool wxWindowMSW::MSWOnNotify(int WXUNUSED(idCtrl),
bool wxWindowMSW::HandleQueryEndSession(long logOff, bool *mayEnd) bool wxWindowMSW::HandleQueryEndSession(long logOff, bool *mayEnd)
{ {
#ifndef __WXWINCE__ #ifndef __WXWINCE__
wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1); wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY);
event.SetEventObject(wxTheApp); event.SetEventObject(wxTheApp);
event.SetCanVeto(true); event.SetCanVeto(true);
event.SetLoggingOff(logOff == (long)ENDSESSION_LOGOFF); event.SetLoggingOff(logOff == (long)ENDSESSION_LOGOFF);
@@ -3352,7 +3352,7 @@ bool wxWindowMSW::HandleEndSession(bool endSession, long logOff)
if ( (this != wxTheApp->GetTopWindow()) ) if ( (this != wxTheApp->GetTopWindow()) )
return false; return false;
wxCloseEvent event(wxEVT_END_SESSION, -1); wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY);
event.SetEventObject(wxTheApp); event.SetEventObject(wxTheApp);
event.SetCanVeto(false); event.SetCanVeto(false);
event.SetLoggingOff( (logOff == (long)ENDSESSION_LOGOFF) ); event.SetLoggingOff( (logOff == (long)ENDSESSION_LOGOFF) );
@@ -4189,25 +4189,25 @@ bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo)
maxWidth = GetMaxWidth(), maxWidth = GetMaxWidth(),
maxHeight = GetMaxHeight(); maxHeight = GetMaxHeight();
if ( minWidth != -1 ) if ( minWidth != wxDefaultSize.x )
{ {
info->ptMinTrackSize.x = minWidth; info->ptMinTrackSize.x = minWidth;
rc = true; rc = true;
} }
if ( minHeight != -1 ) if ( minHeight != wxDefaultSize.y )
{ {
info->ptMinTrackSize.y = minHeight; info->ptMinTrackSize.y = minHeight;
rc = true; rc = true;
} }
if ( maxWidth != -1 ) if ( maxWidth != wxDefaultSize.x )
{ {
info->ptMaxTrackSize.x = maxWidth; info->ptMaxTrackSize.x = maxWidth;
rc = true; rc = true;
} }
if ( maxHeight != -1 ) if ( maxHeight != wxDefaultSize.y )
{ {
info->ptMaxTrackSize.y = maxHeight; info->ptMaxTrackSize.y = maxHeight;
rc = true; rc = true;
@@ -5228,7 +5228,7 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
else else
{ {
handler = wxTheApp; handler = wxTheApp;
event.SetId(-1); event.SetId(wxID_ANY);
} }
if ( handler && handler->ProcessEvent(event) ) if ( handler && handler->ProcessEvent(event) )