bool ret = wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name );
- SetBestSize( size ) ;
+ SetInitialSize( size ) ;
return ret;
}
SetCodePage(wxSTC_CP_UTF8);
#endif
- SetBestFittingSize(size);
+ SetInitialSize(size);
// Reduces flicker on GTK+/X11
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
SetCodePage(wxSTC_CP_UTF8);
#endif
- SetBestFittingSize(size);
+ SetInitialSize(size);
// Reduces flicker on GTK+/X11
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile, wxDefaultPosition, sz);
#endif
- list->SetBestFittingSize(sz);
+ list->SetInitialSize(sz);
// locate and resize with sizers
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
- wxGetWorkingDirectory() deprecated in favour of wxGetCwd().
- wxDC::BeginDrawing() and wxDC::EndDrawing() deprecated, don't use them.
+- wxWindowBase::GetBestFittingSize --> wxWindowBase::GetEffectiveMinSize
+- wxWindowBase::SetBestFittingSize --> wxWindowBase::SetInitialSize
+
Major new features in 2.7 release
\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
\helpref{wxWindow::SetBackgroundStyle}{wxwindowsetbackgroundstyle}
-\membersection{wxWindow::GetBestFittingSize}\label{wxwindowgetbestfittingsize}
+\membersection{wxWindow::GetEffectiveMinSize}\label{wxwindowgeteffectiveminsize}
-\constfunc{wxSize}{GetBestFittingSize}{\void}
+\constfunc{wxSize}{GetEffectiveMinSize}{\void}
-Merges the window's best size into the min size and returns the result.
+Merges the window's best size into the min size and returns the
+result. This is the value used by sizers to determine the appropriate
+ammount of sapce to allocate for the widget.
\wxheading{See also}
\helpref{wxWindow::GetBestSize}{wxwindowgetbestsize},\rtfsp
-\helpref{wxWindow::SetBestFittingSize}{wxwindowsetbestfittingsize}
+\helpref{wxWindow::SetInitialSize}{wxwindowsetinitialsize}
\membersection{wxWindow::GetBestSize}\label{wxwindowgetbestsize}
\helpref{wxWindow::GetBackgroundStyle}{wxwindowgetbackgroundstyle}
-\membersection{wxWindow::SetBestFittingSize}\label{wxwindowsetbestfittingsize}
+\membersection{wxWindow::SetInitialSize}\label{wxwindowsetinitialsize}
-\func{void}{SetBestFittingSize}{\param{const wxSize\& }{size = wxDefaultSize}}
+\func{void}{SetInitialSize}{\param{const wxSize\& }{size = wxDefaultSize}}
A {\it smart} SetSize that will fill in default size components with the
window's {\it best} size values. Also sets the window's minsize to
size instead of the results of GetBestSize to determine the minimum
needs of the window for layout.
+Most controls will use this to set their initial size, and their min
+size to the passed in value (if any.)
+
+
\wxheading{See also}
\helpref{wxWindow::SetSize}{wxwindowsetsize},\rtfsp
\helpref{wxWindow::GetBestSize}{wxwindowgetbestsize},\rtfsp
-\helpref{wxWindow::GetBestFittingSize}{wxwindowgetbestfittingsize}
+\helpref{wxWindow::GetEffectiveMinSize}{wxwindowgeteffectiveminsize}
\membersection{wxWindow::SetCaret}\label{wxwindowsetcaret}
// helper: get the next page wrapping if we reached the end
int GetNextPage(bool forward) const;
- // Always rely on GetBestSize, which will look at all the pages
- virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
-
// Lay out controls
void DoSize();
// initialize the common fields of wxCommandEvent
void InitCommandEvent(wxCommandEvent& event) const;
- // set the initial window size if none is given (i.e. at least one of the
- // components of the size passed to ctor/Create() is -1)
- //
- // normally just calls SetBestSize() but can be overridden not to do it for
- // the controls which have to do some additional initialization (e.g. add
- // strings to list box) before their best size can be accurately calculated
- virtual void SetInitialBestSize(const wxSize& size)
- {
- SetBestSize(size);
- }
-
DECLARE_NO_COPY_CLASS(wxControlBase)
};
virtual bool ShouldInheritColours() const { return false; }
protected:
- // we can't compute our best size before the items are added to the control
- // which is done after calling SetInitialBestSize() (it is called from the
- // base class ctor and the items are added in the derived class ctor), so
- // don't do anything at all here as our size will be changed later anyhow
- //
- // of course, all derived classes *must* call SetBestSize() from their
- // ctors for this to work!
- virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
-
// fill in the client object or data field of the event as appropriate
//
// calls InitCommandEvent() and, if n != wxNOT_FOUND, also sets the per
// common part of all ctors
void Init();
- // we can't compute our best size before the items are added to the control
- virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
-
// subclass one radio button
void SubclassRadioButton(WXHWND hWndBtn);
void SendNotificationEvent();
protected:
- // we can't compute our best size before the items are added to the control
- virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
-
// get the max size of radio buttons
wxSize GetMaxButtonSize() 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.
- wxSize GetBestFittingSize() const;
+ wxSize GetEffectiveMinSize() const;
+ wxDEPRECATED( wxSize GetBestFittingSize() const ); // replaced by GetEffectiveMinSize
// A 'Smart' SetSize that will fill in default size values with 'best'
// size. Sets the minsize to what was passed in.
- void SetBestFittingSize(const wxSize& size=wxDefaultSize);
+ void SetInitialSize(const wxSize& size=wxDefaultSize);
+ wxDEPRECATED( void SetBestFittingSize(const wxSize& size=wxDefaultSize) ); // replaced by SetInitialSize
+
// the generic centre function - centers the window on parent by`
// default or on screen if it doesn't have parent or
// wxCENTER_ON_SCREEN flag is given
// recalculated each time the value is needed.
wxSize m_bestSizeCache;
- // keep the old name for compatibility, at least until all the internal
- // usages of it are changed to SetBestFittingSize
- void SetBestSize(const wxSize& size) { SetBestFittingSize(size); }
-
- // set the initial window size if none is given (i.e. at least one of the
- // components of the size passed to ctor/Create() is wxDefaultCoord)
- //
- // normally just calls SetBestSize() for controls, but can be overridden
- // not to do it for the controls which have to do some additional
- // initialization (e.g. add strings to list box) before their best size
- // can be accurately calculated
- virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) {}
+ wxDEPRECATED( void SetBestSize(const wxSize& size) ); // use SetInitialSize
+ wxDEPRECATED( virtual void SetInitialBestSize(const wxSize& size) ); // use SetInitialSize
DECLARE_EVENT_TABLE()
};
+
+
+// Inlines for some deprecated methods
+inline wxSize wxWindowBase::GetBestFittingSize() const
+{
+ return GetEffectiveMinSize();
+}
+
+inline void wxWindowBase::SetBestFittingSize(const wxSize& size)
+{
+ SetInitialSize(size);
+}
+
+inline void wxWindowBase::SetBestSize(const wxSize& size)
+{
+ SetInitialSize(size);
+}
+
+inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
+{
+ SetInitialSize(size);
+}
+
+
// ----------------------------------------------------------------------------
// now include the declaration of wxWindow class
// ----------------------------------------------------------------------------
}
}
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
else
{
if (Load(fileName))
{
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
else
}
else
{
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
}
return false;
}
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
else
if (Load(location))
{
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
else
{
// Since the size of the window may change during runtime, we
// should use the current minimal/best size.
- m_minSize = m_window->GetBestFittingSize();
+ m_minSize = m_window->GetEffectiveMinSize();
}
return GetMinSizeWithBorder();
}
-wxSize wxWindowBase::GetBestFittingSize() const
+wxSize wxWindowBase::GetEffectiveMinSize() const
{
// merge the best size with the min size, giving priority to the min size
wxSize min = GetMinSize();
}
-void wxWindowBase::SetBestFittingSize(const wxSize& size)
+void wxWindowBase::SetInitialSize(const wxSize& size)
{
// Set the min size to the size passed in. This will usually either be
// wxDefaultSize or the size passed to this window's ctor/Create function.
SetMinSize(size);
// Merge the size with the best size if needed
- wxSize best = GetBestFittingSize();
+ wxSize best = GetEffectiveMinSize();
// If the current size doesn't match then change it
if (GetSize() != best)
m_needsLayout = true;
DoLayout();
- SetBestSize(wxSize(m_maxWidth, m_maxHeight));
+ SetInitialSize(wxSize(m_maxWidth, m_maxHeight));
return true;
}
// we need to set the position as well because the main control position
// is not the same as the one specified in pos if we have the controls
// above it
- SetBestSize(size);
+ SetInitialSize(size);
SetPosition(pos);
// Since we don't paint the whole background make sure that the platform
if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) && m_staticMonth )
{
- wxSize sizeCombo = m_comboMonth->GetBestFittingSize();
+ wxSize sizeCombo = m_comboMonth->GetEffectiveMinSize();
wxSize sizeStatic = m_staticMonth->GetSize();
wxSize sizeSpin = m_spinYear->GetSize();
wxSize wxChoicebook::GetControllerSize() const
{
const wxSize sizeClient = GetClientSize(),
- // sizeChoice = m_bookctrl->GetBestFittingSize();
sizeChoice = m_controlSizer->CalcMin();
wxSize size;
{
m_strLabel = label;
m_pButton->SetLabel(GetBtnLabel());
- m_pButton->SetBestFittingSize();
+ m_pButton->SetInitialSize();
Layout();
}
// Set background
SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering
- // SetBestSize should be called last
- SetBestSize(size);
+ // SetInitialSize should be called last
+ SetInitialSize(size);
return true;
}
m_popup->SetDateValue(date.IsValid() ? date : wxDateTime::Today());
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
m_rowMinHeights(GRID_HASH_SIZE)
{
Create();
- SetBestFittingSize(size);
+ SetInitialSize(size);
}
bool wxGrid::Create(wxWindow *parent, wxWindowID id,
m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE);
Create();
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
f.SetUnderlined(true);
SetFont(f);
- SetBestFittingSize(size);
+ SetInitialSize(size);
return true;
}
m_headerWin->Show( false );
}
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
m_btn->SetRange(min, max);
m_btn->SetValue(initial);
- SetBestSize(size);
+ SetInitialSize(size);
Move(pos);
// have to disable this window to avoid interfering it with message
// get best sizes of subwindows
wxSize size1, size2;
if ( m_windowOne )
- size1 = m_windowOne->GetBestFittingSize();
+ size1 = m_windowOne->GetEffectiveMinSize();
if ( m_windowTwo )
- size2 = m_windowTwo->GetBestFittingSize();
+ size2 = m_windowTwo->GetEffectiveMinSize();
// sum them
//
m_dottedPen = wxPen( wxT("grey"), 0, 0 );
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
if (anim.IsOk())
SetAnimation(anim);
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size); // need this too because this is a wxControlWithItems
+ SetInitialSize(size); // need this too because this is a wxControlWithItems
return true;
}
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
}
else
return wxGenericColourButton::Create(parent, id, col, pos, size,
// gtk_widget_set_size_request( m_widget, setsize.x, setsize.y );
}
- SetBestSize(size); // need this too because this is a wxControlWithItems
+ SetInitialSize(size); // need this too because this is a wxControlWithItems
return true;
gtk_widget_ensure_style(m_widget);
ApplyWidgetStyle();
- SetInitialBestSize(size);
+ SetInitialSize(size);
}
// ----------------------------------------------------------------------------
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
}
else
return wxGenericFileButton::Create(parent, id, label, path, message, wildcard,
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
}
else
return wxGenericDirButton::Create(parent, id, label, path, message, wildcard,
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
}
else
return wxGenericFontButton::Create(parent, id, initial, pos, size,
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size); // need this too because this is a wxControlWithItems
+ SetInitialSize(size); // need this too because this is a wxControlWithItems
return true;
}
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size); // need this too because this is a wxControlWithItems
+ SetInitialSize(size); // need this too because this is a wxControlWithItems
return true;
}
gtk_signal_connect_after( GTK_OBJECT(combo->list), "select-child",
GTK_SIGNAL_FUNC(gtk_combo_select_child_callback), (gpointer)this );
- SetBestSize(size); // need this too because this is a wxControlWithItems
+ SetInitialSize(size); // need this too because this is a wxControlWithItems
// This is required for tool bar support
// wxSize setsize = GetSize();
gtk_widget_ensure_style(m_widget);
ApplyWidgetStyle();
- SetInitialBestSize(size);
+ SetInitialSize(size);
}
// ----------------------------------------------------------------------------
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size); // need this too because this is a wxControlWithItems
+ SetInitialSize(size); // need this too because this is a wxControlWithItems
return true;
}
InsertItems( n , choices , 0 );
// Needed because it is a wxControlWithItems
- SetBestSize( size );
+ SetInitialSize( size );
return true;
}
SetSelection( 0 );
// Needed because it is a wxControlWithItems
- SetBestSize( size );
+ SetInitialSize( size );
return true;
}
}
// Needed because it is a wxControlWithItems
- SetBestSize(size);
+ SetInitialSize(size);
SetStringSelection(value);
return true;
{
m_choice->DoAppend( choices[ i ] );
}
- SetBestSize(csize); // Needed because it is a wxControlWithItems
+ SetInitialSize(csize); // Needed because it is a wxControlWithItems
#endif
return true;
InsertItems( n, choices, 0 );
// Needed because it is a wxControlWithItems
- SetBestSize( size );
+ SetInitialSize( size );
return true;
}
//SetSize(csize);
//MacPostControlCreate(pos, csize);
- SetInitialBestSize(csize);
+ SetInitialSize(csize);
return true;
}
m_windowStyle = style;
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
- SetBestSize( size ) ;
+ SetInitialSize( size ) ;
return ret;
}
InvalidateBestSize();
#endif
- SetBestFittingSize();
+ SetInitialSize();
return true;
}
m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics) ) ;
if (!m_macIsUserPane)
- SetInitialBestSize(size);
+ SetInitialSize(size);
SetCursor( *wxSTANDARD_CURSOR ) ;
}
m_windowStyle = style;
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
- SetBestSize( size ) ;
+ SetInitialSize( size ) ;
return ret;
}
return false;
}
- SetBestSize( size ) ;
+ SetInitialSize( size ) ;
return true;
}
SubclassWin(m_hWnd);
SetPosition(pos);
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
}
// and now we may finally size the control properly (if needed)
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
// Prepare background for double-buffering
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
- // SetBestSize should be called last
- SetBestSize(size);
+ // SetInitialSize should be called last
+ SetInitialSize(size);
return true;
}
}
// set the size now if no initial size specified
- SetInitialBestSize(size);
+ SetInitialSize(size);
return true;
}
}
// now we can compute our best size correctly, so do it if necessary
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
SetSize(pos.x, pos.y, size.x, size.y);
// Now that we have items determine what is the best size and set it.
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
SubclassWin(m_hWnd);
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
}
- SetBestSize(size);
+ SetInitialSize(size);
(void)::ShowWindow(GetBuddyHwnd(), SW_SHOW);
SetImageNoCopy(image);
// GetBestSize will work properly now, so set the best size if needed
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
m_itemsClientData.SetCount(n);
// now we can compute our best size correctly, so do it if necessary
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
}
- SetBestSize(size);
+ SetInitialSize(size);
(void)::ShowWindow(GetBuddyHwnd(), SW_SHOW);
sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
}
- SetBestSize(size);
+ SetInitialSize(size);
(void)::ShowWindow(GetBuddyHwnd(), SW_SHOW);
int nEditHeight;
wxGetCharSize( GetHWND(), NULL, &nEditHeight, &vFont );
nEditHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nEditHeight);
- SetBestFittingSize(wxSize(-1,nEditHeight+4)); // +2x2 for the border
+ SetInitialSize(wxSize(-1,nEditHeight+4)); // +2x2 for the border
return true;
} // end of wxChoice::Create
int nEditHeight;
wxGetCharSize( GetHWND(), NULL, &nEditHeight, &vFont );
nEditHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nEditHeight);
- SetBestFittingSize(wxSize(-1,nEditHeight+4)); // +2x2 for the border
+ SetInitialSize(-1,nEditHeight+4)); // +2x2 for the border
if (!rsValue.empty())
{
m_palmControl = true;
- SetInitialBestSize(size);
+ SetInitialSize(size);
SetLabel(label);
Show();
return true;
m_palmField = true;
- SetInitialBestSize(size);
+ SetInitialSize(size);
SetLabel(label);
Show();
return true;
if(slider==NULL)
return false;
- SetInitialBestSize(size);
+ SetInitialSize(size);
Show();
return true;
}
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
// Tell the sizers to use the given or best size
- SetBestFittingSize(size);
+ SetInitialSize(size);
#if wxRICHTEXT_BUFFERED_PAINTING
// Create a buffer
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (size != wxDefaultSize)
- SetBestFittingSize(size);
+ SetInitialSize(size);
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
SetCodePage(wxSTC_CP_UTF8);
#endif
- SetBestFittingSize(size);
+ SetInitialSize(size);
// Reduces flicker on GTK+/X11
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
SetCodePage(wxSTC_CP_UTF8);
#endif
- SetBestFittingSize(size);
+ SetInitialSize(size);
// Reduces flicker on GTK+/X11
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
SetLabel(label);
if (bitmap.Ok())
- SetImageLabel(bitmap); // SetBestSize called by SetImageLabel()
+ SetImageLabel(bitmap); // SetInitialSize called by SetImageLabel()
else
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_BUTTON);
m_marginBmpX = x + 2;
m_marginBmpY = y + 2;
- SetBestSize(wxDefaultSize);
+ SetInitialSize(wxDefaultSize);
}
void wxButton::SetDefault()
return false;
SetLabel(label);
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_CHECKBOX);
return false;
}
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
Set(n, choices);
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_LISTBOX);
m_sizePad = GetRenderer()->GetTabPadding();
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_NOTEBOOK);
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
- SetBestSize(size);
+ SetInitialSize(size);
// override the cursor of the target window (if any)
SetCursor(wxCURSOR_ARROW);
// call this after setting the range as the best size depends (at least if
// we have wxSL_LABELS style) on the range
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_SLIDER);
wxDefaultValidator, name) )
return false;
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_SPINBTN);
SetBitmap(label);
// and adjust our size to fit it after this
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
return false;
SetLabel(label);
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
RecalcFontMetrics();
SetValue(value);
- SetBestSize(size);
+ SetInitialSize(size);
m_isEditable = !(style & wxTE_READONLY);
CreateInputHandler(wxINP_HANDLER_TOOLBAR);
- SetBestSize(size);
+ SetInitialSize(size);
return true;
}
m_needsLayout = true;
DoLayout();
- SetBestSize(wxDefaultSize);
+ SetInitialSize(wxDefaultSize);
return true;
}
self.PopupMenu(menu)
menu.Destroy()
- event.Skip()
def OnItemBackground(self, event):
col1 = data.GetColour().Get()
self.SetItemBackgroundColour(self.current, col1)
dlg.Destroy()
- event.Skip()
def OnItemForeground(self, event):
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):
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):
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):
dlg = TreeIcons(self, -1, bitmaps=bitmaps)
wx.EndBusyCursor()
dlg.ShowModal()
- event.Skip()
def SetNewIcons(self, bitmaps):
dlg.ShowModal()
dlg.Destroy()
- event.Skip()
def OnItemDelete(self, event):
self.Delete(self.current)
self.current = None
- event.Skip()
def OnItemPrepend(self, event):
self.EnsureVisible(newitem)
dlg.Destroy()
- event.Skip()
def OnItemAppend(self, event):
self.EnsureVisible(newitem)
dlg.Destroy()
- event.Skip()
def OnBeginEdit(self, event):
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)
mask = wx.Mask(bmp, wx.BLUE)
bmp.SetMask(mask)
b.SetBitmapSelected(bmp)
- b.SetBestSize()
+ b.SetInitialSize()
sizer.Add(b)
# A toggle button
bmp.SetMask(mask)
b.SetBitmapSelected(bmp)
b.SetToggle(True)
- b.SetBestSize()
+ b.SetInitialSize()
sizer.Add(b)
# A bitmap button with text.
bmp.SetMask(mask)
b.SetBitmapSelected(bmp)
b.SetUseFocusIndicator(False)
- b.SetBestSize()
+ b.SetInitialSize()
sizer.Add(b)
"ERROR",
wx.ICON_ERROR | wx.OK)
else:
- self.mc.SetBestFittingSize()
+ self.mc.SetInitialSize()
self.GetSizer().Layout()
self.slider.SetRange(0, self.mc.Length())
"ERROR",
wx.ICON_ERROR | wx.OK)
else:
- self.mc.SetBestFittingSize()
+ self.mc.SetInitialSize()
self.GetSizer().Layout()
self.slider.SetRange(0, self.mc.Length())
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)
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("")
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__
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);
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__
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);
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());
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);
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());
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);
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(
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.')
}
%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`");
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())
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
self.SetLabel(label)
self.InheritAttributes()
- self.SetBestFittingSize(size)
+ self.SetInitialSize(size)
self.InitColours()
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
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):
"""
self.SetClientSize(self._CalcSize())
width = self.GetSize().width
height = self.GetBestSize().height
- self.SetBestFittingSize((width, height))
+ self.SetInitialSize((width, height))
if value:
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):
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()
# 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
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
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):
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)
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)
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)
def SetBitmap(self, bitmap):
self._bitmap = bitmap
- self.SetBestFittingSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
+ self.SetInitialSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
self.Refresh()
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:
style = self.GetWindowStyleFlag()
self.InvalidateBestSize()
if not style & wx.ST_NO_AUTORESIZE:
- self.SetBestFittingSize(self.GetBestSize())
+ self.SetInitialSize(self.GetBestSize())
self.Refresh()
style = self.GetWindowStyleFlag()
self.InvalidateBestSize()
if not style & wx.ST_NO_AUTORESIZE:
- self.SetBestFittingSize(self.GetBestSize())
+ self.SetInitialSize(self.GetBestSize())
self.Refresh()
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)