]> git.saurik.com Git - wxWidgets.git/commitdiff
no message
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 15 Jul 2001 10:06:50 +0000 (10:06 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 15 Jul 2001 10:06:50 +0000 (10:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/setup.h
src/generic/spinctlg.cpp
src/mac/carbon/window.cpp
src/mac/window.cpp

index a9ca4ee1bce18b87ff290b52bc5138c00fa9fe15..c15639c854368b0e037bf10bd51554b136c6b9d3 100644 (file)
 // wxSystemOptions class
 #define wxUSE_SYSTEM_OPTIONS 1
 
 // 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
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // Individual GUI controls
 // ----------------------------------------------------------------------------
index 5c02451b72fa5d5b408b959d5271ab693b5a8f4d..9d6ab516e258461b8af7842cafee52d0b54e9071 100644 (file)
@@ -152,10 +152,14 @@ bool wxSpinCtrl::Create(wxWindow *parent,
 
     m_btn->SetRange(min, max);
     m_btn->SetValue(initial);
 
     m_btn->SetRange(min, max);
     m_btn->SetValue(initial);
-
-    DoSetSize(pos.x, pos.y, size.x, size.y);
 #ifdef __WXMAC__
 #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
 #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);
     // 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;
     m_isShown = TRUE;
-
+#endif
     return TRUE;
 }
 
     return TRUE;
 }
 
index 7f2c51c279ad9e86f2a229ac8d1d604c224a01f4..32f583f2eca9d66c77c581e8c9bd2a0df3f02990 100644 (file)
@@ -551,73 +551,16 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip)
 
 void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
 {
 
 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 former_x = m_x ;
        int former_y = m_y ;
        int former_w = m_width ;
        int former_h = m_height ;
        
-  int currentX, currentY;
-  GetPosition(&currentX, &currentY);
-  int currentW,currentH;
-  GetSize(&currentW, &currentH);
-
   int actualWidth = width;
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
   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)) 
     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;
        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 ;
        
        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);
        }
        }
                 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(&currentX, &currentY);
+    int currentW,currentH;
+    GetSize(&currentW, &currentH);
+
+    // ... 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
 }
 // For implementation purposes - sometimes decorations make the client area
 // smaller
index 7f2c51c279ad9e86f2a229ac8d1d604c224a01f4..32f583f2eca9d66c77c581e8c9bd2a0df3f02990 100644 (file)
@@ -551,73 +551,16 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip)
 
 void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
 {
 
 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 former_x = m_x ;
        int former_y = m_y ;
        int former_w = m_width ;
        int former_h = m_height ;
        
-  int currentX, currentY;
-  GetPosition(&currentX, &currentY);
-  int currentW,currentH;
-  GetSize(&currentW, &currentH);
-
   int actualWidth = width;
   int actualHeight = height;
   int actualX = x;
   int actualY = y;
   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)) 
     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;
        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 ;
        
        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);
        }
        }
                 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(&currentX, &currentY);
+    int currentW,currentH;
+    GetSize(&currentW, &currentH);
+
+    // ... 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
 }
 // For implementation purposes - sometimes decorations make the client area
 // smaller