no message
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
acc0ebd7a8
commit
954fc50b6e
@ -368,6 +368,16 @@
|
||||
// wxSystemOptions class
|
||||
#define wxUSE_SYSTEM_OPTIONS 1
|
||||
|
||||
// Support for regular expression matching via wxRegEx class: enable this to
|
||||
// use POSIX regular expressions in your code. You need to compile regex
|
||||
// library from src/regex to use it under Windows.
|
||||
//
|
||||
// Default is 0
|
||||
//
|
||||
// Recommended setting: 1 if your compiler supports it, if it doesn't please
|
||||
// contribute us a makefile for src/regex for it
|
||||
#define wxUSE_REGEX 0
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Individual GUI controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -152,10 +152,14 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
||||
|
||||
m_btn->SetRange(min, max);
|
||||
m_btn->SetValue(initial);
|
||||
|
||||
DoSetSize(pos.x, pos.y, size.x, size.y);
|
||||
#ifdef __WXMAC__
|
||||
DoMoveWindow( pos.x, pos.y, size.x, size.y ) ;
|
||||
wxSize csize = size ;
|
||||
if ( size.y == -1 ) {
|
||||
csize.y = m_text->GetSize().y ;
|
||||
}
|
||||
DoSetSize(pos.x, pos.y, csize.x, csize.y);
|
||||
#else
|
||||
DoSetSize(pos.x, pos.y, size.x, size.y);
|
||||
#endif
|
||||
// have to disable this window to avoid interfering it with message
|
||||
// processing to the text and the button... but pretend it is enabled to
|
||||
@ -166,8 +170,9 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
||||
// we don't even need to show this window itself - and not doing it avoids
|
||||
// that it overwrites the text control
|
||||
wxControl::Show(FALSE);
|
||||
#ifndef __WXMAC__
|
||||
m_isShown = TRUE;
|
||||
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -551,73 +551,16 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip)
|
||||
|
||||
void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
{
|
||||
DoSetSize( x,y, width, height ) ;
|
||||
}
|
||||
|
||||
// set the size of the window: if the dimensions are positive, just use them,
|
||||
// but if any of them is equal to -1, it means that we must find the value for
|
||||
// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
|
||||
// which case -1 is a valid value for x and y)
|
||||
//
|
||||
// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
|
||||
// the width/height to best suit our contents, otherwise we reuse the current
|
||||
// width/height
|
||||
void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
|
||||
int former_x = m_x ;
|
||||
int former_y = m_y ;
|
||||
int former_w = m_width ;
|
||||
int former_h = m_height ;
|
||||
|
||||
int currentX, currentY;
|
||||
GetPosition(¤tX, ¤tY);
|
||||
int currentW,currentH;
|
||||
GetSize(¤tW, ¤tH);
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
int actualX = x;
|
||||
int actualY = y;
|
||||
if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
actualX = currentX;
|
||||
if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
actualY = currentY;
|
||||
|
||||
wxSize size( -1 , -1 ) ;
|
||||
|
||||
if (width == -1 || height == -1 )
|
||||
{
|
||||
size = DoGetBestSize() ;
|
||||
}
|
||||
|
||||
if ( width == -1 )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||
{
|
||||
actualWidth = size.x ;
|
||||
if ( actualWidth == -1 )
|
||||
actualWidth = 80 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualWidth = currentW ;
|
||||
}
|
||||
}
|
||||
if (height == -1)
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||
{
|
||||
actualHeight = size.y ;
|
||||
if ( actualHeight == -1 )
|
||||
actualHeight = 26 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualHeight = currentH ;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
|
||||
actualWidth = m_minWidth;
|
||||
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
|
||||
@ -626,15 +569,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
actualWidth = m_maxWidth;
|
||||
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
|
||||
actualHeight = m_maxHeight;
|
||||
if ( actualX == currentX && actualY == currentY && actualWidth == currentW && actualHeight == currentH)
|
||||
{
|
||||
MacRepositionScrollBars() ; // we might have a real position shift
|
||||
return ;
|
||||
}
|
||||
|
||||
AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
|
||||
|
||||
|
||||
bool doMove = false ;
|
||||
bool doResize = false ;
|
||||
|
||||
@ -719,6 +654,76 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// set the size of the window: if the dimensions are positive, just use them,
|
||||
// but if any of them is equal to -1, it means that we must find the value for
|
||||
// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
|
||||
// which case -1 is a valid value for x and y)
|
||||
//
|
||||
// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
|
||||
// the width/height to best suit our contents, otherwise we reuse the current
|
||||
// width/height
|
||||
void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// get the current size and position...
|
||||
int currentX, currentY;
|
||||
GetPosition(¤tX, ¤tY);
|
||||
int currentW,currentH;
|
||||
GetSize(¤tW, ¤tH);
|
||||
|
||||
// ... and don't do anything (avoiding flicker) if it's already ok
|
||||
if ( x == currentX && y == currentY &&
|
||||
width == currentW && height == currentH )
|
||||
{
|
||||
MacRepositionScrollBars() ; // we might have a real position shift
|
||||
return;
|
||||
}
|
||||
|
||||
if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
|
||||
x = currentX;
|
||||
if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
|
||||
y = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x, y, sizeFlags);
|
||||
|
||||
wxSize size(-1, -1);
|
||||
if ( width == -1 )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||
{
|
||||
size = DoGetBestSize();
|
||||
width = size.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
// just take the current one
|
||||
width = currentW;
|
||||
}
|
||||
}
|
||||
|
||||
if ( height == -1 )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||
{
|
||||
if ( size.x == -1 )
|
||||
{
|
||||
size = DoGetBestSize();
|
||||
}
|
||||
//else: already called DoGetBestSize() above
|
||||
|
||||
height = size.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// just take the current one
|
||||
height = currentH;
|
||||
}
|
||||
}
|
||||
|
||||
DoMoveWindow(x, y, width, height);
|
||||
|
||||
}
|
||||
// For implementation purposes - sometimes decorations make the client area
|
||||
// smaller
|
||||
|
@ -551,73 +551,16 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip)
|
||||
|
||||
void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
{
|
||||
DoSetSize( x,y, width, height ) ;
|
||||
}
|
||||
|
||||
// set the size of the window: if the dimensions are positive, just use them,
|
||||
// but if any of them is equal to -1, it means that we must find the value for
|
||||
// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
|
||||
// which case -1 is a valid value for x and y)
|
||||
//
|
||||
// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
|
||||
// the width/height to best suit our contents, otherwise we reuse the current
|
||||
// width/height
|
||||
void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
|
||||
int former_x = m_x ;
|
||||
int former_y = m_y ;
|
||||
int former_w = m_width ;
|
||||
int former_h = m_height ;
|
||||
|
||||
int currentX, currentY;
|
||||
GetPosition(¤tX, ¤tY);
|
||||
int currentW,currentH;
|
||||
GetSize(¤tW, ¤tH);
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
int actualX = x;
|
||||
int actualY = y;
|
||||
if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
actualX = currentX;
|
||||
if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
actualY = currentY;
|
||||
|
||||
wxSize size( -1 , -1 ) ;
|
||||
|
||||
if (width == -1 || height == -1 )
|
||||
{
|
||||
size = DoGetBestSize() ;
|
||||
}
|
||||
|
||||
if ( width == -1 )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||
{
|
||||
actualWidth = size.x ;
|
||||
if ( actualWidth == -1 )
|
||||
actualWidth = 80 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualWidth = currentW ;
|
||||
}
|
||||
}
|
||||
if (height == -1)
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||
{
|
||||
actualHeight = size.y ;
|
||||
if ( actualHeight == -1 )
|
||||
actualHeight = 26 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualHeight = currentH ;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
|
||||
actualWidth = m_minWidth;
|
||||
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
|
||||
@ -626,15 +569,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
actualWidth = m_maxWidth;
|
||||
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
|
||||
actualHeight = m_maxHeight;
|
||||
if ( actualX == currentX && actualY == currentY && actualWidth == currentW && actualHeight == currentH)
|
||||
{
|
||||
MacRepositionScrollBars() ; // we might have a real position shift
|
||||
return ;
|
||||
}
|
||||
|
||||
AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
|
||||
|
||||
|
||||
bool doMove = false ;
|
||||
bool doResize = false ;
|
||||
|
||||
@ -719,6 +654,76 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// set the size of the window: if the dimensions are positive, just use them,
|
||||
// but if any of them is equal to -1, it means that we must find the value for
|
||||
// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
|
||||
// which case -1 is a valid value for x and y)
|
||||
//
|
||||
// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
|
||||
// the width/height to best suit our contents, otherwise we reuse the current
|
||||
// width/height
|
||||
void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// get the current size and position...
|
||||
int currentX, currentY;
|
||||
GetPosition(¤tX, ¤tY);
|
||||
int currentW,currentH;
|
||||
GetSize(¤tW, ¤tH);
|
||||
|
||||
// ... and don't do anything (avoiding flicker) if it's already ok
|
||||
if ( x == currentX && y == currentY &&
|
||||
width == currentW && height == currentH )
|
||||
{
|
||||
MacRepositionScrollBars() ; // we might have a real position shift
|
||||
return;
|
||||
}
|
||||
|
||||
if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
|
||||
x = currentX;
|
||||
if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
|
||||
y = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x, y, sizeFlags);
|
||||
|
||||
wxSize size(-1, -1);
|
||||
if ( width == -1 )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||
{
|
||||
size = DoGetBestSize();
|
||||
width = size.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
// just take the current one
|
||||
width = currentW;
|
||||
}
|
||||
}
|
||||
|
||||
if ( height == -1 )
|
||||
{
|
||||
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||
{
|
||||
if ( size.x == -1 )
|
||||
{
|
||||
size = DoGetBestSize();
|
||||
}
|
||||
//else: already called DoGetBestSize() above
|
||||
|
||||
height = size.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// just take the current one
|
||||
height = currentH;
|
||||
}
|
||||
}
|
||||
|
||||
DoMoveWindow(x, y, width, height);
|
||||
|
||||
}
|
||||
// For implementation purposes - sometimes decorations make the client area
|
||||
// smaller
|
||||
|
Loading…
Reference in New Issue
Block a user