updates for scrolling/sizing methods.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6,26 +6,45 @@ scroll positions, thumb sizes and ranges according to the area in view.
|
||||
|
||||
Starting from version 2.4 of wxWindows, there are several ways to use a
|
||||
wxScrolledWindow. In particular, there are now three ways to set the
|
||||
size of the scrolling area: One way is to set the scrollbars directly
|
||||
using a call to
|
||||
size of the scrolling area:
|
||||
|
||||
One way is to set the scrollbars directly using a call to
|
||||
\helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars}.
|
||||
This is the way it used to be in any previous version of wxWindows
|
||||
and it will be kept for backwards compatibility.
|
||||
Additionally you can set the total size of the scrolling area by
|
||||
calling \helpref{wxWindow::SetVirtualSize}{wxwindowsetvirtualsize}
|
||||
and further fine-tune the desired scrolling behaviour by calling
|
||||
\helpref{wxWindow::SetVirtualSizeHints}{wxwindowsetvirtualsizehints}
|
||||
to limit how much the scrolling area can change its size. The last
|
||||
and newest way is to let sizers determine the scrolling area. This
|
||||
is actually the default now when you use sizers at all, i.e. if you
|
||||
set a sizer to a wxScrolledWindow with
|
||||
\helpref{wxWindow::SetSizer}{wxwindowsetsizer},
|
||||
then the scrolling area will be the size requested by the sizer. This
|
||||
fully automatic way can be partially overridden by calling
|
||||
\helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars}
|
||||
later.
|
||||
|
||||
As with all windows, an application can draw onto a wxScrolledWindow using a \helpref{device context}{dcoverview}.
|
||||
An additional method of manual control, which requires a little less
|
||||
computation of your own, is to set the total size of the scrolling area by
|
||||
calling either \helpref{wxWindow::SetVirtualSize}{wxwindowsetvirtualsize},
|
||||
or \helpref{wxWindow::FitInside}{wxwindowfitinside}, and setting the
|
||||
scrolling increments for it by calling
|
||||
\helpref{wxScrolledWindow::SetScrollRate}{wxscrolledwindowsetscrollrate}.
|
||||
Scrolling in some orientation is enabled by setting a non zero increment
|
||||
for it.
|
||||
|
||||
The most automatic and newest way is to simply let sizers determine the
|
||||
scrolling area. This is now the default when you set an interior sizer
|
||||
into a wxScrolledWindow with \helpref{wxWindow::SetSizer}{wxwindowsetsizer}.
|
||||
The scrolling area will be set to the size requested by the sizer and
|
||||
the scrollbars will be assigned for each orientation according to the need
|
||||
for them and the scrolling increment set by
|
||||
\helpref{wxScrolledWindow::SetScrollRate}{wxscrolledwindowsetscrollrate}.
|
||||
As above, scrolling is only enabled in orientations with a non-zero
|
||||
increment. You can influence the minimum size of the scrolled area
|
||||
controlled by a sizer by calling
|
||||
\helpref{wxWindow::SetVirtualSizeHints}{wxwindowsetvirtualsizehints}.
|
||||
(calling \helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars}
|
||||
has analogous effects in wxWindows 2.4 -- in later versions it may not continue
|
||||
to override the sizer)
|
||||
|
||||
Note: if Maximum size hints are still supported by SetVirtualSizeHints, use
|
||||
them at your own dire risk. They may or may not have been removed for 2.4,
|
||||
but it really only makes sense to set minimum size hints here. We should
|
||||
probably replace SetVirtualSizeHints with SetMinVirtualSize or similar
|
||||
and remove it entirely in future.
|
||||
|
||||
As with all windows, an application can draw onto a wxScrolledWindow using
|
||||
a \helpref{device context}{dcoverview}.
|
||||
|
||||
You have the option of handling the OnPaint handler
|
||||
or overriding the \helpref{OnDraw}{wxscrolledwindowondraw} function, which is passed
|
||||
|
@@ -106,7 +106,7 @@ in the main orientation using wxALIGN\_CENTER\_VERTICAL (same as
|
||||
wxALIGN\_CENTRE\_VERTICAL) and wxALIGN\_CENTER\_HORIZONTAL (same as
|
||||
wxALIGN\_CENTRE\_HORIZONTAL) flags. Finally, you can also specify
|
||||
wxADJUST\_MINSIZE flag to make the minimal size of the control dynamically adjust
|
||||
to the value returned by its \helpref{GetBestSize()}{wxwindowgetbestsize}
|
||||
to the value returned by its \helpref{GetAdjustedBestSize()}{wxwindowgetadjustedbestsize}
|
||||
method - this allows, for example, for correct relayouting of a static text
|
||||
control even if its text is changed during run-time.}
|
||||
|
||||
|
@@ -521,6 +521,16 @@ The search is recursive in both cases.
|
||||
Sizes the window so that it fits around its subwindows. This function won't do
|
||||
anything if there are no subwindows.
|
||||
|
||||
\membersection{wxWindow::FitInside}\label{wxwindowfitinside}
|
||||
|
||||
\func{virtual void}{FitInside}{\void}
|
||||
|
||||
Similar to \helpref{Fit}{wxwindowfit}, 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.
|
||||
|
||||
\membersection{wxWindow::Freeze}\label{wxwindowfreeze}
|
||||
|
||||
\func{virtual void}{Freeze}{\void}
|
||||
@@ -535,6 +545,16 @@ wxTextCtrl under wxGTK) but is not implemented on all platforms nor for all
|
||||
controls so it is mostly just a hint to wxWindows and not a mandatory
|
||||
directive.
|
||||
|
||||
\membersection{wxWindow::GetAdjustedBestSize}\label{wxwindowgetadjustedbestsize}
|
||||
|
||||
\constfunc{wxSize}{GetAdjustedBestSize}{\void}
|
||||
|
||||
This method is similar to \helpref{GetBestSize}{wxwindowgetbestsize}, except
|
||||
in one thing. GetBestSize should return the minimum untruncated size of the
|
||||
window, while this method will return the largest of BestSize and any user
|
||||
specified minimum size. ie. it is the minimum size the window should currently
|
||||
be drawn at, not the minimal size it can possibly tolerate.
|
||||
|
||||
\membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour}
|
||||
|
||||
\constfunc{virtual wxColour}{GetBackgroundColour}{\void}
|
||||
|
Reference in New Issue
Block a user