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

@@ -1543,7 +1543,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
self.PopupMenu(menu)
menu.Destroy()
event.Skip()
def OnItemBackground(self, event):
@@ -1559,7 +1558,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
col1 = data.GetColour().Get()
self.SetItemBackgroundColour(self.current, col1)
dlg.Destroy()
event.Skip()
def OnItemForeground(self, event):
@@ -1575,13 +1573,11 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
col1 = data.GetColour().Get()
self.SetItemTextColour(self.current, col1)
dlg.Destroy()
event.Skip()
def OnItemBold(self, event):
self.SetItemBold(self.current, not self.itemdict["isbold"])
event.Skip()
def OnItemFont(self, event):
@@ -1602,13 +1598,11 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
self.SetItemFont(self.current, font)
dlg.Destroy()
event.Skip()
def OnItemHyperText(self, event):
self.SetItemHyperText(self.current, not self.itemdict["ishtml"])
event.Skip()
def OnEnableWindow(self, event):
@@ -1616,13 +1610,10 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
enable = self.GetItemWindowEnabled(self.current)
self.SetItemWindowEnabled(self.current, not enable)
event.Skip()
def OnDisableItem(self, event):
self.EnableItem(self.current, False)
event.Skip()
def OnItemIcons(self, event):
@@ -1634,7 +1625,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
dlg = TreeIcons(self, -1, bitmaps=bitmaps)
wx.EndBusyCursor()
dlg.ShowModal()
event.Skip()
def SetNewIcons(self, bitmaps):
@@ -1668,7 +1658,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
dlg.ShowModal()
dlg.Destroy()
event.Skip()
def OnItemDelete(self, event):
@@ -1686,7 +1675,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
self.Delete(self.current)
self.current = None
event.Skip()
def OnItemPrepend(self, event):
@@ -1699,7 +1687,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
self.EnsureVisible(newitem)
dlg.Destroy()
event.Skip()
def OnItemAppend(self, event):
@@ -1712,7 +1699,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl):
self.EnsureVisible(newitem)
dlg.Destroy()
event.Skip()
def OnBeginEdit(self, event):

View File

@@ -43,7 +43,6 @@ class TestPanel(wx.Panel):
self.Bind(wx.EVT_BUTTON, self.OnBiggerButton, b)
b.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD, False))
b.SetBezelWidth(5)
###b.SetBestSize()
b.SetMinSize(wx.DefaultSize)
b.SetBackgroundColour("Navy")
b.SetForegroundColour(wx.WHITE)
@@ -76,7 +75,7 @@ class TestPanel(wx.Panel):
mask = wx.Mask(bmp, wx.BLUE)
bmp.SetMask(mask)
b.SetBitmapSelected(bmp)
b.SetBestSize()
b.SetInitialSize()
sizer.Add(b)
# A toggle button
@@ -96,7 +95,7 @@ class TestPanel(wx.Panel):
bmp.SetMask(mask)
b.SetBitmapSelected(bmp)
b.SetToggle(True)
b.SetBestSize()
b.SetInitialSize()
sizer.Add(b)
# A bitmap button with text.
@@ -111,7 +110,7 @@ class TestPanel(wx.Panel):
bmp.SetMask(mask)
b.SetBitmapSelected(bmp)
b.SetUseFocusIndicator(False)
b.SetBestSize()
b.SetInitialSize()
sizer.Add(b)

View File

@@ -95,7 +95,7 @@ class TestPanel(wx.Panel):
"ERROR",
wx.ICON_ERROR | wx.OK)
else:
self.mc.SetBestFittingSize()
self.mc.SetInitialSize()
self.GetSizer().Layout()
self.slider.SetRange(0, self.mc.Length())
@@ -108,7 +108,7 @@ class TestPanel(wx.Panel):
"ERROR",
wx.ICON_ERROR | wx.OK)
else:
self.mc.SetBestFittingSize()
self.mc.SetInitialSize()
self.GetSizer().Layout()
self.slider.SetRange(0, self.mc.Length())

View File

@@ -299,7 +299,7 @@ class Frame(wx.Frame):
w = b.GenButton(p, -1, "Generic Button")
w.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD, False))
w.SetBezelWidth(5)
w.SetBestSize()
w.SetInitialSize()
w.SetBackgroundColour("Navy")
w.SetForegroundColour(wx.WHITE)
self.DoWidget(w)

View File

@@ -446,7 +446,7 @@ class SizeInfoPane(wx.Panel):
self._minsize.SetValue( str(win.GetMinSize()) )
self._bestsize.SetValue( str(win.GetBestSize()) )
self._adjbstsize.SetValue( str(win.GetAdjustedBestSize()) )
self._bestfit.SetValue( str(win.GetBestFittingSize()) )
self._bestfit.SetValue( str(win.GetEffectiveMinSize()) )
def Clear(self):
self._size.SetValue("")

View File

@@ -34,7 +34,6 @@ public:
const wxString& name = wxPyControlNameStr)
: wxControl(parent, id, pos, size, style, validator, name) {}
void SetBestSize(const wxSize& size) { wxControl::SetBestSize(size); }
bool DoEraseBackground(wxDC* dc) {
#ifdef __WXMSW__
@@ -133,7 +132,6 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void DoMoveWindow(int x, int y, int width, int height);

View File

@@ -62,7 +62,6 @@ public:
const wxString& name = wxPyPanelNameStr)
: wxWindow(parent, id, pos, size, style, name) {}
void SetBestSize(const wxSize& size) { wxWindow::SetBestSize(size); }
bool DoEraseBackground(wxDC* dc) {
#ifdef __WXMSW__
@@ -160,7 +159,6 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void DoMoveWindow(int x, int y, int width, int height);
@@ -245,7 +243,6 @@ public:
const wxString& name = wxPyPanelNameStr)
: wxPanel(parent, id, pos, size, style, name) {}
void SetBestSize(const wxSize& size) { wxPanel::SetBestSize(size); }
bool DoEraseBackground(wxDC* dc) {
#ifdef __WXMSW__
return wxWindow::DoEraseBackground(dc->GetHDC());
@@ -343,7 +340,6 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void DoMoveWindow(int x, int y, int width, int height);
@@ -421,7 +417,6 @@ public:
const wxString& name = wxPyPanelNameStr)
: wxScrolledWindow(parent, id, pos, size, style, name) {}
void SetBestSize(const wxSize& size) { wxScrolledWindow::SetBestSize(size); }
bool DoEraseBackground(wxDC* dc) {
#ifdef __WXMSW__
return wxWindow::DoEraseBackground(dc->GetHDC());
@@ -518,7 +513,6 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void DoMoveWindow(int x, int y, int width, int height);

View File

@@ -448,10 +448,10 @@ equal to -1.
MoveXY);
DocDeclStr(
void , SetBestFittingSize(const wxSize& size=wxDefaultSize),
void , SetInitialSize(const wxSize& size=wxDefaultSize),
"A 'Smart' SetSize that will fill in default size components with the
window's *best size* values. Also set's the minsize for use with sizers.", "");
%pythoncode { SetBestFittingSize = wx._deprecated(SetInitialSize, 'Use `SetInitialSize`') }
DocDeclStr(
@@ -571,19 +571,19 @@ some properties of the window change.)", "");
DocDeclStr(
wxSize , GetBestFittingSize() const,
wxSize , GetEffectiveMinSize() const,
"This function will merge the window's best size into the window's
minimum size, giving priority to the min size components, and returns
the results.
", "");
%pythoncode { GetBestFittingSize = wx._deprecated(GetEffectiveMinSize, , 'Use `GetEffectiveMinSize` instead.') }
%pythoncode {
def GetAdjustedBestSize(self):
s = self.GetBestSize()
return wx.Size(max(s.width, self.GetMinWidth()),
max(s.height, self.GetMinHeight()))
GetAdjustedBestSize = wx._deprecated(GetAdjustedBestSize, 'Use `GetBestFittingSize` instead.')
GetAdjustedBestSize = wx._deprecated(GetAdjustedBestSize, 'Use `GetEffectiveMinSize` instead.')
}
@@ -2077,7 +2077,7 @@ opaque.", "");
%property(AutoLayout, GetAutoLayout, SetAutoLayout, doc="See `GetAutoLayout` and `SetAutoLayout`");
%property(BackgroundColour, GetBackgroundColour, SetBackgroundColour, doc="See `GetBackgroundColour` and `SetBackgroundColour`");
%property(BackgroundStyle, GetBackgroundStyle, SetBackgroundStyle, doc="See `GetBackgroundStyle` and `SetBackgroundStyle`");
%property(BestFittingSize, GetBestFittingSize, SetBestFittingSize, doc="See `GetBestFittingSize` and `SetBestFittingSize`");
%property(EffectiveMinSize, GetEffectiveMinSize, doc="See `GetEffectiveMinSize`");
%property(BestSize, GetBestSize, doc="See `GetBestSize`");
%property(BestVirtualSize, GetBestVirtualSize, doc="See `GetBestVirtualSize`");
%property(Border, GetBorder, doc="See `GetBorder`");

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)