1. wxMenu changes: wxMenuBase appears, several new functions for dynamic menu

handling as well
2. new sample: menu
3. small corrections to wxFileHistory made possible by wxMenu changes
4. ugly fix for panel loaded from resources and TABbing
5. wxDataObject &c doc updates


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-02 01:25:43 +00:00
parent cf85cb95f1
commit 717a57c2fa
29 changed files with 2205 additions and 1790 deletions

View File

@@ -1,16 +1,21 @@
\section{\class{wxBitmapDataObject}}\label{wxbitmapdataobject}
wxBitmapDataObject is a specialization of wxDataObject for bitmap data. It can be
used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new class
from this class for providing a bitmap on-demand in order to minimize memory consumption
when offering data in several formats, such as a bitmap and GIF.
wxBitmapDataObject is a specialization of wxDataObject for bitmap data. It can
be used without change to paste data into the
\helpref{wxClipboard}{wxclipboard} or a \helpref{wxDropSource}{wxdropsource}. A
user may wish to derive a new class from this class for providing a bitmap
on-demand in order to minimize memory consumption when offering data in several
formats, such as a bitmap and GIF.
In order to offer bitmap data on-demand \helpref{GetSize}{wxbitmapdataobjectgetsize}
and \helpref{WriteData}{wxbitmapdataobjectwritedata} will have to be overridden.
\wxheading{Virtual functions to override}
This class may be used as is, but
\helpref{GetBitmap}{wxbitmapdataobjectgetbitmap} may be overridden to increase
efficiency.
\wxheading{Derived from}
\helpref{wxDataObjectSimple}{wxdataobjectsimple}
\helpref{wxDataObject}{wxdataobject}
\wxheading{Include files}
@@ -19,64 +24,17 @@ and \helpref{WriteData}{wxbitmapdataobjectwritedata} will have to be overridden.
\wxheading{See also}
\helpref{Clipboard and drag and drop overview}{wxclipboardonfigoverview},
\helpref{wxDataObject}{wxdataobject},
\helpref{wxDataObjectSimple}{wxdataobjectsimple},
\helpref{wxFileDataObject}{wxfiledataobject},
\helpref{wxTextDataObject}{wxtextdataobject},
\helpref{wxDataObject}{wxdataobject}
\latexignore{\rtfignore{\wxheading{Members}}}
\func{}{wxBitmapDataObject}{\param{const wxBitmap\& }{bitmap = wxNullBitmap}}
\membersection{wxBitmapDataObject::wxBitmapDataObject}\label{wxbitmapdataobjectwxbitmapdataobject}
\func{}{wxBitmapDataObject}{\void}
Default constructor. Call \helpref{SetBitmap}{wxbitmapdataobjectsetbitmap} later
or override \helpref{WriteData}{wxbitmapdataobjectwritedata} and
\helpref{GetSize}{wxbitmapdataobjectgetsize} for providing data on-demand.
\func{}{wxBitmapDataObject}{\param{const wxBitmap\& }{bitmap}}
Constructor, passing a bitmap.
\membersection{wxBitmapDataObject::GetSize}\label{wxbitmapdataobjectgetsize}
\constfunc{virtual size\_t}{GetSize}{\void}
Returns the data size. By default, returns the size of the bitmap data
set in the constructor or using \helpref{SetBitmap}{wxbitmapdataobjectsetbitmap}.
This can be overridden to provide size data on-demand. Note that you'd
have to call the inherited GetSize method as this is the only way
to get to know the transfer size of the bitmap in a platform dependent
way - a bitmap has different size under GTK and Windows. In practice,
this would look like this:
\begin{verbatim}
size_t MyBitmapDataObject::GetSize()
{
// Get bitmap from global container. This container
// should be able to "produce" data in all formats
// offered by the application but store it only in
// one format to reduce memory consumption.
wxBitmap my_bitmap = my_global_container->GetBitmap();
// temporarily set bitmap
SetBitmap( my_bitmap );
size_t ret = wxBitmapDataObject::GetSize();
// unset bitmap again
SetBitmap( wxNullBitmap );
retrun ret;
}
\end{verbatim}
TODO: Offer a nicer way to do this. Maybe by providing a platform
dependent function in this class like
\begin{verbatim}
size_t GetBitmapSize( const wxBitmap &bitmap )
\end{verbatim}
Constructor, optionally passing a bitmap (otherwise use
\helpref{SetBitmap}{wxbitmapdataobjectsetbitmap} later)
\membersection{wxBitmapDataObject::GetBitmap}\label{wxbitmapdataobjectgettext}
@@ -91,26 +49,8 @@ the \helpref{wxClipboard}{wxclipboard}.
\func{virtual void}{SetBitmap}{\param{const wxBitmap\& }{bitmap}}
Sets the bitmap associated with the data object. This method is called
internally when retrieving data from the \helpref{wxClipboard}{wxclipboard}
and may be used to paste data to the clipboard directly (instead of
on-demand).
Sets the bitmap associated with the data object. This method is called when the
data object receives data. Usually there will be no reason to override this
function.
\membersection{wxBitmapDataObject::WriteData}\label{wxbitmapdataobjectwritedata}
\constfunc{virtual void}{WriteData}{\param{void}{*dest} }
Write the data owned by this class to {\it dest}. By default, this
calls \helpref{WriteBitmap}{wxbitmapdataobjectwritebitmap} with the bitmap
set in the constructor or using \helpref{SetBitmap}{wxbitmapdataobjectsetbitmap}.
This can be overridden to provide bitmap data on-demand; in this case
\helpref{WriteBitmap}{wxbitmapdataobjectwritebitmap} must be called from
within th overriding WriteData() method.
\membersection{wxBitmapDataObject::WriteBitmap}\label{wxbitmapdataobjectwritebitmap}
\constfunc{void}{WriteBitmap}{\param{const wxBitmap\& }{bitmap}\param{void}{*dest} }
Writes the the bitmap {\it bitmap} to {\it dest}. This method must be called
from \helpref{WriteData}{wxbitmapdataobjectwritedata}.

View File

@@ -40,6 +40,8 @@
\input cursor.tex
\input database.tex
\input dataobj.tex
\input dobjcomp.tex
\input dobjsmpl.tex
\input datstrm.tex
\input date.tex
\input dc.tex

View File

@@ -1,38 +1,118 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: dataobj.tex
%% Purpose: wxDataObject documentation
%% Author: Vadim Zeitlin
%% Modified by:
%% Created: 18.10.99
%% RCS-ID: $Id$
%% Copyright: (c) wxWindows team
%% Licence: wxWindows licence
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxDataObject}}\label{wxdataobject}
A wxDataObject represents data that can be copied to or from the clipboard, or
dragged and dropped. There are two classes directly derived from wxDataObject:
wxDataObjectSimple and wxDataObjectComposite. As you will guess, wxDataObjectSimple
holds data for a single format (such as HTML or text) and wxDataObjectComposite
can hold any number of wxDataObjectSimple classes. Please note that this is an
easy way to use Drag'n'Drop and the clipboard with multiple formats, but not the
most efficient one as each wxDataObjectSimple would contain the whole data in its
respective formars. Now imagine that you want to paste 200 pages of text in your
proprietary format, as well as Word, RTF, HTML, Unicode and plain text to the
clipboard and even today's computers are in trouble. For this case, you will have
to derive from wxDataObject directly and make it enumerate its formats and provide
the data in the requested format on demand.
dragged and dropped. The important thing about wxDataObject is that this is a
"smart" piece of data unlike usual "dumb" data containers such as memory
buffers or files. Being "smart" here means that the data object itself should
know what data formats it supports and how to render itself in each of
supported formats.
Note that neither the GTK data transfer mechanisms for the clipboard and Drag'n'Drop
nor the OLE data transfer copies any data until another application actually
requests the data. This is in contrast to the "feel" offered to the user of a
program who would normally think that the data resides in the clipboard after
having pressed "Copy" - in reality it is only declared to be available.
A supported format, incidentally, is exactly the format in which the data can
be requested from a data object or from which the data object may be set. In
the general case, an object may support different formats on "input" and
"output", i.e. it may be able to render itself in a given format but not be
created from data on this format or vice versa. wxDataObject defines an
enumeration type
There are several predefined data object classes derived from wxDataObjectSimple:
\helpref{wxFileDataObject}{wxfiledataobject}, \helpref{wxTextDataObject}{wxtextdataobject}
and \helpref{wxBitmapDataObject}{wxbitmapdataobject} which can be used without change.
\begin{verbatim}
enum Direction
{
Get = 0x01, // format is supported by GetDataHere()
Set = 0x02 // format is supported by SetData()
};
\end{verbatim}
You may also derive your own data object classes from \helpref{wxCustomDataObject}{wxprivatedataobject}
for user-defined types. The format of user-defined data is given as mime-type string literal,
such as "application/word" or "image/png". These strings are used as they are under Unix (so
far only GTK) to identify a format and are translated into their Windows equivalent under
Win32 (using the OLE IDataObject for data exchange to and from the clipboard and for Drag'n'Drop).
Note that the format string translation under Windows is not yet finnished.
which allows to distinguish between them. See
\helpref{wxDataFormat}{wxdataformat} documentation for more about formats.
Not surprizingly, being "smart" comes at a price of added complexity. This is
reasonable for the situations when you really need to support multiple formats,
but may be annoying if you only want to do something simple like cut and paste
text.
To provide a solution for both cases, wxWindows has two predefined classes
which derive from wxDataObject:
\helpref{wxDataObjectSimple}{wxdataobjectsimple} and
\helpref{wxDataObjectComposite}{wxdataobjectcomposite}.
\helpref{wxDataObjectSimple}{wxdataobjectsimple} is
the simplest wxDataObject possible and only holds data in a single format (such
as HTML or text) and \helpref{wxDataObjectComposite}{wxdataobjectcomposite} is
the simplest way to implement wxDataObject which does support multiple formats
because it achievs this by simply holding several wxDataObjectSimple objects.
So, you have several solutions when you need a wxDataObject class (and you need
one as soon as you want to transfer data via the clipboard or drag and drop):
\begin{twocollist}
\twocolitem{0. Use one of built-in classes}{You may use wxTextDataObject,
wxBitmapDataObject or wxFileDataObject in the simplest cases when you only need
to support one format and your data is either text, bitmap or list of files}
\twocolitem{1. Derive your class from wxDataObjectSimple}{This is the simplest
solution for custom data - you will only support one format and so probably
won't be able to communicate with other programs, but data transfer will work
in your program (or between different copies of it).}
\twocolitem{2. Use wxDataObjectComposite}{This is a quite simple, but rather
powerful solution which allows you to support any number of formats (either
standard or custom if you combine it with the previous solution).}
\twocolitem{3. Derive from wxDataObject directly}{This is the solution of
maximal flexibility and efficiency, but it also is the most difficult to
implement.}
\end{twocollist}
Please note that the easiest way to use Drag'n'Drop and the clipboard with
multiple formats is by using wxDataObjectComposite, but it is not the most
efficient one as each wxDataObjectSimple would contain the whole data in its
respective formars. Now imagine that you want to paste 200 pages of text in
your proprietary format, as well as Word, RTF, HTML, Unicode and plain text to
the clipboard and even today's computers are in trouble. For this case, you
will have to derive from wxDataObject directly and make it enumerate its
formats and provide the data in the requested format on demand.
Note that neither the GTK data transfer mechanisms for the clipboard and
Drag'n'Drop nor the OLE data transfer copies any data until another application
actually requests the data. This is in contrast to the "feel" offered to the
user of a program who would normally think that the data resides in the
clipboard after having pressed "Copy" - in reality it is only declared to be
available.
There are several predefined data object classes derived from
wxDataObjectSimple: \helpref{wxFileDataObject}{wxfiledataobject},
\helpref{wxTextDataObject}{wxtextdataobject} and
\helpref{wxBitmapDataObject}{wxbitmapdataobject} which can be used without
change.
You may also derive your own data object classes from
\helpref{wxCustomDataObject}{wxprivatedataobject} for user-defined types. The
format of user-defined data is given as mime-type string literal, such as
"application/word" or "image/png". These strings are used as they are under
Unix (so far only GTK) to identify a format and are translated into their
Windows equivalent under Win32 (using the OLE IDataObject for data exchange to
and from the clipboard and for Drag'n'Drop). Note that the format string
translation under Windows is not yet finnished.
\wxheading{Virtual functions to override}
Each class derived directly from wxDataObject must override and implement all
of its functions which are pure virtual in the base class.
The data objects which only render their data or only set it (i.e. work in
only one direction), should return 0 from
\helpref{GetFormatCount}{wxdataobjectgetformatcount}.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
None
\wxheading{Include files}
@@ -40,13 +120,16 @@ Note that the format string translation under Windows is not yet finnished.
\wxheading{See also}
\helpref{Clipboard and drag and drop overview}{wxclipboardonfigoverview},
\helpref{DnD sample}{samplednd},
\helpref{wxFileDataObject}{wxfiledataobject},
\helpref{wxTextDataObject}{wxtextdataobject},
\helpref{wxBitmapDataObject}{wxbitmapdataobject},
\helpref{wxPrivateDataObject}{wxprivatedataobject},
\helpref{Drag and drop overview}{wxdndoverview}, \helpref{wxDropTarget}{wxdroptarget},
\helpref{wxDropTarget}{wxdroptarget},
\helpref{wxDropSource}{wxdropsource},
\helpref{wxTextDropTarget}{wxtextdroptarget}, \helpref{wxFileDropTarget}{wxfiledroptarget}
\helpref{wxTextDropTarget}{wxtextdroptarget},
\helpref{wxFileDropTarget}{wxfiledroptarget}
\latexignore{\rtfignore{\wxheading{Members}}}
@@ -62,17 +145,21 @@ Constructor.
Destructor.
\membersection{wxDataObject::GetFormatCount}\label{wxdataobjectgetformatcount}
\membersection{wxDataObject::GetAllFormats}\label{wxdataobjectgetallformats}
\constfunc{virtual size_t}{GetFormatCount}{\void}
\constfunc{virtual void}{GetAllFormats}{
\param{wxDataFormat *}{formats},
\param{Direction}{ dir = Get}}
Return the number of available formats.
Copy all supported formats in the given direction to the array pointed to by
{\it formats} (there is enough place for GetFormatCount(dir) formats in it).
\membersection{wxDataObject::GetDataHere}\label{wxdataobjectgetdatahere}
\constfunc{virtual bool}{GetDataHere}{\param{const wxDataFormat\&}{ format}, \param{void}{*buf} }
\constfunc{virtual bool}{GetDataHere}{\param{const wxDataFormat\&}{ format}, \param{void }{*buf} }
The method will write the data of the format {\it format} in the buffer {\it buf}.
The method will write the data of the format {\it format} in the buffer {\it
buf} and return TRUE on success, FALSE on failure.
\membersection{wxDataObject::GetDataSize}\label{wxdataobjectgetdatasize}
@@ -80,16 +167,30 @@ The method will write the data of the format {\it format} in the buffer {\it buf
Returns the data size of the given format {\it format}.
\membersection{wxDataObject::GetFormatCount}\label{wxdataobjectgetformatcount}
\constfunc{virtual size\_t}{GetFormatCount}{\param{Direction}{ dir = Get}}
Return the number of available formats for rendering or setting the data.
\membersection{wxDataObject::GetPreferredFormat}\label{wxdataobjectgetpreferredformat}
\constfunc{virtual wxDataFormat}{GetPreferredFormat}{\void}
\constfunc{virtual wxDataFormat}{GetPreferredFormat}{\param{Direction}{ dir = Get}}
Returns the preferred format. Usually the first format in the list of available formats.
Returns the preferred format for either rendering the data (if {\it dir} is
{\tt Get}, its default value) or for setting it. Usually this will be the
native format of the wxDataObject.
\membersection{wxDataObject::SetData}\label{wxdataobjectsetdata}
\func{virtual bool}{SetData}{\param{const wxDataFormat\&}{ format}, \param{size_t}{ len}, \param{const void}{*buf} }
\func{virtual bool}{SetData}{
\param{const wxDataFormat\&}{ format},
\param{size\_t}{ len},
\param{const void }{*buf} }
Set the data of the format {\it format} and the size {\it len} provided in the buffer {\it buf}.
Set the data in the format {\it format} of the length {\it len} provided in the
buffer {\it buf}.
Returns TRUE on sucess, FALSE on failure.

View File

@@ -1,9 +1,18 @@
\section{\class{wxFileDataObject}}\label{wxfiledataobject}
wxFileDataObject is a specialization of wxDataObject for file names.
wxFileDataObject is a specialization of \helpref{wxDataObject}{wxdataobject}
for file names. Unlike other predefined wxDataObject derivations, it only works
in one direction - the one of setting the data, i.e. the program can only
receive files dropped on it using it and there is no way (currently) to
initiate a drag and drop file operation.
\wxheading{Virtual functions to override}
None.
\wxheading{Derived from}
\helpref{wxDataObjectSimple}{wxdataobjectsimple}
\helpref{wxDataObject}{wxdataobject}
\wxheading{Include files}
@@ -12,31 +21,23 @@ wxFileDataObject is a specialization of wxDataObject for file names.
\wxheading{See also}
\helpref{wxDataObject}{wxdataobject},
\helpref{wxDataObjectSimple}{wxdataobjectsimple},
\helpref{wxTextDataObject}{wxtextdataobject},
\helpref{wxBitmapDataObject}{wxbitmapdataobject}
\helpref{wxDataObject}{wxdataobject}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxFileDataObject::wxFileDataObject}\label{wxfiledataobjectwxfiledataobject}
\membersection{wxFileDataObject}\label{wxfiledataobjectwxfiledataobject}
\func{}{wxFileDataObject}{\void}
Constructor.
\membersection{wxFileDataObject::GetFormat}\label{wxfiledataobjectgetformat}
\membersection{wxFileDataObject::GetFilenames}\label{wxfiledataobjectgetfilenames}
\constfunc{virtual wxDataFormat}{GetFormat}{\void}
\constfunc{const wxArrayString\& }{GetFilenames}{\void}
Returns wxDF\_FILENAME.
\membersection{wxFileDataObject::AddFile}\label{wxfiledataobjectaddfile}
\func{virtual void}{AddFile}{\param{const wxString\& }{file}}
Adds a filename to the data object.
\membersection{wxFileDataObject::GetFiles}\label{wxfiledataobjectgetfiles}
\constfunc{virtual wxString}{GetFiles}{\void}
Returns files as a zero-separated list.
Returns the \helpref{array}{wxarraystring} of file names.

View File

@@ -15,7 +15,18 @@ A static text control displays one or more lines of read-only text.
\wxheading{Window styles}
There are no special styles for this control.
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxALIGN\_LEFT}}{Align the text to the left}
\twocolitem{\windowstyle{wxALIGN\_RIGHT}}{Align the text to the right}
\twocolitem{\windowstyle{wxALIGN\_CENTRE}}{Center the text (horisontally)}
\twocolitem{\windowstyle{wxST\_NO\_AUTORESIZE}}{By default, the control will
adjust its size to exactly fit to the size of the text when
\helpref{SetLabel}{wxstatictextsetlabel} is called. If this style flag is
given, the control will not change its size (this style is especially useful
with controls which also have wxALIGN\_RIGHT or CENTER style because otherwise
they won't make sense any longer after a call to SetLabel)}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.
@@ -75,7 +86,8 @@ Returns the contents of the control.
\func{virtual void}{SetLabel}{\param{const wxString\& }{ label}}
Sets the static text label.
Sets the static text label and updates the controls size to exactly fit the
label unless the control has wxST\_NO\_AUTORESIZE flag.
\wxheading{Parameters}

View File

@@ -1,4 +1,4 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: tclipbrd.tex
%% Purpose: Data transfer (clipboard and drag and drop) overview
%% Author: Vadim Zeitlin
@@ -7,7 +7,7 @@
%% RCS-ID: $Id$
%% Copyright: (c) Vadim Zeitlin
%% Licence: wxWindows licence
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Clipboard and drag and drop overview}\label{wxclipboardonfigoverview}
@@ -17,23 +17,24 @@ Classes: \helpref{wxDataObject}{wxdataobject},
\helpref{wxDropSource}{wxdropsource},
\helpref{wxDropTarget}{wxdroptarget}
See also: \helpref{DnD sample}{samplednd}
This overview discusses data transfer through clipboard or drag and drop. In
wxWindows, these two ways to transfer data (either between different
applications or inside one and the same) are very similar which allows to
implement both of them using almost the same code - or in other
implement both of them using almost the same code - or, in other
words, if you implement drag and drop support for your application, you get
clipboard support for free and vice versa.
In the heart of both clipboard and drag and drop operations lies the
\helpref{wxDataObject}{wxdataobject} class. The objects of this class (or, to be
precise, classes derived from it) represent the data which is being carried by
the mouse during drag and drop operation or copied to or pasted from the
clipboard. wxDataObject is a "smart" piece of data
because it knows which formats it supports (see
GetFormatCount and GetAllFormats) and knows how to render
itself in any of them (see GetDataHere).
It can also receive its value from the outside in a format it supports if it
implements the SetData method.
\helpref{wxDataObject}{wxdataobject} class. The objects of this class (or, to
be precise, classes derived from it) represent the data which is being carried
by the mouse during drag and drop operation or copied to or pasted from the
clipboard. wxDataObject is a "smart" piece of data because it knows which
formats it supports (see GetFormatCount and GetAllFormats) and knows how to
render itself in any of them (see GetDataHere). It can also receive its value
from the outside in a format it supports if it implements the SetData method.
Please see the documentation of this class for more details.
Both clipboard and drag and drop operations have two sides: the source and
target, the data provider and the data receiver. These which may be in the same
@@ -44,10 +45,10 @@ should do.
\subsection{The data provider (source) duties}{wxdataobjectsource}
The data provider is responsible for creating a
\helpref{wxDataObject}{wxdataobjectwxdataobject} containing the data to be
transfered. Then it should either pass it to the clipboard using
\helpref{AddData}{wxclipboardadddata} or \helpref{SetData}{wxclipboardsetdata}
functions or to \helpref{wxDropSource}{wxdropsource} and call
\helpref{wxDataObject}{wxdataobject} containing the data to be
transfered. Then it should either pass it to the clipboard using
\helpref{SetData}{wxclipboardsetdata} function or to
\helpref{wxDropSource}{wxdropsource} and call
\helpref{DoDragDrop}{wxdropsourcedodragdrop} function.
The only (but important) difference is that the object for the clipboard
@@ -74,9 +75,10 @@ data formats you need and pass it as argument to
no data in (any of) the supported format(s) is available. If it returns {\tt
TRUE}, the data has been successfully transfered to wxDataObject.
{\bf TODO} document drag and drop side when the API is finalised
For drag and drop case, the \helpref{wxDropTarget::OnData}{wxdroptargetondata}
virtual function will be called when a data object is dropped, from which the
data itself may be requested by calling
\helpref{wxDropTarget::GetData}{wxdroptargetwxdroptarget} method which fills
the data object.
% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
% Vadim, please remember the new line at the end of each file. Please
% also remember to compile the .hlp file to check for bad references etc.,
% before checking in. I have removed references that were unresolved. - JACS

View File

@@ -4,6 +4,7 @@
This chapter contains a selection of topic overviews.
\input tsamples.tex
\input tapp.tex
\input tstring.tex
\input tcontain.tex
@@ -38,7 +39,6 @@ This chapter contains a selection of topic overviews.
\input tvalidat.tex
\input texpr.tex
\input tgrid.tex
\input tdnd.tex
\input tthreads.tex
\input tfile.tex
\input ti18n.tex
@@ -46,3 +46,6 @@ This chapter contains a selection of topic overviews.
\input tusage.tex
\input ttips.tex
\input fs.tex
% \input tdnd.tex

View File

@@ -1,16 +1,28 @@
\section{\class{wxTextDataObject}}\label{wxtextdataobject}
wxTextDataObject is a specialization of wxDataObject for text data. It can be
used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new class
from this class for providing text on-demand in order to minimize memory consumption
when offering data in several formats, such as plain text and RTF.
used without change to paste data into the \helpref{wxClipboard}{wxclipboard}
or a \helpref{wxDropSource}{wxdropsource}. A user may wish to derive a new
class from this class for providing text on-demand in order to minimize memory
consumption when offering data in several formats, such as plain text and RTF
because by default the text is stored in a string in this class, but it might
as well be generated when requested. For this,
\helpref{GetTextLength}{wxtextdataobjectgettextlength} and
\helpref{GetText}{wxtextdataobjectgettext} will have to be overridden.
In order to offer text data on-demand \helpref{GetSize}{wxtextdataobjectgetsize}
and \helpref{WriteData}{wxtextdataobjectwritedata} will have to be overridden.
Note that if you already have the text inside a string, you will not achieve
any efficiency gain by overriding these functions because copying wxStrings is
already a very efficient operation (data is not actualyl copied because
wxStrings are reference counted).
\wxheading{Virtual functions to override}
This class may be used as is, but all of data transfer functions may be
overridden to increase efficiency.
\wxheading{Derived from}
\helpref{wxDataObjectSimple}{wxdataobjectsimple}
\helpref{wxDataObject}{wxdataobject}
\wxheading{Include files}
@@ -19,25 +31,24 @@ and \helpref{WriteData}{wxtextdataobjectwritedata} will have to be overridden.
\wxheading{See also}
\helpref{wxDataObject}{wxdataobject}
\helpref{Clipboard and drag and drop overview}{wxclipboardonfigoverview},
\helpref{wxDataObject}{wxdataobject},
\helpref{wxDataObjectSimple}{wxdataobjectsimple},
\helpref{wxFileDataObject}{wxfiledataobject},
\helpref{wxBitmapDataObject}{wxbitmapdataobject}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxTextDataObject::wxTextDataObject}\label{wxtextdataobjectwxtextdataobject}
\func{}{wxTextDataObject}{\void}
\func{}{wxTextDataObject}{\param{const wxString\& }{text = wxEmptyString}}
Default constructor. Call \helpref{SetText}{wxtextdataobjectsettext} later
or override \helpref{WriteData}{wxtextdataobjectwritedata} and
\helpref{GetSize}{wxtextdataobjectgetsize} for providing data on-demand.
Constructor, may be used to initialise the text (otherwise
\helpref{SetText}{wxtextdataobjectsettext} should be used later)
\func{}{wxTextDataObject}{\param{const wxString\& }{strText}}
\membersection{wxTextDataObject::GetTextLength}\label{wxtextdataobjectgettextlength}
Constructor, passing text.
\membersection{wxTextDataObject::GetSize}\label{wxtextdataobjectgetsize}
\constfunc{virtual size\_t}{GetSize}{\void}
\constfunc{virtual size\_t}{GetTextLength}{\void}
Returns the data size. By default, returns the size of the text data
set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
@@ -59,25 +70,8 @@ the \helpref{wxClipboard}{wxclipboard}.
\func{virtual void}{SetText}{\param{const wxString\& }{strText}}
Sets the text associated with the data object. This method is called
internally when retrieving data from the \helpref{wxClipboard}{wxclipboard}
and may be used to paste data to the clipboard directly (instead of
on-demand).
when the data object receives the data and, by default, copies the text into
the member variable. If you want to process the text on the fly you may wish to
override this function.
\membersection{wxTextDataObject::WriteData}\label{wxtextdataobjectwritedata}
\constfunc{virtual void}{WriteData}{\param{void}{*dest} }
Write the data owned by this class to {\it dest}. By default, this
calls \helpref{WriteString}{wxtextdataobjectwritestring} with the string
set in the constructor or using \helpref{SetText}{wxtextdataobjectsettext}.
This can be overridden to provide text data on-demand; in this case
\helpref{WriteString}{wxtextdataobjectwritestring} must be called from
within the overriding WriteData() method.
\membersection{wxTextDataObject::WriteString}\label{wxtextdataobjectwritestring}
\constfunc{void}{WriteString}{\param{const wxString\& }{str}\param{void}{*dest} }
Writes the the string {\it str} to {\it dest}. This method must be called
from \helpref{WriteData}{wxtextdataobjectwritedata}.

View File

@@ -1,14 +1,14 @@
[OPTIONS]
BMROOT=d:\wx2\wxWindows\docs\latex\wx ; Assume that bitmaps are where the source is
BMROOT=L:\wxWindows\docs\latex\wx ; Assume that bitmaps are where the source is
TITLE=wxWindows Manual
CONTENTS=Contents
COMPRESS=HIGH
[FILES]
wx.rtf
Wx.rtf
[CONFIG]
CreateButton("Up", "&Up", "JumpId(`wx.hlp', `Contents')")
CreateButton("Up", "&Up", "JumpId(`Wx.hlp', `Contents')")
BrowseButtons()
[MAP]