void CacheBestSize(const wxSize& size) const
{ wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; }
- // There are times (and windows) where 'Best' size and 'Min' size
- // are vastly out of sync. This should be remedied somehow, but in
- // the meantime, this method will return the larger of BestSize
- // (the window's smallest legible size), and any user specified
- // MinSize hint.
- wxSize GetAdjustedBestSize() const
- {
- wxSize s( GetBestSize() );
- return wxSize( wxMax( s.x, GetMinWidth() ), wxMax( s.y, GetMinHeight() ) );
- }
// 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
+ wxDEPRECATED( wxSize GetAdjustedMinSize() 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
virtual void FitInside();
- // Methods for setting size hints. This is only used
- // for toplevel windows.
+ // SetSizeHints is actually for setting the size hints
+ // for the wxTLW for a Window Manager - hence the name -
+ // and it is therefore overridden in wxTLW to do that.
+ // In wxWindow(Base), it has (unfortunately) been abused
+ // to mean the same as SetMinSize() and SetMaxSize().
virtual void SetSizeHints( int minW, int minH,
int maxW = wxDefaultCoord, int maxH = wxDefaultCoord,
const wxSize& incSize=wxDefaultSize)
{ DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); }
- virtual void DoSetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH),
- int WXUNUSED(maxW), int WXUNUSED(maxH),
- int WXUNUSED(incW), int WXUNUSED(incH) )
- {
- }
+ virtual void DoSetSizeHints( int minW, int minH,
+ int maxW, int maxH,
+ int incW, int incH );
// Methods for setting virtual size hints
// FIXME: What are virtual size hints?
SetVirtualSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y);
}
- int GetMinWidth() const { return GetMinSize().x; }
- int GetMinHeight() const { return GetMinSize().y; }
- int GetMaxWidth() const { return GetMaxSize().x; }
- int GetMaxHeight() const { return GetMaxSize().y; }
- // Override these methods to impose restrictions on min/max size
+ // Call these to override what GetBestSize() returns. This
+ // method is only virtual because it is overriden in wxTLW
+ // as a different API for SetSizeHints().
+ virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; }
+ virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; }
+
+ // Override these methods to impose restrictions on min/max size.
+ // The easier way is to call SetMinSize() and SetMaxSize() which
+ // will have the same effect. Doing both is non-sense.
virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); }
virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); }
- void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; }
- void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; }
+ // Get the min and max values one by one
+ int GetMinWidth() const { return GetMinSize().x; }
+ int GetMinHeight() const { return GetMinSize().y; }
+ int GetMaxWidth() const { return GetMaxSize().x; }
+ int GetMaxHeight() const { return GetMaxSize().y; }
// Methods for accessing the virtual size of a window. For most
return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) );
}
+ // return the size of the left/right and top/bottom borders in x and y
+ // components of the result respectively
+ virtual wxSize GetWindowBorderSize() const;
+
+
// window state
// ------------
// 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
// ----------------------------------------------------------------------------