Minor doc updates,
Made resizing a scrolled window function, git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -7,7 +7,8 @@ is selected, the previous selection is removed) or multiple selection
|
|||||||
(clicking an item toggles the item on or off independently of other
|
(clicking an item toggles the item on or off independently of other
|
||||||
selections).
|
selections).
|
||||||
|
|
||||||
List box elements are numbered from zero.
|
List box elements are numbered from zero. Their number is limited in
|
||||||
|
some platforms (e.g. ca. 2000 on GTK).
|
||||||
|
|
||||||
A listbox callback gets an event wxEVT\_COMMAND\_LISTBOX\_SELECT for single clicks, and
|
A listbox callback gets an event wxEVT\_COMMAND\_LISTBOX\_SELECT for single clicks, and
|
||||||
wxEVT\_COMMAND\_LISTBOX\_DOUBLE\_CLICKED for double clicks.
|
wxEVT\_COMMAND\_LISTBOX\_DOUBLE\_CLICKED for double clicks.
|
||||||
|
@@ -14,6 +14,12 @@ If you don't wish to calculate your own scrolling, you must call PrepareDC when
|
|||||||
within OnDraw, to set the device origin for the device context according to the current
|
within OnDraw, to set the device origin for the device context according to the current
|
||||||
scroll position.
|
scroll position.
|
||||||
|
|
||||||
|
Note that the underlying system knows nothing about scrolling coordinates, so that all system
|
||||||
|
functions (mouse events, expose events, refresh calls etc) as well as the position of subwindows
|
||||||
|
are relative to the "physical" origin of the scrolled window. If the user insert a child window at
|
||||||
|
position (10,10) and scrolls the window down 100 pixels (moving the child window out of the visible
|
||||||
|
area), the child window will report a position of (10,-90).
|
||||||
|
|
||||||
\wxheading{Derived from}
|
\wxheading{Derived from}
|
||||||
|
|
||||||
\helpref{wxPanel}{wxpanel}\\
|
\helpref{wxPanel}{wxpanel}\\
|
||||||
@@ -139,7 +145,9 @@ Enable or disable physical scrolling in the given direction. Physical
|
|||||||
scrolling is the physical transfer of bits up or down the
|
scrolling is the physical transfer of bits up or down the
|
||||||
screen when a scroll event occurs. If the application scrolls by a
|
screen when a scroll event occurs. If the application scrolls by a
|
||||||
variable amount (e.g. if there are different font sizes) then physical
|
variable amount (e.g. if there are different font sizes) then physical
|
||||||
scrolling will not work, and you should switch it off.
|
scrolling will not work, and you should switch it off. Note that you
|
||||||
|
will have to reposition child windows yourself, if physical scrolling
|
||||||
|
is disabled.
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
@@ -95,11 +95,11 @@ section.
|
|||||||
|
|
||||||
\subsection{Unicode support in wxWindows}
|
\subsection{Unicode support in wxWindows}
|
||||||
|
|
||||||
In wxWindows, the code fragment froim above should be written instead:
|
In wxWindows, the code fragment from above should be written instead:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
wxChar ch = T('*');
|
wxChar ch = wxT('*');
|
||||||
wxString s = T("Hello, world!");
|
wxString s = wxT("Hello, world!");
|
||||||
int len = s.Len();
|
int len = s.Len();
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
@@ -114,22 +114,22 @@ a separate type for strings though, because the standard
|
|||||||
\helpref{wxString}{wxstring} supports Unicode, i.e. it stores iether ANSI or
|
\helpref{wxString}{wxstring} supports Unicode, i.e. it stores iether ANSI or
|
||||||
Unicode strings depending on the mode.
|
Unicode strings depending on the mode.
|
||||||
|
|
||||||
Finally, there is a special {\tt T()} macro which should enclose all literal
|
Finally, there is a special {\tt wxT()} macro which should enclose all literal
|
||||||
strings in the program. As it's easy to see comparing the last fragment with
|
strings in the program. As it's easy to see comparing the last fragment with
|
||||||
the one above, this macro expands to nothing in the (usual) ANSI mode and
|
the one above, this macro expands to nothing in the (usual) ANSI mode and
|
||||||
prefixes {\tt 'L'} to its argument in the Unicode mode.
|
prefixes {\tt 'L'} to its argument in the Unicode mode.
|
||||||
|
|
||||||
The important conclusion is that if you use {\tt wxChar} instead of
|
The important conclusion is that if you use {\tt wxChar} instead of
|
||||||
{\tt char}, avoid using C style strings and use {\tt wxString} instead and
|
{\tt char}, avoid using C style strings and use {\tt wxString} instead and
|
||||||
don't forget to enclose all string literals inside {\tt T()} macro, your
|
don't forget to enclose all string literals inside {\tt wxT()} macro, your
|
||||||
program automatically becomes (almost) Unicode compliant!
|
program automatically becomes (almost) Unicode compliant!
|
||||||
|
|
||||||
Just let us state once again the rules:
|
Just let us state once again the rules:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item Always use {\tt wxChar} instead of {\tt char}
|
\item Always use {\tt wxChar} instead of {\tt char}
|
||||||
\item Always enclose literal string constants in {\tt T()} macro unless
|
\item Always enclose literal string constants in {\tt wxT()} macro unless
|
||||||
they're already converted to the right representation (another standard
|
they're already converted to the right representation (another standard
|
||||||
wxWindows macro {\tt \_()} does it, so there is no need for {\tt T()} in this
|
wxWindows macro {\tt \_()} does it, so there is no need for {\tt wxT()} in this
|
||||||
case) or you intend to pass the constant directly to an external function
|
case) or you intend to pass the constant directly to an external function
|
||||||
which doesn't accept wide-character strings.
|
which doesn't accept wide-character strings.
|
||||||
\item Use {\tt wxString} instead of C style strings.
|
\item Use {\tt wxString} instead of C style strings.
|
||||||
|
@@ -28,10 +28,10 @@ window class or on all platforms.
|
|||||||
\twocolwidtha{5cm}%
|
\twocolwidtha{5cm}%
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
|
\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
|
||||||
for this style. Windows only. }
|
for this style. }
|
||||||
\twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows only.}
|
\twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows only.}
|
||||||
\twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.}
|
\twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.}
|
||||||
\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border.}
|
\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border. GTK only. }
|
||||||
\twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control. Windows only. }
|
\twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control. Windows only. }
|
||||||
\twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint
|
\twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint
|
||||||
events. Windows only.}
|
events. Windows only.}
|
||||||
|
@@ -124,7 +124,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
|
m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
|
||||||
|
|
||||||
(void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150) );
|
(void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150), wxSize(80,-1) );
|
||||||
|
|
||||||
(void) new wxRadioButton( this, -1, "Disable", wxPoint(10,190) );
|
(void) new wxRadioButton( this, -1, "Disable", wxPoint(10,190) );
|
||||||
|
|
||||||
|
@@ -305,10 +305,13 @@ int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adjust the scrollbars - new version.
|
// Adjust the scrollbars - new version.
|
||||||
void wxScrolledWindow::AdjustScrollbars(void)
|
void wxScrolledWindow::AdjustScrollbars()
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
|
|
||||||
|
int oldXScroll = m_xScrollPosition;
|
||||||
|
int oldYScroll = m_yScrollPosition;
|
||||||
|
|
||||||
if (m_xScrollLines > 0)
|
if (m_xScrollLines > 0)
|
||||||
{
|
{
|
||||||
@@ -353,6 +356,22 @@ void wxScrolledWindow::AdjustScrollbars(void)
|
|||||||
m_yScrollPosition = 0;
|
m_yScrollPosition = 0;
|
||||||
SetScrollbar (wxVERTICAL, 0, 0, 0, FALSE);
|
SetScrollbar (wxVERTICAL, 0, 0, 0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldXScroll != m_xScrollPosition)
|
||||||
|
{
|
||||||
|
if (m_xScrollingEnabled)
|
||||||
|
ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll-m_xScrollPosition), 0, (const wxRect *) NULL );
|
||||||
|
else
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldYScroll != m_yScrollPosition)
|
||||||
|
{
|
||||||
|
if (m_yScrollingEnabled)
|
||||||
|
ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), (const wxRect *) NULL );
|
||||||
|
else
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default OnSize resets scrollbars, if any
|
// Default OnSize resets scrollbars, if any
|
||||||
|
Reference in New Issue
Block a user