From 954fc50b6edca29cfc1b042c1227c91023580131 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 15 Jul 2001 10:06:50 +0000 Subject: [PATCH] no message git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/setup.h | 10 +++ src/generic/spinctlg.cpp | 13 ++-- src/mac/carbon/window.cpp | 135 ++++++++++++++++++++------------------ src/mac/window.cpp | 135 ++++++++++++++++++++------------------ 4 files changed, 159 insertions(+), 134 deletions(-) diff --git a/include/wx/mac/setup.h b/include/wx/mac/setup.h index a9ca4ee1bc..c15639c854 100644 --- a/include/wx/mac/setup.h +++ b/include/wx/mac/setup.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 5c02451b72..9d6ab516e2 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -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; } diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 7f2c51c279..32f583f2ec 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -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 diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 7f2c51c279..32f583f2ec 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -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 -- 2.45.2