From f7bd26981f1c8d46d3909e3de90df081de4df33b Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 29 Jul 1998 06:51:33 +0000 Subject: [PATCH] Update to docs incl. wxString first stab; added a couple of palette-related events (wxMSW) needed for wxGLCanvas git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/generic.rsp | 1 + docs/latex/wx/button.tex | 2 +- docs/latex/wx/classes.tex | 4 +- docs/latex/wx/datstrm.tex | 2 +- docs/latex/wx/docchfrm.tex | 2 +- docs/latex/wx/docmdich.tex | 89 +++ docs/latex/wx/docmdipr.tex | 79 +++ docs/latex/wx/docprfrm.tex | 2 +- docs/latex/wx/function.tex | 107 ---- docs/latex/wx/joystick.tex | 6 +- docs/latex/wx/tabctrl.tex | 2 +- docs/latex/wx/tdocview.tex | 49 +- docs/latex/wx/thread.tex | 2 +- docs/latex/wx/toolbar.tex | 2 +- docs/latex/wx/topics.tex | 2 +- docs/latex/wx/tstring.tex | 1078 +----------------------------------- docs/latex/wx/window.tex | 10 +- docs/latex/wx/winhelp.tex | 2 +- docs/latex/wx/wxstring.tex | 493 +++++++++-------- docs/msw/todo.txt | 52 +- include/wx/event.h | 46 +- include/wx/msw/window.h | 2 + include/wx/string.h | 20 +- src/common/docmdi.cpp | 2 +- src/common/docview.cpp | 10 +- src/common/event.cpp | 2 + src/msw/window.cpp | 33 +- 27 files changed, 578 insertions(+), 1523 deletions(-) create mode 100644 docs/latex/wx/docmdich.tex create mode 100644 docs/latex/wx/docmdipr.tex diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index c51eb89b53..ca6ef6df3a 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -48,6 +48,7 @@ src/zlib/*.3 src/zlib/*.mms include/wx/*.h +include/wx/*.cpp include/wx/wx_setup.vms include/wx/common/*.h include/wx/generic/*.h diff --git a/docs/latex/wx/button.tex b/docs/latex/wx/button.tex index 1bdd34457f..5abd58966e 100644 --- a/docs/latex/wx/button.tex +++ b/docs/latex/wx/button.tex @@ -99,7 +99,7 @@ box. Under Windows, only dialog box buttons respond to this function. As normal under Windows and Motif, pressing return causes the default button to be depressed when the return key is pressed. See also \helpref{wxWindow::SetFocus}{wxwindowsetfocus}\rtfsp -which sets the keyboard focus for windows and text panel items, \helpref{wxWindow::OnDefaultAction}{wxwindowondefaultaction}\rtfsp +which sets the keyboard focus for windows and text panel items,\rtfsp and \helpref{wxWindow::GetDefaultItem}{wxwindowgetdefaultitem}. Note that under Motif, calling this function immediately after diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex index 693c934d58..4b1eda6bc6 100644 --- a/docs/latex/wx/classes.tex +++ b/docs/latex/wx/classes.tex @@ -61,6 +61,8 @@ $$\image{14cm;0cm}{wxclass.ps}$$ \input document.tex \input docchfrm.tex \input docmanag.tex +\input docmdich.tex +\input docmdipr.tex \input docprfrm.tex \input doctempl.tex \input dropevt.tex @@ -144,7 +146,7 @@ $$\image{14cm;0cm}{wxclass.ps}$$ \input statbox.tex \input stattext.tex \input statusbr.tex -%\input wxstring.tex +\input wxstring.tex \input strlist.tex \input sysclevt.tex \input settings.tex diff --git a/docs/latex/wx/datstrm.tex b/docs/latex/wx/datstrm.tex index c357fb665e..637ee3ae0b 100644 --- a/docs/latex/wx/datstrm.tex +++ b/docs/latex/wx/datstrm.tex @@ -6,7 +6,7 @@ Sparc or anything else. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxDataStream::wxDataStream}\label{wxwaveconstr} +\membersection{wxDataStream::wxDataStream}\label{wxdatastreamconstr} \func{}{wxDataStream}{\param{istream\&}{ stream}} diff --git a/docs/latex/wx/docchfrm.tex b/docs/latex/wx/docchfrm.tex index f979bc070f..37479e12bf 100644 --- a/docs/latex/wx/docchfrm.tex +++ b/docs/latex/wx/docchfrm.tex @@ -35,7 +35,7 @@ The view associated with the frame. \membersection{wxDocChildFrame::wxDocChildFrame} \func{}{wxDocChildFrame}{\param{wxDocument* }{doc}, \param{wxView* }{view}, \param{wxFrame* }{parent}, - \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, + \param{wxWindowID}{ id}, \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE}, \param{const wxString\& }{name = ``frame"}} diff --git a/docs/latex/wx/docmdich.tex b/docs/latex/wx/docmdich.tex new file mode 100644 index 0000000000..b9b16ac740 --- /dev/null +++ b/docs/latex/wx/docmdich.tex @@ -0,0 +1,89 @@ +\section{\class{wxDocMDIChildFrame}}\label{wxdocmdichildframe} + +The wxDocMDIChildFrame class provides a default frame for displaying documents +on separate windows. This class can only be used for MDI child frames. + +The class is part of the document/view framework supported by wxWindows, +and cooperates with the \helpref{wxView}{wxview}, \helpref{wxDocument}{wxdocument}, +\rtfsp\helpref{wxDocManager}{wxdocmanager} and \helpref{wxDocTemplate}{wxdoctemplate} classes. + +See the example application in {\tt samples/docview}. + +\wxheading{Derived from} + +\helpref{wxMDIChildFrame}{wxmdichildframe}\\ +\helpref{wxFrame}{wxframe}\\ +\helpref{wxWindow}{wxwindow}\\ +\helpref{wxEvtHandler}{wxevthandler}\\ +\helpref{wxObject}{wxobject} + +\wxheading{See also} + +\helpref{Document/view overview}{docviewoverview}, \helpref{wxMDIChildFrame}{wxmdichildframe} + +\membersection{wxDocMDIChildFrame::m\_childDocument} + +\member{wxDocument*}{m\_childDocument} + +The document associated with the frame. + +\membersection{wxDocMDIChildFrame::m\_childView} + +\member{wxView*}{m\_childView} + +The view associated with the frame. + +\membersection{wxDocMDIChildFrame::wxDocMDIChildFrame} + +\func{}{wxDocMDIChildFrame}{\param{wxDocument* }{doc}, \param{wxView* }{view}, \param{wxFrame* }{parent}, + \param{wxWindowID}{ id}, \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, + \param{const wxSize\&}{ size = wxDefaultSize}, + \param{long}{ style = wxDEFAULT\_FRAME\_STYLE}, \param{const wxString\& }{name = ``frame"}} + +Constructor. + +\membersection{wxDocMDIChildFrame::\destruct{wxDocMDIChildFrame}} + +\func{}{\destruct{wxDocMDIChildFrame}}{\void} + +Destructor. + +\membersection{wxDocMDIChildFrame::GetDocument} + +\constfunc{wxDocument*}{GetDocument}{\void} + +Returns the document associated with this frame. + +\membersection{wxDocMDIChildFrame::GetView} + +\constfunc{wxView*}{GetView}{\void} + +Returns the view associated with this frame. + +\membersection{wxDocMDIChildFrame::OnActivate} + +\func{void}{OnActivate}{\param{bool}{ active}} + +Sets the currently active view to be the frame's view. You may need +to override (but still call) this function in order to set the keyboard +focus for your subwindow. + +\membersection{wxDocMDIChildFrame::OnClose} + +\func{virtual bool}{OnClose}{\void} + +Closes and deletes the current view and document. + +\membersection{wxDocMDIChildFrame::SetDocument} + +\func{void}{SetDocument}{\param{wxDocument *}{doc}} + +Sets the document for this frame. + +\membersection{wxDocMDIChildFrame::SetView} + +\func{void}{SetView}{\param{wxView *}{view}} + +Sets the view for this frame. + + diff --git a/docs/latex/wx/docmdipr.tex b/docs/latex/wx/docmdipr.tex new file mode 100644 index 0000000000..5bb084dcfe --- /dev/null +++ b/docs/latex/wx/docmdipr.tex @@ -0,0 +1,79 @@ +\section{\class{wxDocMDIParentFrame}}\label{wxdocmdiparentframe} + +The wxDocMDIParentFrame class provides a default top-level frame for +applications using the document/view framework. This class can only be used for MDI parent frames. + +It cooperates with the \helpref{wxView}{wxview}, \helpref{wxDocument}{wxdocument}, +\rtfsp\helpref{wxDocManager}{wxdocmanager} and \helpref{wxDocTemplates}{wxdoctemplate} classes. + +See the example application in {\tt samples/docview}. + +\wxheading{Derived from} + +\helpref{wxMDIParentFrame}{wxmdiparentframe}\\ +\helpref{wxFrame}{wxframe}\\ +\helpref{wxWindow}{wxwindow}\\ +\helpref{wxEvtHandler}{wxevthandler}\\ +\helpref{wxObject}{wxobject} + +\wxheading{See also} + +\helpref{Document/view overview}{docviewoverview}, \helpref{wxMDIParentFrame}{wxmdiparentframe} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxDocMDIParentFrame::wxDocMDIParentFrame} + +\func{}{wxDocMDIParentFrame}{\param{wxFrame *}{parent}, \param{wxWindowID}{ id}, + \param{const wxString\& }{title}, \param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}, + \param{long}{ style}, \param{const wxString\& }{name}} + +Constructor. + +\membersection{wxDocMDIParentFrame::\destruct{wxDocMDIParentFrame}} + +\func{}{\destruct{wxDocMDIParentFrame}}{\void} + +Destructor. + +\membersection{wxDocMDIParentFrame::OnClose} + +\func{bool}{OnClose}{\void} + +Deletes all views and documents. If no user input cancelled the +operation, the function returns TRUE and the application will exit. + +Since understanding how document/view clean-up takes place can be difficult, +the implementation of this function is shown below. + +\begin{verbatim} +bool wxDocMDIParentFrame::OnClose(void) +{ + // Delete all views and documents + wxNode *node = docManager->GetDocuments().First(); + while (node) + { + wxDocument *doc = (wxDocument *)node->Data(); + wxNode *next = node->Next(); + + if (!doc->Close()) + return FALSE; + + // Implicitly deletes the document when the last + // view is removed (deleted) + doc->DeleteAllViews(); + + // Check document is deleted + if (docManager->GetDocuments().Member(doc)) + delete doc; + + // This assumes that documents are not connected in + // any way, i.e. deleting one document does NOT + // delete another. + node = next; + } + return TRUE; +} +\end{verbatim} + + diff --git a/docs/latex/wx/docprfrm.tex b/docs/latex/wx/docprfrm.tex index 75ae9c7692..f0eff917de 100644 --- a/docs/latex/wx/docprfrm.tex +++ b/docs/latex/wx/docprfrm.tex @@ -23,7 +23,7 @@ See the example application in {\tt samples/docview}. \membersection{wxDocParentFrame::wxDocParentFrame} -\func{}{wxDocParentFrame}{\param{wxFrame *}{parent}, +\func{}{wxDocParentFrame}{\param{wxFrame *}{parent}, \param{wxWindowID}{ id}, \param{const wxString\& }{title}, \param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}, \param{long}{ style}, \param{const wxString\& }{name}} diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 9d3d820f1e..15c982dbe2 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -479,113 +479,6 @@ This function is only available under Windows. Globally sets the cursor; only has an effect in MS Windows. See also \helpref{wxCursor}{wxcursor}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor}. -\section{System event functions} - -The wxWindows system event implementation is incomplete and -experimental, but is intended to be a platform-independent way of -intercepting and sending events, including defining -application-specific events and handlers. - -Ultimately it is intended to be used as a way of testing wxWindows -applications using scripts, although there are currently -problems with this (especially with modal dialogs). - -All this is documented more to provoke comments and suggestions, and -jog my own memory, rather than to be used, since it has not been -tested. However {\bf wxSendEvent} will probably work if you -instantiate the event structure properly for a command event type (see -the code in {\tt wb\_panel.cpp} for \helpref{wxWindow::OnDefaultAction}{wxwindowondefaultaction}\rtfsp -which uses {\bf wxSendEvent} to send a command to the default button). - -\membersection{::wxAddPrimaryEventHandler} - -\func{bool}{wxAddPrimaryEventHandler}{\param{wxEventHandler}{ handlerFunc}} - -Add a primary event handler---the normal event handler for this -event. For built-in events, these would include moving and resizing -windows. User-defined primary events might include the code to -select an image in a diagram (which could of course be achieved by a series -of external events for mouse-clicking, but would be more difficult to specify -and less robust). - -Returns TRUE if it succeeds. - -An event handler takes a pointer to a wxEvent and a boolean flag which is -TRUE if the event was externally generated, and returns a boolean which is -TRUE if that event was handled. - -\membersection{::wxAddSecondaryEventHandler} - -\func{bool}{wxAddSecondaryEventHandler}{\param{wxEventHandler}{ handlerFunc}, \param{bool}{ pre},\\ - \param{bool}{ override}, \param{bool }{append}} - -Add a secondary event handler, pre = TRUE iff it should be called before the -event is executed. override = TRUE iff the handler is allowed to override -all subsequent events by returning TRUE. Returns TRUE if succeeds. - -A secondary event handler is an application-defined handler that may -intercept normal events, possibly overriding them. A primary event handler -provides the normal behaviour for the event. - -An event handler takes a pointer to a wxEvent and a boolean flag which is -TRUE if the event was externally generated, and returns a boolean which is -TRUE if that event was handled. - -\membersection{::wxNotifyEvent} - -\func{bool}{wxNotifyEvent}{\param{wxEvent\&}{ event}, \param{bool}{ pre}} - -Notify the system of the event you are about to execute/have just -executed. If TRUE is returned and pre = TRUE, the calling code should -not execute the event (since it has been intercepted by a handler and -vetoed). - -These events are always internal, because they're generated from within -the main application code. - -\membersection{::wxRegisterEventClass} - -\func{void}{wxRegisterEventClass}{\param{WXTYPE}{ eventClassId},\param{WXTYPE}{ superClassId},\\ - \param{wxEventConstructor}{ constructor}, \param{const wxString\& }{description}} - -Register a new event class (derived from wxEvent), giving the new -event class type, its superclass, a function for creating a new event -object of this class, and an optional description. - -\membersection{::wxRegisterEventName} - -\func{void}{wxRegisterEventName}{\param{WXTYPE}{ eventTypeId},\param{WXTYPE}{ eventClassId},\\ - \param{const wxString\& }{eventName}} - -Register the name of the event. This will allow a simple command -language where giving the event type name and some arguments will -cause a new event of class {\it eventClassId} to be created, with given -event type, and some arguments, allows an event to be dynamically -constructed and sent. - -\membersection{::wxRegisterExternalEventHandlers} - -\func{void}{wxRegisterExternalEventHandlers}{\void} - -Define this and link before wxWindows library to allow registering -events from `outside' the main application. - -\membersection{::wxRemoveSecondaryEventHandler} - -\func{bool}{wxRemoveSecondaryEventHandler}{\param{wxEventHandler}{ handlerFunc}, \param{bool}{ pre}} - -Remove a secondary event handler. Returns TRUE if it succeeds. - -\membersection{::wxSendEvent}\label{wxsendevent} - -\func{bool}{wxSendEvent}{\param{wxEvent\&}{ event}, \param{bool}{ external}} - -Send an event to the system; usually it will be external, but set -external to FALSE if calling from within the main application in -response to other events. - -Returns TRUE if the event was processed. - \section{Printer settings}\label{printersettings} The following functions are used to control PostScript printing. Under diff --git a/docs/latex/wx/joystick.tex b/docs/latex/wx/joystick.tex index 118a233360..338f11668f 100644 --- a/docs/latex/wx/joystick.tex +++ b/docs/latex/wx/joystick.tex @@ -147,11 +147,11 @@ Gets the position of the fifth axis of the joystick, if it exists. Returns the maximum V position. -\membersection{wxJoystick::GetUMin}\label{wxjoystickgetumin} +\membersection{wxJoystick::GetVMin}\label{wxjoystickgetvmin} -\constfunc{int}{GetUMin}{\void} +\constfunc{int}{GetVMin}{\void} -Returns the minimum U position. +Returns the minimum V position. \membersection{wxJoystick::GetVPosition}\label{wxjoystickgetvposition} diff --git a/docs/latex/wx/tabctrl.tex b/docs/latex/wx/tabctrl.tex index f623a4748a..05aa81886d 100644 --- a/docs/latex/wx/tabctrl.tex +++ b/docs/latex/wx/tabctrl.tex @@ -188,7 +188,7 @@ Sets the client data for a tab. \func{bool}{SetItemImage}{\param{int}{ item}, \param{int }{image}} Sets the image index for the given tab. {\it image} is an index into -the image list which was set with \helpref{wxTabCtrl::SetImageList}{setimagelist}. +the image list which was set with \helpref{wxTabCtrl::SetImageList}{wxtabctrlsetimagelist}. \membersection{wxTabCtrl::SetImageList}\label{wxtabctrlsetimagelist} diff --git a/docs/latex/wx/tdocview.tex b/docs/latex/wx/tdocview.tex index 8b147fa176..05d29bd93a 100644 --- a/docs/latex/wx/tdocview.tex +++ b/docs/latex/wx/tdocview.tex @@ -2,6 +2,7 @@ Classes: \helpref{wxDocument}{wxdocument}, \helpref{wxView}{wxview}, \helpref{wxDocTemplate}{wxdoctemplate},\rtfsp \helpref{wxDocManager}{wxdocmanager}, \helpref{wxDocParentFrame}{wxdocparentframe}, \helpref{wxDocChildFrame}{wxdocchildframe}, +\rtfsp\helpref{wxDocMDIParentFrame}{wxdocmdiparentframe}, \helpref{wxDocMDIChildFrame}{wxdocmdichildframe}, \rtfsp\helpref{wxCommand}{wxcommand}, \helpref{wxCommandProcessor}{wxcommandprocessor} The document/view framework is found in most application frameworks, because it @@ -254,42 +255,28 @@ the file history, that will be used for appending the filenames. They are appended using menu identifiers in the range wxID\_FILE1 to wxID\_FILE9. In order to respond to a file load command from one of these identifiers, -you need to handle them in your wxFrame::OnMenuCommand. Below is the -code used by the default document/view parent frame. +you need to handle them using an event handler, for example: +{\small \begin{verbatim} -void wxDocParentFrame::OnMenuCommand(int id) +BEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame) + EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit) + EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile) +END_EVENT_TABLE() + +void wxDocParentFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { - switch (id) - { - case wxID_EXIT: - { - if (GetEventHandler()->OnClose()) - delete this; - break; - } - case wxID_FILE1: - case wxID_FILE2: - case wxID_FILE3: - case wxID_FILE4: - case wxID_FILE5: - case wxID_FILE6: - case wxID_FILE7: - case wxID_FILE8: - case wxID_FILE9: - { - char *f = docManager->GetHistoryFile(id-wxID_FILE1); - if (f) - (void)docManager->CreateDocument(f, wxDOC_SILENT); - break; - } - default: - { - docManager->OnMenuCommand(id); - } - } + Close(); +} + +void wxDocParentFrame::OnMRUFile(wxCommandEvent& event) +{ + wxString f(m_docManager->GetHistoryFile(event.GetSelection() - wxID_FILE1)); + if (f != "") + (void)m_docManager->CreateDocument(f, wxDOC_SILENT); } \end{verbatim} +} \subsection{wxWindows predefined command identifiers}\label{predefinedids} diff --git a/docs/latex/wx/thread.tex b/docs/latex/wx/thread.tex index fab79009fc..62d334e12a 100644 --- a/docs/latex/wx/thread.tex +++ b/docs/latex/wx/thread.tex @@ -52,7 +52,7 @@ calling thread. \func{wxThreadError}{Destroy}{\void} -Destroys the thread immediately unless the application has specified deferral via \helpref{wxThread::DeferDestroy}{deferdestroy}. +Destroys the thread immediately unless the application has specified deferral via \helpref{wxThread::DeferDestroy}{wxthreaddeferdestroy}. \wxheading{Return value} diff --git a/docs/latex/wx/toolbar.tex b/docs/latex/wx/toolbar.tex index 28468766b0..701b3f3c36 100644 --- a/docs/latex/wx/toolbar.tex +++ b/docs/latex/wx/toolbar.tex @@ -226,7 +226,7 @@ Enables or disables the tool. \wxheading{Remarks} -For \helpref{wxToolBarSimple}{wxtoolbarsimple}, does nothing. Some other implementations +For wxToolBarSimple, does nothing. Some other implementations will change the visible state of the tool to indicate that it is disabled. \wxheading{See also} diff --git a/docs/latex/wx/topics.tex b/docs/latex/wx/topics.tex index d189e2d9a1..bd87b29a42 100644 --- a/docs/latex/wx/topics.tex +++ b/docs/latex/wx/topics.tex @@ -8,7 +8,6 @@ This chapter contains a selection of topic overviews. \input tbitmap.tex \input tdialog.tex \input tfont.tex -\input tstring.tex \input tsplittr.tex \input ttreectl.tex \input tlistctl.tex @@ -33,5 +32,6 @@ This chapter contains a selection of topic overviews. \input tvalidat.tex \input texpr.tex \input tgrid.tex +\input tstring.tex \input tusage.tex diff --git a/docs/latex/wx/tstring.tex b/docs/latex/wx/tstring.tex index b9afab0b9f..c0208f6d20 100644 --- a/docs/latex/wx/tstring.tex +++ b/docs/latex/wx/tstring.tex @@ -1,1079 +1,5 @@ \section{wxString overview}\label{wxstringoverview} -Class: \helpref{wxString}{wxstring} - -Strings are used very frequently in most programs. There is no direct support in -the C++ language for strings. A string class can be useful in many -situations: it not only makes the code shorter and easier to read, it also -provides more security, because we don't have to deal with pointer acrobatics. - -wxString is available in two versions: a cut-down wxWindows, -copyright-free version, and a much more powerful GNU-derived version. The default is the -GNU-derived, fully-featured version, ported and revised by Stefan Hammes. - -For backward compatibility most of the member functions of the original -wxWindows wxString class have been included, except some `dangerous' -functions. - -wxString can be compiled under MSW, UNIX and VMS (see below). The -function names have been capitalized to be consistent with the wxWindows -naming scheme. - -The reasons for not using the GNU string class directly are: - -\begin{itemize}\itemsep=0pt -\item It is not available on all systems (generally speaking, it is available only on some -UNIX systems). -\item We can make changes and extensions to the string class as needed and are not -forced to use `only' the functionality of the GNU string class. -\end{itemize} - -The GNU code comes with certain copyright restrictions. If you can't -live with these, you will need to use the cut-down wxString class -instead, by editing wx\_setup.h and appropriate wxWindows makefiles. - -\subsection{Copyright of the original GNU code portion} - -Copyright (C) 1988, 1991, 1992 Free Software Foundation, Inc. -written by Doug Lea (dl@rocky.oswego.edu) - -This file is part of the GNU C++ Library. This library is free -software; you can redistribute it and/or modify it under the terms of -the GNU Library General Public License as published by the Free -Software Foundation; either version 2 of the License, or (at your -option) any later version. This library is distributed in the hope -that it will be useful, but WITHOUT ANY WARRANTY; without even the -implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -\subsection{Features/Additions/Modifications} - -The wxString class offers many string handling functions and a support for -regular expressions. This gives powerful, easy-to-use pattern-matching functionality. -See below for a discussion of the GNU features of wxString. See also -the header file `wxstrgnu.h' which shows all member functions. - -As stated above, there are extensions to the wxString class. -This includes the including of the `old' wxString class member functions. -Below is a list of the additional member functions: - -\begin{itemize}\itemsep=0pt -\item Access to the internal representation. Should be used with care: -\begin{verbatim} - char* GetData() const; -\end{verbatim} -\item To make a copy of 'this' (only for compatibility): -\begin{verbatim} - wxString Copy() const; -\end{verbatim} -\item For case sensitive and case insensitive comparisons: -\begin{verbatim} - enum caseCompare {exact, ignoreCase}; - int CompareTo(const char* cs, caseCompare cmp = exact) const; - int CompareTo(const wxString& st, caseCompare cmp = exact) const; -\end{verbatim} - -\item For case sensitive and case insensitive containment check: -\begin{verbatim} - Bool Contains(const char* pat, caseCompare cmp = exact) const; - Bool Contains(const wxString& pat, caseCompare cmp = exact) const; -\end{verbatim} - -\item For case sensitive and case insensitive index calculation: -\begin{verbatim} - int Index(const char* pat, int i=0, caseCompare cmp = exact) const; - int Index(const wxString& s, int i=0, caseCompare cmp = exact) const; -\end{verbatim} - -\item For element access in addition to the [] operator: -\begin{verbatim} - char& operator()(int); // Indexing with bounds checking -\end{verbatim} - -\item To put something in front of a string: -\begin{verbatim} - wxString& Prepend(const char*); // Prepend a character string - wxString& Prepend(const wxString& s); - wxString& Prepend(char c, int rep=1); // Prepend c rep times -\end{verbatim} - -\item For concatenation: -\begin{verbatim} - wxString& Append(const char* cs); - wxString& Append(const wxString& s); - wxString& Append(char c, int rep=1); // Append c rep times -\end{verbatim} - -\item To get the first and last occurrence of a char or string: -\begin{verbatim} - int First(char c) const; - int First(const char* cs) const; - int First(const wxString& cs) const; - int Last(char c) const; - int Last(const char* cs) const; - int Last(const wxString& cs) const; -\end{verbatim} - -\item To insert something into a string -\begin{verbatim} - wxString& Insert(int pos, const char*); - wxString& Insert(int pos, const wxString&); -\end{verbatim} - -\item To remove data (in addition to the 'Del' functions): -\begin{verbatim} - wxString& Remove(int pos); // Remove pos to end of string - wxString& Remove(int pos, int n); // Remove n chars starting at pos - wxString& RemoveLast(void); // It removes the last char of a string -\end{verbatim} - -\item To replace data: -\begin{verbatim} - wxString& Replace(int pos, int n, const char*); - wxString& Replace(int pos, int n, const wxString&); -\end{verbatim} - -\item Alternative names for compatibility: -\begin{verbatim} - void LowerCase(); // Change self to lower-case - void UpperCase(); // Change self to upper-case -\end{verbatim} - -\item Edward Zimmermann's additions: -\begin{verbatim} - wxString SubString(int from, int to); -\end{verbatim} - -\item Formatted assignment: -\begin{verbatim} - void sprintf(const char *fmt, ...); -\end{verbatim} - -We do not use the 'sprintf' constructor of the old wxString class anymore, -because with that constructor, every initialisation with a string would -go through sprintf and this is not desirable, because sprintf interprets -some characters. With the above function we can write: - -\begin{verbatim} - wxString msg; msg.sprintf("Processing item %d\n",count); -\end{verbatim} - -\item Strip chars at the front and/or end. -This can be useful for trimming strings: -\begin{verbatim} - enum StripType {leading = 0x1, trailing = 0x2, both = 0x3}; - wxSubString Strip(StripType s=trailing, char c=' '); -\end{verbatim} - -\item Line input: -Besides the stream I/O functions this function can be used for non-standard -formatted I/O with arbitrary line terminators. -\begin{verbatim} - friend int Readline(FILE *f, wxString& x, - char terminator = '\\n', - int discard_terminator = 1); -\end{verbatim} - -\item The GNU wxString class lacks some classification functions: -\begin{verbatim} - int IsAscii() const; - int IsWord() const; - int IsNumber() const; - int IsNull() const; - int IsDefined() const; -\end{verbatim} - -\item The meaning of nil has been changed. A wxString x is only nil, if it -has been declared `wxString x'. In all other cases it is NOT nil. This -seems to me more logical than to let a `wxString x=""' be nil as it -was in the original GNU code. - -\item {\bf IMPORTANT:} -the following is a very, very, very ugly macro, but it makes things more -transparent in cases, where a library function requires a -(char*) argument. This is especially the case in wxWindows, -where most char-arguments are (char*) and not (const char*). -this macro should only be used in such cases and NOT to -modify the internal data. The standard type conversion function -of wxString returns a '(const char*)'. -The conventional way would be 'function((char*)string.Chars())'. -With the macro this can be achieved by 'function(wxCHARARG(string))'. -Whis makes it clearer that the usage should be confined -to arguments. See below for examples. - -\begin{verbatim} -#define wxCHARARG(s) ((char*)(s).Chars()) -\end{verbatim} - -\end{itemize} - -\subsection{Function calls} - -When using wxString objects as parameters to other functions you should -note the following: - -\begin{verbatim} -void f1(const char *s){} -void f2(char *s){} - -main(){ - wxString aString; - f1(aString); // ok - f2(aString); // error - f2(wxCHARARG(aString)); // ok - printf("%s",aString); // NO compilation error, but a runtime error. - printf("%s",aString.Chars()); // ok - printf("%s",wxCHARARG(aString)); // ok -} -\end{verbatim} - -\subsection{Header files} - -For DOS and UNIX we use a stub-headerfile {\tt include/base/wxstring.h}\rtfsp -which includes the two headerfiles in the {\tt contrib/wxstring} directory, -namely {\tt contrib/wxstring/wxstrgnu.h} and {\tt contrib/wxstring/wxregex.h}. -If there is a headerfile {\tt contrib/wxstring/wxstring.h}, please -delete it. It will cause problems in the VMS compilation. - -For VMS we have to do an addition due to the not very intelligent inclusion mechanism -of the VMS C++ compiler: -In the VMS-Makefile, the include-file search path is augmented with the -{\tt contrib/wxstring} directory, so that the correct headerfiles -can be included. - -So you have only to specify - -\begin{verbatim} -#define USE_GNU_WXSTRING 1 -\end{verbatim} - -in {\tt include/base/wx\_setup.h} to use the wxString class. - -\subsection{Test program} - -Stefan Hammes has included a test program {\tt test.cc} in the contrib/wxstring directory for many features -of wxString and wxRegex. It also tests Stefan's extensions. -When running the compiled program, there should -be NO assert-errors if everything is OK. When compiling the test -program, you can ignore warnings about unused variables. They -occur because Stefan has used a special method of initializing all -variables to the same start values before each test. - -\subsection{Compilers} - -wxString and wxRegex have been compiled successfully with the following -compilers (it should work on nearly every C++ compiler): - -\begin{itemize}\itemsep=0pt -\item PC MS-Visual C++ 1.0, 1.5 -\item UNIX gcc v2.6.3 -\item UNIX Sun SunPro compiler under Solaris 2.x -\item VMS DEC C++ compiler (on VAX and AXP) -\end{itemize} - -Warnings about type conversion or assignments can be ignored. - -\subsection{GNU Documentation} - -Below is the original GNU wxString and wxRegex -documentation. It describes most functions of the classes. -The function names have been capitalized to be consistent with -the wxWindows naming scheme. The examples are integrated into the test program. - -Copyright (C) 1988, 1991, 1992 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - -Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided also -that the section entitled "GNU Library General Public License" is -included exactly as in the original, and provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that the section entitled "GNU Library General Public -License" and this permission notice may be included in translations -approved by the Free Software Foundation instead of in the original -English. - -\subsubsection{The wxString class} - -The `wxString' class is designed to extend GNU C++ to support string -processing capabilities similar to those in languages like Awk. The -class provides facilities that ought to be convenient and efficient -enough to be useful replacements for `char*' based processing via the C -string library (i.e., `strcpy, strcmp,' etc.) in many applications. -Many details about wxString representations are described in the -Representation section. - -A separate `wxSubString' class supports substring extraction and -modification operations. This is implemented in a way that user -programs never directly construct or represent substrings, which are -only used indirectly via wxString operations. - -Another separate class, `wxRegex' is also used indirectly via wxString -operations in support of regular expression searching, matching, and the -like. The wxRegex class is based entirely on the GNU Emacs regex -functions. See \helpref{Regular Expressions}{regularexpressions} -for a full explanation of regular expression syntax. (For -implementation details, see the internal documentation in files -{\tt wxregex.h} and {\tt wxregex.cc}). - -\subsubsection{Constructor examples} - -Strings are initialized and assigned as in the following examples: - -{\tt wxString x;} -Set x to the nil string. This is different from the original GNU code -which sets a strings also to nil when it is assign 0 or "". - -{\tt wxString x = "Hello"; wxString y("Hello");} -Set x and y to a copy of the string "Hello". - -{\tt wxString x = 'A'; wxString y('A');} -Set x and y to the string value "A". - -{\tt wxString u = x; wxString v(x);} -Set u and v to the same string as wxString x - -{\tt wxString u = x.At(1,4); wxString v(x.At(1,4));} -Set u and v to the length 4 substring of x starting at position 1 -(counting indexes from 0). - -{\tt wxString x("abc", 2);} -Sets x to "ab", i.e., the first 2 characters of "abc". - -There are no directly accessible forms for declaring wxSubString -variables. - -The declaration \verb$wxRegex r("[a-zA-Z_][a-zA-Z0-9_]*");$ creates -compiled regular expression suitable for use in wxString operations -described below. (In this case, one that matches any C++ identifier). -The first argument may also be a wxString. Be careful in distinguishing -the role of backslashes in quoted GNU C++ `char*' constants versus those -in Regexes. For example, a wxRegex that matches either one or more tabs -or all strings beginning with "ba" and ending with any number of -occurrences of "na" could be declared as - -\begin{verbatim} - wxRegex r = "\\(\t+\\)\\|\\(ba\\(na\\)*\\)" -\end{verbatim} - -Note that only one backslash is needed -to signify the tab, but two are needed for the parenthesization and -virgule, since the GNU C++ lexical analyzer decodes and strips -backslashes before they are seen by wxRegex. - -There are three additional optional arguments to the wxRegex -constructor that are less commonly useful: - -{\tt fast (default 0)} -`fast' may be set to true (1) if the wxRegex should be -"fast-compiled". This causes an additional compilation step that -is generally worthwhile if the wxRegex will be used many times. - -{\tt bufsize (default max(40, length of the string))} -This is an estimate of the size of the internal compiled -expression. Set it to a larger value if you know that the -expression will require a lot of space. If you do not know, do not -worry: realloc is used if necessary. - -{\tt transtable (default none == 0)} -The address of a byte translation table (a char[256]) that -translates each character before matching. - -As a convenience, several Regexes are predefined and usable in any -program. Here are their declarations from {\tt wxString.h}. -\begin{verbatim} - extern wxRegex RXwhite; // = "[ \n\t]+" - extern wxRegex RXint; // = "-?[0-9]+" - extern wxRegex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\| - // \\([0-9]+\\)\\| - // \\(\\.[0-9]+\\)\\) - // \\([eE][---+]?[0-9]+\\)?" - extern wxRegex RXalpha; // = "[A-Za-z]+" - extern wxRegex RXlowercase; // = "[a-z]+" - extern wxRegex RXuppercase; // = "[A-Z]+" - extern wxRegex RXalphanum; // = "[0-9A-Za-z]+" - extern wxRegex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*" -\end{verbatim} - -\subsubsection{Examples} - -Most {\tt wxString} class capabilities are best shown via example. The -examples below use the following declarations. - -\begin{verbatim} - wxString x = "Hello"; - wxString y = "world"; - wxString n = "123"; - wxString z; - char *s = ","; - wxString lft, mid, rgt; - wxRegex r = "e[a-z]*o"; - wxRegex r2("/[a-z]*/"); - char c; - int i, pos, len; - double f; - wxString words[10]; - words[0] = "a"; - words[1] = "b"; - words[2] = "c"; -\end{verbatim} - -\subsubsection{Comparing, Searching and Matching examples} - -The usual lexicographic relational operators (`==, !=, <, <=, >, >=') -are defined. A functional form `compare(wxString, wxString)' is also -provided, as is `fcompare(wxString, wxString)', which compares Strings -without regard for upper vs. lower case. - -All other matching and searching operations are based on some form -of the (non-public) `match' and `search' functions. `match' and -`search' differ in that `match' attempts to match only at the given -starting position, while `search' starts at the position, and then -proceeds left or right looking for a match. As seen in the following -examples, the second optional `startpos' argument to functions using -`match' and `search' specifies the starting position of the search: If -non-negative, it results in a left-to-right search starting at position -`startpos', and if negative, a right-to-left search starting at -position `x.Length() + startpos'. In all cases, the index returned is -that of the beginning of the match, or -1 if there is no match. - -Three wxString functions serve as front ends to `search' and `match'. -`index' performs a search, returning the index, `matches' performs a -match, returning nonzero (actually, the length of the match) on success, -and `contains' is a boolean function performing either a search or -match, depending on whether an index argument is provided: - -{\tt x.Index("lo")} -Returns the zero-based index of the leftmost occurrence of -substring "lo" (3, in this case). The argument may be a wxString, -wxSubString, char, char*, or wxRegex. - -{\tt x.Index("l", 2)} -Returns the index of the first of the leftmost occurrence of "l" -found starting the search at position x[2], or 2 in this case. - -{\tt x.Index("l", -1)} -Returns the index of the rightmost occurrence of "l", or 3 here. - -{\tt x.Index("l", -3)} -Returns the index of the rightmost occurrence of "l" found by -starting the search at the 3rd to the last position of x, -returning 2 in this case. - -{\tt pos = r.Search("leo", 3, len, 0)} -Returns the index of r in the {\tt char*} string of length 3, starting -at position 0, also placing the length of the match in reference -parameter len. - -{\tt x.Contains("He")} -Returns nonzero if the wxString x contains the substring "He". The -argument may be a wxString, wxSubString, char, char*, or wxRegex. - -{\tt x.Contains("el", 1)} -Returns nonzero if x contains the substring "el" at position 1. -As in this example, the second argument to `contains', if present, -means to match the substring only at that position, and not to -search elsewhere in the string. - -{\tt x.Contains(RXwhite);} -Returns nonzero if x contains any whitespace (space, tab, or -newline). Recall that `RXwhite' is a global whitespace wxRegex. - -{\tt x.Matches("lo", 3)} -Returns nonzero if x starting at position 3 exactly matches "lo", -with no trailing characters (as it does in this example). - -{\tt x.Matches(r)} -Returns nonzero if wxString x as a whole matches wxRegex r. - -{\tt int f = x.Freq("l")} -Returns the number of distinct, nonoverlapping matches to the -argument (2 in this case). - -\subsubsection{Substring extraction examples} - -Substrings may be extracted via the `at', `before', `through', -`from', and `after' functions. These behave as either lvalues or -rvalues. - -{\tt z = x.At(2, 3)} -Sets wxString z to be equal to the length 3 substring of wxString x -starting at zero-based position 2, setting z to "llo" in this -case. A nil wxString is returned if the arguments don't make sense. - -{\tt x.At(2, 2) = "r"} -Sets what was in positions 2 to 3 of x to "r", setting x to "Hero" -in this case. As indicated here, wxSubString assignments may be of -different lengths. - -{\tt x.At("He") = "je";} -x("He") is the substring of x that matches the first occurrence of -it's argument. The substitution sets x to "jello". If "He" did not -occur, the substring would be nil, and the assignment would have -no effect. - -{\tt x.At("l", -1) = "i";} -Replaces the rightmost occurrence of "l" with "i", setting x to -"Helio". - -{\tt z = x.At(r)} -Sets wxString z to the first match in x of wxRegex r, or "ello" in this -case. A nil wxString is returned if there is no match. - -{\tt z = x.Before("o")} -Sets z to the part of x to the left of the first occurrence of -"o", or "Hell" in this case. The argument may also be a wxString, -wxSubString, or wxRegex. (If there is no match, z is set to "".) - -{\tt x.Before("ll") = "Bri";} -Sets the part of x to the left of "ll" to "Bri", setting x to -"Brillo". - -{\tt z = x.Before(2)} -Sets z to the part of x to the left of x[2], or "He" in this case. - -{\tt z = x.After("Hel")} -Sets z to the part of x to the right of "Hel", or "lo" in this -case. - -{\tt z = x.Through("el")} -Sets z to the part of x up and including "el", or "Hel" in this -case. - -{\tt z = x.From("el")} -Sets z to the part of x from "el" to the end, or "ello" in this -case. - -{\tt x.After("Hel") = "p";} -Sets x to "Help"; - -{\tt z = x.After(3)} -Sets z to the part of x to the right of x[3] or "o" in this case. - -{\tt z = " ab c"; z = z.After(RXwhite)} -Sets z to the part of its old string to the right of the first -group of whitespace, setting z to "ab c"; Use GSub(below) to strip -out multiple occurrences of whitespace or any pattern. - -{\tt x[0] = 'J';} -Sets the first element of x to 'J'. x[i] returns a reference to -the ith element of x, or triggers an error if i is out of range. - -{\tt CommonPrefix(x, "Help")} -Returns the wxString containing the common prefix of the two Strings -or "Hel" in this case. - -{\tt CommonSuffix(x, "to")} -Returns the wxString containing the common suffix of the two Strings -or "o" in this case. - -\subsubsection{Concatenation examples} - -{\tt z = x + s + ' ' + y.At("w") + y.After("w") + ".";} -Sets z to "Hello, world." - -{\tt x += y;} -Sets x to "Helloworld". - -{\tt Cat(x, y, z)} -A faster way to say z = x + y. - -{\tt Cat(z, y, x, x)} -Double concatenation; A faster way to say x = z + y + x. - -{\tt y.Prepend(x);} -A faster way to say y = x + y. - -{\tt z = Replicate(x, 3);} -Sets z to "HelloHelloHello". - -{\tt z = Join(words, 3, "/")} -Sets z to the concatenation of the first 3 Strings in wxString array -words, each separated by "/", setting z to "a/b/c" in this case. -The last argument may be "" or 0, indicating no separation. - -\subsubsection{Other manipulation examples} - -{\tt z = "this string has five words"; i = Split(z, words, 10, RXwhite);} -Sets up to 10 elements of wxString array words to the parts of z -separated by whitespace, and returns the number of parts actually -encountered (5 in this case). Here, words[0] = "this", words[1] = -"string", etc. The last argument may be any of the usual. If -there is no match, all of z ends up in words[0]. The words array -is *not* dynamically created by split. - -{\tt int nmatches x.GSub("l","ll")} -Substitutes all original occurrences of "l" with "ll", setting x -to "Hellllo". The first argument may be any of the usual, -including wxRegex. If the second argument is "" or 0, all -occurrences are deleted. gsub returns the number of matches that -were replaced. - -{\tt z = x + y; z.Del("loworl");} -Deletes the leftmost occurrence of "loworl" in z, setting z to -"Held". - -{\tt z = Reverse(x)} -Sets z to the reverse of x, or "olleH". - -{\tt z = Upcase(x)} -Sets z to x, with all letters set to uppercase, setting z to -"HELLO". - -{\tt z = Downcase(x)} -Sets z to x, with all letters set to lowercase, setting z to -"hello" - -{\tt z = Capitalize(x)} -Sets z to x, with the first letter of each word set to uppercase, -and all others to lowercase, setting z to "Hello" - -{\tt x.Reverse(), x.Upcase(), x.Downcase(), x.Capitalize()} -in-place, self-modifying versions of the above. - -\subsubsection{Reading, Writing and Conversion examples} - -{\tt cout << x} -Writes out x. - -{\tt cout << x.At(2, 3)} -Writes out the substring "llo". - -{\tt cin >> x} -Reads a whitespace-bounded string into x. - -{\tt x.Length()} -Returns the length of wxString x (5, in this case). - -{\tt s = (const char*)x} -Can be used to extract the `char*' char array. This coercion is -useful for sending a wxString as an argument to any function -expecting a `const char*' argument (like `atoi', and -`File::open'). This operator must be used with care, since the -conversion returns a pointer to `wxString' internals without copying -the characters: The resulting `(char*)' is only valid until the -next wxString operation, and you must not modify it. (The -conversion is defined to return a const value so that GNU C++ will -produce warning and/or error messages if changes are attempted.) - -\subsection{Regular Expressions}\label{regularexpressions} - -The following are extracts from GNU documentation. - -\subsubsection{Regular Expression Overview} - -Regular expression matching allows you to test whether a string fits -into a specific syntactic shape. You can also search a string for a -substring that fits a pattern. - -A regular expression describes a set of strings. The simplest case -is one that describes a particular string; for example, the string -`foo' when regarded as a regular expression matches `foo' and nothing -else. Nontrivial regular expressions use certain special constructs -so that they can match more than one string. For example, the -regular expression `foo$\backslash$|bar' matches either the string `foo' or the -string `bar'; the regular expression `c[ad]*r' matches any of the -strings `cr', `car', `cdr', `caar', `cadddar' and all other such -strings with any number of `a''s and `d''s. - -The first step in matching a regular expression is to compile it. -You must supply the pattern string and also a pattern buffer to hold -the compiled result. That result contains the pattern in an internal -format that is easier to use in matching. - -Having compiled a pattern, you can match it against strings. You can -match the compiled pattern any number of times against different -strings. - -\subsubsection{Syntax of Regular Expressions} - -Regular expressions have a syntax in which a few characters are -special constructs and the rest are "ordinary". An ordinary -character is a simple regular expression which matches that character -and nothing else. The special characters are `\verb+\$+', `\verb+^+', `.', `*', -`+', `?', `[', `]' and `$\backslash$'. Any other character appearing in a -regular expression is ordinary, unless a `$\backslash$' precedes it. - -For example, `f' is not a special character, so it is ordinary, and -therefore `f' is a regular expression that matches the string `f' and -no other string. (It does *not* match the string `ff'.) Likewise, -`o' is a regular expression that matches only `o'. - -Any two regular expressions A and B can be concatenated. The result -is a regular expression which matches a string if A matches some -amount of the beginning of that string and B matches the rest of the -string. - -As a simple example, we can concatenate the regular expressions `f' -and `o' to get the regular expression `fo', which matches only the -string `fo'. Still trivial. - -Note: for Unix compatibility, special characters are treated as -ordinary ones if they are in contexts where their special meanings -make no sense. For example, `*foo' treats `*' as ordinary since -there is no preceding expression on which the `*' can act. It is -poor practice to depend on this behavior; better to quote the special -character anyway, regardless of where is appears. - -The following are the characters and character sequences which have -special meaning within regular expressions. Any character not -mentioned here is not special; it stands for exactly itself for the -purposes of searching and matching. - -\begin{itemize} -\itemsep=0pt - -\item \rtfsp -{\tt .} is a special character that matches anything except a newline. -Using concatenation, we can make regular expressions like {\tt a.b} -which matches any three-character string which begins with {\tt a} -and ends with {\tt b}. - -\item \rtfsp -{\tt *} is not a construct by itself; it is a suffix, which means the -preceding regular expression is to be repeated as many times as -possible. In {\tt fo*}, the {\tt *} applies to the {\tt o}, so {\tt fo*} -matches {\tt f} followed by any number of {\tt o}'s. - -The case of zero {\tt o}'s is allowed: {\tt fo*} does match {\tt f}. - -{\tt *} always applies to the *smallest* possible preceding -expression. Thus, {\tt fo*} has a repeating {\tt o}, not a repeating -{\tt fo}. - -The matcher processes a {\tt *} construct by matching, immediately, -as many repetitions as can be found. Then it continues with the -rest of the pattern. If that fails, backtracking occurs, -discarding some of the matches of the {\tt *}'d construct in case -that makes it possible to match the rest of the pattern. For -example, matching {\tt c$[$ad$]$*ar} against the string {\tt caddaar}, the -{\tt $[$ad$]$*} first matches {\tt addaa}, but this does not allow the next -{\tt a} in the pattern to match. So the last of the matches of -{\tt $[$ad$]$} is undone and the following {\tt a} is tried again. Now it -succeeds. - -\item \rtfsp -{\tt +} is like {\tt *} except that at least one match for the preceding -pattern is required for {\tt +}. Thus, {\tt c$[$ad$]$+r} does not match -{\tt cr} but does match anything else that {\tt c$[$ad$]$*r} would match. - -\item \rtfsp -{\tt ?} is like {\tt *} except that it allows either zero or one match -for the preceding pattern. Thus, {\tt c$[$ad$]$?r} matches {\tt cr} or -{\tt car} or {\tt cdr}, and nothing else. - -\item \rtfsp -{\tt $[$} begins a "character set", which is terminated by a {\tt $]$}. In -the simplest case, the characters between the two form the set. -Thus, {\tt $[$ad$]$} matches either {\tt a} or {\tt d}, and {\tt $[$ad$]$*} matches any -string of {\tt a}'s and {\tt d}'s (including the empty string), from -which it follows that {\tt c$[$ad$]$*r} matches {\tt car}, etc. - -Character ranges can also be included in a character set, by -writing two characters with a {\tt -} between them. Thus, {\tt $[$a-z$]$} -matches any lower-case letter. Ranges may be intermixed freely -with individual characters, as in {\tt $[$a-z\$\%.$]$}, which matches any -lower case letter or {\tt \$}, {\tt \%} or period. - -Note that the usual special characters are not special any more -inside a character set. A completely different set of special -characters exists inside character sets: {\tt $]$}, {\tt -} and \verb$^$. - -To include a {\tt $]$} in a character set, you must make it the first -character. For example, {\tt $[$$]$a$]$} matches {\tt $]$} or {\tt a}. To include -a {\tt -}, you must use it in a context where it cannot possibly -indicate a range: that is, as the first character, or -immediately after a range. - -\item \rtfsp -\verb$[^$ begins a "complement character set", which matches any -character except the ones specified. Thus, \verb$[^a-z0-9A-Z]$ -matches all characters {\it except} letters and digits. - -\item \rtfsp -\verb$^$ is not special in a character set unless it is the first -character. The character following the \verb$^$ is treated as if it -were first (it may be a {\tt -} or a {\tt $]$}). - -\verb$^$ is a special character that matches the empty string -- but only -if at the beginning of a line in the text being matched. -Otherwise it fails to match anything. Thus, \verb$^foo$ matches a -{\tt foo} which occurs at the beginning of a line. - -\item \rtfsp -{\tt \$} -is similar to \verb$^$ but matches only at the end of a line. Thus, -{\tt xx*\$} matches a string of one or more {\tt x}'s at the end of a line. - -\item \rtfsp -{\tt $\backslash$} -has two functions: it quotes the above special characters -(including {\tt $\backslash$}), and it introduces additional special constructs. - -Because {\tt $\backslash$} quotes special characters, {\tt $\backslash$\$} is a regular -expression which matches only {\tt \$}, and {\tt $\backslash$$[$} is a regular -expression which matches only {\tt $[$}, and so on. - -For the most part, {\tt $\backslash$} followed by any character matches only -that character. However, there are several exceptions: -characters which, when preceded by {\tt $\backslash$}, are special constructs. -Such characters are always ordinary when encountered on their own. - -No new special characters will ever be defined. All extensions -to the regular expression syntax are made by defining new -two-character constructs that begin with {\tt $\backslash$}. - -\item \rtfsp -{\tt $\backslash$|} -specifies an alternative. Two regular expressions A and B with -{\tt $\backslash$|} in between form an expression that matches anything that -either A or B will match. - -Thus, {\tt foo$\backslash$|bar} matches either {\tt foo} or {\tt bar} but no other -string. - -{\tt $\backslash$|} applies to the largest possible surrounding expressions. -Only a surrounding {\tt $\backslash$( ... $\backslash$)} grouping can limit the grouping -power of {\tt $\backslash$|}. - -Full backtracking capability exists when multiple {\tt $\backslash$|}'s are used. - -\item \rtfsp -{\tt $\backslash$( ... $\backslash$)} -is a grouping construct that serves three purposes: -\begin{enumerate} -\item To enclose a set of {\tt $\backslash$|} alternatives for other operations. -Thus, {\tt $\backslash$(foo$\backslash$|bar$\backslash$)x} matches either {\tt foox} or {\tt barx}. -\item To enclose a complicated expression for the postfix {\tt *} to -operate on. Thus, {\tt ba$\backslash$(na$\backslash$)*} matches {\tt bananana}, etc., -with any (zero or more) number of {\tt na}'s. -\item To mark a matched substring for future reference. -\end{enumerate} - -This last application is not a consequence of the idea of a -parenthetical grouping; it is a separate feature which happens -to be assigned as a second meaning to the same {\tt $\backslash$( ... $\backslash$)} -construct because there is no conflict in practice between the -two meanings. Here is an explanation of this feature: - -\item \rtfsp -{\tt $\backslash$DIGIT} -After the end of a {\tt $\backslash$( ... $\backslash$)} construct, the matcher remembers -the beginning and end of the text matched by that construct. -Then, later on in the regular expression, you can use {\tt $\backslash$} -followed by DIGIT to mean "match the same text matched the -DIGIT'th time by the {\tt $\backslash$( ... $\backslash$)} construct." The {\tt $\backslash$( ... $\backslash$)} -constructs are numbered in order of commencement in the regexp. - -The strings matching the first nine {\tt $\backslash$( ... $\backslash$)} constructs -appearing in a regular expression are assigned numbers 1 through -9 in order of their beginnings. {\tt $\backslash$1} through {\tt $\backslash$9} may be used -to refer to the text matched by the corresponding {\tt $\backslash$( ... $\backslash$)} -construct. - -For example, {\tt $\backslash$(.*$\backslash$)$\backslash$1} matches any string that is composed of -two identical halves. The {\tt $\backslash$(.*$\backslash$)} matches the first half, -which may be anything, but the {\tt $\backslash$1} that follows must match the -same exact text. - -\item \rtfsp -{\tt $\backslash$b} -matches the empty string, but only if it is at the beginning or -end of a word. Thus, {\tt $\backslash$bfoo$\backslash$b} matches any occurrence of {\tt foo} -as a separate word. {\tt $\backslash$bball$\backslash$(s$\backslash$|$\backslash$)$\backslash$b} matches {\tt ball} or {\tt balls} -as a separate word. - -\item \rtfsp -{\tt $\backslash$B} -matches the empty string, provided it is *not* at the beginning -or end of a word. - -\item \rtfsp -{\tt $\backslash$<} -matches the empty string, but only if it is at the beginning of -a word. - -\item \rtfsp -{\tt $\backslash$>} -matches the empty string, but only if it is at the end of a word. - -\item \rtfsp -{\tt $\backslash$w} -matches any word-constituent character. - -\item \rtfsp -{\tt $\backslash$W} -matches any character that is not a word-constituent. - -\end{itemize} - - - - - -\section{wxString member functions}\label{wxstringcategories} - -\overview{Overview}{wxstringoverview} - -This section describes categories of \helpref{wxString}{wxstring} class -member functions. - -TODO: describe each one briefly here. - -{\large {\bf Assigment}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::operator $=$}{wxstringoperatorassign}\\ -\end{itemize} - -{\large {\bf Classification}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::IsAscii}{wxstringIsAscii} -\item \helpref{wxString::IsWord}{wxstringIsWord} -\item \helpref{wxString::IsNumber}{wxstringIsNumber} -\item \helpref{wxString::IsNull}{wxstringIsNull} -\item \helpref{wxString::IsDefined}{wxstringIsDefined} -\end{itemize} - -{\large {\bf Comparisons (case sensitive and insensitive)}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::CompareTo}{wxstringCompareTo} -\item \helpref{Compare}{wxstringCompare} -\item \helpref{FCompare}{wxstringFCompare} -\item \helpref{Comparisons}{wxstringComparison} -\end{itemize} - -{\large {\bf Composition and Concatenation}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::operator $+=$}{wxstringPlusEqual} -\item \helpref{wxString::Append}{wxstringAppend} -\item \helpref{wxString::Prepend}{wxstringPrepend} -\item \helpref{wxString::Cat}{wxstringCat} -\item \helpref{operator $+$}{wxstringoperatorplus} -\end{itemize} - -{\large {\bf Constructors/Destructors}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::wxString}{wxstringconstruct} -\item \helpref{wxString::~wxString}{wxstringdestruct} -\end{itemize} - -{\large {\bf Conversions}} - -\begin{itemize} -\item \helpref{wxString::operator const char *}{wxstringoperatorconstcharpt} -\item \helpref{wxString::Chars}{wxstringChars} -\item \helpref{wxString::GetData}{wxstringGetData} -\end{itemize} - -{\large {\bf Deletion/Insertion}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::Del}{wxstringDel} -\item \helpref{wxString::Remove}{wxstringRemove} -\item \helpref{wxString::Insert}{wxstringInsert} -\item \helpref{Split}{wxstringSplit} -\item \helpref{Join}{wxstringJoin} -\end{itemize} - -{\large {\bf Duplication}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::Copy}{wxstringCopy} -\item \helpref{wxString::Replicate}{wxstringReplicate} -\end{itemize} - -{\large {\bf Element access}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::operator[]}{wxstringoperatorbracket} -\item \helpref{wxString::operator()}{wxstringoperatorparenth} -\item \helpref{wxString::Elem}{wxstringElem} -\item \helpref{wxString::Firstchar}{wxstringFirstchar} -\item \helpref{wxString::Lastchar}{wxstringLastchar} -\end{itemize} - -{\large {\bf Extraction of Substrings}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::At}{wxstringAt} -\item \helpref{wxString::Before}{wxstringBefore} -\item \helpref{wxString::Through}{wxstringThrough} -\item \helpref{wxString::From}{wxstringFrom} -\item \helpref{wxString::After}{wxstringAfter} -\item \helpref{wxString::SubString}{wxstringSubString} -\end{itemize} - -{\large {\bf Input/Output}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::sprintf}{wxstringsprintf} -\item \helpref{wxString::operator \cinsert}{wxstringoperatorout} -\item \helpref{wxString::operator \cextract}{wxstringoperatorin} -\item \helpref{wxString::Readline}{wxstringReadline} -\end{itemize} - -{\large {\bf Searching/Matching}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::Index}{wxstringIndex} -\item \helpref{wxString::Contains}{wxstringContains} -\item \helpref{wxString::Matches}{wxstringMatches} -\item \helpref{wxString::Freq}{wxstringFreq} -\item \helpref{wxString::First}{wxstringFirst} -\item \helpref{wxString::Last}{wxstringLast} -\end{itemize} - -{\large {\bf Substitution}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::GSub}{wxstringGSub} -\item \helpref{wxString::Replace}{wxstringReplace} -\end{itemize} - -{\large {\bf Status}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::Length}{wxstringLength} -\item \helpref{wxString::Empty}{wxstringEmpty} -\item \helpref{wxString::Allocation}{wxstringAllocation} -\item \helpref{wxString::IsNull}{wxstringIsNull} -\end{itemize} - -{\large {\bf Transformations}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::Reverse}{wxstringReverse} -\item \helpref{wxString::Upcase}{wxstringUpcase} -\item \helpref{wxString::UpperCase}{wxstringUpperCase} -\item \helpref{wxString::DownCase}{wxstringDownCase} -\item \helpref{wxString::LowerCase}{wxstringLowerCase} -\item \helpref{wxString::Capitalize}{wxstringCapitalize} -\end{itemize} - -{\large {\bf Utilities}} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxString::Strip}{wxstringStrip} -\item \helpref{wxString::Error}{wxstringError} -\item \helpref{wxString::OK}{wxstringOK} -\item \helpref{wxString::Alloc}{wxstringAlloc} -\item \helpref{wxCHARARG}{wxstringwxCHARARG} -\item \helpref{CommonPrefix}{wxstringCommonPrefix} -\item \helpref{CommonSuffix}{wxstringCommonSuffix} -\end{itemize} +Classes: \helpref{wxString}{wxstring} +TODO. diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index bb19e4544c..438d651f49 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -1585,10 +1585,8 @@ handling of pages and ranges. \wxheading{See also} \helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp -\helpref{wxWindow::SetScrollRange}{wxwindowsetscrollpage},\rtfsp \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp -\helpref{wxWindow::GetScrollRange}{wxwindowsetscrollrange},\rtfsp -\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollrange},\rtfsp +\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} \end{comment} @@ -1615,8 +1613,7 @@ application to take note of scrollbar attributes and redraw contents accordingly \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar},\rtfsp \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp -\helpref{wxWindow::GetScrollRange}{wxwindowsetscrollrange},\rtfsp -\helpref{wxWindow::GetScrollThumb}{wxwindowsetscrollthumb},\rtfsp +\helpref{wxWindow::GetScrollThumb}{wxwindowgetscrollthumb},\rtfsp \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} \begin{comment} @@ -1647,8 +1644,7 @@ and usually the scrollbar will be automatically hidden. \helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp \helpref{wxWindow::SetScrollPage}{wxwindowsetscrollpage},\rtfsp \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp -\helpref{wxWindow::GetScrollRange}{wxwindowsetscrollrange},\rtfsp -\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollrange},\rtfsp +\helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} \end{comment} diff --git a/docs/latex/wx/winhelp.tex b/docs/latex/wx/winhelp.tex index f4af922bb1..0bf137c8b8 100644 --- a/docs/latex/wx/winhelp.tex +++ b/docs/latex/wx/winhelp.tex @@ -19,7 +19,7 @@ just before the first call to display something. \wxheading{See also} -\helpref{wxHelpControllerBase}{wxwinhelpcontrollerbase} +\helpref{wxHelpControllerBase}{wxhelpcontrollerbase} \wxheading{Include file} diff --git a/docs/latex/wx/wxstring.tex b/docs/latex/wx/wxstring.tex index 9556358cba..bad897ccc5 100644 --- a/docs/latex/wx/wxstring.tex +++ b/docs/latex/wx/wxstring.tex @@ -75,6 +75,26 @@ Returns the empty string if {\it ch} is not found. Gets all characters before the last occurence of {\it ch}. Returns empty string if {\it ch} is not found. +\membersection{wxString::Cmp}\label{wxstringcmp} + +\constfunc{int}{Cmp}{\param{const char*}{ psz}} + +Case-sensitive comparison. + +Returns 0 if equal, +1 if greater or -1 if less. + +See also CmpNoCase, IsSameAs. + +\membersection{wxString::CmpNoCase}\label{wxstringcmpnocase} + +\constfunc{int}{CmpNoCase}{\param{const char*}{ psz}} + +Case-insensitive comparison. + +Returns 0 if equal, +1 if greater or -1 if less. + +See also Cmp, IsSameAs. + \membersection{wxString::CompareTo}\label{wxstringCompareTo} \begin{verbatim} @@ -92,9 +112,21 @@ Case-sensitive comparison. Returns 0 if equal, 1 if greater or -1 if less. Returns 1 if target appears anyhere in wxString; else 0. -\membersection{wxString::IsEmpty}\label{wxstringisempty} +\membersection{wxString::Empty}\label{wxstringempty} -\constfunc{bool}{IsEmpty}{\void} +\func{void}{Empty}{\void} + +Reinitializes the string and frees the data. + +\membersection{wxString::Find}\label{wxstringfind} + +\constfunc{int}{Find}{\param{char}{ ch}, \param{bool}{ fromEnd = FALSE}} + +Searches for the given character. Returns the starting index, or -1 if not found. + +\constfunc{int}{Find}{\param{const char*}{ sz}} + +Searches for the given string. Returns the starting index, or -1 if not found. \membersection{wxString::First}\label{wxstringfirst} @@ -106,383 +138,386 @@ Returns 1 if target appears anyhere in wxString; else 0. \constfunc{size\_t}{First}{\param{const char}{ ch}} -Returns first occurrence of item. +Returns the first occurrence of the item. +\membersection{wxString::GetChar}\label{wxstringgetchar} +\constfunc{char}{GetChar}{\param{size\_t}{ n}} +Returns the character at position {\it n} (read-only). +\membersection{wxString::GetData}\label{wxstringGetData} +\constfunc{const char*}{GetData}{\void} +wxWindows compatibility conversion. Returns a constant pointer to the data in the string. +\membersection{wxString::GetWritableChar}\label{wxstringgetwritablechar} +\func{char\&}{GetWritableChar}{\param{size\_t}{ n}} - -\membersection{wxString::Firstchar}\label{wxstringFirstchar} -\func{char}{Firstchar}{\param{void}{}} \param{ const}{} +Returns a reference to the character at position {\it n}. -Element extraction. +\membersection{wxString::GetWriteBuf}\label{wxstringgetwritebuf} -\membersection{wxString::Freq}\label{wxstringFreq} +\func{char*}{GetWriteBuf}{\param{uint}{ len}} -\func{int}{Freq}{\param{char}{ c}} \param{ const}{}\\ -\func{int}{Freq}{\param{const wxString\&}{ y}} \param{ const}{}\\ -\func{int}{Freq}{\param{const wxSubString\&}{ y}} \param{ const}{}\\ -\func{int}{Freq}{\param{const char*}{ t}} \param{ const}{} +Returns a writable buffer of at least {\it len} bytes. -Return number of occurrences of target in wxString. +Call \helpref{wxString::UngetWriteBuf}{wxstringungetwritebuf} as soon as possible +to put the string back into a reasonable state. -\membersection{wxString::From}\label{wxstringFrom} +\membersection{wxString::Index}\label{wxstringIndex} -\func{wxSubString}{From}{\param{int}{ pos}}\\ -\func{wxSubString}{From}{\param{const wxString\&}{ x}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{From}{\param{const wxSubString\&}{ x}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{From}{\param{const char*}{ t}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{From}{\param{char}{ c}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{From}{\param{const wxRegex\&}{ r}, \param{int}{ startpos = 0}} +\constfunc{size\_t}{Index}{\param{char}{ ch}, \param{int}{ startpos = 0}} -\membersection{wxString::GetData}\label{wxstringGetData} +Same as \helpref{wxString::Find}{wxstringfind}. -\func{char*}{GetData}{\param{void}{}} +\constfunc{size\_t}{Index}{\param{const char*}{ sz}} -wxWindows compatibility conversion. +Same as \helpref{wxString::Find}{wxstringfind}. -\membersection{wxString::GSub}\label{wxstringGSub} -\func{int}{GSub}{\param{const wxString\&}{ pat}, \param{const wxString\&}{ repl}}\\ -\func{int}{GSub}{\param{const wxSubString\&}{ pat}, \param{const wxString\&}{ repl}}\\ -\func{int}{GSub}{\param{const char*}{ pat}, \param{const wxString\&}{ repl}}\\ -\func{int}{GSub}{\param{const char*}{ pat}, \param{const char*}{ repl}}\\ -\func{int}{GSub}{\param{const wxRegex\&}{ pat}, \param{const wxString\&}{ repl}} +\constfunc{size\_t}{Index}{\param{const char*}{ sz}, \param{bool}{ caseSensitive = TRUE}, \param{bool}{ fromEnd = FALSE}} -Global substitution: substitute all occurrences of {\it pat} with {\it repl}, -returning the number of matches. +Search the element in the array, starting from either side. -\membersection{wxString::Index}\label{wxstringIndex} +If {\it fromEnd} is TRUE, reverse search direction. -\func{int}{Index}{\param{char}{ c}, \param{int}{ startpos = 0}} \param{ const}{}\\ -\func{int}{Index}{\param{const wxString\&}{ y}, \param{int}{ startpos = 0}} \param{ const}{}\\ -\func{int}{Index}{\param{const wxString\&}{ y}, \param{int}{ startpos}, \param{CaseCompare}{ cmp}} \param{ const}{}\\ -\func{int}{Index}{\param{const wxSubString\&}{ y}, \param{int}{ startpos = 0}} \param{ const}{}\\ -\func{int}{Index}{\param{const char*}{ t}, \param{int}{ startpos = 0}} \param{ const}{}\\ -\func{int}{Index}{\param{const char*}{ t}, \param{int}{ startpos}, \param{CaseCompare}{ cmp}} \param{ const}{}\\ -\func{int}{Index}{\param{const wxRegex\&}{ r}, \param{int}{ startpos = 0}} \param{ const}{} +If {\bf caseSensitive}, comparison is case sensitive (the default). -Return the position of target in string, or -1 for failure. +Returns the index of the first item matched, or NOT\_FOUND. \membersection{wxString::Insert}\label{wxstringInsert} -\func{wxString\&}{Insert}{\param{int}{ pos}, \param{const char*}{ s}}\\ -\func{wxString\&}{Insert}{\param{int}{ pos}, \param{const wxString\&}{ s}} +\func{void}{Insert}{\param{const wxString\&}{ str}, \param{uint}{ index}} -Insertion. +Add new element at the given position. \membersection{wxString::IsAscii}\label{wxstringIsAscii} -\func{int}{IsAscii}{\param{void}{}} \param{ const}{} +\constfunc{bool}{IsAscii}{\void} -Classification (should be capital, because of ctype.h macros). +Returns TRUE if the string is ASCII. -\membersection{wxString::IsDefined}\label{wxstringIsDefined} +\membersection{wxString::IsEmpty}\label{wxstringisempty} -\func{int}{IsDefined}{\param{void}{}} \param{ const}{} +\constfunc{bool}{IsEmpty}{\void} -Classification (should be capital, because of ctype.h macros). +Returns TRUE if the string is NULL. \membersection{wxString::IsNull}\label{wxstringIsNull} -\func{int}{IsNull}{\param{void}{}} \param{ const}{} +\constfunc{bool}{IsNull}{\void} -Classification (should be capital, because of ctype.h macros). +Returns TRUE if the string is NULL (same as IsEmpty). \membersection{wxString::IsNumber}\label{wxstringIsNumber} -\func{int}{IsNumber}{\param{void}{}} \param{ const}{} +\constfunc{bool}{IsNumber}{\void} + +Returns TRUE if the string is a number. + +\membersection{wxString::IsSameAs}\label{wxstringissameas} + +\constfunc{bool}{IsSameAs}{\param{const char*}{ psz}, \param{bool}{ caseSensitive = TRUE}} + +Test for string equality, case-sensitive (default) or not. + +caseSensitive is TRUE by default (case matters). -Classification (should be capital, because of ctype.h macros). +Returns TRUE if strings are equal, FALSE otherwise. + +See also Cmp, CmpNoCase. \membersection{wxString::IsWord}\label{wxstringIsWord} -\func{int}{IsWord}{\param{void}{}} \param{ const}{} +\constfunc{bool}{IsWord}{\void} -Classification (should be capital, because of ctype.h macros). +Returns TRUE if the string is a word. TODO: what's the definition of a word? \membersection{wxString::Last}\label{wxstringLast} -\func{int}{Last}{\param{char}{ c}} \param{ const}{}\\ -\func{int}{Last}{\param{const char*}{ cs}} \param{ const}{}\\ -\func{int}{Last}{\param{const wxString\&}{ cs}} \param{ const}{} +\constfunc{char}{Last}{\void} -First or last occurrence of item. +Returns the last character. -\membersection{wxString::Lastchar}\label{wxstringLastchar} +\func{char\&}{Last}{\void} -\func{char}{Lastchar}{\param{void}{}} \param{ const}{} +Returns a reference to the last character (writable). -Element extraction. +\membersection{wxString::Left}\label{wxstringleft} + +\constfunc{wxString}{Left}{\param{size\_t}{ count}} + +Returns the first {\it count} characters. + +\constfunc{wxString}{Left}{\param{char}{ ch}} + +Returns all characters before the first occurence of {\it ch}. +Returns the whole string if {\it ch} is not found. -\membersection{wxString::Length}\label{wxstringLength} +\membersection{wxString::Len}\label{wxstringlen} -\func{unsigned int}{Length}{\param{void}{}} \param{ const}{} +\constfunc{size\_t}{Len}{\void} + +Returns the length of the string. + +\membersection{wxString::Length}\label{wxstringlength} + +\constfunc{size\_t}{Length}{\void} + +Returns the length of the string (same as Len). \membersection{wxString::LowerCase}\label{wxstringLowerCase} -\func{void}{LowerCase}{\param{void}{}} +\func{void}{LowerCase}{\void} + +Same as MakeLower. + +\membersection{wxString::MakeLower}\label{wxstringmakelower} + +\func{void}{MakeLower}{\void} + +Converts all characters to lower case. + +\membersection{wxString::MakeUpper}\label{wxstringmakeupper} + +\func{void}{MakeUpper}{\void} + +Converts all characters to upper case. \membersection{wxString::Matches}\label{wxstringMatches} -\func{bool}{Matches}{\param{char}{ c}, \param{int}{ pos = 0}} \param{ const}{}\\ -\func{bool}{Matches}{\param{const wxString\&}{ y}, \param{int}{ pos = 0}} \param{ const}{}\\ -\func{bool}{Matches}{\param{const wxSubString\&}{ y}, \param{int}{ pos = 0}} \param{ const}{}\\ -\func{bool}{Matches}{\param{const char*}{ t}, \param{int}{ pos = 0}} \param{ const}{}\\ -\func{bool}{Matches}{\param{const wxRegex\&}{ r}, \param{int}{ pos = 0}} \param{ const}{} +\constfunc{bool}{Matches}{\param{const char*}{ szMask}} + +Returns TRUE if the string contents matches a mask containing '*' and '?'. -Return 1 if target appears at position {\it pos} in wxString; else 0. +\membersection{wxString::Mid}\label{wxstringmid} -\membersection{wxString::OK}\label{wxstringOK} +\constfunc{wxString}{Mid}{\param{size\_t}{ first}, \param{size\_t}{ count = STRING\_MAXLEN}} -\func{int}{OK}{\param{void}{}} \param{ const}{} +Returns a substring starting at {\it first}, with length {\it count}, or the rest of +the string if {\it count} is the default value. + +\membersection{wxString::Pad}\label{wxstringpad} + +\func{wxString\&}{Pad}{\param{size\_t}{ count}, \param{char}{ pad = ' '}, \param{bool}{ fromRight = TRUE}} + +Adds {\it count} copies of {\it pad} to the beginning, or to the end of the string (the default). + +Removes spaces from the left or from the right (default). \membersection{wxString::Prepend}\label{wxstringPrepend} -\func{wxString\&}{Prepend}{\param{const wxString\&}{ y}}\\ -\func{wxString\&}{Prepend}{\param{const wxSubString\&}{ y}}\\ -\func{wxString\&}{Prepend}{\param{const char*}{ t}}\\ -\func{wxString\&}{Prepend}{\param{char}{ c}} +\func{wxString\&}{Prepend}{\param{const wxString\&}{ str}} -Prepend. +Prepends {\it str} to this string, returning a reference to this string. -\func{wxString\&}{Prepend}{\param{char}{ c}, \param{int}{ rep=1}} +\membersection{wxString::Printf}\label{wxstringprintf} -Prepend {\it c}, {\it rep} times. - -\membersection{wxString::Readline}\label{wxstringReadline} +\func{int}{Printf}{\param{const char* }{pszFormat}, \param{}{...}} + +Similar to sprintf. Returns the number of characters written, or an integer less than zero +on error. -\func{friend int}{Readline}{\param{istream\&}{ s}, \param{wxString\&}{ x}, - \param{char}{ terminator = '$\backslash$n'}, - \param{int}{ discard\_terminator = 1}}\\ -\func{friend int}{Readline}{\param{FILE *}{ f}, \param{wxString\&}{ x}, - \param{char}{ terminator = '$\backslash$n'}, - \param{int}{ discard\_terminator = 1}} +\membersection{wxString::PrintfV}\label{wxstringprintfv} + +\func{int}{PrintfV}{\param{const char* }{pszFormat}, \param{va\_list}{ argPtr}} + +Similar to vprintf. Returns the number of characters written, or an integer less than zero +on error. \membersection{wxString::Remove}\label{wxstringRemove} -\func{wxString\&}{RemoveLast}{\param{void}{}}\\ -\func{wxString\&}{Remove}{\param{int}{ pos}}\\ -\func{wxString\&}{Remove}{\param{int}{ pos}, \param{int}{ len}} +\func{wxString\&}{Remove}{\param{size\_t}{ pos}} + +Same as Truncate. Removes the portion from {\it pos} to the end of the string. + +\func{wxString\&}{Remove}{\param{size\_t}{ pos}, \param{size\_t}{ len}} + +Removes the last {\it len} characters from the string, starting at {\it pos}. + +\membersection{wxString::RemoveLast}\label{wxstringremovelast} -Remove {\it pos} to end of string. +\func{wxString\&}{RemoveLast}{\void} + +Removes the last character. \membersection{wxString::Replace}\label{wxstringReplace} -\func{wxString\&}{Replace}{\param{int}{ pos}, \param{int}{ n}, \param{const char*}{ s}}\\ -\func{wxString\&}{Replace}{\param{int}{ pos}, \param{int}{ n}, \param{const wxString\&}{ s}} +\func{uint}{Replace}{\param{const char*}{ szOld}, \param{const char*}{ szNew}, \param{bool}{ replaceAll}} + +Replace first (or all) occurences of substring with another one. + +{\it replaceAll}: global replace (default), or only the first occurence. + +Returns the number of replacements made. + +\membersection{wxString::Right}\label{wxstringright} + +\constfunc{wxString}{Right}{\param{size\_t}{ count}} -\membersection{wxString::Replicate}\label{wxstringReplicate} +Returns the last {\it count} characters. -\func{friend wxString}{Replicate}{\param{char}{ c}, \param{int}{ n}}\\ -\func{friend wxString}{Replicate}{\param{const wxString\&}{ y}, \param{int}{ n}} +\constfunc{wxString}{Right}{\param{char}{ ch}} -Replication. +Returns all characters after the last occurence of {\it ch}. +Returns the whole string if {\it ch} is not found. -\membersection{wxString::Reverse}\label{wxstringReverse} +\membersection{wxString::SetChar}\label{wxstringsetchar} -\func{void}{Reverse}{\param{void}{}}\\ -\func{friend wxString}{Reverse}{\param{wxString\&}{ x}} +\func{void}{SetChar}{\param{size\_t}{ n}, \param{char}{ch}} + +Sets the character at position {\it n}. + +\membersection{wxString::Shrink}\label{wxstringshrink} + +\func{void}{Shrink}{\void} + +Minimizes the string's memory. Only works if the data of this string is not shared. \membersection{wxString::sprintf}\label{wxstringsprintf} -\func{void}{sprintf}{\param{const wxString\& }{ fmt}} -Formatted assignment. We do not use the 'sprintf' constructor anymore, -because with that constructor, every initialisation with a string would -go through sprintf and this is not desirable, because sprintf -interprets some characters. With the above function we can write: +\func{void}{sprintf}{\param{const char* }{ fmt}} -\begin{verbatim} -wxString msg; msg.sprintf("Processing item %d\n", count); -\end{verbatim} +The same as Printf. \membersection{wxString::Strip}\label{wxstringStrip} \begin{verbatim} -enumStripType {leading = 0x1, trailing = 0x2, both = 0x3}; +enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; \end{verbatim} -\func{wxSubString}{Strip}{\param{StripType}{ s = trailing}, \param{char}{ c = ' '}} +\constfunc{wxString}{Strip}{\param{stripType}{ s = trailing}} -Strip characterss at the front and/or end. -StripType is defined for bitwise ORing. +Strip characters at the front and/or end. The same as Trim except that it +doesn't change this string. -\membersection{wxString::SubString}\label{wxstringSubString} +\membersection{wxString::Trim}\label{wxstringtrim} -\func{wxString}{SubString}{\param{int}{ from}, \param{int}{ to}} +\func{wxString\&}{Trim}{\param{bool}{ fromRight = TRUE}} -Edward Zimmermann's additions. +Removes spaces from the left or from the right (default). -\membersection{wxString::Through}\label{wxstringThrough} +\membersection{wxString::Truncate}\label{wxstringtruncate} -\func{wxSubString}{Through}{\param{int}{ pos}}\\ -\func{wxSubString}{Through}{\param{const wxString\&}{ x}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{Through}{\param{const wxSubString\&}{ x}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{Through}{\param{const char*}{ t}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{Through}{\param{char}{ c}, \param{int}{ startpos = 0}}\\ -\func{wxSubString}{Through}{\param{const wxRegex\&}{ r}, \param{int}{ startpos = 0}} +\func{wxString\&}{Truncate}{\param{size\_t}{ len}} -\membersection{wxString::Upcase}\label{wxstringUpcase} +Truncate the string to the given length. -\func{void}{Upcase}{\param{void}{}}\\ -\func{friend wxString}{Upcase}{\param{wxString\&}{ x}} +\membersection{wxString::UngetWriteBuf}\label{wxstringungetwritebuf} + +\func{void}{UngetWriteBuf}{\void} + +Puts the string back into a reasonable state, after +\rtfsp\helpref{wxString::GetWriteBuf}{wxstringgetwritebuf} was called. \membersection{wxString::UpperCase}\label{wxstringUpperCase} -\func{void}{UpperCase}{\param{void}{}}\\ +\func{void}{UpperCase}{\void} + +The same as MakeUpper. \membersection{wxString::operator $=$}\label{wxstringoperatorassign} -\func{wxString\&}{operator $=$}{\param{const wxString\&}{ y}}\\ -\func{wxString\&}{operator $=$}{\param{const char*}{ y}}\\ -\func{wxString\&}{operator $=$}{\param{char}{ c}}\\ -\func{wxString\&}{operator $=$}{\param{const wxSubString\&}{ y}} +\func{wxString\&}{operator $=$}{\param{const wxString\&}{ str}} + +\func{wxString\&}{operator $=$}{\param{const char*}{ psz}} + +\func{wxString\&}{operator $=$}{\param{char}{ c}} + +\func{wxString\&}{operator $=$}{\param{const unsigned char*}{ psz}} + +\func{wxString\&}{operator $=$}{\param{const wchar\_t*}{ pwz}} Assignment. \membersection{wxString::operator $+=$}\label{wxstringPlusEqual} -\func{wxString\&}{operator $+=$}{\param{const wxString\&}{ y}}\\ -\func{wxString\&}{operator $+=$}{\param{const wxSubString\&}{ y}}\\ -\func{wxString\&}{operator $+=$}{\param{const char*}{ t}}\\ -\func{wxString\&}{operator $+=$}{\param{char}{ c}} +\func{void}{operator $+=$}{\param{const wxString\&}{ str}} + +\func{void}{operator $+=$}{\param{const char*}{ psz}} + +\func{void}{operator $+=$}{\param{char}{ c}} Concatenation. \membersection{wxString::operator []}\label{wxstringoperatorbracket} -\func{char\&}{operator []}{\param{int}{ i}} +\func{char\&}{operator []}{\param{size\_t}{ i}} + +\func{char}{operator []}{\param{size\_t}{ i}} + +\func{char}{operator []}{\param{int}{ i}} Element extraction. \membersection{wxString::operator ()}\label{wxstringoperatorparenth} -\func{char\&}{operator ()}{\param{int}{ i}} +\func{wxString}{operator ()}{\param{size\_t}{ start}, \param{size\_t}{ len}} + +Same as Mid (substring extraction). \membersection{wxString::operator \cinsert}\label{wxstringoperatorout} -\func{friend ostream\&}{operator \cinsert}{\param{ostream\&}{ s}, \param{const wxString\&}{ x}}\\ -\func{friend ostream\&}{operator \cinsert}{\param{ostream\&}{ s}, \param{const wxSubString\&}{ x}} + +\func{wxString\&}{operator \cinsert}{\\param{const wxString\&}{ str}} + +\func{wxString\&}{operator \cinsert}{\\param{const char*}{ psz}} + +\func{wxString\&}{operator \cinsert}{\\param{char }{ch}} + +Same as $+=$. \membersection{wxString::operator \cextract}\label{wxstringoperatorin} -\func{friend istream\&}{operator \cextract}{\param{istream\&}{ s}, \param{wxString\&}{ x}} -\membersection{wxString::operator const char*}\label{wxstringoperatorconstcharpt} -\constfunc{}{operator const char*}{\param{void}{}} +\func{friend istream\&}{operator \cextract}{\param{istream\&}{ is}, \param{wxString\&}{ str}} -Conversion. +Extraction from a stream. -\membersection{wxCHARARG}\label{wxstringwxCHARARG} +\membersection{wxString::operator const char*}\label{wxstringoperatorconstcharpt} -\begin{verbatim} -#define wxCHARARG(s) ((const wxString\& )(s).Chars()) -\end{verbatim} +\constfunc{}{operator const char*}{\void} -Here is a very, very, very ugly macro, but it makes things more -transparent in cases, where a library function requires a -(const wxString\& ) argument. This is especially the case in wxWindows, -where all char-arguments are (const wxString\& ) and not (const char* ). -This macro should only be used in such cases and NOT to -modify the internal data. -The conventional way would be 'function((char*)string.Chars())'. -With the wxCHARARG macro, this can be achieved by 'function(wxCHARARG(string))'. -This makes it clearer that the usage should be confined -to arguments. +Implicit conversion to a C string. -\membersection{CommonPrefix}\label{wxstringCommonPrefix} +\membersection{Comparison operators}\label{wxstringComparison} -\func{friend wxString}{CommonPrefix}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y},\\ - \param{int}{ startpos = 0}}\\ +\func{bool}{operator $==$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -\membersection{CommonSuffix}\label{wxstringCommonSuffix} +\func{bool}{operator $==$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} -\func{friend wxString}{CommonSuffix}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y},\\ - \param{int}{ startpos = -1}} +\func{bool}{operator $!=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -\membersection{Compare}\label{wxstringCompare} +\func{bool}{operator $!=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} -\func{int}{Compare}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{Compare}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{Compare}{\param{const wxString\&}{ x}, \param{const char*}{ y}}\\ -\func{int}{Compare}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{Compare}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{Compare}{\param{const wxSubString\&}{ x}, \param{const char*}{ y}} +\func{bool}{operator $>$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -Case dependent comparison. Returns 0 if the match succeeded. +\func{bool}{operator $>$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} -\membersection{FCompare}\label{wxstringFCompare} +\func{bool}{operator $>=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -\func{int}{FCompare}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} +\func{bool}{operator $>=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} -Case independent comparison. Returns 0 if the match succeeded. +\func{bool}{operator $<$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -\membersection{Comparison operators}\label{wxstringComparison} +\func{bool}{operator $<$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} -\func{int}{operator $==$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $!=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $>$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $>=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $<$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $<=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $==$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $!=$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $>$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $>=$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $<$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $<=$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $==$}{\param{const wxString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $!=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $>$}{\param{const wxString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $>=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $<$}{\param{const wxString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $<=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $==$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $!=$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $>$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $>=$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $<$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $<=$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{int}{operator $==$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $!=$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $>$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $>=$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $<$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $<=$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{int}{operator $==$}{\param{const wxSubString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $!=$}{\param{const wxSubString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $>$}{\param{const wxSubString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $>=$}{\param{const wxSubString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $<$}{\param{const wxSubString\&}{ x}, \param{const char*}{ t}}\\ -\func{int}{operator $<=$}{\param{const wxSubString\&}{ x}, \param{const char*}{ t}} +\func{bool}{operator $<=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -\membersection{operator $+$}\label{wxstringoperatorplus} +\func{bool}{operator $<=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} -\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const char*}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{char}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxSubString\&}{ x}, \param{const wxString\&}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxSubString\&}{ x}, \param{const wxSubString\&}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxSubString\&}{ x}, \param{const char*}{ y}}\\ -\func{wxString}{operator $+$}{\param{const wxSubString\&}{ x}, \param{char}{ y}}\\ -\func{wxString}{operator $+$}{\param{const char*}{ x}, \param{const wxString\&}{ y}}\\ -\func{wxString}{operator $+$}{\param{const char*}{ x}, \param{const wxSubString\&}{ y}} +\wxheading{Remarks} -\membersection{Join}\label{wxstringJoin} +These comparisons are case-sensitive. -\func{friend wxString}{Join}{\param{wxString}{ src[]}, \param{int}{ n}, \param{const wxString\&}{ sep}} +\membersection{operator $+$}\label{wxstringoperatorplus} -\membersection{Split}\label{wxstringSplit} +\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} -\func{friend int}{Split}{\param{const wxString\&}{ x}, \param{wxString}{ res[]}, \param{int}{ maxn},\\ - \param{const wxString\&}{ sep}}\\ -\func{friend int}{Split}{\param{const wxString\&}{ x}, \param{wxString}{ res[]}, \param{int}{ maxn},\\ - \param{const wxRegex\&}{ sep}}\\ +\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const char*}{ y}} -Split string into array res at separators; return number of elements +\func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{char}{ y}} +\func{wxString}{operator $+$}{\param{const char*}{ x}, \param{const wxString\&}{ y}} diff --git a/docs/msw/todo.txt b/docs/msw/todo.txt index dba3e00493..4f098c93e8 100644 --- a/docs/msw/todo.txt +++ b/docs/msw/todo.txt @@ -5,8 +5,6 @@ Todo on wxWin 2.0, Windows platform HIGH PRIORITY ------------- -Integrate Robert's wxGrid enhancements. - Find/add wxThread sample - Arthur T-D? wxControl dimensions should be optionally based on dialog font @@ -14,15 +12,12 @@ size for portability (dialog units as per Windows). Implement wxDC floating point transformations. -Remove transformation from device to logical coordinates from -events e.g. mouse events. - Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors). Revamp Dialog Editor for new controls and properties (e.g. window id). -Registry classes (check out wxConfig class - see issues.txt). +Tidy wxConfig API. Change DnD classes to use global symbols, and wxString. @@ -47,18 +42,19 @@ Update manual. wxListBox changes (for ownerdraw functionality) wxThread DONE (except for topic overview) wxHelpController classes DONE (except for Unix ones) - wxString - wxTString + wxString PARTLY DONE Drag and drop (change API if required, e.g. const). wxCheckListBox wxBaseArray, other arrays (wxOwnerDrawn) Document the include file for each class Macros, e.g. wxASSERT + Stream classes + Functions Write tutorial. -Other static classes. +A wxDC function (or two) for drawing 3D edges. Makefiles for other compilers. Generic makefiles? Rewrite makefiles to maintain simultaneous debug/release @@ -68,31 +64,15 @@ More wxSystemSettings (see comment in settings.cpp). wxSocket integration. -wxListCtrl, wxTreeCtrl, wxImageList integration with Robert -Roebling's classes. - -Convert OGL, other utilities and samples. +Convert remaining utilities e.g. (GLCanvas; wxGraphLayout) and samples Check TODO entries. -Change #include "wx/xxx.h" to #include - -Tidy code further, e.g. formatting from DevStudio, plus -standard header. - Shell function to invoke a document with open, print, whatever... -wxTextCtrl (and wxMultiText/wxTextWindow in wxWin 1.xx) - differences between Edit -and RichEdit controls. - Make use of Vadim's gettext implementation throughout wxWin code. Document it. -Change wxUpdateIterator to use wxRegion; or scrap -wxUpdateIterator? See wxGTK. - -Check WXWIN_COMPATIBILITY mode, remove any unnecessary #ifdefs. - Retain callback functions; have semi-compatible callback function prototypes for all controls, at least in WXWIN_COMPATIBLE mode, but retain (Set)Callback for all compilations. This is following a @@ -100,18 +80,10 @@ panicky response to losing callbacks. Merge dib.cpp, dibutils.cpp. -Simplify the toolbar samples. - Add a wxTabCtrl sample. -EVT_ENTER/LEAVE_WINDOW: Perhaps one approach to reliable implementation of -EVT_LEAVE_WINDOW is to set a flag when the mouse pointer is in a window, -then in idle time, check this window. -If the flag is set but the mouse pointer is outside the window, then -it's time to generate an EVT_LEAVE_WINDOW. This would be necessary at -least for the case when the mouse cursor goes off the application windows, -and no motion event was generated (i.e. you moved the mouse quickly!). -If it goes from one app window to another, you could generate the event sooner. +Improve printing. More API functions for printer DCs (to get +printer characteristics) and more reliable printing framework. LOW PRIORITY ------------ @@ -132,12 +104,8 @@ BS_BITMAP, SS_BITMAP - but this may not allow wxBitmap argument, so instead just allow controls loaded from native resource to deal with this style and call default processing. -Completion of drag and drop support (Vadim). - Better clipboard support. -Toolbars: use event tables not virtual functions. - wxWizard class? Doc/view - have some standard views/docs e.g. wxTextView. @@ -153,10 +121,6 @@ Integrate existing multimedia classes. Rich text class? -Optimize size further. - -wxThread integration. - Look at WinCE stuff incl. database classes. Improve conversion guide, compatibility classes, tools? diff --git a/include/wx/event.h b/include/wx/event.h index e65b2333e6..e86f5afd25 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -907,6 +907,46 @@ class WXDLLEXPORT wxSysColourChangedEvent: public wxEvent { m_eventType = wxEVT_SYS_COLOUR_CHANGED; } }; +/* + wxEVT_PALETTE_CHANGED + */ + +class WXDLLEXPORT wxPaletteChangedEvent: public wxEvent +{ + DECLARE_DYNAMIC_CLASS(wxPaletteChangedEvent) + +public: + inline wxPaletteChangedEvent(wxWindowID id = 0): wxEvent(id) + { m_eventType = wxEVT_PALETTE_CHANGED; m_changedWindow = NULL; } + + inline void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } + inline wxWindow* GetChangedWindow() const { return m_changedWindow; } + +protected: + wxWindow* m_changedWindow; +}; + +/* + wxEVT_QUERY_NEW_PALETTE + Indicates the window is getting keyboard focus and should re-do its palette. + */ + +class WXDLLEXPORT wxQueryNewPaletteEvent: public wxEvent +{ + DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent) + +public: + inline wxQueryNewPaletteEvent(wxWindowID id = 0): wxEvent(id) + { m_eventType = wxEVT_QUERY_NEW_PALETTE; m_paletteRealized = FALSE; } + + // App sets this if it changes the palette. + inline void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } + inline bool GetPaletteRealized() const { return m_paletteRealized; } + +protected: + bool m_paletteRealized; +}; + /* Event generated by dialog navigation keys wxEVT_NAVIGATION_KEY @@ -940,8 +980,6 @@ public: wxEVT_DESTROY, wxEVT_MOUSE_CAPTURE_CHANGED, wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) - wxEVT_QUERY_NEW_PALETTE, - wxEVT_PALETTE_CHANGED, // wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate // wxEVT_FONT_CHANGED to all other windows (maybe). wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific. @@ -1046,6 +1084,8 @@ typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxShowEvent&); typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&); typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); +typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); +typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); // N.B. In GNU-WIN32, you *have* to take the address of a member function // (use &) or the compiler crashes... @@ -1097,6 +1137,8 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ #define EVT_MAXIMIZE(func) { wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, NULL }, #define EVT_ICONIZE(func) { wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, NULL }, #define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, NULL }, +#define EVT_PALETTE_CHANGED(func) { wxEVT_PALETTE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaletteChangedEventFunction) & func, NULL }, +#define EVT_QUERY_NEW_PALETTE(func) { wxEVT_QUERY_NEW_PALETTE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, NULL }, // Mouse events #define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL }, diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index c1cb243339..82c7516980 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -503,6 +503,8 @@ public: virtual WXHBRUSH MSWOnCtlColor(WXHDC dc, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual long MSWOnPaletteChanged(WXHWND hWndPalChange); + virtual long MSWOnQueryNewPalette(); virtual bool MSWOnEraseBkgnd(WXHDC pDC); virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu); virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem); diff --git a/include/wx/string.h b/include/wx/string.h index af979150b0..efe6e9fbe4 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -112,10 +112,10 @@ inline int WXDLLEXPORT Stricmp(const char *psz1, const char *psz2) // ---------------------------------------------------------------------------- // global pointer to empty string -extern const char *g_szNul; +WXDLLEXPORT_DATA(extern const char*) g_szNul; // return an empty wxString -class wxString; // not yet defined +class WXDLLEXPORT wxString; // not yet defined inline const wxString& wxGetEmptyString() { return *(wxString *)&g_szNul; } // --------------------------------------------------------------------------- @@ -375,13 +375,13 @@ public: /** @name string comparison */ //@{ /** - case-sensitive comparaison + case-sensitive comparison @return 0 if equal, +1 if greater or -1 if less @see CmpNoCase, IsSameAs */ int Cmp(const char *psz) const { return strcmp(c_str(), psz); } /** - case-insensitive comparaison, return code as for wxString::Cmp() + case-insensitive comparison, return code as for wxString::Cmp() @see: Cmp, IsSameAs */ int CmpNoCase(const char *psz) const { return Stricmp(c_str(), psz); } @@ -758,14 +758,14 @@ public: //@{ /// just like strcmp() int compare(const wxString& str) const { return Cmp(str); } - /// comparaison with a substring + /// comparison with a substring int compare(size_t nStart, size_t nLen, const wxString& str) const; - /// comparaison of 2 substrings + /// comparison of 2 substrings int compare(size_t nStart, size_t nLen, const wxString& str, size_t nStart2, size_t nLen2) const; /// just like strcmp() int compare(const char* sz) const { return Cmp(sz); } - /// substring comparaison with first nCount characters of sz + /// substring comparison with first nCount characters of sz int compare(size_t nStart, size_t nLen, const char* sz, size_t nCount = npos) const; //@} @@ -843,7 +843,7 @@ public: /** Search the element in the array, starting from the either side @param if bFromEnd reverse search direction - @param if bCase, comparaison is case sensitive (default) + @param if bCase, comparison is case sensitive (default) @return index of the first item matched or NOT_FOUND @see NOT_FOUND */ @@ -872,8 +872,8 @@ private: }; // --------------------------------------------------------------------------- -/** @name wxString comparaison functions - @memo Comparaisons are case sensitive +/** @name wxString comparison functions + @memo Comparisons are case sensitive */ // --------------------------------------------------------------------------- //@{ diff --git a/src/common/docmdi.cpp b/src/common/docmdi.cpp index 114a3f4df7..245a131de7 100644 --- a/src/common/docmdi.cpp +++ b/src/common/docmdi.cpp @@ -40,7 +40,7 @@ IMPLEMENT_CLASS(wxDocMDIParentFrame, wxMDIParentFrame) BEGIN_EVENT_TABLE(wxDocMDIParentFrame, wxMDIParentFrame) EVT_MENU(wxID_EXIT, wxDocMDIParentFrame::OnExit) - EVT_MENU_RANGE(wxID_FILE1, wxID_FILE2, wxDocMDIParentFrame::OnMRUFile) + EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocMDIParentFrame::OnMRUFile) END_EVENT_TABLE() wxDocMDIParentFrame::wxDocMDIParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 36f36611c0..204c77fbb5 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -34,6 +34,9 @@ #include "wx/menu.h" #include "wx/list.h" #include "wx/filedlg.h" +#endif + +#ifdef __WXGTK__ #include "wx/mdi.h" #endif @@ -490,9 +493,11 @@ void wxView::OnChangeFilename(void) wxFrame *frame = NULL; wxMDIChildFrame *mdi_frame = NULL; +#ifdef __WXGTK__ if (GetFrame()->IsKindOf(CLASSINFO(wxMDIChildFrame))) mdi_frame = (wxMDIChildFrame*)GetFrame(); else +#endif frame = GetFrame(); if (frame) @@ -500,7 +505,7 @@ void wxView::OnChangeFilename(void) frame->SetTitle(name); return; } - +#ifdef __WXGTK__ if (mdi_frame) { if (wxTheApp->GetAppName() != "") @@ -512,6 +517,7 @@ void wxView::OnChangeFilename(void) else mdi_frame->SetTitle(name); } +#endif } } @@ -1399,7 +1405,7 @@ bool wxDocChildFrame::OnClose(void) BEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame) EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit) - EVT_MENU_RANGE(wxID_FILE1, wxID_FILE2, wxDocParentFrame::OnMRUFile) + EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile) END_EVENT_TABLE() wxDocParentFrame::wxDocParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, diff --git a/src/common/event.cpp b/src/common/event.cpp index d3cb798bdf..428d8eb13a 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -56,6 +56,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent) +IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent) const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 7bf3b752da..5281e2a8bf 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1366,6 +1366,16 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) return MSWDefWindowProc(message, wParam, lParam ); break; } + case WM_PALETTECHANGED: + { + return MSWOnPaletteChanged((WXHWND) (HWND) wParam); + break; + } + case WM_QUERYNEWPALETTE: + { + return MSWOnQueryNewPalette(); + break; + } case WM_ERASEBKGND: { // Prevents flicker when dragging @@ -1862,7 +1872,7 @@ WXHBRUSH wxWindow::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, bool wxWindow::MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { wxSysColourChangedEvent event; - event.m_eventObject = this; + event.SetEventObject(this); // Check if app handles this. if (GetEventHandler()->ProcessEvent(event)) @@ -1872,6 +1882,27 @@ bool wxWindow::MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WX return 1; } +long wxWindow::MSWOnPaletteChanged(WXHWND hWndPalChange) +{ + wxPaletteChangedEvent event(GetId()); + event.SetEventObject(this); + event.SetChangedWindow(wxFindWinFromHandle(hWndPalChange)); + GetEventHandler()->ProcessEvent(event); + return 0; +} + +long wxWindow::MSWOnQueryNewPalette() +{ + wxQueryNewPaletteEvent event(GetId()); + event.SetEventObject(this); + if (!GetEventHandler()->ProcessEvent(event) || !event.GetPaletteRealized()) + { + return (long) FALSE; + } + else + return (long) TRUE; +} + // Responds to colour changes: passes event on to children. void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event) { -- 2.45.2