This commit was manufactured by cvs2svn to create tag 'wxPy_2_7_1_2'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/wxPy_2_7_1_2@42287 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -119,7 +119,7 @@ Default constructor.
|
||||
|
||||
\func{}{wxAcceleratorTable}{\param{const wxAcceleratorTable\& }{bitmap}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Copy constructor.
|
||||
|
||||
\func{}{wxAcceleratorTable}{\param{int}{ n}, \param{wxAcceleratorEntry}{ entries[]}}
|
||||
|
||||
@@ -161,7 +161,9 @@ Returns true if the accelerator table is valid.
|
||||
|
||||
\func{wxAcceleratorTable\& }{operator $=$}{\param{const wxAcceleratorTable\& }{accel}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator. This operator does not copy any data, but instead
|
||||
passes a pointer to the data in {\it accel} and increments a reference
|
||||
counter. It is a fast operation.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -110,14 +110,6 @@ of the animation is displayed.
|
||||
Returns the animation associated with this control.
|
||||
|
||||
|
||||
\membersection{wxAnimationCtrl::GetInactiveBitmap}\label{wxanimationctrlgetinactivebitmap}
|
||||
|
||||
\constfunc{wxBitmap}{GetInactiveBitmap}{\void}
|
||||
|
||||
Returns the inactive bitmap shown in this control when the;
|
||||
see \helpref{SetInactiveBitmap}{wxanimationctrlsetinactivebitmap} for more info.
|
||||
|
||||
|
||||
\membersection{wxAnimationCtrl::IsPlaying}\label{wxanimationctrlisplaying}
|
||||
|
||||
\constfunc{bool}{IsPlaying}{\void}
|
||||
@@ -151,31 +143,17 @@ displayed).
|
||||
Sets the animation to play in this control.
|
||||
If the previous animation is being played, it's \helpref{Stopped}{wxanimationctrlstop}.
|
||||
|
||||
Until \helpref{Play}{wxanimationctrlplay} isn't called, a static image, the first
|
||||
frame of the given animation or the background colour will be shown
|
||||
(see \helpref{SetInactiveBitmap}{wxanimationctrlsetinactivebitmap} for more info).
|
||||
Until \helpref{Play}{wxanimationctrlplay} isn't called, the first frame
|
||||
of the animation is displayed.
|
||||
|
||||
If {\tt wxNullAnimation} is given as animation, the control will be cleared to display
|
||||
the background colour (see \helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour}).
|
||||
|
||||
\membersection{wxAnimationCtrl::SetInactiveBitmap}\label{wxanimationctrlsetinactivebitmap}
|
||||
|
||||
\func{void}{SetInactiveBitmap}{\param{const wxBitmap\& }{bmp}}
|
||||
|
||||
Sets the bitmap to show on the control when it's not playing an animation.
|
||||
If you set as inactive bitmap {\tt wxNullBitmap} (which is the default), then the
|
||||
first frame of the animation is instead shown when the control is inactive; in this case,
|
||||
if there's no valid animation associated with the control (see \helpref{SetAnimation}{wxanimationctrlsetanimation}),
|
||||
then the background colour of the window is shown.
|
||||
|
||||
If the control is not playing the animation, the given bitmap will be immediately
|
||||
shown, otherwise it will be shown as soon as \helpref{Stop}{wxanimationctrlstop}
|
||||
is called.
|
||||
|
||||
\membersection{wxAnimationCtrl::Stop}\label{wxanimationctrlstop}
|
||||
|
||||
\func{void}{Stop}{\void}
|
||||
|
||||
Stops playing the animation.
|
||||
The control will show the first frame of the animation, a custom static image or
|
||||
the window's background colour as specified by the
|
||||
last \helpref{SetInactiveBitmap}{wxanimationctrlsetinactivebitmap} call.
|
||||
The control will show the last frame rendered of the current animation until \helpref{Play}{wxanimationctrlplay} is called.
|
||||
|
||||
|
@@ -38,8 +38,10 @@ Default constructor.
|
||||
|
||||
\func{}{wxBitmap}{\param{const wxBitmap\& }{bitmap}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
To make a real copy, you can use:
|
||||
Copy constructor. Note that this does not take a fresh copy of the data,
|
||||
but instead makes the internal data point to {\it bitmap}'s data. So
|
||||
changing one bitmap will change the other. To make a real copy, you can
|
||||
use:
|
||||
|
||||
\begin{verbatim}
|
||||
wxBitmap newBitmap = oldBitmap.GetSubBitmap(
|
||||
@@ -585,7 +587,9 @@ Sets the width member (does not affect the bitmap data).
|
||||
|
||||
\func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator. This operator does not copy any data, but instead
|
||||
passes a pointer to the data in {\it bitmap} and increments a reference
|
||||
counter. It is a fast operation.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -95,7 +95,7 @@ Constructs a stippled brush using a bitmap.
|
||||
|
||||
\func{}{wxBrush}{\param{const wxBrush\&}{ brush}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Copy constructor. This uses reference counting so is a cheap operation.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -293,7 +293,8 @@ Sets the brush style.
|
||||
|
||||
\func{wxBrush\&}{operator $=$}{\param{const wxBrush\& }{brush}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator, using reference counting. Returns a reference
|
||||
to `this'.
|
||||
|
||||
|
||||
\membersection{wxBrush::operator $==$}\label{wxbrushequals}
|
||||
|
@@ -84,7 +84,7 @@ On MacOS if the cursor is larger than 16x16 it is resized and currently only sho
|
||||
|
||||
\func{}{wxCursor}{\param{const wxCursor\&}{ cursor}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Copy constructor. This uses reference counting so is a cheap operation.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -244,7 +244,8 @@ Returns true if cursor data is present.
|
||||
|
||||
\func{wxCursor\&}{operator $=$}{\param{const wxCursor\& }{cursor}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator, using reference counting. Returns a reference
|
||||
to `this'.
|
||||
|
||||
\membersection{wxCursor::operator $==$}\label{wxcursorequals}
|
||||
|
||||
|
@@ -165,10 +165,6 @@ wxSWISS\_FONT}
|
||||
|
||||
Default constructor.
|
||||
|
||||
\func{}{wxFont}{\param{const wxFont\&}{ font}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
|
||||
\func{}{wxFont}{\param{int}{ pointSize}, \param{wxFontFamily}{ family}, \param{int}{ style}, \param{wxFontWeight}{ weight},
|
||||
\param{const bool}{ underline = false}, \param{const wxString\& }{faceName = ""},
|
||||
\param{wxFontEncoding }{encoding = wxFONTENCODING\_DEFAULT}}
|
||||
@@ -582,7 +578,8 @@ Sets the font weight.
|
||||
|
||||
\func{wxFont\&}{operator $=$}{\param{const wxFont\& }{font}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator, using reference counting. Returns a reference
|
||||
to `this'.
|
||||
|
||||
|
||||
\membersection{wxFont::operator $==$}\label{wxfontequals}
|
||||
|
@@ -95,7 +95,7 @@ Default constructor.
|
||||
|
||||
\func{}{wxImage}{\param{const wxImage\& }{image}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Copy constructor.
|
||||
|
||||
\func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}}
|
||||
|
||||
@@ -1290,7 +1290,9 @@ data.
|
||||
|
||||
\func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator. This operator does not copy any data, but instead
|
||||
passes a pointer to the data in {\it image} and increments a reference
|
||||
counter. It is a fast operation.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
|
@@ -12,8 +12,8 @@ The class contains optional debugging versions
|
||||
of {\bf new} and {\bf delete}, which can help trace memory allocation
|
||||
and deallocation problems.
|
||||
|
||||
wxObject can be used to implement \helpref{reference counted}{trefcount} objects,
|
||||
such as wxPen, wxBitmap and others (see \helpref{this list}{refcountlist}).
|
||||
wxObject can be used to implement reference counted objects, such as
|
||||
wxPen, wxBitmap and others.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
@@ -197,6 +197,12 @@ you will need to cast to your own derived class.
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxObjectRefData::m\_count}\label{wxobjectrefdatamcount}
|
||||
|
||||
\member{int}{m\_count}
|
||||
|
||||
Reference count. When this goes to zero during a \helpref{wxObject::UnRef}{wxobjectunref}, an object
|
||||
can delete the {\bf wxObjectRefData} object.
|
||||
|
||||
\membersection{wxObjectRefData::wxObjectRefData}\label{wxobjectrefdatactor}
|
||||
|
||||
@@ -210,11 +216,4 @@ Default constructor. Initialises the {\bf m\_count} member to 1.
|
||||
|
||||
Destructor.
|
||||
|
||||
\membersection{wxObjectRefData::GetRefCount}\label{wxobjectrefdatagetrefcount}
|
||||
|
||||
\constfunc{int}{GetRefCount}{\void}
|
||||
|
||||
Returns the reference count associated with this shared data.
|
||||
When this goes to zero during a \helpref{wxObject::UnRef}{wxobjectunref}, an object
|
||||
can delete this {\bf wxObjectRefData} object.
|
||||
|
||||
|
@@ -54,7 +54,7 @@ Default constructor.
|
||||
|
||||
\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Copy constructor. This uses reference counting so is a cheap operation.
|
||||
|
||||
\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
|
||||
\param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
|
||||
@@ -180,7 +180,8 @@ Returns true if palette data is present.
|
||||
|
||||
\func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator, using reference counting. Returns a reference
|
||||
to `this'.
|
||||
|
||||
\membersection{wxPalette::operator $==$}\label{wxpaletteequals}
|
||||
|
||||
|
@@ -93,7 +93,7 @@ Constructs a stippled pen from a stipple bitmap and a width.
|
||||
|
||||
\func{}{wxPen}{\param{const wxPen\&}{ pen}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Copy constructor. This uses reference counting so is a cheap operation.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -329,7 +329,8 @@ Sets the pen width.
|
||||
|
||||
\func{wxPen\&}{operator $=$}{\param{const wxPen\& }{pen}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
Assignment operator, using reference counting. Returns a reference
|
||||
to `this'.
|
||||
|
||||
\membersection{wxPen::operator $==$}\label{wxpenequals}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ Constructs a rectangular region a wxRect object.
|
||||
|
||||
\func{}{wxRegion}{\param{const wxRegion\&}{ region}}
|
||||
|
||||
Copy constructor, uses \helpref{reference counting}{trefcount}.
|
||||
Constructs a region by copying another region.
|
||||
|
||||
\func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}}
|
||||
|
||||
@@ -260,9 +260,7 @@ for any overlapping areas. The result is stored in this region.
|
||||
|
||||
\func{void}{operator $=$}{\param{const wxRegion\&}{ region}}
|
||||
|
||||
Assignment operator, using \helpref{reference counting}{trefcount}.
|
||||
|
||||
|
||||
Copies {\it region} by reference counting.
|
||||
|
||||
\section{\class{wxRegionIterator}}\label{wxregioniterator}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ In that cases, GetSize returns $0$ so you should always test its return value.
|
||||
|
||||
\membersection{wxStreamBase::IsOk}\label{wxstreambaseisok}
|
||||
|
||||
\constfunc{virtual bool}{IsOk}{\void}
|
||||
\constfunc{bool}{IsOk}{\void}
|
||||
|
||||
Returns true if no error occurred on the stream.
|
||||
|
||||
|
@@ -4,14 +4,13 @@
|
||||
|
||||
This chapter contains a selection of topic overviews.
|
||||
|
||||
%\input tchanges.tex -- deprecated: look at docs/changes.txt instead
|
||||
\input tchanges.tex
|
||||
\input tusage.tex
|
||||
\input tguide.tex
|
||||
\input hworld.tex
|
||||
\input tsamples.tex
|
||||
\input tapp.tex
|
||||
\input truntime.tex
|
||||
\input trefcount.tex
|
||||
\input tstring.tex
|
||||
\input tbuffer.tex
|
||||
\input tdate.tex
|
||||
@@ -67,3 +66,4 @@ This chapter contains a selection of topic overviews.
|
||||
\input re_syntax.tex
|
||||
\input arc.tex
|
||||
\input backwardcompat.tex
|
||||
|
||||
|
@@ -1,66 +0,0 @@
|
||||
\section{Reference counting}\label{trefcount}
|
||||
|
||||
\subsection{Reference counting and why you shouldn't care about it}\label{refcount}
|
||||
|
||||
Many wxWidgets objects use a technique known as \it{reference counting}, also known
|
||||
as {\it copy on write} (COW).
|
||||
This means that when an object is assigned to another, no copying really takes place:
|
||||
only the reference count on the shared object data is incremented and both objects
|
||||
share the same data (a very fast operation).
|
||||
|
||||
But as soon as one of the two (or more) objects is modified, the data has to be
|
||||
copied because the changes to one of the objects shouldn't be seen in the
|
||||
others. As data copying only happens when the object is written to, this is
|
||||
known as COW.
|
||||
|
||||
What is important to understand is that all this happens absolutely
|
||||
transparently to the class users and that whether an object is shared or not
|
||||
is not seen from the outside of the class - in any case, the result of any
|
||||
operation on it is the same.
|
||||
|
||||
|
||||
|
||||
\subsection{List of reference-counted wxWidgets classes}\label{refcountlist}
|
||||
|
||||
The following classes in wxWidgets have efficient (i.e. fast) assignment operators
|
||||
and copy constructors since they are reference-counted:
|
||||
|
||||
\helpref{wxAcceleratorTable}{wxacceleratortable}\\
|
||||
\helpref{wxBrush}{wxbrush}\\
|
||||
\helpref{wxCursor}{wxcursor}\\
|
||||
\helpref{wxFont}{wxfont}\\
|
||||
\helpref{wxImage}{wximage}\\
|
||||
\helpref{wxMetafile}{wxmetafile}\\
|
||||
\helpref{wxPalette}{wxpalette}\\
|
||||
\helpref{wxPen}{wxpen}\\
|
||||
\helpref{wxRegion}{wxregion}\\
|
||||
\helpref{wxRegionIterator}{wxregioniterator}\\
|
||||
\helpref{wxString}{wxstring}
|
||||
|
||||
|
||||
|
||||
\subsection{Make your own reference-counted class}\label{wxobjectoverview}
|
||||
|
||||
Reference counting can be implemented easily using \helpref{wxObject}{wxobject}
|
||||
and \helpref{wxObjectRefData}{wxobjectrefdata} classes.
|
||||
|
||||
First, derive a new class from \helpref{wxObjectRefData}{wxobjectrefdata} and
|
||||
put there the memory-consuming data.
|
||||
|
||||
Then derive a new class from \helpref{wxObject}{wxobject} and implement there
|
||||
the public interface which will be seen by the user of your class.
|
||||
You'll probably want to add a function to your class which does the cast from
|
||||
\helpref{wxObjectRefData}{wxobjectrefdata} to your class-specific shared data; e.g.:
|
||||
|
||||
\begin{verbatim}
|
||||
MyClassRefData *GetData() const { return wx_static_cast(MyClassRefData*, m_refData); }
|
||||
\end{verbatim}
|
||||
|
||||
in fact, all times you'll need to read the data from your wxObject-derived class,
|
||||
you'll need to call such function.
|
||||
|
||||
Very important, all times you need to actually modify the data placed inside your
|
||||
wxObject-derived class, you must first call the \helpref{wxObject::UnShare}{wxobjectunshare}
|
||||
function to be sure that the modifications won't affect other instances which are
|
||||
eventually sharing your object's data.
|
||||
|
@@ -167,8 +167,20 @@ vastly better from a performance point of view than a wxObjectArray of wxStrings
|
||||
|
||||
\subsection{Reference counting and why you shouldn't care about it}\label{wxstringrefcount}
|
||||
|
||||
All considerations for wxObject-derived \helpref{reference counted}{trefcount} objects
|
||||
are valid also for wxString, even if it does not derive from wxObject.
|
||||
wxString objects use a technique known as {\it copy on write} (COW). This means
|
||||
that when a string is assigned to another, no copying really takes place: only
|
||||
the reference count on the shared string data is incremented and both strings
|
||||
share the same data.
|
||||
|
||||
But as soon as one of the two (or more) strings is modified, the data has to be
|
||||
copied because the changes to one of the strings shouldn't be seen in the
|
||||
others. As data copying only happens when the string is written to, this is
|
||||
known as COW.
|
||||
|
||||
What is important to understand is that all this happens absolutely
|
||||
transparently to the class users and that whether a string is shared or not is
|
||||
not seen from the outside of the class - in any case, the result of any
|
||||
operation on it is the same.
|
||||
|
||||
Probably the unique case when you might want to think about reference
|
||||
counting is when a string character is taken from a string which is not a
|
||||
|
Reference in New Issue
Block a user