GetBestFittingSize --> GetEffectiveMinSize

SetBestFittingSize --> SetInitialSize
SetBestSize  --> SetInitialSize
SetInitialBestSize --> SetInitialSize


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-10-31 08:50:17 +00:00
parent 1e0e7f7d0e
commit 170acdc90e
103 changed files with 173 additions and 199 deletions

View File

@@ -92,7 +92,7 @@ class AnalogClock(wx.PyWindow):
self.Bind(wx.EVT_MENU, self._OnShowAbout, id=popup2)
# Set initial size based on given size, or best size
self.SetBestFittingSize(size)
self.SetInitialSize(size)
# Do initial drawing (in case there is not an initial size event)
self.RecalcCoords(self.GetSize())

View File

@@ -620,7 +620,7 @@ class BPArt:
if isVertical:
dc.DrawLine(rect.x, coord, rect.x + rect.width, coord)
else:
dc.DrawLine(coord, rect.y, coord, rect.y + rect.width)
dc.DrawLine(coord, rect.y, coord, rect.y + rect.height)
rf += rstep
gf += gstep

View File

@@ -77,7 +77,7 @@ class GenButton(wx.PyControl):
self.SetLabel(label)
self.InheritAttributes()
self.SetBestFittingSize(size)
self.SetInitialSize(size)
self.InitColours()
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
@@ -92,15 +92,16 @@ class GenButton(wx.PyControl):
self.Bind(wx.EVT_PAINT, self.OnPaint)
def SetBestSize(self, size=None):
def SetInitialSize(self, size=None):
"""
Given the current font and bezel width settings, calculate
and set a good size.
"""
if size is None:
size = wx.DefaultSize
wx.PyControl.SetBestFittingSize(self, size)
wx.PyControl.SetInitialSize(self, size)
SetBestSize = SetInitialSize
def DoGetBestSize(self):
"""

View File

@@ -133,7 +133,7 @@ class BaseMaskedComboBox( wx.ComboBox, MaskedEditMixin ):
self.SetClientSize(self._CalcSize())
width = self.GetSize().width
height = self.GetBestSize().height
self.SetBestFittingSize((width, height))
self.SetInitialSize((width, height))
if value:
@@ -189,7 +189,7 @@ class BaseMaskedComboBox( wx.ComboBox, MaskedEditMixin ):
width = self.GetSize().width
height = self.GetBestSize().height
## dbg('setting client size to:', (width, height))
self.SetBestFittingSize((width, height))
self.SetInitialSize((width, height))
def _GetSelection(self):

View File

@@ -1992,7 +1992,7 @@ class MaskedEditMixin:
width = self.GetSize().width
height = self.GetBestSize().height
## dbg('setting client size to:', (width, height))
self.SetBestFittingSize((width, height))
self.SetInitialSize((width, height))
# Set value/type-specific formatting
self._applyFormatting()
@@ -2076,7 +2076,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 SetBestFittingSize. The root of the problem is
# we need to set with SetInitialSize. 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
@@ -2084,7 +2084,7 @@ class MaskedEditMixin:
self.SetClientSize(self._CalcSize())
width = self.GetSize().width
height = self.GetBestSize().height
self.SetBestFittingSize((width, height))
self.SetInitialSize((width, height))
# Set value/type-specific formatting

View File

@@ -239,7 +239,7 @@ class BaseMaskedTextCtrl( wx.TextCtrl, MaskedEditMixin ):
width = self.GetSize().width
height = self.GetBestSize().height
## dbg('setting client size to:', (width, height))
self.SetBestFittingSize((width, height))
self.SetInitialSize((width, height))
def Clear(self):

View File

@@ -38,7 +38,7 @@ class ScrolledPanel( wx.PyScrolledWindow ):
wx.PyScrolledWindow.__init__(self, parent, id,
pos=pos, size=size,
style=style, name=name)
self.SetBestFittingSize(size)
self.SetInitialSize(size)
self.Bind(wx.EVT_CHILD_FOCUS, self.OnChildFocus)

View File

@@ -240,14 +240,14 @@ class MultiSplitterWindow(wx.PyPanel):
sashsize = self._GetSashSize()
if self._orient == wx.HORIZONTAL:
for win in self._windows:
winbest = win.GetAdjustedBestSize()
winbest = win.GetEffectiveMinSize()
best.width += max(self._minimumPaneSize, winbest.width)
best.height = max(best.height, winbest.height)
best.width += sashsize * (len(self._windows)-1)
else:
for win in self._windows:
winbest = win.GetAdjustedBestSize()
winbest = win.GetEffectiveMinSize()
best.height += max(self._minimumPaneSize, winbest.height)
best.width = max(best.width, winbest.width)
best.height += sashsize * (len(self._windows)-1)

View File

@@ -27,7 +27,7 @@ class GenStaticBitmap(wx.PyControl):
wx.DefaultValidator, name)
self._bitmap = bitmap
self.InheritAttributes()
self.SetBestFittingSize(size)
self.SetInitialSize(size)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.Bind(wx.EVT_PAINT, self.OnPaint)
@@ -35,7 +35,7 @@ class GenStaticBitmap(wx.PyControl):
def SetBitmap(self, bitmap):
self._bitmap = bitmap
self.SetBestFittingSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
self.SetInitialSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
self.Refresh()

View File

@@ -36,7 +36,7 @@ class GenStaticText(wx.PyControl):
wx.PyControl.SetLabel(self, label) # don't check wx.ST_NO_AUTORESIZE yet
self.InheritAttributes()
self.SetBestFittingSize(size)
self.SetInitialSize(size)
self.Bind(wx.EVT_PAINT, self.OnPaint)
if BUFFERED:
@@ -56,7 +56,7 @@ class GenStaticText(wx.PyControl):
style = self.GetWindowStyleFlag()
self.InvalidateBestSize()
if not style & wx.ST_NO_AUTORESIZE:
self.SetBestFittingSize(self.GetBestSize())
self.SetInitialSize(self.GetBestSize())
self.Refresh()
@@ -69,7 +69,7 @@ class GenStaticText(wx.PyControl):
style = self.GetWindowStyleFlag()
self.InvalidateBestSize()
if not style & wx.ST_NO_AUTORESIZE:
self.SetBestFittingSize(self.GetBestSize())
self.SetInitialSize(self.GetBestSize())
self.Refresh()

View File

@@ -50,7 +50,7 @@ class Ticker(wx.PyControl):
self._ppf = ppf #pixels per frame
self.SetDirection(direction)
self.SetText(text)
self.SetBestFittingSize(size)
self.SetInitialSize(size)
self.SetForegroundColour(fgcolor)
self.SetBackgroundColour(bgcolor)
wx.EVT_TIMER(self, -1, self.OnTick)