+
+ /**
+ @name Sizing functions
+
+ See also the protected functions DoGetBestSize() and SetInitialBestSize().
+ */
+ //@{
+
+ /**
+ Sets the cached best size value.
+
+ @see GetBestSize()
+ */
+ void CacheBestSize(const wxSize& size) const;
+
+ /**
+ Converts client area size @a size to corresponding window size.
+
+ In other words, the returned value is what would GetSize() return if this
+ window had client area of given size. Components with wxDefaultCoord
+ value are left unchanged. Note that the conversion is not always
+ exact, it assumes that non-client area doesn't change and so doesn't
+ take into account things like menu bar (un)wrapping or (dis)appearance
+ of the scrollbars.
+
+ @since 2.8.8
+
+ @see WindowToClientSize()
+ */
+ virtual wxSize ClientToWindowSize(const wxSize& size) const;
+
+ /**
+ Converts window size @a size to corresponding client area size
+ In other words, the returned value is what would GetClientSize() return if
+ this window had given window size. Components with wxDefaultCoord value
+ are left unchanged.
+
+ Note that the conversion is not always exact, it assumes that
+ non-client area doesn't change and so doesn't take into account things
+ like menu bar (un)wrapping or (dis)appearance of the scrollbars.
+
+ @since 2.8.8
+
+ @see ClientToWindowSize()
+ */
+ virtual wxSize WindowToClientSize(const wxSize& size) const;
+
+ /**
+ Sizes the window so that it fits around its subwindows.
+
+ This function won't do anything if there are no subwindows and will only really
+ work correctly if sizers are used for the subwindows layout.
+
+ Also, if the window has exactly one subwindow it is better (faster and the result
+ is more precise as Fit() adds some margin to account for fuzziness of its calculations)
+ to call:
+
+ @code
+ window->SetClientSize(child->GetSize());
+ @endcode
+
+ instead of calling Fit().
+
+ @see @ref overview_windowsizing
+ */
+ virtual void Fit();
+
+ /**
+ Similar to Fit(), but sizes the interior (virtual) size of a window.
+
+ Mainly useful with scrolled windows to reset scrollbars after sizing
+ changes that do not trigger a size event, and/or scrolled windows without
+ an interior sizer. This function similarly won't do anything if there are
+ no subwindows.
+ */
+ virtual void FitInside();
+
+ /**
+ This functions returns the best acceptable minimal size for the window.
+
+ For example, for a static control, it will be the minimal size such that the
+ control label is not truncated. For windows containing subwindows (typically
+ wxPanel), the size returned by this function will be the same as the size
+ the window would have had after calling Fit().
+
+ Note that when you write your own widget you need to override the
+ DoGetBestSize() function instead of this (non-virtual!) function.
+
+ @see CacheBestSize(), @ref overview_windowsizing
+ */
+ wxSize GetBestSize() const;
+
+ /**
+ Returns the size of the window 'client area' in pixels.
+
+ The client area is the area which may be drawn on by the programmer,
+ excluding title bar, border, scrollbars, etc.
+ Note that if this window is a top-level one and it is currently minimized, the
+ return size is empty (both width and height are 0).
+
+ @beginWxPerlOnly
+ In wxPerl this method takes no parameters and returns
+ a 2-element list (width, height).
+ @endWxPerlOnly
+
+ @see GetSize(), GetVirtualSize()
+ */
+ void GetClientSize(int* width, int* height) const;
+
+ /**
+ @overload
+ */
+ wxSize GetClientSize() const;
+
+ /**
+ 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
+ amount of space to allocate for the widget.
+
+ This is the method called by a wxSizer when it queries the size
+ of a window or control.
+
+ @see GetBestSize(), SetInitialSize(), @ref overview_windowsizing
+ */
+ virtual wxSize GetEffectiveMinSize() const;
+
+ /**
+ Returns the maximum size of window's client area.
+
+ This is an indication to the sizer layout mechanism that this is the maximum
+ possible size as well as the upper bound on window's size settable using
+ SetClientSize().
+
+ @see GetMaxSize(), @ref overview_windowsizing
+ */
+ virtual wxSize GetMaxClientSize() const;
+
+ /**
+ Returns the maximum size of the window.
+
+ This is an indication to the sizer layout mechanism that this is the maximum
+ possible size as well as the upper bound on window's size settable using SetSize().
+
+ @see GetMaxClientSize(), @ref overview_windowsizing
+ */
+ virtual wxSize GetMaxSize() const;
+
+ /**
+ Returns the minimum size of window's client area, an indication to the sizer
+ layout mechanism that this is the minimum required size of its client area.
+
+ It normally just returns the value set by SetMinClientSize(), but it can be
+ overridden to do the calculation on demand.
+
+ @see GetMinSize(), @ref overview_windowsizing
+ */
+ virtual wxSize GetMinClientSize() const;
+
+ /**
+ Returns the minimum size of the window, an indication to the sizer layout
+ mechanism that this is the minimum required size.
+
+ This method normally just returns the value set by SetMinSize(), but it
+ can be overridden to do the calculation on demand.
+
+ @see GetMinClientSize(), @ref overview_windowsizing
+ */
+ virtual wxSize GetMinSize() const;
+
+ int GetMinWidth() const;
+ int GetMinHeight() const;
+ int GetMaxWidth() const;
+ int GetMaxHeight() const;
+
+ /**
+ Returns the size of the entire window in pixels, including title bar, border,
+ scrollbars, etc.
+
+ Note that if this window is a top-level one and it is currently minimized, the
+ returned size is the restored window size, not the size of the window icon.
+
+ @param width
+ Receives the window width.
+ @param height
+ Receives the window height.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetSizeWH() returning
+ a 2-element list (width, height).
+ @endWxPerlOnly
+
+ @see GetClientSize(), GetVirtualSize(), @ref overview_windowsizing
+ */
+ void GetSize(int* width, int* height) const;
+
+ /**
+ See the GetSize(int*,int*) overload for more info.
+ */
+ wxSize GetSize() const;
+
+ /**
+ This gets the virtual size of the window in pixels.
+ By default it returns the client size of the window, but after a call to
+ SetVirtualSize() it will return the size set with that method.
+
+ @see @ref overview_windowsizing
+ */
+ wxSize GetVirtualSize() const;
+
+ /**
+ Like the other GetVirtualSize() overload but uses pointers instead.
+
+ @param width
+ Receives the window virtual width.
+ @param height
+ Receives the window virtual height.
+ */
+ void GetVirtualSize(int* width, int* height) const;
+
+ /**
+ Return the largest of ClientSize and BestSize (as determined
+ by a sizer, interior children, or other means)
+ */
+ virtual wxSize GetBestVirtualSize() const;
+
+ /**
+ Returns the size of the left/right and top/bottom borders of this window in x
+ and y components of the result respectively.
+ */
+ virtual wxSize GetWindowBorderSize() const;
+
+ /**
+ wxSizer and friends use this to give a chance to a component to recalc
+ its min size once one of the final size components is known. Override
+ this function when that is useful (such as for wxStaticText which can
+ stretch over several lines). Parameter availableOtherDir
+ tells the item how much more space there is available in the opposite
+ direction (-1 if unknown).
+ */
+ virtual bool
+ InformFirstDirection(int direction,
+ int size,
+ int availableOtherDir);
+
+ /**
+ Resets the cached best size value so it will be recalculated the next time it
+ is needed.
+
+ @see CacheBestSize()
+ */
+ void InvalidateBestSize();
+
+ /**
+ Posts a size event to the window.
+
+ This is the same as SendSizeEvent() with @c wxSEND_EVENT_POST argument.
+ */
+ void PostSizeEvent();
+
+ /**
+ Posts a size event to the parent of this window.
+
+ This is the same as SendSizeEventToParent() with @c wxSEND_EVENT_POST
+ argument.
+ */
+ void PostSizeEventToParent();
+
+ /**
+ This function sends a dummy @ref wxSizeEvent "size event" to
+ the window allowing it to re-layout its children positions.
+
+ It is sometimes useful to call this function after adding or deleting a
+ children after the frame creation or if a child size changes. Note that
+ if the frame is using either sizers or constraints for the children
+ layout, it is enough to call wxWindow::Layout() directly and this
+ function should not be used in this case.
+
+ If @a flags includes @c wxSEND_EVENT_POST value, this function posts
+ the event, i.e. schedules it for later processing, instead of
+ dispatching it directly. You can also use PostSizeEvent() as a more
+ readable equivalent of calling this function with this flag.
+
+ @param flags
+ May include @c wxSEND_EVENT_POST. Default value is 0.
+ */
+ virtual void SendSizeEvent(int flags = 0);
+
+ /**
+ Safe wrapper for GetParent()->SendSizeEvent().
+
+ This function simply checks that the window has a valid parent which is
+ not in process of being deleted and calls SendSizeEvent() on it. It is
+ used internally by windows such as toolbars changes to whose state
+ should result in parent re-layout (e.g. when a toolbar is added to the
+ top of the window, all the other windows must be shifted down).
+
+ @see PostSizeEventToParent()
+
+ @param flags
+ See description of this parameter in SendSizeEvent() documentation.
+ */
+ void SendSizeEventToParent(int flags = 0);
+