]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/window.h
ensure that wxToolBar has one of wxTB_TOP/LEFT/RIGHT/BOTTOM styles set, otherwise...
[wxWidgets.git] / include / wx / window.h
index c545e576a0cb2f7acef5b74dcec64902b4b42314..3d39594bc41554c7b11c7b05ac9e609ef26771fb 100644 (file)
@@ -353,26 +353,19 @@ public:
     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
 
         // 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
@@ -420,17 +413,24 @@ public:
         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
@@ -1278,18 +1278,8 @@ protected:
     // 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
 
 
 
@@ -1396,6 +1386,30 @@ private:
     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
 // ----------------------------------------------------------------------------