Began docs on sizers,
Correted a few other docs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,24 +1,91 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% include\wx\sizer.h at 13/Aug/99 22:27:59
|
||||
%
|
||||
|
||||
|
||||
\section{\class{wxBoxSizer}}\label{wxboxsizer}
|
||||
|
||||
The basic idea behind a box sizer is that windows will most often be laid out in rather
|
||||
simple basic geomerty, typically in a row or a column or several hierachies of either.
|
||||
|
||||
As an exmaple, we will construct a dialog that will contain a text field at the top and
|
||||
two buttons at the bottom. This can be seen as a top-hierarchy column with the text at
|
||||
the top and buttons at the bottom and a low-hierchary row with an OK button to the left
|
||||
and a Cancel button to the right. In many cases (particulary dialogs under Unix and
|
||||
normal frames) the main window will be resizable by the user and this change of size
|
||||
will have to get propagated to its children. In our case, we want the text area to grow
|
||||
with the dialog, whereas the button shall have a fixed size. In addition, there will be
|
||||
a thin border around all controls to make the dialog look nice and - to make matter worse -
|
||||
the buttons shall be centred as the width of the dialog changes.
|
||||
|
||||
It is the unique feature of a box sizer, that it can grow in both directions (height and
|
||||
width) but can distribute its growth in the main direction (horizontal for a row) {\it unevenly}
|
||||
among its children. In our example case, the vertical sizer is supposed to propagate all its
|
||||
height changes to only the text area, not to the button area. This is determined by the
|
||||
{\it option} parameter when adding a window (or another sizer) to a sizer. It is interpreted
|
||||
as a weight factor, i.e. it can be zero, indicating that the window may not be resized
|
||||
at all, or above zero. If several windows have a value above zero, the value is interpreted
|
||||
relative to the sum of all weight factors of the sizer, so when adding two windows with
|
||||
a value of 1, they will both get resized equally much and each half as much as the sizer
|
||||
owning them. Then what do we do when a column sizer changes its width? This behaviour is
|
||||
controlled by {\it flags} (the second parameter of the Add() function): Zero or no flag indicates that
|
||||
the window will get aligned at the left (in a column sizer) and the top (row sizer), whereas
|
||||
wxALIGN\_RIGHT and wxALIGN\_BOTTOM will do what they say. The item can also be centered
|
||||
using the wxCENTRE flag (same as wxCENTER) or it can be forced to grow with the sizer (using
|
||||
the wxGROW flag (same as wxEXPAND)).
|
||||
|
||||
As mentioned above, any window belonging to a sizer may have border, and it can be specified
|
||||
which of the four sides may have this border, using the wxTOP, wxLEFT, wxRIGHT and wxBOTTOM
|
||||
constants or wxALL for all directions (and you may also use wxNORTH, wxWEST etc instead). These
|
||||
flags can be used in combintaion with the alignement flags above as the second paramter of the
|
||||
Add() method using the binary or operator |. The sizer of the border also must be made known,
|
||||
and it is the third parameter in the Add() method. This means, that the entire behaviour of
|
||||
a sizer and its children can be controlled by the three parameters of the Add() method.
|
||||
|
||||
\begin{verbatim}
|
||||
// we want to get a dialog that is stretchable because it
|
||||
// has a text ctrl at the top and two buttons at the bottom
|
||||
|
||||
MyDialog::MyDialog(wxFrame *parent, wxWindowID id, const wxString &title ) :
|
||||
wxDialog( parent, id, title, wxDefaultPosition, wxDefaultSize, wxDIALOG_STYLE | wxRESIZE_BORDER )
|
||||
{
|
||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
// create text ctrl with minimal size 100x60
|
||||
topsizer->Add(
|
||||
new wxTextCtrl( this, -1, "My text.", wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
|
||||
1, // make vertically stretchable
|
||||
wxEXPAND | // make horizontally stretchable
|
||||
wxALL, // and make border all around
|
||||
10 ); // set border width to 10
|
||||
|
||||
|
||||
wxBoxSizer
|
||||
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
button_sizer->Add(
|
||||
new wxButton( this, wxID_OK, "OK" ),
|
||||
0, // make horizontally unstretchable
|
||||
wxALL, // make border all around (implicit top alignment)
|
||||
10 ); // set border width to 10
|
||||
button_sizer->Add(
|
||||
new wxButton( this, wxID_CANCEL, "Cancel" ),
|
||||
0, // make horizontally unstretchable
|
||||
wxALL, // make border all around (implicit top alignment)
|
||||
10 ); // set border width to 10
|
||||
|
||||
topsizer->Add(
|
||||
button_sizer,
|
||||
0, // make vertically unstretchable
|
||||
wxCENTER ); // no border and centre horizontally
|
||||
|
||||
SetAutoLayout( TRUE ); // tell dialog to use sizer
|
||||
SetSizer( topsizer ); // actually set the sizer
|
||||
|
||||
topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
|
||||
topsizer->SetSizeHints( this ); // set size hints to honour mininum size
|
||||
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxSizer}{wxsizer}
|
||||
|
||||
\wxheading{Data structures}
|
||||
|
||||
}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
@@ -26,6 +93,8 @@ wxBoxSizer
|
||||
|
||||
\func{}{wxBoxSizer}{\param{int }{orient}}
|
||||
|
||||
Constructor for a wxBoxSizer. {\it orient} may be either of wxVERTICAL
|
||||
or wxHORIZONTAL for creating either a column sizer or a row sizer.
|
||||
|
||||
\membersection{wxBoxSizer::RecalcSizes}\label{wxboxsizerrecalcsizes}
|
||||
|
||||
|
@@ -100,9 +100,22 @@ that are not static can have \helpref{validators}{wxvalidator} associated with t
|
||||
|
||||
{\large {\bf Window layout}}
|
||||
|
||||
\overview{Overview}{constraintsoverview}
|
||||
There are two different systems for layouting windows (and dialogs in particluar).
|
||||
One is based upon so-called sizers and it requires less typing, thinking and calculating
|
||||
and will in almost all cases produce dialogs looking equally well on all platforms, the
|
||||
other is based on so-called constraints and allows for more detailed layouts.
|
||||
|
||||
These are the classes relevant to automated window layout.
|
||||
These are the classes relevant to the sizer-based layout.
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{\helpref{wxSizer}{wxsizer}}{Abstract base class}
|
||||
\twocolitem{\helpref{wxBoxSizer}{wxboxsizer}}{A sizer for laying out windows in a row or column}
|
||||
\twocolitem{\helpref{wxStaticBoxSizer}{wxstaticboxsizer}}{Same as wxBoxSizer, but with surrounding static box}
|
||||
\end{twocollist}
|
||||
|
||||
\overview{Overview}{constraintsoverview} over the constraints-based layout.
|
||||
|
||||
These are the classes relevant to constraints-based window layout.
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{\helpref{wxIndividualLayoutConstraint}{wxindividuallayoutconstraint}}{Represents a single constraint dimension}
|
||||
@@ -268,7 +281,8 @@ classes, functions and macros.
|
||||
\overview{Overview}{ipcoverview}
|
||||
|
||||
wxWindows provides a simple interprocess communications facilities
|
||||
based on DDE.
|
||||
based on DDE. [Note that this is currently work in progress and may not
|
||||
function properly.]
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{\helpref{wxDDEClient}{wxddeclient}}{Represents a client}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
\input array.tex
|
||||
\input arrstrng.tex
|
||||
\input autoobj.tex
|
||||
\input boxsizer.tex
|
||||
\input busycurs.tex
|
||||
\input busyinfo.tex
|
||||
\input button.tex
|
||||
@@ -172,6 +173,7 @@
|
||||
\input sashevt.tex
|
||||
\input sashlayw.tex
|
||||
\input sashwin.tex
|
||||
\input sbsizer.tex
|
||||
\input screendc.tex
|
||||
\input scrolbar.tex
|
||||
\input scrlwevt.tex
|
||||
@@ -180,6 +182,7 @@
|
||||
\input sngchdlg.tex
|
||||
\input size.tex
|
||||
\input sizeevt.tex
|
||||
\input sizer.tex
|
||||
\input slider.tex
|
||||
\input sckaddr.tex
|
||||
\input socket.tex
|
||||
|
@@ -1,22 +1,30 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% include\wx\sizer.h at 13/Aug/99 22:27:59
|
||||
%
|
||||
|
||||
|
||||
\section{\class{wxSizer}}\label{wxsizer}
|
||||
|
||||
wxSizer is the abstract base class used for layouting subwindows in a window. You
|
||||
cannot use wxSizer directly; instead, you'll have to use \helpref{wxBoxSizer}{wxboxsizer}
|
||||
or \helpref{wxStaticBoxSizer}{wxstaticboxsizer}.
|
||||
|
||||
The layouting algorithm used by sizers in wxWindows closely related to layouting
|
||||
in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit. It is
|
||||
based upon the idea of the individual subwindows reporting their minimal required
|
||||
size and their ability to get stretched if the size of the parent window has changed.
|
||||
This will most often mean, that the programmer does not set the original size of
|
||||
the dialog in the beginning, rather the top-most sizer will get queried and it will
|
||||
then query its children. Its children can be normal windows or other sizers, so that
|
||||
a hierachy of sizer can be constructed. Note that sizer are not derived from wxWindows
|
||||
and thus do not interfere with tab ordering and require very little resources compared
|
||||
to a real window on screen.
|
||||
|
||||
wxSizer
|
||||
|
||||
What makes sizers so well fitted for use in wxWindows, is the fact that every control
|
||||
reports its own minimal size and the algorithm can handle differences in font sizes
|
||||
or different window (dialog item) sizes on different platforms without problems. If e.g.
|
||||
the standard font as well as the overall design of Motif widgets requires more space than
|
||||
on Windows, the intial dialog size will automatically be bigger on Motif than on Windows.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Data structures}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
|
@@ -46,27 +46,32 @@ functions that take a wxTreeEvent argument.
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxTreeEvent::m\_code}
|
||||
\membersection{wxTreeEvent::GetItem}
|
||||
|
||||
\member{int}{m\_code}
|
||||
\constfunc{wxTreeItemId}{GetItem}{}
|
||||
|
||||
Key code if the event is a keypress event.
|
||||
Returns he item (valid for all events).
|
||||
|
||||
\membersection{wxTreeEvent::m\_itemIndex}
|
||||
\membersection{wxTreeEvent::GetOldItem}
|
||||
|
||||
\member{wxTreeItem}{m\_item}
|
||||
\constfunc{wxTreeItemId}{GetOldItem}{}
|
||||
|
||||
The item (valid for all events).
|
||||
Returns the old item index (valid for EVT\_TREE\_ITEM\_CHANGING and CHANGED events)
|
||||
|
||||
\membersection{wxTreeEvent::m\_oldItem}
|
||||
\membersection{wxTreeEvent::GetPoint()}
|
||||
|
||||
\member{long}{m\_oldItem}
|
||||
\constfunc{wxPoint}{GetPoint}{}
|
||||
|
||||
The old item index (valid for EVT\_TREE\_ITEM\_CHANGING and CHANGED events)
|
||||
Returns the position of the mouse pointer if the event is a drag event.
|
||||
|
||||
\membersection{wxTreeEvent::m\_pointDrag}
|
||||
\membersection{wxTreeEvent::GetCode}
|
||||
|
||||
\member{wxPoint}{m\_pointDrag}
|
||||
\constfunc{int}{GetCode}{}
|
||||
|
||||
The position of the mouse pointer if the event is a drag event.
|
||||
The key code if the event was is a key event.
|
||||
|
||||
\membersection{wxTreeEvent::GetLabel}
|
||||
|
||||
\constfunc{const wxString&}{GetLabel}{}
|
||||
|
||||
Returns the label if the event was a begin or end edit label event.
|
||||
|
@@ -772,12 +772,16 @@ Returns TRUE if the window is enabled for input, FALSE otherwise.
|
||||
|
||||
\helpref{wxWindow::Enable}{wxwindowenable}
|
||||
|
||||
\memebersection{wxWindow:IsExposed}\label{wxwindowisexposed}
|
||||
\membersection{wxWindow:IsExposed}\label{wxwindowisexposed}
|
||||
|
||||
\constfunc{bool}{IsExposed}{\param{int }{x}, \param{int }{y}}
|
||||
|
||||
\constfunc{bool}{IsExposed}{\param{wxPoint }{&pt}}
|
||||
|
||||
\constfunc{bool}{IsExposed}{\param{int }{x}, \param{int }{y}, \param{int }{w}, \param{int }{h}}
|
||||
|
||||
\constfunc{bool}{IsExposed}{\param{wxRectangle }{&rect}}
|
||||
|
||||
Returns TRUE if the given point or rectange area has been exposed since the
|
||||
last repaint. Call this in an paint event handler to optimize redrawing by
|
||||
only redrawing those area, which have been exposed.
|
||||
@@ -810,7 +814,8 @@ window).
|
||||
|
||||
\func{void}{Layout}{\void}
|
||||
|
||||
Invokes the constraint-based layout algorithm for this window.
|
||||
Invokes the constraint-based layout algorithm or the sizer-based algorithm
|
||||
for this window.
|
||||
|
||||
See \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} on when
|
||||
this function gets called automatically using auto layout.
|
||||
@@ -1688,7 +1693,9 @@ Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxa
|
||||
\func{void}{SetAutoLayout}{\param{const bool}{ autoLayout}}
|
||||
|
||||
Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will
|
||||
be called automatically when the window is resized.
|
||||
be called automatically when the window is resized. Use in connection with
|
||||
\helpref{wxWindow::SetSizer}{wxwindowsetsizer} and
|
||||
\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} for layouting subwindows.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -1827,8 +1834,9 @@ constraints.}
|
||||
\wxheading{Remarks}
|
||||
|
||||
You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use
|
||||
the constraints automatically in OnSize; otherwise, you must
|
||||
override OnSize and call Layout explicitly.
|
||||
the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout()
|
||||
explicitly. When setting both a wxLayoutConstraints and a \helpref{wxSizer}{wxsizer}, only the
|
||||
sizer will have effect.
|
||||
|
||||
\membersection{wxWindow::SetDropTarget}\label{wxwindowsetdroptarget}
|
||||
|
||||
@@ -2171,6 +2179,27 @@ given bounds.
|
||||
|
||||
The resizing increments are only significant under Motif or Xt.
|
||||
|
||||
\membersection{wxWindow::SetSizer}\label{wxwindowsetsizer}
|
||||
|
||||
\func{void}{SetSizer}{\param{wxSizer* }{sizer}}
|
||||
|
||||
Sets the window to have the given layout sizer. The window
|
||||
will then own the object, and will take care of its deletion.
|
||||
If an existing layout constraints object is already owned by the
|
||||
window, it will be deleted.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{sizer}{The sizer to set. Pass NULL to disassociate and delete the window's
|
||||
sizer.}
|
||||
|
||||
\wxheading{Remarks}
|
||||
|
||||
You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use
|
||||
the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout()
|
||||
explicitly. When setting both a wxSizer and a \helpref{wxLayoutConstraints}{wxlayoutconstraints},
|
||||
only the sizer will have effect.
|
||||
|
||||
\membersection{wxWindow::SetTitle}\label{wxwindowsettitle}
|
||||
|
||||
\func{virtual void}{SetTitle}{\param{const wxString\& }{title}}
|
||||
|
Reference in New Issue
Block a user