]> git.saurik.com Git - wxWidgets.git/commitdiff
SetSizeHints --> SetMinSize or SetBestFittingSize, and other tweaks
authorRobin Dunn <robin@alldunn.com>
Wed, 4 Aug 2004 22:24:57 +0000 (22:24 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 4 Aug 2004 22:24:57 +0000 (22:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/demo/GenericButtons.py
wxPython/demo/KeyEvents.py
wxPython/wx/lib/buttons.py
wxPython/wx/lib/masked/combobox.py
wxPython/wx/lib/masked/maskededit.py
wxPython/wx/lib/masked/textctrl.py
wxPython/wx/lib/scrolledpanel.py
wxPython/wx/lib/statbmp.py
wxPython/wx/lib/stattext.py

index beb8a5245112e845d6b41e5dddd596e7f976e628..7bbe9d57042f2fc43f3282edec41f6642828f0d6 100644 (file)
@@ -44,7 +44,7 @@ class TestPanel(wx.Panel):
         b.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD, False))
         b.SetBezelWidth(5)
         ###b.SetBestSize()
-        b.SetSizeHints(wx.DefaultSize)
+        b.SetMinSize(wx.DefaultSize)
         b.SetBackgroundColour("Navy")
         b.SetForegroundColour(wx.WHITE)
         b.SetToolTipString("This is a BIG button...")
index b1e87002263fb659f6d29a6358940c127814879d..611c51f76e9dc6b8d06c49308129347f69f6cf2d 100644 (file)
@@ -265,7 +265,7 @@ class TestPanel(wx.Panel):
         self.log = log
         wx.Panel.__init__(self, parent, -1, style=0)
         self.keysink = KeySink(self)
-        self.keysink.SetSizeHints((100, 65))
+        self.keysink.SetMinSize((100, 65))
         self.keylog = KeyLog(self)
 
         btn = wx.Button(self, -1, "Clear Log")
index 68260c0572e60fcffb8853985534abd93f707416..833f176a576bb7d2e0283f509aedae04cddd7663 100644 (file)
@@ -77,7 +77,7 @@ class GenButton(wx.PyControl):
 
         self.SetLabel(label)
         self.InheritAttributes()
-        self.SetBestSize(size)
+        self.SetBestFittingSize(size)
         self.InitColours()
 
         self.Bind(wx.EVT_LEFT_DOWN,        self.OnLeftDown)
@@ -100,7 +100,7 @@ class GenButton(wx.PyControl):
         """
         if size is None:
             size = wx.DefaultSize            
-        wx.PyControl.SetBestSize(self, size)
+        wx.PyControl.SetBestFittingSize(self, size)
 
 
     def DoGetBestSize(self):
index 7e1ec0d0d5562a10cdacd171993354e522bfec23..d41d85e66cf9522e2c68d52f693735612d4f4524 100644 (file)
@@ -122,8 +122,7 @@ class BaseMaskedComboBox( wx.ComboBox, MaskedEditMixin ):
             self.SetClientSize(self._CalcSize())
             width = self.GetSize().width
             height = self.GetBestSize().height
-            self.SetSize((width, height))
-            self.SetSizeHints((width, height))
+            self.SetBestFittingSize((width, height))
 
 
         if value:
@@ -179,8 +178,7 @@ class BaseMaskedComboBox( wx.ComboBox, MaskedEditMixin ):
             width = self.GetSize().width
             height = self.GetBestSize().height
             dbg('setting client size to:', (width, height))
-            self.SetSize((width, height))
-            self.SetSizeHints((width, height))
+            self.SetBestFittingSize((width, height))
 
 
     def _GetSelection(self):
index dc78b9dc7ea27c7535fcfc441773806242eda883..a3801d6eb9da960f706966c6abc978d48b09b43a 100644 (file)
@@ -1919,8 +1919,7 @@ class MaskedEditMixin:
                 width = self.GetSize().width
                 height = self.GetBestSize().height
 ##                dbg('setting client size to:', (width, height))
-                self.SetSize((width, height))
-                self.SetSizeHints((width, height))
+                self.SetBestFittingSize((width, height))
 
             # Set value/type-specific formatting
             self._applyFormatting()
@@ -2002,7 +2001,7 @@ class MaskedEditMixin:
                     #  the outside size that does include the borders.  What you are
                     #  calculating (in _CalcSize) is the client size, but the sizers
                     #  deal with the full size and so that is the minimum size that
-                    #  we need to set with SetSizeHints.  The root of the problem is
+                    #  we need to set with SetBestFittingSize.  The root of the problem is
                     #  that in _calcSize the current client size height is returned,
                     #  instead of a height based on the current font.  So I suggest using
                     #  _calcSize to just get the width, and then use GetBestSize to
@@ -2010,8 +2009,7 @@ class MaskedEditMixin:
                     self.SetClientSize(self._CalcSize())
                     width = self.GetSize().width
                     height = self.GetBestSize().height
-                    self.SetSize((width, height))
-                    self.SetSizeHints((width, height))
+                    self.SetBestFittingSize((width, height))
 
 
             # Set value/type-specific formatting
index f232e2266ab91aa6feaf9fc0582b4bae71f379ce..fc20e71dc19c0215c78156d5bc3edbf69f12cb3b 100644 (file)
@@ -235,8 +235,7 @@ class BaseMaskedTextCtrl( wx.TextCtrl, MaskedEditMixin ):
             width = self.GetSize().width
             height = self.GetBestSize().height
 ##            dbg('setting client size to:', (width, height))
-            self.SetSize((width, height))
-            self.SetSizeHints((width, height))
+            self.SetBestFittingSize((width, height))
 
 
     def Clear(self):
index 006cbc87339f415fe832eede13d84f5d395d4593..851d9332fa9a075dd7e32466f680e7c1f07af3a5 100644 (file)
@@ -38,7 +38,7 @@ class ScrolledPanel( wx.PyScrolledWindow ):
         wx.PyScrolledWindow.__init__(self, parent, -1,
                                      pos=pos, size=size,
                                      style=style, name=name)
-        self.SetBestSize(size)
+        self.SetBestFittingSize(size)
         self.Bind(wx.EVT_CHILD_FOCUS, self.OnChildFocus)
 
 
index f0e0ff488cee57dd3c1c32a832b32b5d7f587989..fa2db42356c89927cac926996749a3674de0c19b 100644 (file)
@@ -25,7 +25,7 @@ class GenStaticBitmap(wx.PyControl):
                              wx.DefaultValidator, name)
         self._bitmap = bitmap
         self.InheritAttributes()
-        self.SetBestSize(size)
+        self.SetBestFittingSize(size)
 
         self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
         self.Bind(wx.EVT_PAINT,            self.OnPaint)
@@ -33,7 +33,7 @@ class GenStaticBitmap(wx.PyControl):
 
     def SetBitmap(self, bitmap):
         self._bitmap = bitmap
-        self.SetBestSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
+        self.SetBestFittingSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
         self.Refresh()
 
 
index 1c1ac8fca4c35b1f22ac658f726d8d28faabc149..ac50f76e733266a902a02ebd16a48ff30cf0f4ae 100644 (file)
@@ -34,7 +34,7 @@ class GenStaticText(wx.PyControl):
         wx.PyControl.SetLabel(self, label) # don't check wx.ST_NO_AUTORESIZE yet
         self.defBackClr = self.GetBackgroundColour()
         self.InheritAttributes()
-        self.SetBestSize(size)
+        self.SetBestFittingSize(size)
 
         self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
         self.Bind(wx.EVT_PAINT,            self.OnPaint)
@@ -50,7 +50,7 @@ class GenStaticText(wx.PyControl):
         if not style & wx.ST_NO_AUTORESIZE:
             best = self.GetBestSize()
             self.SetSize(best)
-            self.SetSizeHints(best)
+            self.SetMinSize(best)
         self.Refresh()
 
 
@@ -64,7 +64,7 @@ class GenStaticText(wx.PyControl):
         if not style & wx.ST_NO_AUTORESIZE:
             best = self.GetBestSize()
             self.SetSize(best)
-            self.SetSizeHints(best)
+            self.SetMinSize(best)
         self.Refresh()