repo_name
stringclasses
10 values
file_path
stringlengths
29
222
content
stringlengths
24
926k
extention
stringclasses
5 values
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/clipbrd.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/clipbrd.h // Purpose: wxClipboad class and clipboard functions // Author: Vadim Zeitlin // Modified by: // Created: 19.10.99 // Copyright: (c) wxWidgets Team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_CLIPBRD_H_BASE_ #define _WX_CLIPBRD_H_BASE_ #include "wx/defs.h" #if wxUSE_CLIPBOARD #include "wx/event.h" #include "wx/chartype.h" #include "wx/dataobj.h" // for wxDataFormat #include "wx/vector.h" class WXDLLIMPEXP_FWD_CORE wxClipboard; // ---------------------------------------------------------------------------- // wxClipboard represents the system clipboard. Normally, you should use // wxTheClipboard which is a global pointer to the (unique) clipboard. // // Clipboard can be used to copy data to/paste data from. It works together // with wxDataObject. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxClipboardBase : public wxObject { public: wxClipboardBase() { m_usePrimary = false; } // open the clipboard before Add/SetData() and GetData() virtual bool Open() = 0; // close the clipboard after Add/SetData() and GetData() virtual void Close() = 0; // query whether the clipboard is opened virtual bool IsOpened() const = 0; // add to the clipboard data // // NB: the clipboard owns the pointer and will delete it, so data must be // allocated on the heap virtual bool AddData( wxDataObject *data ) = 0; // set the clipboard data, this is the same as Clear() followed by // AddData() virtual bool SetData( wxDataObject *data ) = 0; // ask if data in correct format is available virtual bool IsSupported( const wxDataFormat& format ) = 0; // ask if data in correct format is available virtual bool IsSupportedAsync( wxEvtHandler *sink ); // fill data with data on the clipboard (if available) virtual bool GetData( wxDataObject& data ) = 0; // clears wxTheClipboard and the system's clipboard if possible virtual void Clear() = 0; // flushes the clipboard: this means that the data which is currently on // clipboard will stay available even after the application exits (possibly // eating memory), otherwise the clipboard will be emptied on exit virtual bool Flush() { return false; } // this allows to choose whether we work with CLIPBOARD (default) or // PRIMARY selection on X11-based systems // // on the other ones, working with primary selection does nothing: this // allows to write code which sets the primary selection when something is // selected without any ill effects (i.e. without overwriting the // clipboard which would be wrong on the platforms without X11 PRIMARY) virtual void UsePrimarySelection(bool usePrimary = false) { m_usePrimary = usePrimary; } // return true if we're using primary selection bool IsUsingPrimarySelection() const { return m_usePrimary; } // Returns global instance (wxTheClipboard) of the object: static wxClipboard *Get(); // don't use this directly, it is public for compatibility with some ports // (wxX11, wxMotif, ...) only bool m_usePrimary; }; // ---------------------------------------------------------------------------- // asynchronous clipboard event // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxClipboardEvent : public wxEvent { public: wxClipboardEvent(wxEventType evtType = wxEVT_NULL) : wxEvent(0, evtType) { } wxClipboardEvent(const wxClipboardEvent& event) : wxEvent(event), m_formats(event.m_formats) { } bool SupportsFormat(const wxDataFormat& format) const; void AddFormat(const wxDataFormat& format); virtual wxEvent *Clone() const wxOVERRIDE { return new wxClipboardEvent(*this); } protected: wxVector<wxDataFormat> m_formats; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent ); typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); #define wxClipboardEventHandler(func) \ wxEVENT_HANDLER_CAST(wxClipboardEventFunction, func) #define EVT_CLIPBOARD_CHANGED(func) wx__DECLARE_EVT0(wxEVT_CLIPBOARD_CHANGED, wxClipboardEventHandler(func)) // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- // The global clipboard object - backward compatible access macro: #define wxTheClipboard (wxClipboard::Get()) // ---------------------------------------------------------------------------- // include platform-specific class declaration // ---------------------------------------------------------------------------- #if defined(__WXMSW__) #include "wx/msw/clipbrd.h" #elif defined(__WXMOTIF__) #include "wx/motif/clipbrd.h" #elif defined(__WXGTK20__) #include "wx/gtk/clipbrd.h" #elif defined(__WXGTK__) #include "wx/gtk1/clipbrd.h" #elif defined(__WXX11__) #include "wx/x11/clipbrd.h" #elif defined(__WXMAC__) #include "wx/osx/clipbrd.h" #elif defined(__WXQT__) #include "wx/qt/clipbrd.h" #endif // ---------------------------------------------------------------------------- // helpful class for opening the clipboard and automatically closing it // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxClipboardLocker { public: wxClipboardLocker(wxClipboard *clipboard = NULL) { m_clipboard = clipboard ? clipboard : wxTheClipboard; if ( m_clipboard ) { m_clipboard->Open(); } } bool operator!() const { return !m_clipboard->IsOpened(); } ~wxClipboardLocker() { if ( m_clipboard ) { m_clipboard->Close(); } } private: wxClipboard *m_clipboard; wxDECLARE_NO_COPY_CLASS(wxClipboardLocker); }; #endif // wxUSE_CLIPBOARD #endif // _WX_CLIPBRD_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/collpane.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/collpane.h // Purpose: wxCollapsiblePane // Author: Francesco Montorsi // Modified by: // Created: 8/10/2006 // Copyright: (c) Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_COLLAPSABLE_PANE_H_BASE_ #define _WX_COLLAPSABLE_PANE_H_BASE_ #include "wx/defs.h" #if wxUSE_COLLPANE #include "wx/control.h" // class name extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[]; // ---------------------------------------------------------------------------- // wxCollapsiblePaneBase: interface for wxCollapsiblePane // ---------------------------------------------------------------------------- #define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER) #define wxCP_NO_TLW_RESIZE (0x0002) class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl { public: wxCollapsiblePaneBase() {} virtual void Collapse(bool collapse = true) = 0; void Expand() { Collapse(false); } virtual bool IsCollapsed() const = 0; bool IsExpanded() const { return !IsCollapsed(); } virtual wxWindow *GetPane() const = 0; virtual wxString GetLabel() const wxOVERRIDE = 0; virtual void SetLabel(const wxString& label) wxOVERRIDE = 0; virtual bool InformFirstDirection(int direction, int size, int availableOtherDir) wxOVERRIDE { wxWindow* const p = GetPane(); if ( !p ) return false; if ( !p->InformFirstDirection(direction, size, availableOtherDir) ) return false; InvalidateBestSize(); return true; } }; // ---------------------------------------------------------------------------- // event types and macros // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent ); class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent { public: wxCollapsiblePaneEvent() {} wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed) : wxCommandEvent(wxEVT_COLLAPSIBLEPANE_CHANGED, id), m_bCollapsed(collapsed) { SetEventObject(generator); } bool GetCollapsed() const { return m_bCollapsed; } void SetCollapsed(bool c) { m_bCollapsed = c; } // default copy ctor, assignment operator and dtor are ok virtual wxEvent *Clone() const wxOVERRIDE { return new wxCollapsiblePaneEvent(*this); } private: bool m_bCollapsed; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent); }; // ---------------------------------------------------------------------------- // event types and macros // ---------------------------------------------------------------------------- typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); #define wxCollapsiblePaneEventHandler(func) \ wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func) #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn)) #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/collpane.h" #else #include "wx/generic/collpaneg.h" // use #define and not a typedef to allow forward declaring the class #define wxCollapsiblePane wxGenericCollapsiblePane #endif // old wxEVT_COMMAND_* constant #define wxEVT_COMMAND_COLLPANE_CHANGED wxEVT_COLLAPSIBLEPANE_CHANGED #endif // wxUSE_COLLPANE #endif // _WX_COLLAPSABLE_PANE_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/vidmode.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/vidmode.h // Purpose: declares wxVideoMode class used by both wxDisplay and wxApp // Author: Vadim Zeitlin // Modified by: // Created: 27.09.2003 (extracted from wx/display.h) // Copyright: (c) 2003 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_VMODE_H_ #define _WX_VMODE_H_ // ---------------------------------------------------------------------------- // wxVideoMode: a simple struct containing video mode parameters for a display // ---------------------------------------------------------------------------- struct WXDLLIMPEXP_CORE wxVideoMode { wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) { w = width; h = height; bpp = depth; refresh = freq; } // default copy ctor and assignment operator are ok bool operator==(const wxVideoMode& m) const { return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh; } bool operator!=(const wxVideoMode& mode) const { return !operator==(mode); } // returns true if this mode matches the other one in the sense that all // non zero fields of the other mode have the same value in this one // (except for refresh which is allowed to have a greater value) bool Matches(const wxVideoMode& other) const { return (!other.w || w == other.w) && (!other.h || h == other.h) && (!other.bpp || bpp == other.bpp) && (!other.refresh || refresh >= other.refresh); } // trivial accessors int GetWidth() const { return w; } int GetHeight() const { return h; } int GetDepth() const { return bpp; } int GetRefresh() const { return refresh; } // returns true if the object has been initialized bool IsOk() const { return w && h; } // the screen size in pixels (e.g. 640*480), 0 means unspecified int w, h; // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known int bpp; // refresh frequency in Hz, 0 means unspecified/unknown int refresh; }; #endif // _WX_VMODE_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/tarstrm.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/tarstrm.h // Purpose: Streams for Tar files // Author: Mike Wetherell // Copyright: (c) 2004 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_WXTARSTREAM_H__ #define _WX_WXTARSTREAM_H__ #include "wx/defs.h" #if wxUSE_TARSTREAM #include "wx/archive.h" #include "wx/hashmap.h" ///////////////////////////////////////////////////////////////////////////// // Constants // TypeFlag values enum wxTarType { wxTAR_REGTYPE = '0', // regular file wxTAR_LNKTYPE = '1', // hard link wxTAR_SYMTYPE = '2', // symbolic link wxTAR_CHRTYPE = '3', // character special wxTAR_BLKTYPE = '4', // block special wxTAR_DIRTYPE = '5', // directory wxTAR_FIFOTYPE = '6', // named pipe wxTAR_CONTTYPE = '7' // contiguous file }; // Archive Formats (use wxTAR_PAX, it's backward compatible) enum wxTarFormat { wxTAR_USTAR, // POSIX.1-1990 tar format wxTAR_PAX // POSIX.1-2001 tar format }; ///////////////////////////////////////////////////////////////////////////// // wxTarNotifier class WXDLLIMPEXP_BASE wxTarNotifier { public: virtual ~wxTarNotifier() { } virtual void OnEntryUpdated(class wxTarEntry& entry) = 0; }; ///////////////////////////////////////////////////////////////////////////// // Tar Entry - hold the meta data for a file in the tar class WXDLLIMPEXP_BASE wxTarEntry : public wxArchiveEntry { public: wxTarEntry(const wxString& name = wxEmptyString, const wxDateTime& dt = wxDateTime::Now(), wxFileOffset size = wxInvalidOffset); virtual ~wxTarEntry(); wxTarEntry(const wxTarEntry& entry); wxTarEntry& operator=(const wxTarEntry& entry); // Get accessors wxString GetName(wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE; wxString GetInternalName() const wxOVERRIDE { return m_Name; } wxPathFormat GetInternalFormat() const wxOVERRIDE { return wxPATH_UNIX; } int GetMode() const; int GetUserId() const { return m_UserId; } int GetGroupId() const { return m_GroupId; } wxFileOffset GetSize() const wxOVERRIDE { return m_Size; } wxFileOffset GetOffset() const wxOVERRIDE { return m_Offset; } wxDateTime GetDateTime() const wxOVERRIDE { return m_ModifyTime; } wxDateTime GetAccessTime() const { return m_AccessTime; } wxDateTime GetCreateTime() const { return m_CreateTime; } int GetTypeFlag() const { return m_TypeFlag; } wxString GetLinkName() const { return m_LinkName; } wxString GetUserName() const { return m_UserName; } wxString GetGroupName() const { return m_GroupName; } int GetDevMajor() const { return m_DevMajor; } int GetDevMinor() const { return m_DevMinor; } // is accessors bool IsDir() const wxOVERRIDE; bool IsReadOnly() const wxOVERRIDE { return !(m_Mode & 0222); } // set accessors void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE) wxOVERRIDE; void SetUserId(int id) { m_UserId = id; } void SetGroupId(int id) { m_GroupId = id; } void SetMode(int mode); void SetSize(wxFileOffset size) wxOVERRIDE { m_Size = size; } void SetDateTime(const wxDateTime& dt) wxOVERRIDE { m_ModifyTime = dt; } void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; } void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; } void SetTypeFlag(int type) { m_TypeFlag = type; } void SetLinkName(const wxString& link) { m_LinkName = link; } void SetUserName(const wxString& user) { m_UserName = user; } void SetGroupName(const wxString& group) { m_GroupName = group; } void SetDevMajor(int dev) { m_DevMajor = dev; } void SetDevMinor(int dev) { m_DevMinor = dev; } // set is accessors void SetIsDir(bool isDir = true) wxOVERRIDE; void SetIsReadOnly(bool isReadOnly = true) wxOVERRIDE; static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, bool *pIsDir = NULL); wxTarEntry *Clone() const { return new wxTarEntry(*this); } void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { } private: void SetOffset(wxFileOffset offset) wxOVERRIDE { m_Offset = offset; } virtual wxArchiveEntry* DoClone() const wxOVERRIDE { return Clone(); } wxString m_Name; int m_Mode; bool m_IsModeSet; int m_UserId; int m_GroupId; wxFileOffset m_Size; wxFileOffset m_Offset; wxDateTime m_ModifyTime; wxDateTime m_AccessTime; wxDateTime m_CreateTime; int m_TypeFlag; wxString m_LinkName; wxString m_UserName; wxString m_GroupName; int m_DevMajor; int m_DevMinor; friend class wxTarInputStream; wxDECLARE_DYNAMIC_CLASS(wxTarEntry); }; ///////////////////////////////////////////////////////////////////////////// // wxTarInputStream WX_DECLARE_STRING_HASH_MAP(wxString, wxTarHeaderRecords); class WXDLLIMPEXP_BASE wxTarInputStream : public wxArchiveInputStream { public: typedef wxTarEntry entry_type; wxTarInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); wxTarInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); virtual ~wxTarInputStream(); bool OpenEntry(wxTarEntry& entry); bool CloseEntry() wxOVERRIDE; wxTarEntry *GetNextEntry(); wxFileOffset GetLength() const wxOVERRIDE { return m_size; } bool IsSeekable() const wxOVERRIDE { return m_parent_i_stream->IsSeekable(); } protected: size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; private: void Init(); wxArchiveEntry *DoGetNextEntry() wxOVERRIDE { return GetNextEntry(); } bool OpenEntry(wxArchiveEntry& entry) wxOVERRIDE; bool IsOpened() const { return m_pos != wxInvalidOffset; } wxStreamError ReadHeaders(); bool ReadExtendedHeader(wxTarHeaderRecords*& recs); wxString GetExtendedHeader(const wxString& key) const; wxString GetHeaderPath() const; wxFileOffset GetHeaderNumber(int id) const; wxString GetHeaderString(int id) const; wxDateTime GetHeaderDate(const wxString& key) const; wxFileOffset m_pos; // position within the current entry wxFileOffset m_offset; // offset to the start of the entry's data wxFileOffset m_size; // size of the current entry's data int m_sumType; int m_tarType; class wxTarHeaderBlock *m_hdr; wxTarHeaderRecords *m_HeaderRecs; wxTarHeaderRecords *m_GlobalHeaderRecs; wxDECLARE_NO_COPY_CLASS(wxTarInputStream); }; ///////////////////////////////////////////////////////////////////////////// // wxTarOutputStream class WXDLLIMPEXP_BASE wxTarOutputStream : public wxArchiveOutputStream { public: wxTarOutputStream(wxOutputStream& stream, wxTarFormat format = wxTAR_PAX, wxMBConv& conv = wxConvLocal); wxTarOutputStream(wxOutputStream *stream, wxTarFormat format = wxTAR_PAX, wxMBConv& conv = wxConvLocal); virtual ~wxTarOutputStream(); bool PutNextEntry(wxTarEntry *entry); bool PutNextEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now(), wxFileOffset size = wxInvalidOffset) wxOVERRIDE; bool PutNextDirEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now()) wxOVERRIDE; bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream); bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; } void Sync() wxOVERRIDE; bool CloseEntry() wxOVERRIDE; bool Close() wxOVERRIDE; bool IsSeekable() const wxOVERRIDE { return m_parent_o_stream->IsSeekable(); } void SetBlockingFactor(int factor) { m_BlockingFactor = factor; } int GetBlockingFactor() const { return m_BlockingFactor; } protected: size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; private: void Init(wxTarFormat format); bool PutNextEntry(wxArchiveEntry *entry) wxOVERRIDE; bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream) wxOVERRIDE; bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) wxOVERRIDE { return true; } bool IsOpened() const { return m_pos != wxInvalidOffset; } bool WriteHeaders(wxTarEntry& entry); bool ModifyHeader(); wxString PaxHeaderPath(const wxString& format, const wxString& path); void SetExtendedHeader(const wxString& key, const wxString& value); void SetHeaderPath(const wxString& name); bool SetHeaderNumber(int id, wxFileOffset n); void SetHeaderString(int id, const wxString& str); void SetHeaderDate(const wxString& key, const wxDateTime& datetime); wxFileOffset m_pos; // position within the current entry wxFileOffset m_maxpos; // max pos written wxFileOffset m_size; // expected entry size wxFileOffset m_headpos; // offset within the file to the entry's header wxFileOffset m_datapos; // offset within the file to the entry's data wxFileOffset m_tarstart;// offset within the file to the tar wxFileOffset m_tarsize; // size of tar so far bool m_pax; int m_BlockingFactor; wxUint32 m_chksum; bool m_large; class wxTarHeaderBlock *m_hdr; class wxTarHeaderBlock *m_hdr2; char *m_extendedHdr; size_t m_extendedSize; wxString m_badfit; bool m_endrecWritten; wxDECLARE_NO_COPY_CLASS(wxTarOutputStream); }; ///////////////////////////////////////////////////////////////////////////// // Iterators #if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR typedef wxArchiveIterator<wxTarInputStream> wxTarIter; typedef wxArchiveIterator<wxTarInputStream, std::pair<wxString, wxTarEntry*> > wxTarPairIter; #endif ///////////////////////////////////////////////////////////////////////////// // wxTarClassFactory class WXDLLIMPEXP_BASE wxTarClassFactory : public wxArchiveClassFactory { public: typedef wxTarEntry entry_type; typedef wxTarInputStream instream_type; typedef wxTarOutputStream outstream_type; typedef wxTarNotifier notifier_type; #if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR typedef wxTarIter iter_type; typedef wxTarPairIter pairiter_type; #endif wxTarClassFactory(); wxTarEntry *NewEntry() const { return new wxTarEntry; } wxTarInputStream *NewStream(wxInputStream& stream) const { return new wxTarInputStream(stream, GetConv()); } wxTarOutputStream *NewStream(wxOutputStream& stream) const { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } wxTarInputStream *NewStream(wxInputStream *stream) const { return new wxTarInputStream(stream, GetConv()); } wxTarOutputStream *NewStream(wxOutputStream *stream) const { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE { return wxTarEntry::GetInternalName(name, format); } const wxChar * const *GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const wxOVERRIDE; protected: wxArchiveEntry *DoNewEntry() const wxOVERRIDE { return NewEntry(); } wxArchiveInputStream *DoNewStream(wxInputStream& stream) const wxOVERRIDE { return NewStream(stream); } wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const wxOVERRIDE { return NewStream(stream); } wxArchiveInputStream *DoNewStream(wxInputStream *stream) const wxOVERRIDE { return NewStream(stream); } wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const wxOVERRIDE { return NewStream(stream); } private: wxDECLARE_DYNAMIC_CLASS(wxTarClassFactory); }; #endif // wxUSE_TARSTREAM #endif // _WX_WXTARSTREAM_H__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/imagjpeg.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/imagjpeg.h // Purpose: wxImage JPEG handler // Author: Vaclav Slavik // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_IMAGJPEG_H_ #define _WX_IMAGJPEG_H_ #include "wx/defs.h" //----------------------------------------------------------------------------- // wxJPEGHandler //----------------------------------------------------------------------------- #if wxUSE_LIBJPEG #include "wx/image.h" #include "wx/versioninfo.h" class WXDLLIMPEXP_CORE wxJPEGHandler: public wxImageHandler { public: inline wxJPEGHandler() { m_name = wxT("JPEG file"); m_extension = wxT("jpg"); m_altExtensions.Add(wxT("jpeg")); m_altExtensions.Add(wxT("jpe")); m_type = wxBITMAP_TYPE_JPEG; m_mime = wxT("image/jpeg"); } static wxVersionInfo GetLibraryVersionInfo(); #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: wxDECLARE_DYNAMIC_CLASS(wxJPEGHandler); }; #endif // wxUSE_LIBJPEG #endif // _WX_IMAGJPEG_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/sizer.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/sizer.h // Purpose: provide wxSizer class for layout // Author: Robert Roebling and Robin Dunn // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) // Created: // Copyright: (c) Robin Dunn, Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WXSIZER_H__ #define __WXSIZER_H__ #include "wx/defs.h" #include "wx/window.h" //--------------------------------------------------------------------------- // classes //--------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxButton; class WXDLLIMPEXP_FWD_CORE wxBoxSizer; class WXDLLIMPEXP_FWD_CORE wxSizerItem; class WXDLLIMPEXP_FWD_CORE wxSizer; #ifndef wxUSE_BORDER_BY_DEFAULT #define wxUSE_BORDER_BY_DEFAULT 1 #endif // ---------------------------------------------------------------------------- // wxSizerFlags: flags used for an item in the sizer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxSizerFlags { public: // construct the flags object initialized with the given proportion (0 by // default) wxSizerFlags(int proportion = 0) : m_proportion(proportion) { m_flags = 0; m_borderInPixels = 0; } // setters for all sizer flags, they all return the object itself so that // calls to them can be chained wxSizerFlags& Proportion(int proportion) { m_proportion = proportion; return *this; } wxSizerFlags& Expand() { m_flags |= wxEXPAND; return *this; } // notice that Align() replaces the current alignment flags, use specific // methods below such as Top(), Left() &c if you want to set just the // vertical or horizontal alignment wxSizerFlags& Align(int alignment) // combination of wxAlignment values { m_flags &= ~wxALIGN_MASK; m_flags |= alignment; return *this; } // some shortcuts for Align() wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); } wxSizerFlags& Center() { return Centre(); } wxSizerFlags& CentreVertical() { return Align(wxALIGN_CENTRE_VERTICAL); } wxSizerFlags& CenterVertical() { return CentreVertical(); } wxSizerFlags& CentreHorizontal() { return Align(wxALIGN_CENTRE_HORIZONTAL); } wxSizerFlags& CenterHorizontal() { return CentreHorizontal(); } wxSizerFlags& Top() { m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL); return *this; } wxSizerFlags& Left() { m_flags &= ~(wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL); return *this; } wxSizerFlags& Right() { m_flags = (m_flags & ~wxALIGN_CENTRE_HORIZONTAL) | wxALIGN_RIGHT; return *this; } wxSizerFlags& Bottom() { m_flags = (m_flags & ~wxALIGN_CENTRE_VERTICAL) | wxALIGN_BOTTOM; return *this; } // default border size used by Border() below static int GetDefaultBorder() { #if wxUSE_BORDER_BY_DEFAULT #ifdef __WXGTK20__ // GNOME HIG says to use 6px as the base unit: // http://library.gnome.org/devel/hig-book/stable/design-window.html.en return 6; #elif defined(__WXMAC__) // Not sure if this is really the correct size for the border. return 5; #else // For the other platforms, we need to scale raw pixel values using the // current DPI, do it once (and cache the result) in another function. #define wxNEEDS_BORDER_IN_PX // We don't react to dynamic DPI changes, so we can cache the values of // the border in on-screen pixels after computing it once. This // could/should change in the future. if ( !ms_defaultBorderInPx ) ms_defaultBorderInPx = DoGetDefaultBorderInPx(); return ms_defaultBorderInPx; #endif #else return 0; #endif } wxSizerFlags& Border(int direction, int borderInPixels) { wxCHECK_MSG( !(direction & ~wxALL), *this, wxS("direction must be a combination of wxDirection ") wxS("enum values.") ); m_flags &= ~wxALL; m_flags |= direction; m_borderInPixels = borderInPixels; return *this; } wxSizerFlags& Border(int direction = wxALL) { #if wxUSE_BORDER_BY_DEFAULT return Border(direction, GetDefaultBorder()); #else // no borders by default on limited size screen wxUnusedVar(direction); return *this; #endif } wxSizerFlags& DoubleBorder(int direction = wxALL) { #if wxUSE_BORDER_BY_DEFAULT return Border(direction, 2*GetDefaultBorder()); #else wxUnusedVar(direction); return *this; #endif } wxSizerFlags& TripleBorder(int direction = wxALL) { #if wxUSE_BORDER_BY_DEFAULT return Border(direction, 3*GetDefaultBorder()); #else wxUnusedVar(direction); return *this; #endif } wxSizerFlags& HorzBorder() { #if wxUSE_BORDER_BY_DEFAULT return Border(wxLEFT | wxRIGHT, GetDefaultBorder()); #else return *this; #endif } wxSizerFlags& DoubleHorzBorder() { #if wxUSE_BORDER_BY_DEFAULT return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder()); #else return *this; #endif } // setters for the others flags wxSizerFlags& Shaped() { m_flags |= wxSHAPED; return *this; } wxSizerFlags& FixedMinSize() { m_flags |= wxFIXED_MINSIZE; return *this; } // makes the item ignore window's visibility status wxSizerFlags& ReserveSpaceEvenIfHidden() { m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN; return *this; } // accessors for wxSizer only int GetProportion() const { return m_proportion; } int GetFlags() const { return m_flags; } int GetBorderInPixels() const { return m_borderInPixels; } private: #ifdef wxNEEDS_BORDER_IN_PX static int DoGetDefaultBorderInPx(); static int ms_defaultBorderInPx; #endif // wxNEEDS_BORDER_IN_PX int m_proportion; int m_flags; int m_borderInPixels; }; // ---------------------------------------------------------------------------- // wxSizerSpacer: used by wxSizerItem to represent a spacer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxSizerSpacer { public: wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } void SetSize(const wxSize& size) { m_size = size; } const wxSize& GetSize() const { return m_size; } void Show(bool show) { m_isShown = show; } bool IsShown() const { return m_isShown; } private: // the size, in pixel wxSize m_size; // is the spacer currently shown? bool m_isShown; }; // ---------------------------------------------------------------------------- // wxSizerItem // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxSizerItem : public wxObject { public: // window wxSizerItem( wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject* userData=NULL ); // window with flags wxSizerItem(wxWindow *window, const wxSizerFlags& flags) { Init(flags); DoSetWindow(window); } // subsizer wxSizerItem( wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject* userData=NULL ); // sizer with flags wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) { Init(flags); DoSetSizer(sizer); } // spacer wxSizerItem( int width, int height, int proportion=0, int flag=0, int border=0, wxObject* userData=NULL); // spacer with flags wxSizerItem(int width, int height, const wxSizerFlags& flags) { Init(flags); DoSetSpacer(wxSize(width, height)); } wxSizerItem(); virtual ~wxSizerItem(); virtual void DeleteWindows(); // Enable deleting the SizerItem without destroying the contained sizer. void DetachSizer() { m_sizer = NULL; } virtual wxSize GetSize() const; virtual wxSize CalcMin(); virtual void SetDimension( const wxPoint& pos, const wxSize& size ); wxSize GetMinSize() const { return m_minSize; } wxSize GetMinSizeWithBorder() const; wxSize GetMaxSize() const { return IsWindow() ? m_window->GetMaxSize() : wxDefaultSize; } wxSize GetMaxSizeWithBorder() const; void SetMinSize(const wxSize& size) { if ( IsWindow() ) m_window->SetMinSize(size); m_minSize = size; } void SetMinSize( int x, int y ) { SetMinSize(wxSize(x, y)); } void SetInitSize( int x, int y ) { SetMinSize(wxSize(x, y)); } // if either of dimensions is zero, ratio is assumed to be 1 // to avoid "divide by zero" errors void SetRatio(int width, int height) { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } void SetRatio(const wxSize& size) { SetRatio(size.x, size.y); } void SetRatio(float ratio) { m_ratio = ratio; } float GetRatio() const { return m_ratio; } virtual wxRect GetRect() { return m_rect; } // set a sizer item id (different from a window id, all sizer items, // including spacers, can have an associated id) void SetId(int id) { m_id = id; } int GetId() const { return m_id; } bool IsWindow() const { return m_kind == Item_Window; } bool IsSizer() const { return m_kind == Item_Sizer; } bool IsSpacer() const { return m_kind == Item_Spacer; } void SetProportion( int proportion ) { m_proportion = proportion; } int GetProportion() const { return m_proportion; } void SetFlag( int flag ) { m_flag = flag; } int GetFlag() const { return m_flag; } void SetBorder( int border ) { m_border = border; } int GetBorder() const { return m_border; } wxWindow *GetWindow() const { return m_kind == Item_Window ? m_window : NULL; } wxSizer *GetSizer() const { return m_kind == Item_Sizer ? m_sizer : NULL; } wxSize GetSpacer() const; // This function behaves obviously for the windows and spacers but for the // sizers it returns true if any sizer element is shown and only returns // false if all of them are hidden. Also, it always returns true if // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used. bool IsShown() const; void Show(bool show); void SetUserData(wxObject* userData) { delete m_userData; m_userData = userData; } wxObject* GetUserData() const { return m_userData; } wxPoint GetPosition() const { return m_pos; } // Called once the first component of an item has been decided. This is // used in algorithms that depend on knowing the size in one direction // before the min size in the other direction can be known. // Returns true if it made use of the information (and min size was changed). bool InformFirstDirection( int direction, int size, int availableOtherDir=-1 ); // these functions delete the current contents of the item if it's a sizer // or a spacer but not if it is a window void AssignWindow(wxWindow *window) { Free(); DoSetWindow(window); } void AssignSizer(wxSizer *sizer) { Free(); DoSetSizer(sizer); } void AssignSpacer(const wxSize& size) { Free(); DoSetSpacer(size); } void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); } #if WXWIN_COMPATIBILITY_2_8 // these functions do not free the old sizer/spacer and so can easily // provoke the memory leaks and so shouldn't be used, use Assign() instead wxDEPRECATED( void SetWindow(wxWindow *window) ); wxDEPRECATED( void SetSizer(wxSizer *sizer) ); wxDEPRECATED( void SetSpacer(const wxSize& size) ); wxDEPRECATED( void SetSpacer(int width, int height) ); #endif // WXWIN_COMPATIBILITY_2_8 protected: // common part of several ctors void Init() { m_userData = NULL; m_kind = Item_None; } // common part of ctors taking wxSizerFlags void Init(const wxSizerFlags& flags); // free current contents void Free(); // common parts of Set/AssignXXX() void DoSetWindow(wxWindow *window); void DoSetSizer(wxSizer *sizer); void DoSetSpacer(const wxSize& size); // Add the border specified for this item to the given size // if it's != wxDefaultSize, just return wxDefaultSize otherwise. wxSize AddBorderToSize(const wxSize& size) const; // discriminated union: depending on m_kind one of the fields is valid enum { Item_None, Item_Window, Item_Sizer, Item_Spacer, Item_Max } m_kind; union { wxWindow *m_window; wxSizer *m_sizer; wxSizerSpacer *m_spacer; }; wxPoint m_pos; wxSize m_minSize; int m_proportion; int m_border; int m_flag; int m_id; // on screen rectangle of this item (not including borders) wxRect m_rect; // Aspect ratio can always be calculated from m_size, // but this would cause precision loss when the window // is shrunk. It is safer to preserve the initial value. float m_ratio; wxObject *m_userData; private: wxDECLARE_CLASS(wxSizerItem); wxDECLARE_NO_COPY_CLASS(wxSizerItem); }; WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); //--------------------------------------------------------------------------- // wxSizer //--------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer { public: wxSizer() { m_containingWindow = NULL; } virtual ~wxSizer(); // methods for adding elements to the sizer: there are Add/Insert/Prepend // overloads for each of window/sizer/spacer/wxSizerItem wxSizerItem* Add(wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Add(wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Add(int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); wxSizerItem* Add( int width, int height, const wxSizerFlags& flags); wxSizerItem* Add( wxSizerItem *item); virtual wxSizerItem *AddSpacer(int size); wxSizerItem* AddStretchSpacer(int prop = 1); wxSizerItem* Insert(size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Insert(size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Insert(size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Insert(size_t index, wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Insert(size_t index, wxSizer *sizer, const wxSizerFlags& flags); wxSizerItem* Insert(size_t index, int width, int height, const wxSizerFlags& flags); // NB: do _not_ override this function in the derived classes, this one is // virtual for compatibility reasons only to allow old code overriding // it to continue to work, override DoInsert() instead in the new code virtual wxSizerItem* Insert(size_t index, wxSizerItem *item); wxSizerItem* InsertSpacer(size_t index, int size); wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); wxSizerItem* Prepend(wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Prepend(wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Prepend(int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL); wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags); wxSizerItem* Prepend(wxSizerItem *item); wxSizerItem* PrependSpacer(int size); wxSizerItem* PrependStretchSpacer(int prop = 1); // set (or possibly unset if window is NULL) or get the window this sizer // is used in void SetContainingWindow(wxWindow *window); wxWindow *GetContainingWindow() const { return m_containingWindow; } virtual bool Remove( wxSizer *sizer ); virtual bool Remove( int index ); virtual bool Detach( wxWindow *window ); virtual bool Detach( wxSizer *sizer ); virtual bool Detach( int index ); virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); virtual bool Replace( size_t index, wxSizerItem *newitem ); virtual void Clear( bool delete_windows = false ); virtual void DeleteWindows(); // Inform sizer about the first direction that has been decided (by parent item) // Returns true if it made use of the information (and recalculated min size) // // Note that while this method doesn't do anything by default, it should // almost always be overridden in the derived classes and should have been // pure virtual if not for backwards compatibility constraints. virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) ) { return false; } void SetMinSize( int width, int height ) { DoSetMinSize( width, height ); } void SetMinSize( const wxSize& size ) { DoSetMinSize( size.x, size.y ); } // Searches recursively bool SetItemMinSize( wxWindow *window, int width, int height ) { return DoSetItemMinSize( window, width, height ); } bool SetItemMinSize( wxWindow *window, const wxSize& size ) { return DoSetItemMinSize( window, size.x, size.y ); } // Searches recursively bool SetItemMinSize( wxSizer *sizer, int width, int height ) { return DoSetItemMinSize( sizer, width, height ); } bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) { return DoSetItemMinSize( sizer, size.x, size.y ); } bool SetItemMinSize( size_t index, int width, int height ) { return DoSetItemMinSize( index, width, height ); } bool SetItemMinSize( size_t index, const wxSize& size ) { return DoSetItemMinSize( index, size.x, size.y ); } wxSize GetSize() const { return m_size; } wxPoint GetPosition() const { return m_position; } // Calculate the minimal size or return m_minSize if bigger. wxSize GetMinSize(); // These virtual functions are used by the layout algorithm: first // CalcMin() is called to calculate the minimal size of the sizer and // prepare for laying it out and then RecalcSizes() is called to really // update all the sizer items virtual wxSize CalcMin() = 0; virtual void RecalcSizes() = 0; virtual void Layout(); wxSize ComputeFittingClientSize(wxWindow *window); wxSize ComputeFittingWindowSize(wxWindow *window); wxSize Fit( wxWindow *window ); void FitInside( wxWindow *window ); void SetSizeHints( wxWindow *window ); #if WXWIN_COMPATIBILITY_2_8 // This only calls FitInside() since 2.9 wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) ); #endif wxSizerItemList& GetChildren() { return m_children; } const wxSizerItemList& GetChildren() const { return m_children; } void SetDimension(const wxPoint& pos, const wxSize& size) { m_position = pos; m_size = size; Layout(); // This call is required for wxWrapSizer to be able to calculate its // minimal size correctly. InformFirstDirection(wxHORIZONTAL, size.x, size.y); } void SetDimension(int x, int y, int width, int height) { SetDimension(wxPoint(x, y), wxSize(width, height)); } size_t GetItemCount() const { return m_children.GetCount(); } bool IsEmpty() const { return m_children.IsEmpty(); } wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); wxSizerItem* GetItem( size_t index ); wxSizerItem* GetItemById( int id, bool recursive = false ); // Manage whether individual scene items are considered // in the layout calculations or not. bool Show( wxWindow *window, bool show = true, bool recursive = false ); bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); bool Show( size_t index, bool show = true ); bool Hide( wxSizer *sizer, bool recursive = false ) { return Show( sizer, false, recursive ); } bool Hide( wxWindow *window, bool recursive = false ) { return Show( window, false, recursive ); } bool Hide( size_t index ) { return Show( index, false ); } bool IsShown( wxWindow *window ) const; bool IsShown( wxSizer *sizer ) const; bool IsShown( size_t index ) const; // Recursively call wxWindow::Show () on all sizer items. virtual void ShowItems (bool show); void Show(bool show) { ShowItems(show); } // This is the ShowItems() counterpart and returns true if any of the sizer // items are shown. virtual bool AreAnyItemsShown() const; protected: wxSize m_size; wxSize m_minSize; wxPoint m_position; wxSizerItemList m_children; // the window this sizer is used in, can be NULL wxWindow *m_containingWindow; wxSize GetMaxClientSize( wxWindow *window ) const; wxSize GetMinClientSize( wxWindow *window ); wxSize VirtualFitSize( wxWindow *window ); virtual void DoSetMinSize( int width, int height ); virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); virtual bool DoSetItemMinSize( size_t index, int width, int height ); // insert a new item into m_children at given index and return the item // itself virtual wxSizerItem* DoInsert(size_t index, wxSizerItem *item); private: wxDECLARE_CLASS(wxSizer); }; //--------------------------------------------------------------------------- // wxGridSizer //--------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxGridSizer: public wxSizer { public: // ctors specifying the number of columns only: number of rows will be // deduced automatically depending on the number of sizer elements wxGridSizer( int cols, int vgap, int hgap ); wxGridSizer( int cols, const wxSize& gap = wxSize(0, 0) ); // ctors specifying the number of rows and columns wxGridSizer( int rows, int cols, int vgap, int hgap ); wxGridSizer( int rows, int cols, const wxSize& gap ); virtual void RecalcSizes() wxOVERRIDE; virtual wxSize CalcMin() wxOVERRIDE; void SetCols( int cols ) { wxASSERT_MSG( cols >= 0, "Number of columns must be non-negative"); m_cols = cols; } void SetRows( int rows ) { wxASSERT_MSG( rows >= 0, "Number of rows must be non-negative"); m_rows = rows; } void SetVGap( int gap ) { m_vgap = gap; } void SetHGap( int gap ) { m_hgap = gap; } int GetCols() const { return m_cols; } int GetRows() const { return m_rows; } int GetVGap() const { return m_vgap; } int GetHGap() const { return m_hgap; } int GetEffectiveColsCount() const { return m_cols ? m_cols : CalcCols(); } int GetEffectiveRowsCount() const { return m_rows ? m_rows : CalcRows(); } // return the number of total items and the number of columns and rows // (for internal use only) int CalcRowsCols(int& rows, int& cols) const; protected: // the number of rows/columns in the sizer, if 0 then it is determined // dynamically depending on the total number of items int m_rows; int m_cols; // gaps between rows and columns int m_vgap; int m_hgap; virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); // returns the number of columns/rows needed for the current total number // of children (and the fixed number of rows/columns) int CalcCols() const { wxCHECK_MSG ( m_rows, 0, "Can't calculate number of cols if number of rows is not specified" ); return int(m_children.GetCount() + m_rows - 1) / m_rows; } int CalcRows() const { wxCHECK_MSG ( m_cols, 0, "Can't calculate number of cols if number of rows is not specified" ); return int(m_children.GetCount() + m_cols - 1) / m_cols; } private: wxDECLARE_CLASS(wxGridSizer); }; //--------------------------------------------------------------------------- // wxFlexGridSizer //--------------------------------------------------------------------------- // values which define the behaviour for resizing wxFlexGridSizer cells in the // "non-flexible" direction enum wxFlexSizerGrowMode { // don't resize the cells in non-flexible direction at all wxFLEX_GROWMODE_NONE, // uniformly resize only the specified ones (default) wxFLEX_GROWMODE_SPECIFIED, // uniformly resize all cells wxFLEX_GROWMODE_ALL }; class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer { public: // ctors specifying the number of columns only: number of rows will be // deduced automatically depending on the number of sizer elements wxFlexGridSizer( int cols, int vgap, int hgap ); wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) ); // ctors specifying the number of rows and columns wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); wxFlexGridSizer( int rows, int cols, const wxSize& gap ); // dtor virtual ~wxFlexGridSizer(); // set the rows/columns which will grow (the others will remain of the // constant initial size) void AddGrowableRow( size_t idx, int proportion = 0 ); void RemoveGrowableRow( size_t idx ); void AddGrowableCol( size_t idx, int proportion = 0 ); void RemoveGrowableCol( size_t idx ); bool IsRowGrowable( size_t idx ); bool IsColGrowable( size_t idx ); // the sizer cells may grow in both directions, not grow at all or only // grow in one direction but not the other // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) void SetFlexibleDirection(int direction) { m_flexDirection = direction; } int GetFlexibleDirection() const { return m_flexDirection; } // note that the grow mode only applies to the direction which is not // flexible void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } // Read-only access to the row heights and col widths arrays const wxArrayInt& GetRowHeights() const { return m_rowHeights; } const wxArrayInt& GetColWidths() const { return m_colWidths; } // implementation virtual void RecalcSizes() wxOVERRIDE; virtual wxSize CalcMin() wxOVERRIDE; protected: void AdjustForFlexDirection(); void AdjustForGrowables(const wxSize& sz); void FindWidthsAndHeights(int nrows, int ncols); // the heights/widths of all rows/columns wxArrayInt m_rowHeights, m_colWidths; // indices of the growable columns and rows wxArrayInt m_growableRows, m_growableCols; // proportion values of the corresponding growable rows and columns wxArrayInt m_growableRowsProportions, m_growableColsProportions; // parameters describing whether the growable cells should be resized in // both directions or only one int m_flexDirection; wxFlexSizerGrowMode m_growMode; // saves CalcMin result to optimize RecalcSizes wxSize m_calculatedMinSize; private: wxDECLARE_CLASS(wxFlexGridSizer); wxDECLARE_NO_COPY_CLASS(wxFlexGridSizer); }; //--------------------------------------------------------------------------- // wxBoxSizer //--------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxBoxSizer: public wxSizer { public: wxBoxSizer(int orient) { m_orient = orient; m_totalProportion = 0; wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL, wxT("invalid value for wxBoxSizer orientation") ); } virtual wxSizerItem *AddSpacer(int size) wxOVERRIDE; int GetOrientation() const { return m_orient; } bool IsVertical() const { return m_orient == wxVERTICAL; } void SetOrientation(int orient) { m_orient = orient; } // implementation of our resizing logic virtual wxSize CalcMin() wxOVERRIDE; virtual void RecalcSizes() wxOVERRIDE; virtual bool InformFirstDirection(int direction, int size, int availableOtherDir) wxOVERRIDE; protected: // Only overridden to perform extra debugging checks. virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; // helpers for our code: this returns the component of the given wxSize in // the direction of the sizer and in the other direction, respectively int GetSizeInMajorDir(const wxSize& sz) const { return m_orient == wxHORIZONTAL ? sz.x : sz.y; } int& SizeInMajorDir(wxSize& sz) { return m_orient == wxHORIZONTAL ? sz.x : sz.y; } int& PosInMajorDir(wxPoint& pt) { return m_orient == wxHORIZONTAL ? pt.x : pt.y; } int GetSizeInMinorDir(const wxSize& sz) const { return m_orient == wxHORIZONTAL ? sz.y : sz.x; } int& SizeInMinorDir(wxSize& sz) { return m_orient == wxHORIZONTAL ? sz.y : sz.x; } int& PosInMinorDir(wxPoint& pt) { return m_orient == wxHORIZONTAL ? pt.y : pt.x; } // another helper: creates wxSize from major and minor components wxSize SizeFromMajorMinor(int major, int minor) const { if ( m_orient == wxHORIZONTAL ) { return wxSize(major, minor); } else // wxVERTICAL { return wxSize(minor, major); } } // either wxHORIZONTAL or wxVERTICAL int m_orient; // the sum of proportion of all of our elements int m_totalProportion; // the minimal size needed for this sizer as calculated by the last call to // our CalcMin() wxSize m_calculatedMinSize; private: wxDECLARE_CLASS(wxBoxSizer); }; //--------------------------------------------------------------------------- // wxStaticBoxSizer //--------------------------------------------------------------------------- #if wxUSE_STATBOX class WXDLLIMPEXP_FWD_CORE wxStaticBox; class WXDLLIMPEXP_CORE wxStaticBoxSizer: public wxBoxSizer { public: wxStaticBoxSizer(wxStaticBox *box, int orient); wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); virtual ~wxStaticBoxSizer(); void RecalcSizes() wxOVERRIDE; wxSize CalcMin() wxOVERRIDE; wxStaticBox *GetStaticBox() const { return m_staticBox; } // override to hide/show the static box as well virtual void ShowItems (bool show) wxOVERRIDE; virtual bool AreAnyItemsShown() const wxOVERRIDE; virtual bool Detach( wxWindow *window ) wxOVERRIDE; virtual bool Detach( wxSizer *sizer ) wxOVERRIDE { return wxBoxSizer::Detach(sizer); } virtual bool Detach( int index ) wxOVERRIDE { return wxBoxSizer::Detach(index); } protected: wxStaticBox *m_staticBox; private: wxDECLARE_CLASS(wxStaticBoxSizer); wxDECLARE_NO_COPY_CLASS(wxStaticBoxSizer); }; #endif // wxUSE_STATBOX //--------------------------------------------------------------------------- // wxStdDialogButtonSizer //--------------------------------------------------------------------------- #if wxUSE_BUTTON class WXDLLIMPEXP_CORE wxStdDialogButtonSizer: public wxBoxSizer { public: // Constructor just creates a new wxBoxSizer, not much else. // Box sizer orientation is automatically determined here: // vertical for PDAs, horizontal for everything else? wxStdDialogButtonSizer(); // Checks button ID against system IDs and sets one of the pointers below // to this button. Does not do any sizer-related things here. void AddButton(wxButton *button); // Use these if no standard ID can/should be used void SetAffirmativeButton( wxButton *button ); void SetNegativeButton( wxButton *button ); void SetCancelButton( wxButton *button ); // All platform-specific code here, checks which buttons exist and add // them to the sizer accordingly. // Note - one potential hack on Mac we could use here, // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE // is set to _("Save") and m_buttonNegative is set to _("Don't Save") // I wouldn't add any other hacks like that into here, // but this one I can see being useful. void Realize(); wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } wxButton *GetApplyButton() const { return m_buttonApply; } wxButton *GetNegativeButton() const { return m_buttonNegative; } wxButton *GetCancelButton() const { return m_buttonCancel; } wxButton *GetHelpButton() const { return m_buttonHelp; } protected: wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here wxButton *m_buttonApply; // wxID_APPLY wxButton *m_buttonNegative; // wxID_NO wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP private: wxDECLARE_CLASS(wxStdDialogButtonSizer); wxDECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer); }; #endif // wxUSE_BUTTON // ---------------------------------------------------------------------------- // inline functions implementation // ---------------------------------------------------------------------------- #if WXWIN_COMPATIBILITY_2_8 inline void wxSizerItem::SetWindow(wxWindow *window) { DoSetWindow(window); } inline void wxSizerItem::SetSizer(wxSizer *sizer) { DoSetSizer(sizer); } inline void wxSizerItem::SetSpacer(const wxSize& size) { DoSetSpacer(size); } inline void wxSizerItem::SetSpacer(int width, int height) { DoSetSpacer(wxSize(width, height)); } #endif // WXWIN_COMPATIBILITY_2_8 inline wxSizerItem* wxSizer::Insert(size_t index, wxSizerItem *item) { return DoInsert(index, item); } inline wxSizerItem* wxSizer::Add( wxSizerItem *item ) { return Insert( m_children.GetCount(), item ); } inline wxSizerItem* wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) { return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) { return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) { return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) { return Add( new wxSizerItem(window, flags) ); } inline wxSizerItem* wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) { return Add( new wxSizerItem(sizer, flags) ); } inline wxSizerItem* wxSizer::Add( int width, int height, const wxSizerFlags& flags ) { return Add( new wxSizerItem(width, height, flags) ); } inline wxSizerItem* wxSizer::AddSpacer(int size) { return Add(size, size); } inline wxSizerItem* wxSizer::AddStretchSpacer(int prop) { return Add(0, 0, prop); } inline wxSizerItem* wxSizer::Prepend( wxSizerItem *item ) { return Insert( 0, item ); } inline wxSizerItem* wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) { return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) { return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) { return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::PrependSpacer(int size) { return Prepend(size, size); } inline wxSizerItem* wxSizer::PrependStretchSpacer(int prop) { return Prepend(0, 0, prop); } inline wxSizerItem* wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) { return Prepend( new wxSizerItem(window, flags) ); } inline wxSizerItem* wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) { return Prepend( new wxSizerItem(sizer, flags) ); } inline wxSizerItem* wxSizer::Prepend( int width, int height, const wxSizerFlags& flags ) { return Prepend( new wxSizerItem(width, height, flags) ); } inline wxSizerItem* wxSizer::Insert( size_t index, wxWindow *window, int proportion, int flag, int border, wxObject* userData ) { return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Insert( size_t index, wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) { return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Insert( size_t index, int width, int height, int proportion, int flag, int border, wxObject* userData ) { return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); } inline wxSizerItem* wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) { return Insert( index, new wxSizerItem(window, flags) ); } inline wxSizerItem* wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) { return Insert( index, new wxSizerItem(sizer, flags) ); } inline wxSizerItem* wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags ) { return Insert( index, new wxSizerItem(width, height, flags) ); } inline wxSizerItem* wxSizer::InsertSpacer(size_t index, int size) { return Insert(index, size, size); } inline wxSizerItem* wxSizer::InsertStretchSpacer(size_t index, int prop) { return Insert(index, 0, 0, prop); } #endif // __WXSIZER_H__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/compositewin.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/compositewin.h // Purpose: wxCompositeWindow<> declaration // Author: Vadim Zeitlin // Created: 2011-01-02 // Copyright: (c) 2011 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_COMPOSITEWIN_H_ #define _WX_COMPOSITEWIN_H_ #include "wx/window.h" #include "wx/containr.h" class WXDLLIMPEXP_FWD_CORE wxToolTip; // NB: This is an experimental and, as for now, undocumented class used only by // wxWidgets itself internally. Don't use it in your code until its API is // officially stabilized unless you are ready to change it with the next // wxWidgets release. // ---------------------------------------------------------------------------- // wxCompositeWindow is a helper for implementing composite windows: to define // a class using subwindows, simply inherit from it specialized with the real // base class name and implement GetCompositeWindowParts() pure virtual method. // ---------------------------------------------------------------------------- // This is the base class of wxCompositeWindow which takes care of propagating // colours, fonts etc changes to all the children, but doesn't bother with // handling their events or focus. There should be rarely any need to use it // rather than the full wxCompositeWindow. // The template parameter W must be a wxWindow-derived class. template <class W> class wxCompositeWindowSettersOnly : public W { public: typedef W BaseWindowClass; // Override all wxWindow methods which must be forwarded to the composite // window parts. // Attribute setters group. // // NB: Unfortunately we can't factor out the call for the setter itself // into DoSetForAllParts() because we can't call the function passed to // it non-virtually and we need to do this to avoid infinite recursion, // so we work around this by calling the method of this object itself // manually in each function. virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE { if ( !BaseWindowClass::SetForegroundColour(colour) ) return false; SetForAllParts(&wxWindowBase::SetForegroundColour, colour); return true; } virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE { if ( !BaseWindowClass::SetBackgroundColour(colour) ) return false; SetForAllParts(&wxWindowBase::SetBackgroundColour, colour); return true; } virtual bool SetFont(const wxFont& font) wxOVERRIDE { if ( !BaseWindowClass::SetFont(font) ) return false; SetForAllParts(&wxWindowBase::SetFont, font); return true; } virtual bool SetCursor(const wxCursor& cursor) wxOVERRIDE { if ( !BaseWindowClass::SetCursor(cursor) ) return false; SetForAllParts(&wxWindowBase::SetCursor, cursor); return true; } virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE { BaseWindowClass::SetLayoutDirection(dir); SetForAllParts(&wxWindowBase::SetLayoutDirection, dir); // The child layout almost invariably depends on the layout direction, // so redo it when it changes. // // However avoid doing it when we're called from wxWindow::Create() in // wxGTK as the derived window is not fully created yet and calling its // SetSize() may be unexpected. This does mean that any future calls to // SetLayoutDirection(wxLayout_Default) wouldn't result in a re-layout // neither, but then we're not supposed to be called with it at all. if ( dir != wxLayout_Default ) this->SetSize(-1, -1, -1, -1, wxSIZE_FORCE); } #if wxUSE_TOOLTIPS virtual void DoSetToolTipText(const wxString &tip) wxOVERRIDE { BaseWindowClass::DoSetToolTipText(tip); // Use a variable to disambiguate between SetToolTip() overloads. void (wxWindowBase::*func)(const wxString&) = &wxWindowBase::SetToolTip; SetForAllParts(func, tip); } virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE { BaseWindowClass::DoSetToolTip(tip); SetForAllParts(&wxWindowBase::CopyToolTip, tip); } #endif // wxUSE_TOOLTIPS protected: // Trivial but necessary default ctor. wxCompositeWindowSettersOnly() { } private: // Must be implemented by the derived class to return all children to which // the public methods we override should forward to. virtual wxWindowList GetCompositeWindowParts() const = 0; template <class T, class TArg, class R> void SetForAllParts(R (wxWindowBase::*func)(TArg), T arg) { // Simply call the setters for all parts of this composite window. const wxWindowList parts = GetCompositeWindowParts(); for ( wxWindowList::const_iterator i = parts.begin(); i != parts.end(); ++i ) { wxWindow * const child = *i; // Allow NULL elements in the list, this makes the code of derived // composite controls which may have optionally shown children // simpler and it doesn't cost us much here. if ( child ) (child->*func)(arg); } } wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindowSettersOnly, W); }; // The real wxCompositeWindow itself, inheriting all the setters defined above. template <class W> class wxCompositeWindow : public wxCompositeWindowSettersOnly<W> { public: virtual void SetFocus() wxOVERRIDE { wxSetFocusToChild(this, NULL); } protected: // Default ctor sets things up for handling children events correctly. wxCompositeWindow() { this->Bind(wxEVT_CREATE, &wxCompositeWindow::OnWindowCreate, this); } private: void OnWindowCreate(wxWindowCreateEvent& event) { event.Skip(); // Attach a few event handlers to all parts of the composite window. // This makes the composite window behave more like a simple control // and allows other code (such as wxDataViewCtrl's inline editing // support) to hook into its event processing. wxWindow *child = event.GetWindow(); // Check that it's one of our children: it could also be this window // itself (for which we don't need to handle focus at all) or one of // its grandchildren and we don't want to bind to those as child // controls are supposed to be well-behaved and get their own focus // event if any of their children get focus anyhow, so binding to them // would only result in duplicate events. // // Notice that we can't use GetCompositeWindowParts() here because the // member variables that are typically used in its implementation in // the derived classes would typically not be initialized yet, as this // event is generated by "m_child = new wxChildControl(this, ...)" code // before "m_child" is assigned. if ( child->GetParent() != this ) return; child->Bind(wxEVT_SET_FOCUS, &wxCompositeWindow::OnSetFocus, this); child->Bind(wxEVT_KILL_FOCUS, &wxCompositeWindow::OnKillFocus, this); // Some events should be only handled for non-toplevel children. For // example, we want to close the control in wxDataViewCtrl when Enter // is pressed in the inline editor, but not when it's pressed in a // popup dialog it opens. wxWindow *win = child; while ( win && win != this ) { if ( win->IsTopLevel() ) return; win = win->GetParent(); } child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnChar, this); } void OnChar(wxKeyEvent& event) { if ( !this->ProcessWindowEvent(event) ) event.Skip(); } void OnSetFocus(wxFocusEvent& event) { event.Skip(); // When a child of a composite window gains focus, the entire composite // focus gains focus as well -- unless it had it already. // // We suppose that we hadn't had focus if the event doesn't carry the // previously focused window as it normally means that it comes from // outside of this program. wxWindow* const oldFocus = event.GetWindow(); if ( !oldFocus || oldFocus->GetMainWindowOfCompositeControl() != this ) { wxFocusEvent eventThis(wxEVT_SET_FOCUS, this->GetId()); eventThis.SetEventObject(this); eventThis.SetWindow(event.GetWindow()); this->ProcessWindowEvent(eventThis); } } void OnKillFocus(wxFocusEvent& event) { // Ignore focus changes within the composite control: wxWindow *win = event.GetWindow(); while ( win ) { if ( win == this ) { event.Skip(); return; } // Note that we don't use IsTopLevel() check here, because we do // want to ignore focus changes going to toplevel window that have // the composite control as its parent; these would typically be // some kind of control's popup window. win = win->GetParent(); } // The event shouldn't be ignored, forward it to the main control: if ( !this->ProcessWindowEvent(event) ) event.Skip(); } wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W); }; #endif // _WX_COMPOSITEWIN_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/geometry.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/geometry.h // Purpose: Common Geometry Classes // Author: Stefan Csomor // Modified by: // Created: 08/05/99 // Copyright: (c) 1999 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_GEOMETRY_H_ #define _WX_GEOMETRY_H_ #include "wx/defs.h" #if wxUSE_GEOMETRY #include "wx/utils.h" #include "wx/gdicmn.h" #include "wx/math.h" class WXDLLIMPEXP_FWD_BASE wxDataInputStream; class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; // clipping from Cohen-Sutherland enum wxOutCode { wxInside = 0x00 , wxOutLeft = 0x01 , wxOutRight = 0x02 , wxOutTop = 0x08 , wxOutBottom = 0x04 }; class WXDLLIMPEXP_CORE wxPoint2DInt { public : inline wxPoint2DInt(); inline wxPoint2DInt( wxInt32 x , wxInt32 y ); inline wxPoint2DInt( const wxPoint2DInt &pt ); inline wxPoint2DInt( const wxPoint &pt ); // noops for this class, just return the coords inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; inline wxDouble GetVectorLength() const; wxDouble GetVectorAngle() const; inline void SetVectorLength( wxDouble length ); void SetVectorAngle( wxDouble degrees ); // set the vector length to 1.0, preserving the angle inline void Normalize(); inline wxDouble GetDistance( const wxPoint2DInt &pt ) const; inline wxDouble GetDistanceSquare( const wxPoint2DInt &pt ) const; inline wxInt32 GetDotProduct( const wxPoint2DInt &vec ) const; inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; // the reflection of this point inline wxPoint2DInt operator-(); inline wxPoint2DInt& operator=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator*=(wxDouble n); inline wxPoint2DInt& operator*=(wxInt32 n); inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator/=(wxDouble n); inline wxPoint2DInt& operator/=(wxInt32 n); inline operator wxPoint() const; inline bool operator==(const wxPoint2DInt& pt) const; inline bool operator!=(const wxPoint2DInt& pt) const; #if wxUSE_STREAMS void WriteTo( wxDataOutputStream &stream ) const; void ReadFrom( wxDataInputStream &stream ); #endif // wxUSE_STREAMS wxInt32 m_x; wxInt32 m_y; }; inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n); inline wxPoint2DInt::wxPoint2DInt() { m_x = 0; m_y = 0; } inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y ) { m_x = x; m_y = y; } inline wxPoint2DInt::wxPoint2DInt( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; } inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt ) { m_x = pt.x; m_y = pt.y; } inline void wxPoint2DInt::GetFloor( wxInt32 *x , wxInt32 *y ) const { if ( x ) *x = m_x; if ( y ) *y = m_y; } inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const { GetFloor(x, y); } inline wxDouble wxPoint2DInt::GetVectorLength() const { // cast needed MIPSpro compiler under SGI return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) ); } inline void wxPoint2DInt::SetVectorLength( wxDouble length ) { wxDouble before = GetVectorLength(); m_x = (wxInt32)(m_x * length / before); m_y = (wxInt32)(m_y * length / before); } inline void wxPoint2DInt::Normalize() { SetVectorLength( 1 ); } inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const { return sqrt( GetDistanceSquare( pt ) ); } inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const { return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); } inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const { return ( m_x * vec.m_x + m_y * vec.m_y ); } inline wxInt32 wxPoint2DInt::GetCrossProduct( const wxPoint2DInt &vec ) const { return ( m_x * vec.m_y - vec.m_x * m_y ); } inline wxPoint2DInt::operator wxPoint() const { return wxPoint( m_x, m_y); } inline wxPoint2DInt wxPoint2DInt::operator-() { return wxPoint2DInt( -m_x, -m_y); } inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) { if (this != &pt) { m_x = pt.m_x; m_y = pt.m_y; } return *this; } inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt) { m_x = m_x + pt.m_x; m_y = m_y + pt.m_y; return *this; } inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt) { m_x = m_x - pt.m_x; m_y = m_y - pt.m_y; return *this; } inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt) { m_x = m_x * pt.m_x; m_y = m_y * pt.m_y; return *this; } inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt) { m_x = m_x / pt.m_x; m_y = m_y / pt.m_y; return *this; } inline bool wxPoint2DInt::operator==(const wxPoint2DInt& pt) const { return m_x == pt.m_x && m_y == pt.m_y; } inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const { return m_x != pt.m_x || m_y != pt.m_y; } inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) { return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); } inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) { return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); } inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) { return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); } inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt) { return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); } inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt) { return wxPoint2DInt( static_cast<wxInt32>(pt.m_x * n) , static_cast<wxInt32>(pt.m_y * n) ); } inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) { return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); } inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n) { return wxPoint2DInt( static_cast<wxInt32>(pt.m_x * n) , static_cast<wxInt32>(pt.m_y * n) ); } inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) { return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); } inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n) { return wxPoint2DInt( pt.m_x / n , pt.m_y / n ); } inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) { return wxPoint2DInt( static_cast<wxInt32>(pt.m_x / n) , static_cast<wxInt32>(pt.m_y / n) ); } // wxPoint2Ds represent a point or a vector in a 2d coordinate system class WXDLLIMPEXP_CORE wxPoint2DDouble { public : inline wxPoint2DDouble(); inline wxPoint2DDouble( wxDouble x , wxDouble y ); inline wxPoint2DDouble( const wxPoint2DDouble &pt ); wxPoint2DDouble( const wxPoint2DInt &pt ) { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; } wxPoint2DDouble( const wxPoint &pt ) { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; } // two different conversions to integers, floor and rounding inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; inline wxDouble GetVectorLength() const; wxDouble GetVectorAngle() const ; void SetVectorLength( wxDouble length ); void SetVectorAngle( wxDouble degrees ); // set the vector length to 1.0, preserving the angle void Normalize(); inline wxDouble GetDistance( const wxPoint2DDouble &pt ) const; inline wxDouble GetDistanceSquare( const wxPoint2DDouble &pt ) const; inline wxDouble GetDotProduct( const wxPoint2DDouble &vec ) const; inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; // the reflection of this point inline wxPoint2DDouble operator-(); inline wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator*=(wxDouble n); inline wxPoint2DDouble& operator*=(wxInt32 n); inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator/=(wxDouble n); inline wxPoint2DDouble& operator/=(wxInt32 n); inline bool operator==(const wxPoint2DDouble& pt) const; inline bool operator!=(const wxPoint2DDouble& pt) const; wxDouble m_x; wxDouble m_y; }; inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt); inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt); inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n); inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n); inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n); inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n); inline wxPoint2DDouble::wxPoint2DDouble() { m_x = 0.0; m_y = 0.0; } inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y ) { m_x = x; m_y = y; } inline wxPoint2DDouble::wxPoint2DDouble( const wxPoint2DDouble &pt ) { m_x = pt.m_x; m_y = pt.m_y; } inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const { *x = (wxInt32) floor( m_x ); *y = (wxInt32) floor( m_y ); } inline void wxPoint2DDouble::GetRounded( wxInt32 *x , wxInt32 *y ) const { *x = (wxInt32) floor( m_x + 0.5 ); *y = (wxInt32) floor( m_y + 0.5); } inline wxDouble wxPoint2DDouble::GetVectorLength() const { return sqrt( (m_x)*(m_x) + (m_y)*(m_y) ) ; } inline void wxPoint2DDouble::SetVectorLength( wxDouble length ) { wxDouble before = GetVectorLength() ; m_x = (m_x * length / before) ; m_y = (m_y * length / before) ; } inline void wxPoint2DDouble::Normalize() { SetVectorLength( 1 ); } inline wxDouble wxPoint2DDouble::GetDistance( const wxPoint2DDouble &pt ) const { return sqrt( GetDistanceSquare( pt ) ); } inline wxDouble wxPoint2DDouble::GetDistanceSquare( const wxPoint2DDouble &pt ) const { return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); } inline wxDouble wxPoint2DDouble::GetDotProduct( const wxPoint2DDouble &vec ) const { return ( m_x * vec.m_x + m_y * vec.m_y ); } inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) const { return ( m_x * vec.m_y - vec.m_x * m_y ); } inline wxPoint2DDouble wxPoint2DDouble::operator-() { return wxPoint2DDouble( -m_x, -m_y); } inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) { if (this != &pt) { m_x = pt.m_x; m_y = pt.m_y; } return *this; } inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt) { m_x = m_x + pt.m_x; m_y = m_y + pt.m_y; return *this; } inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt) { m_x = m_x - pt.m_x; m_y = m_y - pt.m_y; return *this; } inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt) { m_x = m_x * pt.m_x; m_y = m_y * pt.m_y; return *this; } inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt) { m_x = m_x / pt.m_x; m_y = m_y / pt.m_y; return *this; } inline bool wxPoint2DDouble::operator==(const wxPoint2DDouble& pt) const { return wxIsSameDouble(m_x, pt.m_x) && wxIsSameDouble(m_y, pt.m_y); } inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const { return !(*this == pt); } inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) { return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); } inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) { return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); } inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) { return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); } inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt) { return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); } inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt) { return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); } inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n) { return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); } inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n) { return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); } inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) { return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); } inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n) { return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); } inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n) { return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); } // wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the // top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if // left <= x < right and top <= m_y < bottom , thus it is a half open interval. class WXDLLIMPEXP_CORE wxRect2DDouble { public: wxRect2DDouble() { m_x = m_y = m_width = m_height = 0; } wxRect2DDouble(wxDouble x, wxDouble y, wxDouble w, wxDouble h) { m_x = x; m_y = y; m_width = w; m_height = h; } /* wxRect2DDouble(const wxPoint2DDouble& topLeft, const wxPoint2DDouble& bottomRight); wxRect2DDouble(const wxPoint2DDouble& pos, const wxSize& size); wxRect2DDouble(const wxRect2DDouble& rect); */ // single attribute accessors wxPoint2DDouble GetPosition() const { return wxPoint2DDouble(m_x, m_y); } wxSize GetSize() const { return wxSize((int) m_width, (int) m_height); } // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately inline wxDouble GetLeft() const { return m_x; } inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } inline void MoveLeftTo( wxDouble n ) { m_x = n; } inline wxDouble GetTop() const { return m_y; } inline void SetTop( wxDouble n ) { m_height += m_y - n; m_y = n; } inline void MoveTopTo( wxDouble n ) { m_y = n; } inline wxDouble GetBottom() const { return m_y + m_height; } inline void SetBottom( wxDouble n ) { m_height += n - (m_y+m_height);} inline void MoveBottomTo( wxDouble n ) { m_y = n - m_height; } inline wxDouble GetRight() const { return m_x + m_width; } inline void SetRight( wxDouble n ) { m_width += n - (m_x+m_width) ; } inline void MoveRightTo( wxDouble n ) { m_x = n - m_width; } inline wxPoint2DDouble GetLeftTop() const { return wxPoint2DDouble( m_x , m_y ); } inline void SetLeftTop( const wxPoint2DDouble &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } inline void MoveLeftTopTo( const wxPoint2DDouble &pt ) { m_x = pt.m_x; m_y = pt.m_y; } inline wxPoint2DDouble GetLeftBottom() const { return wxPoint2DDouble( m_x , m_y + m_height ); } inline void SetLeftBottom( const wxPoint2DDouble &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } inline void MoveLeftBottomTo( const wxPoint2DDouble &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; } inline wxPoint2DDouble GetRightTop() const { return wxPoint2DDouble( m_x+m_width , m_y ); } inline void SetRightTop( const wxPoint2DDouble &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } inline void MoveRightTopTo( const wxPoint2DDouble &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; } inline wxPoint2DDouble GetRightBottom() const { return wxPoint2DDouble( m_x+m_width , m_y + m_height ); } inline void SetRightBottom( const wxPoint2DDouble &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} inline void MoveRightBottomTo( const wxPoint2DDouble &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } inline wxPoint2DDouble GetCentre() const { return wxPoint2DDouble( m_x+m_width/2 , m_y+m_height/2 ); } inline void SetCentre( const wxPoint2DDouble &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving... inline void MoveCentreTo( const wxPoint2DDouble &pt ) { m_x += pt.m_x - (m_x+m_width/2); m_y += pt.m_y -(m_y+m_height/2); } inline wxOutCode GetOutCode( const wxPoint2DDouble &pt ) const { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + ( ( pt.m_x > m_x + m_width ) ? wxOutRight : 0 ) + ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + ( ( pt.m_y > m_y + m_height ) ? wxOutBottom : 0 )); } inline wxOutCode GetOutcode(const wxPoint2DDouble &pt) const { return GetOutCode(pt) ; } inline bool Contains( const wxPoint2DDouble &pt ) const { return GetOutCode( pt ) == wxInside; } inline bool Contains( const wxRect2DDouble &rect ) const { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } inline bool IsEmpty() const { return m_width <= 0 || m_height <= 0; } inline bool HaveEqualSize( const wxRect2DDouble &rect ) const { return wxIsSameDouble(rect.m_width, m_width) && wxIsSameDouble(rect.m_height, m_height); } inline void Inset( wxDouble x , wxDouble y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } inline void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom ) { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} inline void Offset( const wxPoint2DDouble &pt ) { m_x += pt.m_x; m_y += pt.m_y; } void ConstrainTo( const wxRect2DDouble &rect ); inline wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); inline void Intersect( const wxRect2DDouble &otherRect ) { Intersect( *this , otherRect , this ); } inline wxRect2DDouble CreateIntersection( const wxRect2DDouble &otherRect ) const { wxRect2DDouble result; Intersect( *this , otherRect , &result); return result; } bool Intersects( const wxRect2DDouble &rect ) const; static void Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); void Union( const wxRect2DDouble &otherRect ) { Union( *this , otherRect , this ); } void Union( const wxPoint2DDouble &pt ); inline wxRect2DDouble CreateUnion( const wxRect2DDouble &otherRect ) const { wxRect2DDouble result; Union( *this , otherRect , &result); return result; } inline void Scale( wxDouble f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} inline void Scale( wxInt32 num , wxInt32 denum ) { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum); m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);} wxRect2DDouble& operator = (const wxRect2DDouble& rect); inline bool operator == (const wxRect2DDouble& rect) const { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); } inline bool operator != (const wxRect2DDouble& rect) const { return !(*this == rect); } wxDouble m_x; wxDouble m_y; wxDouble m_width; wxDouble m_height; }; // wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the // top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if // left <= x < right and top <= m_y < bottom , thus it is a half open interval. class WXDLLIMPEXP_CORE wxRect2DInt { public: wxRect2DInt() { m_x = m_y = m_width = m_height = 0; } wxRect2DInt( const wxRect& r ) { m_x = r.x ; m_y = r.y ; m_width = r.width ; m_height = r.height ; } wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; } wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight); inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size); inline wxRect2DInt(const wxRect2DInt& rect); // single attribute accessors wxPoint2DInt GetPosition() const { return wxPoint2DInt(m_x, m_y); } wxSize GetSize() const { return wxSize(m_width, m_height); } // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately inline wxInt32 GetLeft() const { return m_x; } inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } inline void MoveLeftTo( wxInt32 n ) { m_x = n; } inline wxInt32 GetTop() const { return m_y; } inline void SetTop( wxInt32 n ) { m_height += m_y - n; m_y = n; } inline void MoveTopTo( wxInt32 n ) { m_y = n; } inline wxInt32 GetBottom() const { return m_y + m_height; } inline void SetBottom( wxInt32 n ) { m_height += n - (m_y+m_height);} inline void MoveBottomTo( wxInt32 n ) { m_y = n - m_height; } inline wxInt32 GetRight() const { return m_x + m_width; } inline void SetRight( wxInt32 n ) { m_width += n - (m_x+m_width) ; } inline void MoveRightTo( wxInt32 n ) { m_x = n - m_width; } inline wxPoint2DInt GetLeftTop() const { return wxPoint2DInt( m_x , m_y ); } inline void SetLeftTop( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } inline void MoveLeftTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; } inline wxPoint2DInt GetLeftBottom() const { return wxPoint2DInt( m_x , m_y + m_height ); } inline void SetLeftBottom( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } inline void MoveLeftBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; } inline wxPoint2DInt GetRightTop() const { return wxPoint2DInt( m_x+m_width , m_y ); } inline void SetRightTop( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } inline void MoveRightTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; } inline wxPoint2DInt GetRightBottom() const { return wxPoint2DInt( m_x+m_width , m_y + m_height ); } inline void SetRightBottom( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} inline void MoveRightBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } inline wxPoint2DInt GetCentre() const { return wxPoint2DInt( m_x+m_width/2 , m_y+m_height/2 ); } inline void SetCentre( const wxPoint2DInt &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving... inline void MoveCentreTo( const wxPoint2DInt &pt ) { m_x += pt.m_x - (m_x+m_width/2); m_y += pt.m_y -(m_y+m_height/2); } inline wxOutCode GetOutCode( const wxPoint2DInt &pt ) const { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + ( ( pt.m_x >= m_x + m_width ) ? wxOutRight : 0 ) + ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + ( ( pt.m_y >= m_y + m_height ) ? wxOutBottom : 0 )); } inline wxOutCode GetOutcode( const wxPoint2DInt &pt ) const { return GetOutCode( pt ) ; } inline bool Contains( const wxPoint2DInt &pt ) const { return GetOutCode( pt ) == wxInside; } inline bool Contains( const wxRect2DInt &rect ) const { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } inline bool IsEmpty() const { return ( m_width <= 0 || m_height <= 0 ); } inline bool HaveEqualSize( const wxRect2DInt &rect ) const { return ( rect.m_width == m_width && rect.m_height == m_height ); } inline void Inset( wxInt32 x , wxInt32 y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } inline void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ) { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } void ConstrainTo( const wxRect2DInt &rect ); inline wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DInt( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } inline wxRect2DInt CreateIntersection( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Intersect( *this , otherRect , &result); return result; } bool Intersects( const wxRect2DInt &rect ) const; static void Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); void Union( const wxRect2DInt &otherRect ) { Union( *this , otherRect , this ); } void Union( const wxPoint2DInt &pt ); inline wxRect2DInt CreateUnion( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Union( *this , otherRect , &result); return result; } inline void Scale( wxInt32 f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} inline void Scale( wxInt32 num , wxInt32 denum ) { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum); m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);} wxRect2DInt& operator = (const wxRect2DInt& rect); bool operator == (const wxRect2DInt& rect) const; bool operator != (const wxRect2DInt& rect) const; #if wxUSE_STREAMS void WriteTo( wxDataOutputStream &stream ) const; void ReadFrom( wxDataInputStream &stream ); #endif // wxUSE_STREAMS wxInt32 m_x; wxInt32 m_y; wxInt32 m_width; wxInt32 m_height; }; inline wxRect2DInt::wxRect2DInt( const wxRect2DInt &r ) { m_x = r.m_x; m_y = r.m_y; m_width = r.m_width; m_height = r.m_height; } inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b) { m_x = wxMin( a.m_x , b.m_x ); m_y = wxMin( a.m_y , b.m_y ); m_width = abs( a.m_x - b.m_x ); m_height = abs( a.m_y - b.m_y ); } inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt& pos, const wxSize& size) { m_x = pos.m_x; m_y = pos.m_y; m_width = size.x; m_height = size.y; } inline bool wxRect2DInt::operator == (const wxRect2DInt& rect) const { return (m_x==rect.m_x && m_y==rect.m_y && m_width==rect.m_width && m_height==rect.m_height); } inline bool wxRect2DInt::operator != (const wxRect2DInt& rect) const { return !(*this == rect); } class WXDLLIMPEXP_CORE wxTransform2D { public : virtual ~wxTransform2D() { } virtual void Transform( wxPoint2DInt* pt )const = 0; virtual void Transform( wxRect2DInt* r ) const; virtual wxPoint2DInt Transform( const wxPoint2DInt &pt ) const; virtual wxRect2DInt Transform( const wxRect2DInt &r ) const ; virtual void InverseTransform( wxPoint2DInt* pt ) const = 0; virtual void InverseTransform( wxRect2DInt* r ) const ; virtual wxPoint2DInt InverseTransform( const wxPoint2DInt &pt ) const ; virtual wxRect2DInt InverseTransform( const wxRect2DInt &r ) const ; }; #endif // wxUSE_GEOMETRY #endif // _WX_GEOMETRY_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/timectrl.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/timectrl.h // Purpose: Declaration of wxTimePickerCtrl class. // Author: Vadim Zeitlin // Created: 2011-09-22 // Copyright: (c) 2011 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_TIMECTRL_H_ #define _WX_TIMECTRL_H_ #include "wx/defs.h" #if wxUSE_TIMEPICKCTRL #include "wx/datetimectrl.h" #define wxTimePickerCtrlNameStr wxS("timectrl") // No special styles are currently defined for this control but still define a // symbolic constant for the default style for consistency. enum { wxTP_DEFAULT = 0 }; // ---------------------------------------------------------------------------- // wxTimePickerCtrl: Allow the user to enter the time. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_ADV wxTimePickerCtrlBase : public wxDateTimePickerCtrl { public: /* The derived classes should implement ctor and Create() method with the following signature: bool Create(wxWindow *parent, wxWindowID id, const wxDateTime& dt = wxDefaultDateTime, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTP_DEFAULT, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTimePickerCtrlNameStr); */ /* We also inherit Set/GetValue() methods from the base class which define our public API. Notice that the date portion of the date passed as input or received as output is or should be ignored, only the time part of wxDateTime objects is really significant here. Use Set/GetTime() below for possibly simpler interface. */ // Set the given time. bool SetTime(int hour, int min, int sec) { // Notice that we should use a date on which DST doesn't change to // avoid any problems with time discontinuity so use a fixed date (on // which nobody changes DST) instead of e.g. today. wxDateTime dt(1, wxDateTime::Jan, 2012, hour, min, sec); if ( !dt.IsValid() ) { // No need to assert here, wxDateTime already does it for us. return false; } SetValue(dt); return true; } // Get the current time components. All pointers must be non-NULL. bool GetTime(int* hour, int* min, int* sec) const { wxCHECK_MSG( hour && min && sec, false, wxS("Time component pointers must be non-NULL") ); const wxDateTime::Tm tm = GetValue().GetTm(); *hour = tm.hour; *min = tm.min; *sec = tm.sec; return true; } }; #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/timectrl.h" #define wxHAS_NATIVE_TIMEPICKERCTRL #elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) #include "wx/osx/timectrl.h" #define wxHAS_NATIVE_TIMEPICKERCTRL #else #include "wx/generic/timectrl.h" class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlGeneric { public: wxTimePickerCtrl() { } wxTimePickerCtrl(wxWindow *parent, wxWindowID id, const wxDateTime& date = wxDefaultDateTime, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTP_DEFAULT, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTimePickerCtrlNameStr) : wxTimePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) { } private: wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); }; #endif #endif // wxUSE_TIMEPICKCTRL #endif // _WX_TIMECTRL_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/filepicker.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/filepicker.h // Purpose: wxFilePickerCtrl, wxDirPickerCtrl base header // Author: Francesco Montorsi // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FILEDIRPICKER_H_BASE_ #define _WX_FILEDIRPICKER_H_BASE_ #include "wx/defs.h" #if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL #include "wx/pickerbase.h" #include "wx/filename.h" class WXDLLIMPEXP_FWD_CORE wxDialog; class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent; extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetLabel[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerCtrlNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetLabel[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerCtrlNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; // ---------------------------------------------------------------------------- // wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent { public: wxFileDirPickerEvent() {} wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) : wxCommandEvent(type, id), m_path(path) { SetEventObject(generator); } wxString GetPath() const { return m_path; } void SetPath(const wxString &p) { m_path = p; } // default copy ctor, assignment operator and dtor are ok virtual wxEvent *Clone() const wxOVERRIDE { return new wxFileDirPickerEvent(*this); } private: wxString m_path; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEvent ); // ---------------------------------------------------------------------------- // event types and macros // ---------------------------------------------------------------------------- typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); #define wxFileDirPickerEventHandler(func) \ wxEVENT_HANDLER_CAST(wxFileDirPickerEventFunction, func) #define EVT_FILEPICKER_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) #define EVT_DIRPICKER_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) // ---------------------------------------------------------------------------- // wxFileDirPickerWidgetBase: a generic abstract interface which must be // implemented by controls used by wxFileDirPickerCtrlBase // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFileDirPickerWidgetBase { public: wxFileDirPickerWidgetBase() { } virtual ~wxFileDirPickerWidgetBase() { } // Path here is the name of the selected file or directory. wxString GetPath() const { return m_path; } virtual void SetPath(const wxString &str) { m_path=str; } // Set the directory to open the file browse dialog at initially. virtual void SetInitialDirectory(const wxString& dir) = 0; // returns the picker widget cast to wxControl virtual wxControl *AsControl() = 0; protected: virtual void UpdateDialogPath(wxDialog *) = 0; virtual void UpdatePathFromDialog(wxDialog *) = 0; wxString m_path; }; // Styles which must be supported by all controls implementing wxFileDirPickerWidgetBase // NB: these styles must be defined to carefully-chosen values to // avoid conflicts with wxButton's styles #define wxFLP_OPEN 0x0400 #define wxFLP_SAVE 0x0800 #define wxFLP_OVERWRITE_PROMPT 0x1000 #define wxFLP_FILE_MUST_EXIST 0x2000 #define wxFLP_CHANGE_DIR 0x4000 #define wxFLP_SMALL wxPB_SMALL // NOTE: wxMULTIPLE is not supported ! #define wxDIRP_DIR_MUST_EXIST 0x0008 #define wxDIRP_CHANGE_DIR 0x0010 #define wxDIRP_SMALL wxPB_SMALL // map platform-dependent controls which implement the wxFileDirPickerWidgetBase // under the name "wxFilePickerWidget" and "wxDirPickerWidget". // NOTE: wxFileDirPickerCtrlBase will allocate a wx{File|Dir}PickerWidget and this // requires that all classes being mapped as wx{File|Dir}PickerWidget have the // same prototype for the contructor... // since GTK >= 2.6, there is GtkFileButton #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/filepicker.h" #define wxFilePickerWidget wxFileButton #define wxDirPickerWidget wxDirButton #else #include "wx/generic/filepickerg.h" #define wxFilePickerWidget wxGenericFileButton #define wxDirPickerWidget wxGenericDirButton #endif // ---------------------------------------------------------------------------- // wxFileDirPickerCtrlBase // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase { public: wxFileDirPickerCtrlBase() {} protected: // NB: no default values since this function will never be used // directly by the user and derived classes wouldn't use them bool CreateBase(wxWindow *parent, wxWindowID id, const wxString& path, const wxString &message, const wxString &wildcard, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name); public: // public API wxString GetPath() const; void SetPath(const wxString &str); // Set the directory to open the file browse dialog at initially. void SetInitialDirectory(const wxString& dir) { m_pickerIface->SetInitialDirectory(dir); } public: // internal functions void UpdatePickerFromTextCtrl() wxOVERRIDE; void UpdateTextCtrlFromPicker() wxOVERRIDE; // event handler for our picker void OnFileDirChange(wxFileDirPickerEvent &); // TRUE if any textctrl change should update the current working directory virtual bool IsCwdToUpdate() const = 0; // Returns the event type sent by this picker virtual wxEventType GetEventType() const = 0; virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) = 0; // Returns the filtered value currently placed in the text control (if present). virtual wxString GetTextCtrlValue() const = 0; protected: // creates the picker control virtual wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, const wxString& wildcard) = 0; protected: // m_picker object as wxFileDirPickerWidgetBase interface wxFileDirPickerWidgetBase *m_pickerIface; }; #endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL #if wxUSE_FILEPICKERCTRL // ---------------------------------------------------------------------------- // wxFilePickerCtrl: platform-independent class which embeds the // platform-dependent wxFilePickerWidget and, if wxFLP_USE_TEXTCTRL style is // used, a textctrl next to it. // ---------------------------------------------------------------------------- #define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) #ifdef __WXGTK__ // GTK apps usually don't have a textctrl next to the picker #define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) #else #define wxFLP_DEFAULT_STYLE (wxFLP_USE_TEXTCTRL|wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) #endif class WXDLLIMPEXP_CORE wxFilePickerCtrl : public wxFileDirPickerCtrlBase { public: wxFilePickerCtrl() {} wxFilePickerCtrl(wxWindow *parent, wxWindowID id, const wxString& path = wxEmptyString, const wxString& message = wxFileSelectorPromptStr, const wxString& wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFLP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFilePickerCtrlNameStr) { Create(parent, id, path, message, wildcard, pos, size, style, validator, name); } bool Create(wxWindow *parent, wxWindowID id, const wxString& path = wxEmptyString, const wxString& message = wxFileSelectorPromptStr, const wxString& wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFLP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFilePickerCtrlNameStr); void SetFileName(const wxFileName &filename) { SetPath(filename.GetFullPath()); } wxFileName GetFileName() const { return wxFileName(GetPath()); } public: // overrides // return the text control value in canonical form wxString GetTextCtrlValue() const wxOVERRIDE; bool IsCwdToUpdate() const wxOVERRIDE { return HasFlag(wxFLP_CHANGE_DIR); } wxEventType GetEventType() const wxOVERRIDE { return wxEVT_FILEPICKER_CHANGED; } virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) wxOVERRIDE { sender->Bind(wxEVT_FILEPICKER_CHANGED, &wxFileDirPickerCtrlBase::OnFileDirChange, eventSink ); } protected: virtual wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, const wxString& wildcard) wxOVERRIDE { return new wxFilePickerWidget(parent, wxID_ANY, wxGetTranslation(wxFilePickerWidgetLabel), path, message, wildcard, wxDefaultPosition, wxDefaultSize, GetPickerStyle(GetWindowStyle())); } // extracts the style for our picker from wxFileDirPickerCtrlBase's style long GetPickerStyle(long style) const wxOVERRIDE { return style & (wxFLP_OPEN | wxFLP_SAVE | wxFLP_OVERWRITE_PROMPT | wxFLP_FILE_MUST_EXIST | wxFLP_CHANGE_DIR | wxFLP_USE_TEXTCTRL | wxFLP_SMALL); } private: wxDECLARE_DYNAMIC_CLASS(wxFilePickerCtrl); }; #endif // wxUSE_FILEPICKERCTRL #if wxUSE_DIRPICKERCTRL // ---------------------------------------------------------------------------- // wxDirPickerCtrl: platform-independent class which embeds the // platform-dependent wxDirPickerWidget and eventually a textctrl // (see wxDIRP_USE_TEXTCTRL) next to it. // ---------------------------------------------------------------------------- #define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) #ifdef __WXGTK__ // GTK apps usually don't have a textctrl next to the picker #define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST) #else #define wxDIRP_DEFAULT_STYLE (wxDIRP_USE_TEXTCTRL|wxDIRP_DIR_MUST_EXIST) #endif class WXDLLIMPEXP_CORE wxDirPickerCtrl : public wxFileDirPickerCtrlBase { public: wxDirPickerCtrl() {} wxDirPickerCtrl(wxWindow *parent, wxWindowID id, const wxString& path = wxEmptyString, const wxString& message = wxDirSelectorPromptStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDirPickerCtrlNameStr) { Create(parent, id, path, message, pos, size, style, validator, name); } bool Create(wxWindow *parent, wxWindowID id, const wxString& path = wxEmptyString, const wxString& message = wxDirSelectorPromptStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDirPickerCtrlNameStr); void SetDirName(const wxFileName &dirname) { SetPath(dirname.GetPath()); } wxFileName GetDirName() const { return wxFileName::DirName(GetPath()); } public: // overrides wxString GetTextCtrlValue() const wxOVERRIDE; bool IsCwdToUpdate() const wxOVERRIDE { return HasFlag(wxDIRP_CHANGE_DIR); } wxEventType GetEventType() const wxOVERRIDE { return wxEVT_DIRPICKER_CHANGED; } virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) wxOVERRIDE { sender->Bind( wxEVT_DIRPICKER_CHANGED, &wxFileDirPickerCtrlBase::OnFileDirChange, eventSink ); } protected: virtual wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, const wxString& WXUNUSED(wildcard)) wxOVERRIDE { return new wxDirPickerWidget(parent, wxID_ANY, wxGetTranslation(wxDirPickerWidgetLabel), path, message, wxDefaultPosition, wxDefaultSize, GetPickerStyle(GetWindowStyle())); } // extracts the style for our picker from wxFileDirPickerCtrlBase's style long GetPickerStyle(long style) const wxOVERRIDE { return style & (wxDIRP_DIR_MUST_EXIST | wxDIRP_CHANGE_DIR | wxDIRP_USE_TEXTCTRL | wxDIRP_SMALL); } private: wxDECLARE_DYNAMIC_CLASS(wxDirPickerCtrl); }; #endif // wxUSE_DIRPICKERCTRL // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_FILEPICKER_CHANGED wxEVT_FILEPICKER_CHANGED #define wxEVT_COMMAND_DIRPICKER_CHANGED wxEVT_DIRPICKER_CHANGED #endif // _WX_FILEDIRPICKER_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/tglbtn.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/tglbtn.h // Purpose: This dummy header includes the proper header file for the // system we're compiling under. // Author: John Norris, minor changes by Axel Schlueter // Modified by: // Created: 08.02.01 // Copyright: (c) 2000 Johnny C. Norris II // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TOGGLEBUTTON_H_BASE_ #define _WX_TOGGLEBUTTON_H_BASE_ #include "wx/defs.h" #if wxUSE_TOGGLEBTN #include "wx/event.h" #include "wx/anybutton.h" // base class extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOGGLEBUTTON, wxCommandEvent ); // ---------------------------------------------------------------------------- // wxToggleButtonBase // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton { public: wxToggleButtonBase() { } // Get/set the value virtual void SetValue(bool state) = 0; virtual bool GetValue() const = 0; // The current "normal" state for the toggle button depends upon its value. virtual State GetNormalState() const wxOVERRIDE { return GetValue() ? State_Pressed : State_Normal; } void UpdateWindowUI(long flags) wxOVERRIDE { wxControl::UpdateWindowUI(flags); if ( !IsShown() ) return; wxWindow *tlw = wxGetTopLevelParent( this ); if (tlw && wxPendingDelete.Member( tlw )) return; wxUpdateUIEvent event( GetId() ); event.SetEventObject(this); if (GetEventHandler()->ProcessEvent(event) ) { if ( event.GetSetChecked() ) SetValue( event.GetChecked() ); } } protected: wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase); }; #define EVT_TOGGLEBUTTON(id, fn) \ wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn)) #if defined(__WXUNIVERSAL__) #include "wx/univ/tglbtn.h" #elif defined(__WXMSW__) #include "wx/msw/tglbtn.h" #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXGTK20__) #include "wx/gtk/tglbtn.h" #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXGTK__) #include "wx/gtk1/tglbtn.h" # elif defined(__WXMOTIF__) #include "wx/motif/tglbtn.h" #elif defined(__WXMAC__) #include "wx/osx/tglbtn.h" #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXQT__) #include "wx/qt/tglbtn.h" #endif // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON #endif // wxUSE_TOGGLEBTN #endif // _WX_TOGGLEBUTTON_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/layout.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/layout.h // Purpose: OBSOLETE layout constraint classes, use sizers instead // Author: Julian Smart // Modified by: // Created: 29/01/98 // Copyright: (c) 1998 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_LAYOUT_H_ #define _WX_LAYOUT_H_ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/object.h" // X stupidly defines these in X.h #ifdef Above #undef Above #endif #ifdef Below #undef Below #endif #if wxUSE_CONSTRAINTS // ---------------------------------------------------------------------------- // forward declrations // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxWindowBase; class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- #define wxLAYOUT_DEFAULT_MARGIN 0 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight, wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY }; enum wxRelationship { wxUnconstrained = 0, wxAsIs, wxPercentOf, wxAbove, wxBelow, wxLeftOf, wxRightOf, wxSameAs, wxAbsolute }; // ---------------------------------------------------------------------------- // wxIndividualLayoutConstraint: a constraint on window position // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxIndividualLayoutConstraint : public wxObject { public: wxIndividualLayoutConstraint(); // note that default copy ctor and assignment operators are ok virtual ~wxIndividualLayoutConstraint(){} void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); // // Sibling relationships // void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); // // 'Same edge' alignment // void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN); // The edge is a percentage of the other window's edge void PercentOf(wxWindowBase *otherW, wxEdge wh, int per); // // Edge has absolute value // void Absolute(int val); // // Dimension is unconstrained // void Unconstrained() { relationship = wxUnconstrained; } // // Dimension is 'as is' (use current size settings) // void AsIs() { relationship = wxAsIs; } // // Accessors // wxWindowBase *GetOtherWindow() { return otherWin; } wxEdge GetMyEdge() const { return myEdge; } void SetEdge(wxEdge which) { myEdge = which; } void SetValue(int v) { value = v; } int GetMargin() { return margin; } void SetMargin(int m) { margin = m; } int GetValue() const { return value; } int GetPercent() const { return percent; } int GetOtherEdge() const { return otherEdge; } bool GetDone() const { return done; } void SetDone(bool d) { done = d; } wxRelationship GetRelationship() { return relationship; } void SetRelationship(wxRelationship r) { relationship = r; } // Reset constraint if it mentions otherWin bool ResetIfWin(wxWindowBase *otherW); // Try to satisfy constraint bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win); // Get the value of this edge or dimension, or if this // is not determinable, -1. int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const; protected: // To be allowed to modify the internal variables friend class wxIndividualLayoutConstraint_Serialize; // 'This' window is the parent or sibling of otherWin wxWindowBase *otherWin; wxEdge myEdge; wxRelationship relationship; int margin; int value; int percent; wxEdge otherEdge; bool done; wxDECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint); }; // ---------------------------------------------------------------------------- // wxLayoutConstraints: the complete set of constraints for a window // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxLayoutConstraints : public wxObject { public: // Edge constraints wxIndividualLayoutConstraint left; wxIndividualLayoutConstraint top; wxIndividualLayoutConstraint right; wxIndividualLayoutConstraint bottom; // Size constraints wxIndividualLayoutConstraint width; wxIndividualLayoutConstraint height; // Centre constraints wxIndividualLayoutConstraint centreX; wxIndividualLayoutConstraint centreY; wxLayoutConstraints(); // note that default copy ctor and assignment operators are ok virtual ~wxLayoutConstraints(){} bool SatisfyConstraints(wxWindowBase *win, int *noChanges); bool AreSatisfied() const { return left.GetDone() && top.GetDone() && width.GetDone() && height.GetDone(); } wxDECLARE_DYNAMIC_CLASS(wxLayoutConstraints); }; #endif // wxUSE_CONSTRAINTS #endif // _WX_LAYOUT_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ipcbase.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/ipcbase.h // Purpose: Base classes for IPC // Author: Julian Smart // Modified by: // Created: 4/1/98 // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_IPCBASEH__ #define _WX_IPCBASEH__ #include "wx/defs.h" #include "wx/object.h" #include "wx/string.h" enum wxIPCFormat { wxIPC_INVALID = 0, wxIPC_TEXT = 1, /* CF_TEXT */ wxIPC_BITMAP = 2, /* CF_BITMAP */ wxIPC_METAFILE = 3, /* CF_METAFILEPICT */ wxIPC_SYLK = 4, wxIPC_DIF = 5, wxIPC_TIFF = 6, wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */ wxIPC_DIB = 8, /* CF_DIB */ wxIPC_PALETTE = 9, wxIPC_PENDATA = 10, wxIPC_RIFF = 11, wxIPC_WAVE = 12, wxIPC_UTF16TEXT = 13, /* CF_UNICODE */ wxIPC_ENHMETAFILE = 14, wxIPC_FILENAME = 15, /* CF_HDROP */ wxIPC_LOCALE = 16, wxIPC_UTF8TEXT = 17, wxIPC_UTF32TEXT = 18, #if SIZEOF_WCHAR_T == 2 wxIPC_UNICODETEXT = wxIPC_UTF16TEXT, #elif SIZEOF_WCHAR_T == 4 wxIPC_UNICODETEXT = wxIPC_UTF32TEXT, #else # error "Unknown wchar_t size" #endif wxIPC_PRIVATE = 20 }; class WXDLLIMPEXP_FWD_BASE wxServerBase; class WXDLLIMPEXP_FWD_BASE wxClientBase; class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject { public: wxConnectionBase(void *buffer, size_t size); // use external buffer wxConnectionBase(); // use internal, adaptive buffer wxConnectionBase(const wxConnectionBase& copy); virtual ~wxConnectionBase(); void SetConnected( bool c ) { m_connected = c; } bool GetConnected() { return m_connected; } // Calls that CLIENT can make bool Execute(const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE) { return DoExecute(data, size, fmt); } bool Execute(const char *s, size_t size = wxNO_LEN) { return DoExecute(s, size == wxNO_LEN ? strlen(s) + 1 : size, wxIPC_TEXT); } bool Execute(const wchar_t *ws, size_t size = wxNO_LEN) { return DoExecute(ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } bool Execute(const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoExecute(buf, strlen(buf) + 1, wxIPC_UTF8TEXT); } bool Execute(const wxCStrData& cs) { return Execute(cs.AsString()); } virtual const void *Request(const wxString& item, size_t *size = NULL, wxIPCFormat format = wxIPC_TEXT) = 0; bool Poke(const wxString& item, const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE) { return DoPoke(item, data, size, fmt); } bool Poke(const wxString& item, const char *s, size_t size = wxNO_LEN) { return DoPoke(item, s, size == wxNO_LEN ? strlen(s) + 1 : size, wxIPC_TEXT); } bool Poke(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN) { return DoPoke(item, ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } bool Poke(const wxString& item, const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); } bool Poke(const wxString& item, const wxCStrData& cs) { return Poke(item, cs.AsString()); } virtual bool StartAdvise(const wxString& item) = 0; virtual bool StopAdvise(const wxString& item) = 0; // Calls that SERVER can make bool Advise(const wxString& item, const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE) { return DoAdvise(item, data, size, fmt); } bool Advise(const wxString& item, const char *s, size_t size = wxNO_LEN) { return DoAdvise(item, s, size == wxNO_LEN ? strlen(s) + 1 : size, wxIPC_TEXT); } bool Advise(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN) { return DoAdvise(item, ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } bool Advise(const wxString& item, const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); } bool Advise(const wxString& item, const wxCStrData& cs) { return Advise(item, cs.AsString()); } // Calls that both can make virtual bool Disconnect() = 0; // Callbacks to SERVER - override at will virtual bool OnExec(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(data)) { wxFAIL_MSG( "This method shouldn't be called, if it is, it probably " "means that you didn't update your old code overriding " "OnExecute() to use the new parameter types (\"const void *\" " "instead of \"wxChar *\" and \"size_t\" instead of \"int\"), " "you must do it or your code wouldn't be executed at all!" ); return false; } // deprecated function kept for backwards compatibility: usually you will // want to override OnExec() above instead which receives its data in a more // convenient format virtual bool OnExecute(const wxString& topic, const void *data, size_t size, wxIPCFormat format) { return OnExec(topic, GetTextFromData(data, size, format)); } virtual const void *OnRequest(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), size_t *size, wxIPCFormat WXUNUSED(format)) { *size = 0; return NULL; } virtual bool OnPoke(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), const void *WXUNUSED(data), size_t WXUNUSED(size), wxIPCFormat WXUNUSED(format)) { return false; } virtual bool OnStartAdvise(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item)) { return false; } virtual bool OnStopAdvise(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item)) { return false; } // Callbacks to CLIENT - override at will virtual bool OnAdvise(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), const void *WXUNUSED(data), size_t WXUNUSED(size), wxIPCFormat WXUNUSED(format)) { return false; } // Callbacks to BOTH virtual bool OnDisconnect() { delete this; return true; } // return true if this is one of the formats used for textual data // transmission static bool IsTextFormat(wxIPCFormat format) { return format == wxIPC_TEXT || format == wxIPC_UTF8TEXT || format == wxIPC_UTF16TEXT || format == wxIPC_UTF32TEXT; } // converts from the data and format into a wxString automatically // // this function accepts data in all of wxIPC_TEXT, wxIPC_UNICODETEXT, and // wxIPC_UTF8TEXT formats but asserts if the format is anything else (i.e. // such that IsTextFormat(format) doesn't return true) // // notice that the size parameter here contains the total size of the data, // including the terminating '\0' or L'\0' static wxString GetTextFromData(const void *data, size_t size, wxIPCFormat format); // return a buffer at least this size, reallocating buffer if needed // returns NULL if using an inadequate user buffer which can't be resized void *GetBufferAtLeast(size_t bytes); protected: virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) = 0; virtual bool DoPoke(const wxString& item, const void *data, size_t size, wxIPCFormat format) = 0; virtual bool DoAdvise(const wxString& item, const void *data, size_t size, wxIPCFormat format) = 0; private: char *m_buffer; size_t m_buffersize; bool m_deletebufferwhendone; protected: bool m_connected; wxDECLARE_NO_ASSIGN_CLASS(wxConnectionBase); wxDECLARE_CLASS(wxConnectionBase); }; class WXDLLIMPEXP_BASE wxServerBase : public wxObject { public: wxServerBase() { } virtual ~wxServerBase() { } // Returns false on error (e.g. port number is already in use) virtual bool Create(const wxString& serverName) = 0; // Callbacks to SERVER - override at will virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; wxDECLARE_CLASS(wxServerBase); }; class WXDLLIMPEXP_BASE wxClientBase : public wxObject { public: wxClientBase() { } virtual ~wxClientBase() { } virtual bool ValidHost(const wxString& host) = 0; // Call this to make a connection. Returns NULL if cannot. virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0; // Callbacks to CLIENT - override at will virtual wxConnectionBase *OnMakeConnection() = 0; wxDECLARE_CLASS(wxClientBase); }; #endif // _WX_IPCBASEH__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fontenc.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/fontenc.h // Purpose: wxFontEncoding constants // Author: Vadim Zeitlin // Modified by: // Created: 29.03.00 // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FONTENC_H_ #define _WX_FONTENC_H_ // font encodings enum wxFontEncoding { wxFONTENCODING_SYSTEM = -1, // system default wxFONTENCODING_DEFAULT, // current default encoding // ISO8859 standard defines a number of single-byte charsets wxFONTENCODING_ISO8859_1, // West European (Latin1) wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) wxFONTENCODING_ISO8859_5, // Cyrillic wxFONTENCODING_ISO8859_6, // Arabic wxFONTENCODING_ISO8859_7, // Greek wxFONTENCODING_ISO8859_8, // Hebrew wxFONTENCODING_ISO8859_9, // Turkish (Latin5) wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) wxFONTENCODING_ISO8859_11, // Thai wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it // here anyhow to make all ISO8859 // consecutive numbers wxFONTENCODING_ISO8859_13, // Baltic (Latin7) wxFONTENCODING_ISO8859_14, // Latin8 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) wxFONTENCODING_ISO8859_MAX, // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) wxFONTENCODING_KOI8, // KOI8 Russian wxFONTENCODING_KOI8_U, // KOI8 Ukrainian wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria // what would we do without Microsoft? They have their own encodings // for DOS wxFONTENCODING_CP437, // original MS-DOS codepage wxFONTENCODING_CP850, // CP437 merged with Latin1 wxFONTENCODING_CP852, // CP437 merged with Latin2 wxFONTENCODING_CP855, // another cyrillic encoding wxFONTENCODING_CP866, // and another one // and for Windows wxFONTENCODING_CP874, // WinThai wxFONTENCODING_CP932, // Japanese (shift-JIS) wxFONTENCODING_CP936, // Chinese simplified (GB) wxFONTENCODING_CP949, // Korean (Hangul charset, a.k.a. EUC-KR) wxFONTENCODING_CP950, // Chinese (traditional - Big5) wxFONTENCODING_CP1250, // WinLatin2 wxFONTENCODING_CP1251, // WinCyrillic wxFONTENCODING_CP1252, // WinLatin1 wxFONTENCODING_CP1253, // WinGreek (8859-7) wxFONTENCODING_CP1254, // WinTurkish wxFONTENCODING_CP1255, // WinHebrew wxFONTENCODING_CP1256, // WinArabic wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) wxFONTENCODING_CP1258, // WinVietnamese wxFONTENCODING_CP1361, // Johab Korean character set. wxFONTENCODING_CP12_MAX, wxFONTENCODING_UTF7, // UTF-7 Unicode encoding wxFONTENCODING_UTF8, // UTF-8 Unicode encoding wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding wxFONTENCODING_MACROMAN, // the standard mac encodings wxFONTENCODING_MACJAPANESE, wxFONTENCODING_MACCHINESETRAD, wxFONTENCODING_MACKOREAN, wxFONTENCODING_MACARABIC, wxFONTENCODING_MACHEBREW, wxFONTENCODING_MACGREEK, wxFONTENCODING_MACCYRILLIC, wxFONTENCODING_MACDEVANAGARI, wxFONTENCODING_MACGURMUKHI, wxFONTENCODING_MACGUJARATI, wxFONTENCODING_MACORIYA, wxFONTENCODING_MACBENGALI, wxFONTENCODING_MACTAMIL, wxFONTENCODING_MACTELUGU, wxFONTENCODING_MACKANNADA, wxFONTENCODING_MACMALAJALAM, wxFONTENCODING_MACSINHALESE, wxFONTENCODING_MACBURMESE, wxFONTENCODING_MACKHMER, wxFONTENCODING_MACTHAI, wxFONTENCODING_MACLAOTIAN, wxFONTENCODING_MACGEORGIAN, wxFONTENCODING_MACARMENIAN, wxFONTENCODING_MACCHINESESIMP, wxFONTENCODING_MACTIBETAN, wxFONTENCODING_MACMONGOLIAN, wxFONTENCODING_MACETHIOPIC, wxFONTENCODING_MACCENTRALEUR, wxFONTENCODING_MACVIATNAMESE, wxFONTENCODING_MACARABICEXT, wxFONTENCODING_MACSYMBOL, wxFONTENCODING_MACDINGBATS, wxFONTENCODING_MACTURKISH, wxFONTENCODING_MACCROATIAN, wxFONTENCODING_MACICELANDIC, wxFONTENCODING_MACROMANIAN, wxFONTENCODING_MACCELTIC, wxFONTENCODING_MACGAELIC, wxFONTENCODING_MACKEYBOARD, // more CJK encodings (for historical reasons some are already declared // above) wxFONTENCODING_ISO2022_JP, // ISO-2022-JP JIS encoding wxFONTENCODING_MAX, // highest enumerated encoding value wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , // aliases for endian-dependent UTF encodings #ifdef WORDS_BIGENDIAN wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16 wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32BE, // native UTF-32 #else // WORDS_BIGENDIAN wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16LE, // native UTF-16 wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32LE, // native UTF-32 #endif // WORDS_BIGENDIAN // alias for the native Unicode encoding on this platform // (this is used by wxEncodingConverter and wxUTFFile only for now) #if SIZEOF_WCHAR_T == 2 wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16, #else // SIZEOF_WCHAR_T == 4 wxFONTENCODING_UNICODE = wxFONTENCODING_UTF32, #endif // alternative names for Far Eastern encodings // Chinese wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html) wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, // Shift JIS // Korean (CP 949 not actually the same but close enough) wxFONTENCODING_EUC_KR = wxFONTENCODING_CP949, wxFONTENCODING_JOHAB = wxFONTENCODING_CP1361, // Vietnamese wxFONTENCODING_VIETNAMESE = wxFONTENCODING_CP1258 }; #endif // _WX_FONTENC_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fs_mem.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/fs_mem.h // Purpose: in-memory file system // Author: Vaclav Slavik // Copyright: (c) 2000 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FS_MEM_H_ #define _WX_FS_MEM_H_ #include "wx/defs.h" #if wxUSE_FILESYSTEM #include "wx/filesys.h" #include "wx/hashmap.h" class wxMemoryFSFile; WX_DECLARE_STRING_HASH_MAP(wxMemoryFSFile *, wxMemoryFSHash); #if wxUSE_GUI #include "wx/bitmap.h" #endif // wxUSE_GUI // ---------------------------------------------------------------------------- // wxMemoryFSHandlerBase // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler { public: wxMemoryFSHandlerBase(); virtual ~wxMemoryFSHandlerBase(); // Add file to list of files stored in memory. Stored data (bitmap, text or // raw data) will be copied into private memory stream and available under // name "memory:" + filename static void AddFile(const wxString& filename, const wxString& textdata); static void AddFile(const wxString& filename, const void *binarydata, size_t size); static void AddFileWithMimeType(const wxString& filename, const wxString& textdata, const wxString& mimetype); static void AddFileWithMimeType(const wxString& filename, const void *binarydata, size_t size, const wxString& mimetype); // Remove file from memory FS and free occupied memory static void RemoveFile(const wxString& filename); virtual bool CanOpen(const wxString& location) wxOVERRIDE; virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; virtual wxString FindNext() wxOVERRIDE; protected: // check that the given file is not already present in m_Hash; logs an // error and returns false if it does exist static bool CheckDoesntExist(const wxString& filename); // the hash map indexed by the names of the files stored in the memory FS static wxMemoryFSHash m_Hash; // the file name currently being searched for, i.e. the argument of the // last FindFirst() call or empty string if FindFirst() hasn't been called // yet or FindNext() didn't find anything wxString m_findArgument; // iterator into m_Hash used by FindFirst/Next(), possibly m_Hash.end() or // even invalid (can only be used when m_findArgument is not empty) wxMemoryFSHash::const_iterator m_findIter; }; // ---------------------------------------------------------------------------- // wxMemoryFSHandler // ---------------------------------------------------------------------------- #if wxUSE_GUI // add GUI-only operations to the base class class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase { public: // bring the base class versions into the scope, otherwise they would be // inaccessible in wxMemoryFSHandler // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...) static void AddFile(const wxString& filename, const wxString& textdata) { wxMemoryFSHandlerBase::AddFile(filename, textdata); } static void AddFile(const wxString& filename, const void *binarydata, size_t size) { wxMemoryFSHandlerBase::AddFile(filename, binarydata, size); } static void AddFileWithMimeType(const wxString& filename, const wxString& textdata, const wxString& mimetype) { wxMemoryFSHandlerBase::AddFileWithMimeType(filename, textdata, mimetype); } static void AddFileWithMimeType(const wxString& filename, const void *binarydata, size_t size, const wxString& mimetype) { wxMemoryFSHandlerBase::AddFileWithMimeType(filename, binarydata, size, mimetype); } #if wxUSE_IMAGE static void AddFile(const wxString& filename, const wxImage& image, wxBitmapType type); static void AddFile(const wxString& filename, const wxBitmap& bitmap, wxBitmapType type); #endif // wxUSE_IMAGE }; #else // !wxUSE_GUI // just the same thing as the base class in wxBase class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase { }; #endif // wxUSE_GUI/!wxUSE_GUI #endif // wxUSE_FILESYSTEM #endif // _WX_FS_MEM_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/scrolwin.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/scrolwin.h // Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper // Author: Vadim Zeitlin // Modified by: // Created: 30.08.00 // Copyright: (c) 2000 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SCROLWIN_H_BASE_ #define _WX_SCROLWIN_H_BASE_ #include "wx/panel.h" class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; class WXDLLIMPEXP_FWD_BASE wxTimer; // default scrolled window style: scroll in both directions #define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) // values for the second argument of wxScrollHelper::ShowScrollbars() enum wxScrollbarVisibility { wxSHOW_SB_NEVER = -1, // never show the scrollbar at all wxSHOW_SB_DEFAULT, // show scrollbar only if it is needed wxSHOW_SB_ALWAYS // always show scrollbar, even if not needed }; // ---------------------------------------------------------------------------- // The hierarchy of scrolling classes is a bit complicated because we want to // put as much functionality as possible in a mix-in class not deriving from // wxWindow so that other classes could derive from the same base class on all // platforms irrespectively of whether they are native controls (and hence // don't use our scrolling) or not. // // So we have // // wxAnyScrollHelperBase // | // | // \|/ // wxScrollHelperBase // | // | // \|/ // wxWindow wxScrollHelper // | \ / / // | \ / / // | _| |_ / // | wxScrolledWindow / // | / // \|/ / // wxControl / // \ / // \ / // _| |_ // wxScrolledControl // // ---------------------------------------------------------------------------- // This class allows reusing some of wxScrollHelperBase functionality in // wxVarScrollHelperBase in wx/vscroll.h without duplicating its code. class WXDLLIMPEXP_CORE wxAnyScrollHelperBase { public: explicit wxAnyScrollHelperBase(wxWindow* win); virtual ~wxAnyScrollHelperBase() {} // Disable use of keyboard keys for scrolling. By default cursor movement // keys (including Home, End, Page Up and Down) are used to scroll the // window appropriately. If the derived class uses these keys for something // else, e.g. changing the currently selected item, this function can be // used to disable this behaviour as it's not only not necessary then but // can actually be actively harmful if another object forwards a keyboard // event corresponding to one of the above keys to us using // ProcessWindowEvent() because the event will always be processed which // can be undesirable. void DisableKeyboardScrolling() { m_kbdScrollingEnabled = false; } // Override this function to draw the graphic (or just process EVT_PAINT) virtual void OnDraw(wxDC& WXUNUSED(dc)) { } // change the DC origin according to the scroll position. virtual void DoPrepareDC(wxDC& dc) = 0; // Simple accessor for the window that is really being scrolled. wxWindow *GetTargetWindow() const { return m_targetWindow; } // The methods called from the window event handlers. void HandleOnChar(wxKeyEvent& event); void HandleOnPaint(wxPaintEvent& event); protected: // the window that receives the scroll events and the window to actually // scroll, respectively wxWindow *m_win, *m_targetWindow; // whether cursor keys should scroll the window bool m_kbdScrollingEnabled; }; // This is the class containing the guts of (uniform) scrolling logic. class WXDLLIMPEXP_CORE wxScrollHelperBase : public wxAnyScrollHelperBase { public: // ctor must be given the associated window wxScrollHelperBase(wxWindow *winToScroll); virtual ~wxScrollHelperBase(); // configure the scrolling virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos = 0, int yPos = 0, bool noRefresh = false ); // scroll to the given (in logical coords) position // // notice that for backwards compatibility reasons Scroll() is virtual as // the existing code could override it but new code should override // DoScroll() instead virtual void Scroll(int x, int y) { DoScroll(x, y); } virtual void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); } // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) int GetScrollPageSize(int orient) const; void SetScrollPageSize(int orient, int pageSize); // get the number of lines the window can scroll, // returns 0 if no scrollbars are there. int GetScrollLines( int orient ) const; // Set the x, y scrolling increments. void SetScrollRate( int xstep, int ystep ); // get the size of one logical unit in physical ones void GetScrollPixelsPerUnit(int *pixelsPerUnitX, int *pixelsPerUnitY) const; // Set scrollbar visibility: it is possible to show scrollbar only if it is // needed (i.e. if our virtual size is greater than the current size of the // associated window), always (as wxALWAYS_SHOW_SB style does) or never (in // which case you should provide some other way to scroll the window as the // user wouldn't be able to do it at all) void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert) { DoShowScrollbars(horz, vert); } // Test whether the specified scrollbar is shown. virtual bool IsScrollbarShown(int orient) const = 0; // Enable/disable Windows scrolling in either direction. If true, wxWidgets // scrolls the canvas and only a bit of the canvas is invalidated; no // Clear() is necessary. If false, the whole canvas is invalidated and a // Clear() is necessary. Disable for when the scroll increment is used to // actually scroll a non-constant distance // // Notice that calling this method with a false argument doesn't disable // scrolling the window in this direction, it just changes the mechanism by // which it is implemented to not use wxWindow::ScrollWindow(). virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); // Get the view start void GetViewStart(int *x, int *y) const { DoGetViewStart(x, y); } wxPoint GetViewStart() const { wxPoint pt; DoGetViewStart(&pt.x, &pt.y); return pt; } // Set the scale factor, used in PrepareDC void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } double GetScaleX() const { return m_scaleX; } double GetScaleY() const { return m_scaleY; } // translate between scrolled and unscrolled coordinates void CalcScrolledPosition(int x, int y, int *xx, int *yy) const { DoCalcScrolledPosition(x, y, xx, yy); } wxPoint CalcScrolledPosition(const wxPoint& pt) const { wxPoint p2; DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y); return p2; } void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const { DoCalcUnscrolledPosition(x, y, xx, yy); } wxPoint CalcUnscrolledPosition(const wxPoint& pt) const { wxPoint p2; DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y); return p2; } void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; // Adjust the scrollbars virtual void AdjustScrollbars() = 0; // Calculate scroll increment int CalcScrollInc(wxScrollWinEvent& event); // Normally the wxScrolledWindow will scroll itself, but in some rare // occasions you might want it to scroll [part of] another window (e.g. a // child of it in order to scroll only a portion the area between the // scrollbars (spreadsheet: only cell area will move). void SetTargetWindow(wxWindow *target); void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } wxRect GetTargetRect() const { return m_rectToScroll; } virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; // are we generating the autoscroll events? bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } // stop generating the scroll events when mouse is held outside the window void StopAutoScrolling(); // this method can be overridden in a derived class to forbid sending the // auto scroll events - note that unlike StopAutoScrolling() it doesn't // stop the timer, so it will be called repeatedly and will typically // return different values depending on the current mouse position // // the base class version just returns true virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; // the methods to be called from the window event handlers void HandleOnScroll(wxScrollWinEvent& event); void HandleOnSize(wxSizeEvent& event); void HandleOnMouseEnter(wxMouseEvent& event); void HandleOnMouseLeave(wxMouseEvent& event); #if wxUSE_MOUSEWHEEL void HandleOnMouseWheel(wxMouseEvent& event); #endif // wxUSE_MOUSEWHEEL void HandleOnChildFocus(wxChildFocusEvent& event); #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED( void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } ) #endif // WXWIN_COMPATIBILITY_2_8 protected: // get pointer to our scroll rect if we use it or NULL const wxRect *GetScrollRect() const { return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; } // get the size of the target window wxSize GetTargetSize() const { return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize() : m_targetWindow->GetClientSize(); } void GetTargetSize(int *w, int *h) const { wxSize size = GetTargetSize(); if ( w ) *w = size.x; if ( h ) *h = size.y; } // implementation of public methods with the same name virtual void DoGetViewStart(int *x, int *y) const; virtual void DoScroll(int x, int y) = 0; virtual void DoShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert) = 0; // implementations of various wxWindow virtual methods which should be // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) bool ScrollLayout(); void ScrollDoSetVirtualSize(int x, int y); wxSize ScrollGetBestVirtualSize() const; // change just the target window (unlike SetWindow which changes m_win as // well) void DoSetTargetWindow(wxWindow *target); // delete the event handler we installed void DeleteEvtHandler(); // this function should be overridden to return the size available for // m_targetWindow inside m_win of the given size // // the default implementation is only good for m_targetWindow == m_win // case, if we're scrolling a subwindow you must override this method virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) { // returning just size from here is wrong but it was decided that it is // not wrong enough to break the existing code (which doesn't override // this recently added function at all) by adding this assert // // wxASSERT_MSG( m_targetWindow == m_win, "must be overridden" ); return size; } double m_scaleX; double m_scaleY; wxRect m_rectToScroll; wxTimer *m_timerAutoScroll; // The number of pixels to scroll in horizontal and vertical directions // respectively. // // If 0, means that the scrolling in the given direction is disabled. int m_xScrollPixelsPerLine; int m_yScrollPixelsPerLine; int m_xScrollPosition; int m_yScrollPosition; int m_xScrollLines; int m_yScrollLines; int m_xScrollLinesPerPage; int m_yScrollLinesPerPage; bool m_xScrollingEnabled; bool m_yScrollingEnabled; #if wxUSE_MOUSEWHEEL int m_wheelRotation; #endif // wxUSE_MOUSEWHEEL wxScrollHelperEvtHandler *m_handler; wxDECLARE_NO_COPY_CLASS(wxScrollHelperBase); }; // this macro can be used in a wxScrollHelper-derived class to forward wxWindow // methods to corresponding wxScrollHelper methods #define WX_FORWARD_TO_SCROLL_HELPER() \ public: \ virtual void PrepareDC(wxDC& dc) wxOVERRIDE { DoPrepareDC(dc); } \ virtual bool Layout() wxOVERRIDE { return ScrollLayout(); } \ virtual bool CanScroll(int orient) const wxOVERRIDE \ { return IsScrollbarShown(orient); } \ virtual void DoSetVirtualSize(int x, int y) wxOVERRIDE \ { ScrollDoSetVirtualSize(x, y); } \ virtual wxSize GetBestVirtualSize() const wxOVERRIDE \ { return ScrollGetBestVirtualSize(); } // include the declaration of the real wxScrollHelper #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/scrolwin.h" #elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) #include "wx/gtk1/scrolwin.h" #else #define wxHAS_GENERIC_SCROLLWIN #include "wx/generic/scrolwin.h" #endif // ---------------------------------------------------------------------------- // wxScrolled<T>: a wxWindow which knows how to scroll // ---------------------------------------------------------------------------- // helper class for wxScrolled<T> below struct WXDLLIMPEXP_CORE wxScrolledT_Helper { static wxSize FilterBestSize(const wxWindow *win, const wxScrollHelper *helper, const wxSize& origBest); #ifdef __WXMSW__ static WXLRESULT FilterMSWWindowProc(WXUINT nMsg, WXLRESULT origResult); #endif }; // Scrollable window base on window type T. This used to be wxScrolledWindow, // but wxScrolledWindow includes wxControlContainer functionality and that's // not always desirable. template<class T> class wxScrolled : public T, public wxScrollHelper, private wxScrolledT_Helper { public: wxScrolled() : wxScrollHelper(this) { } wxScrolled(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxScrolledWindowStyle, const wxString& name = wxPanelNameStr) : wxScrollHelper(this) { Create(parent, winid, pos, size, style, name); } bool Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxScrolledWindowStyle, const wxString& name = wxPanelNameStr) { m_targetWindow = this; #ifdef __WXMAC__ this->MacSetClipChildren(true); #endif // by default, we're scrollable in both directions (but if one of the // styles is specified explicitly, we shouldn't add the other one // automatically) if ( !(style & (wxHSCROLL | wxVSCROLL)) ) style |= wxHSCROLL | wxVSCROLL; return T::Create(parent, winid, pos, size, style, name); } #ifdef __WXMSW__ // we need to return a special WM_GETDLGCODE value to process just the // arrows but let the other navigation characters through virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE { return FilterMSWWindowProc(nMsg, T::MSWWindowProc(nMsg, wParam, lParam)); } // Take into account the scroll origin. virtual void MSWAdjustBrushOrg(int* xOrg, int* yOrg) const wxOVERRIDE { CalcUnscrolledPosition(*xOrg, *yOrg, xOrg, yOrg); } #endif // __WXMSW__ WX_FORWARD_TO_SCROLL_HELPER() protected: virtual wxSize DoGetBestSize() const wxOVERRIDE { return FilterBestSize(this, this, T::DoGetBestSize()); } private: wxDECLARE_NO_COPY_CLASS(wxScrolled); }; // for compatibility with existing code, we provide wxScrolledWindow // "typedef" for wxScrolled<wxPanel>. It's not a real typedef because we // want wxScrolledWindow to show in wxRTTI information (the class is widely // used and likelihood of its wxRTTI information being used too is high): class WXDLLIMPEXP_CORE wxScrolledWindow : public wxScrolled<wxPanel> { public: wxScrolledWindow() : wxScrolled<wxPanel>() {} wxScrolledWindow(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxScrolledWindowStyle, const wxString& name = wxPanelNameStr) : wxScrolled<wxPanel>(parent, winid, pos, size, style, name) {} wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow); }; typedef wxScrolled<wxWindow> wxScrolledCanvas; #endif // _WX_SCROLWIN_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dcscreen.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/dcscreen.h // Purpose: wxScreenDC base header // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DCSCREEN_H_BASE_ #define _WX_DCSCREEN_H_BASE_ #include "wx/defs.h" #include "wx/dc.h" class WXDLLIMPEXP_CORE wxScreenDC : public wxDC { public: wxScreenDC(); static bool StartDrawingOnTop(wxWindow * WXUNUSED(window)) { return true; } static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL) { return true; } static bool EndDrawingOnTop() { return true; } private: wxDECLARE_DYNAMIC_CLASS(wxScreenDC); }; #endif // _WX_DCSCREEN_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/rawbmp.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/rawbmp.h // Purpose: macros for fast, raw bitmap data access // Author: Eric Kidd, Vadim Zeitlin // Modified by: // Created: 10.03.03 // Copyright: (c) 2002 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_RAWBMP_H_ #define _WX_RAWBMP_H_ #include "wx/defs.h" #ifdef wxHAS_RAW_BITMAP #include "wx/image.h" #include "wx/bitmap.h" // ---------------------------------------------------------------------------- // Abstract Pixel API // // We need to access our raw bitmap data (1) portably and (2) efficiently. // We do this using a two-dimensional "iteration" interface. Performance // is extremely important here: these functions will be called hundreds // of thousands of times in a row, and even small inefficiencies will // make applications seem slow. // // We can't always rely on inline functions, because not all compilers actually // bother to inline them unless we crank the optimization levels way up. // Therefore, we also provide macros to wring maximum speed out of compiler // unconditionally (e.g. even in debug builds). Of course, if the performance // isn't absolutely crucial for you you shouldn't be using them but the inline // functions instead. // ---------------------------------------------------------------------------- /* Usage example: typedef wxPixelData<wxBitmap, wxNativePixelFormat> PixelData; wxBitmap bmp; PixelData data(bmp); if ( !data ) { ... raw access to bitmap data unavailable, do something else ... return; } if ( data.GetWidth() < 20 || data.GetHeight() < 20 ) { ... complain: the bitmap it too small ... return; } PixelData::Iterator p(data); // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b p.Offset(data, 10, 10); for ( int y = 0; y < 10; ++y ) { PixelData::Iterator rowStart = p; for ( int x = 0; x < 10; ++x, ++p ) { p.Red() = r; p.Green() = g; p.Blue() = b; } p = rowStart; p.OffsetY(data, 1); } */ /* Note: we do not use WXDLLIMPEXP_CORE with classes in this file because VC++ has problems with exporting inner class defined inside a specialization of a template class from a DLL. Besides, as all the methods are inline it's not really necessary to put them in DLL at all. */ // ---------------------------------------------------------------------------- // wxPixelFormat // ---------------------------------------------------------------------------- /* wxPixelFormat is a template class describing the bitmap data format. It contains the constants describing the format of pixel data, but does not describe how the entire bitmap is stored (i.e. top-to-bottom, bottom-to-top, ...). It is also a "traits"-like class, i.e. it only contains some constants and maybe static methods but nothing more, so it can be safely used without incurring any overhead as all accesses to it are done at compile-time. Current limitations: we don't support RAGABA and ARAGAB formats supported by Mac OS X. If there is sufficient interest, these classes could be extended to deal with them. Neither do we support alpha channel having different representation from the RGB ones (happens under QNX/Photon I think), but again this could be achieved with some small extra effort. Template parameters are: - type of a single pixel component - size of the single pixel in bits - indices of red, green and blue pixel components inside the pixel - index of the alpha component or -1 if none - type which can contain the full pixel value (all channels) */ template <class Channel, size_t Bpp, int R, int G, int B, int A = -1, class Pixel = wxUint32> struct wxPixelFormat { // iterator over pixels is usually of type "ChannelType *" typedef Channel ChannelType; // the type which may hold the entire pixel value typedef Pixel PixelType; // size of one pixel in bits static const int BitsPerPixel = Bpp; // size of one pixel in ChannelType units (usually bytes) static const int SizePixel = Bpp / (8 * sizeof(Channel)); // the channels indices inside the pixel enum { RED = R, GREEN = G, BLUE = B, ALPHA = A }; // true if we have an alpha channel (together with the other channels, this // doesn't cover the case of wxImage which stores alpha separately) enum { HasAlpha = A != -1 }; }; // some "predefined" pixel formats // ------------------------------- // wxImage format is common to all platforms typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat; // the (most common) native bitmap format without alpha support #if defined(__WXMSW__) // under MSW the RGB components are reversed, they're in BGR order typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat; #define wxPIXEL_FORMAT_ALPHA 3 #elif defined(__WXMAC__) // under Mac, first component is unused but still present, hence we use // 32bpp, not 24 typedef wxPixelFormat<unsigned char, 32, 1, 2, 3> wxNativePixelFormat; #define wxPIXEL_FORMAT_ALPHA 0 #elif defined(__WXGTK__) // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; #define wxPIXEL_FORMAT_ALPHA 3 #elif defined(__WXDFB__) // Under DirectFB, RGB components are reversed, they're in BGR order typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat; #define wxPIXEL_FORMAT_ALPHA 3 #elif defined(__WXQT__) typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; #define wxPIXEL_FORMAT_ALPHA 3 #endif // the (most common) native format for bitmaps with alpha channel #ifdef wxPIXEL_FORMAT_ALPHA typedef wxPixelFormat<unsigned char, 32, wxNativePixelFormat::RED, wxNativePixelFormat::GREEN, wxNativePixelFormat::BLUE, wxPIXEL_FORMAT_ALPHA> wxAlphaPixelFormat; #endif // wxPIXEL_FORMAT_ALPHA // we also define the (default/best) pixel format for the given class: this is // used as default value for the pixel format in wxPixelIterator template template <class T> struct wxPixelFormatFor; #if wxUSE_IMAGE // wxPixelFormatFor is only defined for wxImage, attempt to use it with other // classes (wxBitmap...) will result in compile errors which is exactly what we // want template <> struct wxPixelFormatFor<wxImage> { typedef wxImagePixelFormat Format; }; #endif //wxUSE_IMAGE // ---------------------------------------------------------------------------- // wxPixelData // ---------------------------------------------------------------------------- /* wxPixelDataBase is just a helper for wxPixelData: it contains things common to both wxImage and wxBitmap specializations. */ class wxPixelDataBase { public: // origin of the rectangular region we represent wxPoint GetOrigin() const { return m_ptOrigin; } // width and height of the region we represent int GetWidth() const { return m_width; } int GetHeight() const { return m_height; } wxSize GetSize() const { return wxSize(m_width, m_height); } // the distance between two rows int GetRowStride() const { return m_stride; } // private: -- see comment in the beginning of the file // the origin of this image inside the bigger bitmap (usually (0, 0)) wxPoint m_ptOrigin; // the size of the image we address, in pixels int m_width, m_height; // this parameter is the offset of the start of the (N+1)st row from the // Nth one and can be different from m_bypp*width in some cases: // a) the most usual one is to force 32/64 bit alignment of rows // b) another one is for bottom-to-top images where it's negative // c) finally, it could conceivably be 0 for the images with all // lines being identical int m_stride; protected: // ctor is protected because this class is only meant to be used as the // base class by wxPixelData wxPixelDataBase() { m_width = m_height = m_stride = 0; } }; /* wxPixelData represents the entire bitmap data, i.e. unlike wxPixelFormat (which it uses) it also stores the global bitmap characteristics such as its size, inter-row separation and so on. Because of this it can be used to move the pixel iterators (which don't have enough information about the bitmap themselves). This may seem a bit unnatural but must be done in this way to keep the iterator objects as small as possible for maximum efficiency as otherwise they wouldn't be put into the CPU registers by the compiler any more. Implementation note: we use the standard workaround for lack of partial template specialization support in VC7: instead of partly specializing the class Foo<T, U> for some T we introduce FooOut<T> and FooIn<U> nested in it, make Foo<T, U> equivalent to FooOut<T>::FooIn<U> and fully specialize FooOut (FIXME-VC7). Also note that this class doesn't have any default definition because we can't really do anything without knowing the exact image class. We do provide wxPixelDataBase to make it simpler to write new wxPixelData specializations. */ // we need to define this skeleton template to mollify VC++ template <class Image> struct wxPixelDataOut { template <class PixelFormat> class wxPixelDataIn { public: class Iterator { }; }; }; #if wxUSE_IMAGE // wxPixelData specialization for wxImage: this is the simplest case as we // don't have to care about different pixel formats here template <> struct wxPixelDataOut<wxImage> { // NB: this is a template class even though it doesn't use its template // parameter because otherwise wxPixelData couldn't compile template <class dummyPixelFormat> class wxPixelDataIn : public wxPixelDataBase { public: // the type of the class we're working with typedef wxImage ImageType; // the iterator which should be used for working with data in this // format class Iterator { public: // the pixel format we use typedef wxImagePixelFormat PixelFormat; // the pixel data we're working with typedef wxPixelDataOut<wxImage>::wxPixelDataIn<PixelFormat> PixelData; // go back to (0, 0) void Reset(const PixelData& data) { *this = data.GetPixels(); } // creates the iterator pointing to the beginning of data Iterator(PixelData& data) { Reset(data); } // creates the iterator initially pointing to the image origin Iterator(const wxImage& image) { m_pRGB = image.GetData(); if ( image.HasAlpha() ) { m_pAlpha = image.GetAlpha(); } else // alpha is not used at all { m_pAlpha = NULL; } } // true if the iterator is valid bool IsOk() const { return m_pRGB != NULL; } // navigation // ---------- // advance the iterator to the next pixel, prefix version Iterator& operator++() { m_pRGB += PixelFormat::SizePixel; if ( m_pAlpha ) ++m_pAlpha; return *this; } // postfix (hence less efficient -- don't use it unless you // absolutely must) version Iterator operator++(int) { Iterator p(*this); ++*this; return p; } // move x pixels to the right and y down // // note that the rows don't wrap! void Offset(const PixelData& data, int x, int y) { m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; if ( m_pAlpha ) m_pAlpha += data.GetWidth()*y + x; } // move x pixels to the right (again, no row wrapping) void OffsetX(const PixelData& WXUNUSED(data), int x) { m_pRGB += PixelFormat::SizePixel*x; if ( m_pAlpha ) m_pAlpha += x; } // move y rows to the bottom void OffsetY(const PixelData& data, int y) { m_pRGB += data.GetRowStride()*y; if ( m_pAlpha ) m_pAlpha += data.GetWidth()*y; } // go to the given position void MoveTo(const PixelData& data, int x, int y) { Reset(data); Offset(data, x, y); } // data access // ----------- // access to individual colour components PixelFormat::ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } PixelFormat::ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } PixelFormat::ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } PixelFormat::ChannelType& Alpha() { return *m_pAlpha; } // address the pixel contents directly (always RGB, without alpha) // // this can't be used to modify the image as assigning a 32bpp // value to 24bpp pixel would overwrite an extra byte in the next // pixel or beyond the end of image const typename PixelFormat::PixelType& Data() { return *(typename PixelFormat::PixelType *)m_pRGB; } // private: -- see comment in the beginning of the file // pointer into RGB buffer unsigned char *m_pRGB; // pointer into alpha buffer or NULL if alpha isn't used unsigned char *m_pAlpha; }; // initializes us with the data of the given image wxPixelDataIn(ImageType& image) : m_image(image), m_pixels(image) { m_width = image.GetWidth(); m_height = image.GetHeight(); m_stride = Iterator::PixelFormat::SizePixel * m_width; } // initializes us with the given region of the specified image wxPixelDataIn(ImageType& image, const wxPoint& pt, const wxSize& sz) : m_image(image), m_pixels(image) { m_stride = Iterator::PixelFormat::SizePixel * m_width; InitRect(pt, sz); } // initializes us with the given region of the specified image wxPixelDataIn(ImageType& image, const wxRect& rect) : m_image(image), m_pixels(image) { m_stride = Iterator::PixelFormat::SizePixel * m_width; InitRect(rect.GetPosition(), rect.GetSize()); } // we evaluate to true only if we could get access to bitmap data // successfully operator bool() const { return m_pixels.IsOk(); } // get the iterator pointing to the origin Iterator GetPixels() const { return m_pixels; } private: void InitRect(const wxPoint& pt, const wxSize& sz) { m_width = sz.x; m_height = sz.y; m_ptOrigin = pt; m_pixels.Offset(*this, pt.x, pt.y); } // the image we're working with ImageType& m_image; // the iterator pointing to the image origin Iterator m_pixels; }; }; #endif //wxUSE_IMAGE #if wxUSE_GUI // wxPixelData specialization for wxBitmap: here things are more interesting as // we also have to support different pixel formats template <> struct wxPixelDataOut<wxBitmap> { template <class Format> class wxPixelDataIn : public wxPixelDataBase { public: // the type of the class we're working with typedef wxBitmap ImageType; class Iterator { public: // the pixel format we use typedef Format PixelFormat; // the type of the pixel components typedef typename PixelFormat::ChannelType ChannelType; // the pixel data we're working with typedef wxPixelDataOut<wxBitmap>::wxPixelDataIn<Format> PixelData; // go back to (0, 0) void Reset(const PixelData& data) { *this = data.GetPixels(); } // initializes the iterator to point to the origin of the given // pixel data Iterator(PixelData& data) { Reset(data); } // initializes the iterator to point to the origin of the given // bitmap Iterator(wxBitmap& bmp, PixelData& data) { // using cast here is ugly but it should be safe as // GetRawData() real return type should be consistent with // BitsPerPixel (which is in turn defined by ChannelType) and // this is the only thing we can do without making GetRawData() // a template function which is undesirable m_ptr = (ChannelType *) bmp.GetRawData(data, PixelFormat::BitsPerPixel); } // default constructor Iterator() { m_ptr = NULL; } // return true if this iterator is valid bool IsOk() const { return m_ptr != NULL; } // navigation // ---------- // advance the iterator to the next pixel, prefix version Iterator& operator++() { m_ptr += PixelFormat::SizePixel; return *this; } // postfix (hence less efficient -- don't use it unless you // absolutely must) version Iterator operator++(int) { Iterator p(*this); ++*this; return p; } // move x pixels to the right and y down // // note that the rows don't wrap! void Offset(const PixelData& data, int x, int y) { m_ptr += data.GetRowStride()*y + PixelFormat::SizePixel*x; } // move x pixels to the right (again, no row wrapping) void OffsetX(const PixelData& WXUNUSED(data), int x) { m_ptr += PixelFormat::SizePixel*x; } // move y rows to the bottom void OffsetY(const PixelData& data, int y) { m_ptr += data.GetRowStride()*y; } // go to the given position void MoveTo(const PixelData& data, int x, int y) { Reset(data); Offset(data, x, y); } // data access // ----------- // access to individual colour components ChannelType& Red() { return m_ptr[PixelFormat::RED]; } ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } ChannelType& Alpha() { return m_ptr[PixelFormat::ALPHA]; } // address the pixel contents directly // // warning: the format is platform dependent // // warning 2: assigning to Data() only works correctly for 16bpp or // 32bpp formats but using it for 24bpp ones overwrites // one extra byte and so can't be done typename PixelFormat::PixelType& Data() { return *(typename PixelFormat::PixelType *)m_ptr; } // private: -- see comment in the beginning of the file // for efficiency reasons this class should not have any other // fields, otherwise it won't be put into a CPU register (as it // should inside the inner loops) by some compilers, notably gcc ChannelType *m_ptr; }; // ctor associates this pointer with a bitmap and locks the bitmap for // raw access, it will be unlocked only by our dtor and so these // objects should normally be only created on the stack, i.e. have // limited life-time wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this) { } wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) : m_bmp(bmp), m_pixels(bmp, *this) { InitRect(rect.GetPosition(), rect.GetSize()); } wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz) : m_bmp(bmp), m_pixels(bmp, *this) { InitRect(pt, sz); } // we evaluate to true only if we could get access to bitmap data // successfully operator bool() const { return m_pixels.IsOk(); } // get the iterator pointing to the origin Iterator GetPixels() const { return m_pixels; } // dtor unlocks the bitmap ~wxPixelDataIn() { if ( m_pixels.IsOk() ) { #if defined(__WXMSW__) || defined(__WXMAC__) // this is a hack to mark wxBitmap as using alpha channel if ( Format::HasAlpha ) m_bmp.UseAlpha(); #endif m_bmp.UngetRawData(*this); } // else: don't call UngetRawData() if GetRawData() failed } #if WXWIN_COMPATIBILITY_2_8 // not needed anymore, calls to it should be simply removed wxDEPRECATED_INLINE( void UseAlpha(), wxEMPTY_PARAMETER_VALUE ) #endif // private: -- see comment in the beginning of the file // the bitmap we're associated with wxBitmap m_bmp; // the iterator pointing to the image origin Iterator m_pixels; private: void InitRect(const wxPoint& pt, const wxSize& sz) { m_pixels.Offset(*this, pt.x, pt.y); m_ptOrigin = pt; m_width = sz.x; m_height = sz.y; } }; }; #endif //wxUSE_GUI template <class Image, class PixelFormat = typename wxPixelFormatFor<Image>::Format > class wxPixelData : public wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> { public: typedef typename wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> Base; wxPixelData(Image& image) : Base(image) { } wxPixelData(Image& i, const wxRect& rect) : Base(i, rect) { } wxPixelData(Image& i, const wxPoint& pt, const wxSize& sz) : Base(i, pt, sz) { } }; // some "predefined" pixel data classes #if wxUSE_IMAGE typedef wxPixelData<wxImage> wxImagePixelData; #endif //wxUSE_IMAGE #if wxUSE_GUI typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData; typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData; #endif //wxUSE_GUI // ---------------------------------------------------------------------------- // wxPixelIterator // ---------------------------------------------------------------------------- /* wxPixel::Iterator represents something which points to the pixel data and allows us to iterate over it. In the simplest case of wxBitmap it is, indeed, just a pointer, but it can be something more complicated and, moreover, you are free to specialize it for other image classes and bitmap formats. Note that although it would have been much more intuitive to have a real class here instead of what we have now, this class would need two template parameters, and this can't be done because we'd need compiler support for partial template specialization then and VC7 doesn't provide it. */ template < class Image, class PixelFormat = wxPixelFormatFor<Image> > struct wxPixelIterator : public wxPixelData<Image, PixelFormat>::Iterator { }; #endif // wxHAS_RAW_BITMAP #endif // _WX_RAWBMP_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/imagiff.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/imagiff.h // Purpose: wxImage handler for Amiga IFF images // Author: Steffen Gutmann // Copyright: (c) Steffen Gutmann, 2002 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_IMAGE_IFF_H_ #define _WX_IMAGE_IFF_H_ #include "wx/image.h" //----------------------------------------------------------------------------- // wxIFFHandler //----------------------------------------------------------------------------- #if wxUSE_IMAGE && wxUSE_IFF class WXDLLIMPEXP_CORE wxIFFHandler : public wxImageHandler { public: wxIFFHandler() { m_name = wxT("IFF file"); m_extension = wxT("iff"); m_type = wxBITMAP_TYPE_IFF; m_mime = wxT("image/x-iff"); } #if wxUSE_STREAMS virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1) wxOVERRIDE; virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true) wxOVERRIDE; protected: virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; #endif wxDECLARE_DYNAMIC_CLASS(wxIFFHandler); }; #endif // wxUSE_IMAGE && wxUSE_IFF #endif // _WX_IMAGE_IFF_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/splitter.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/splitter.h // Purpose: Base header for wxSplitterWindow // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SPLITTER_H_BASE_ #define _WX_SPLITTER_H_BASE_ #include "wx/event.h" // ---------------------------------------------------------------------------- // wxSplitterWindow flags // ---------------------------------------------------------------------------- #define wxSP_NOBORDER 0x0000 #define wxSP_THIN_SASH 0x0000 // NB: the default is 3D sash #define wxSP_NOSASH 0x0010 #define wxSP_PERMIT_UNSPLIT 0x0040 #define wxSP_LIVE_UPDATE 0x0080 #define wxSP_3DSASH 0x0100 #define wxSP_3DBORDER 0x0200 #define wxSP_NO_XP_THEME 0x0400 #define wxSP_BORDER wxSP_3DBORDER #define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_DOUBLECLICKED, wxSplitterEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_UNSPLIT, wxSplitterEvent ); #include "wx/generic/splitter.h" #endif // _WX_SPLITTER_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/mousestate.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/mousestate.h // Purpose: Declaration of wxMouseState class // Author: Vadim Zeitlin // Created: 2008-09-19 (extracted from wx/utils.h) // Copyright: (c) 2008 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_MOUSESTATE_H_ #define _WX_MOUSESTATE_H_ #include "wx/gdicmn.h" // for wxPoint #include "wx/kbdstate.h" // the symbolic names for the mouse buttons enum wxMouseButton { wxMOUSE_BTN_ANY = -1, wxMOUSE_BTN_NONE = 0, wxMOUSE_BTN_LEFT = 1, wxMOUSE_BTN_MIDDLE = 2, wxMOUSE_BTN_RIGHT = 3, wxMOUSE_BTN_AUX1 = 4, wxMOUSE_BTN_AUX2 = 5, wxMOUSE_BTN_MAX }; // ---------------------------------------------------------------------------- // wxMouseState contains the information about mouse position, buttons and also // key modifiers // ---------------------------------------------------------------------------- // wxMouseState is used to hold information about button and modifier state // and is what is returned from wxGetMouseState. class WXDLLIMPEXP_CORE wxMouseState : public wxKeyboardState { public: wxMouseState() : m_leftDown(false), m_middleDown(false), m_rightDown(false), m_aux1Down(false), m_aux2Down(false), m_x(0), m_y(0) { } // default copy ctor, assignment operator and dtor are ok // accessors for the mouse position wxCoord GetX() const { return m_x; } wxCoord GetY() const { return m_y; } wxPoint GetPosition() const { return wxPoint(m_x, m_y); } void GetPosition(wxCoord *x, wxCoord *y) const { if ( x ) *x = m_x; if ( y ) *y = m_y; } // this overload is for compatibility only void GetPosition(long *x, long *y) const { if ( x ) *x = m_x; if ( y ) *y = m_y; } // accessors for the pressed buttons bool LeftIsDown() const { return m_leftDown; } bool MiddleIsDown() const { return m_middleDown; } bool RightIsDown() const { return m_rightDown; } bool Aux1IsDown() const { return m_aux1Down; } bool Aux2IsDown() const { return m_aux2Down; } bool ButtonIsDown(wxMouseButton but) const { switch ( but ) { case wxMOUSE_BTN_ANY: return LeftIsDown() || MiddleIsDown() || RightIsDown() || Aux1IsDown() || Aux2IsDown(); case wxMOUSE_BTN_LEFT: return LeftIsDown(); case wxMOUSE_BTN_MIDDLE: return MiddleIsDown(); case wxMOUSE_BTN_RIGHT: return RightIsDown(); case wxMOUSE_BTN_AUX1: return Aux1IsDown(); case wxMOUSE_BTN_AUX2: return Aux2IsDown(); case wxMOUSE_BTN_NONE: case wxMOUSE_BTN_MAX: break; } wxFAIL_MSG(wxS("invalid parameter")); return false; } // these functions are mostly used by wxWidgets itself void SetX(wxCoord x) { m_x = x; } void SetY(wxCoord y) { m_y = y; } void SetPosition(const wxPoint& pos) { m_x = pos.x; m_y = pos.y; } void SetLeftDown(bool down) { m_leftDown = down; } void SetMiddleDown(bool down) { m_middleDown = down; } void SetRightDown(bool down) { m_rightDown = down; } void SetAux1Down(bool down) { m_aux1Down = down; } void SetAux2Down(bool down) { m_aux2Down = down; } // this mostly makes sense in the derived classes such as wxMouseEvent void SetState(const wxMouseState& state) { *this = state; } // these functions are for compatibility only, they were used in 2.8 // version of wxMouseState but their names are confusing as wxMouseEvent // has methods with the same names which do something quite different so // don't use them any more #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_INLINE(bool LeftDown() const, return LeftIsDown(); ) wxDEPRECATED_INLINE(bool MiddleDown() const, return MiddleIsDown(); ) wxDEPRECATED_INLINE(bool RightDown() const, return RightIsDown(); ) #endif // WXWIN_COMPATIBILITY_2_8 // for compatibility reasons these variables are public as the code using // wxMouseEvent often uses them directly -- however they should not be // accessed directly in this class, use the accessors above instead // private: bool m_leftDown : 1; bool m_middleDown : 1; bool m_rightDown : 1; bool m_aux1Down : 1; bool m_aux2Down : 1; wxCoord m_x, m_y; }; #endif // _WX_MOUSESTATE_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/choicebk.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/choicebk.h // Purpose: wxChoicebook: wxChoice and wxNotebook combination // Author: Vadim Zeitlin // Modified by: Wlodzimierz ABX Skiba from wx/listbook.h // Created: 15.09.04 // Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_CHOICEBOOK_H_ #define _WX_CHOICEBOOK_H_ #include "wx/defs.h" #if wxUSE_CHOICEBOOK #include "wx/bookctrl.h" #include "wx/choice.h" #include "wx/containr.h" class WXDLLIMPEXP_FWD_CORE wxChoice; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); // wxChoicebook flags #define wxCHB_DEFAULT wxBK_DEFAULT #define wxCHB_TOP wxBK_TOP #define wxCHB_BOTTOM wxBK_BOTTOM #define wxCHB_LEFT wxBK_LEFT #define wxCHB_RIGHT wxBK_RIGHT #define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK // ---------------------------------------------------------------------------- // wxChoicebook // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled<wxBookCtrlBase> { public: wxChoicebook() { } wxChoicebook(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxEmptyString) { (void)Create(parent, id, pos, size, style, name); } // quasi ctor bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxEmptyString); virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; virtual wxString GetPageText(size_t n) const wxOVERRIDE; virtual int GetPageImage(size_t n) const wxOVERRIDE; virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, int imageId = NO_IMAGE) wxOVERRIDE; virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; virtual bool DeleteAllPages() wxOVERRIDE; // returns the choice control wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } protected: virtual void DoSetWindowVariant(wxWindowVariant variant) wxOVERRIDE; virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; void UpdateSelectedPage(size_t newsel) wxOVERRIDE { GetChoiceCtrl()->Select(newsel); } wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; // event handlers void OnChoiceSelected(wxCommandEvent& event); private: wxDECLARE_EVENT_TABLE(); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook); }; // ---------------------------------------------------------------------------- // choicebook event class and related stuff // ---------------------------------------------------------------------------- // wxChoicebookEvent is obsolete and defined for compatibility only #define wxChoicebookEvent wxBookCtrlEvent typedef wxBookCtrlEventFunction wxChoicebookEventFunction; #define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func) #define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \ wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \ wx__DECLARE_EVT1(wxEVT_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED wxEVT_CHOICEBOOK_PAGE_CHANGED #define wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING wxEVT_CHOICEBOOK_PAGE_CHANGING #endif // wxUSE_CHOICEBOOK #endif // _WX_CHOICEBOOK_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/combobox.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/combobox.h // Purpose: wxComboBox declaration // Author: Vadim Zeitlin // Modified by: // Created: 24.12.00 // Copyright: (c) 1996-2000 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_COMBOBOX_H_BASE_ #define _WX_COMBOBOX_H_BASE_ #include "wx/defs.h" #if wxUSE_COMBOBOX // For compatibility with 2.8 include this header to allow using wxTE_XXX // styles with wxComboBox without explicitly including it in the user code. #include "wx/textctrl.h" extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; // ---------------------------------------------------------------------------- // wxComboBoxBase: this interface defines the methods wxComboBox must implement // ---------------------------------------------------------------------------- #include "wx/ctrlsub.h" #include "wx/textentry.h" class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer, public wxTextEntry { public: // override these methods to disambiguate between two base classes versions virtual void Clear() wxOVERRIDE { wxTextEntry::Clear(); wxItemContainer::Clear(); } // IsEmpty() is ambiguous because we inherit it from both wxItemContainer // and wxTextEntry, and even if defined it here to help the compiler with // choosing one of them, it would still be confusing for the human users of // this class. So instead define the clearly named methods below and leave // IsEmpty() ambiguous to trigger a compilation error if it's used. bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } // also bring in GetSelection() versions of both base classes in scope // // NB: GetSelection(from, to) could be already implemented in wxTextEntry // but still make it pure virtual because for some platforms it's not // implemented there and also because the derived class has to override // it anyhow to avoid ambiguity with the other GetSelection() virtual int GetSelection() const wxOVERRIDE = 0; virtual void GetSelection(long *from, long *to) const wxOVERRIDE = 0; virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); } virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); } // may return value different from GetSelection() when the combobox // dropdown is shown and the user selected, but not yet accepted, a value // different from the old one in it virtual int GetCurrentSelection() const { return GetSelection(); } }; // ---------------------------------------------------------------------------- // include the platform-dependent header defining the real class // ---------------------------------------------------------------------------- #if defined(__WXUNIVERSAL__) #include "wx/univ/combobox.h" #elif defined(__WXMSW__) #include "wx/msw/combobox.h" #elif defined(__WXMOTIF__) #include "wx/motif/combobox.h" #elif defined(__WXGTK20__) #include "wx/gtk/combobox.h" #elif defined(__WXGTK__) #include "wx/gtk1/combobox.h" #elif defined(__WXMAC__) #include "wx/osx/combobox.h" #elif defined(__WXQT__) #include "wx/qt/combobox.h" #endif #endif // wxUSE_COMBOBOX #endif // _WX_COMBOBOX_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/atomic.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/atomic.h // Purpose: functions to manipulate atomically integers and pointers // Author: Armel Asselin // Created: 12/13/2006 // Copyright: (c) Armel Asselin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ATOMIC_H_ #define _WX_ATOMIC_H_ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- // get the value of wxUSE_THREADS configuration flag #include "wx/defs.h" // constraints on the various functions: // - wxAtomicDec must return a zero value if the value is zero once // decremented else it must return any non-zero value (the true value is OK // but not necessary). #if wxUSE_THREADS #if defined(HAVE_GCC_ATOMIC_BUILTINS) // NB: we intentionally don't use Linux's asm/atomic.h header, because it's // an internal kernel header that doesn't always work in userspace: // http://bugs.mysql.com/bug.php?id=28456 // http://golubenco.org/blog/atomic-operations/ inline void wxAtomicInc (wxUint32 &value) { __sync_fetch_and_add(&value, 1); } inline wxUint32 wxAtomicDec (wxUint32 &value) { return __sync_sub_and_fetch(&value, 1); } #elif defined(__WINDOWS__) // include standard Windows headers #include "wx/msw/wrapwin.h" inline void wxAtomicInc (wxUint32 &value) { InterlockedIncrement ((LONG*)&value); } inline wxUint32 wxAtomicDec (wxUint32 &value) { return InterlockedDecrement ((LONG*)&value); } #elif defined(__DARWIN__) #include "libkern/OSAtomic.h" inline void wxAtomicInc (wxUint32 &value) { OSAtomicIncrement32 ((int32_t*)&value); } inline wxUint32 wxAtomicDec (wxUint32 &value) { return OSAtomicDecrement32 ((int32_t*)&value); } #elif defined (__SOLARIS__) #include <atomic.h> inline void wxAtomicInc (wxUint32 &value) { atomic_add_32 ((uint32_t*)&value, 1); } inline wxUint32 wxAtomicDec (wxUint32 &value) { return atomic_add_32_nv ((uint32_t*)&value, (uint32_t)-1); } #else // unknown platform // it will result in inclusion if the generic implementation code a bit later in this page #define wxNEEDS_GENERIC_ATOMIC_OPS #endif // unknown platform #else // else of wxUSE_THREADS // if no threads are used we can safely use simple ++/-- inline void wxAtomicInc (wxUint32 &value) { ++value; } inline wxUint32 wxAtomicDec (wxUint32 &value) { return --value; } #endif // !wxUSE_THREADS // ---------------------------------------------------------------------------- // proxies to actual implementations, but for various other types with same // behaviour // ---------------------------------------------------------------------------- #ifdef wxNEEDS_GENERIC_ATOMIC_OPS #include "wx/thread.h" // for wxCriticalSection class wxAtomicInt32 { public: wxAtomicInt32() { } // non initialized for consistency with basic int type wxAtomicInt32(wxInt32 v) : m_value(v) { } wxAtomicInt32(const wxAtomicInt32& a) : m_value(a.m_value) {} operator wxInt32() const { return m_value; } operator volatile wxInt32&() { return m_value; } wxAtomicInt32& operator=(wxInt32 v) { m_value = v; return *this; } void Inc() { wxCriticalSectionLocker lock(m_locker); ++m_value; } wxInt32 Dec() { wxCriticalSectionLocker lock(m_locker); return --m_value; } private: volatile wxInt32 m_value; wxCriticalSection m_locker; }; inline void wxAtomicInc(wxAtomicInt32 &value) { value.Inc(); } inline wxInt32 wxAtomicDec(wxAtomicInt32 &value) { return value.Dec(); } #else // !wxNEEDS_GENERIC_ATOMIC_OPS #define wxHAS_ATOMIC_OPS inline void wxAtomicInc(wxInt32 &value) { wxAtomicInc((wxUint32&)value); } inline wxInt32 wxAtomicDec(wxInt32 &value) { return wxAtomicDec((wxUint32&)value); } typedef wxInt32 wxAtomicInt32; #endif // wxNEEDS_GENERIC_ATOMIC_OPS // all the native implementations use 32 bits currently // for a 64 bits implementation we could use (a future) wxAtomicInt64 as // default type typedef wxAtomicInt32 wxAtomicInt; #endif // _WX_ATOMIC_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/filename.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/filename.h // Purpose: wxFileName - encapsulates a file path // Author: Robert Roebling, Vadim Zeitlin // Modified by: // Created: 28.12.00 // Copyright: (c) 2000 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FILENAME_H_ #define _WX_FILENAME_H_ #include "wx/arrstr.h" #include "wx/filefn.h" #include "wx/datetime.h" #include "wx/intl.h" #include "wx/longlong.h" #include "wx/file.h" #if wxUSE_FILE class WXDLLIMPEXP_FWD_BASE wxFile; #endif #if wxUSE_FFILE class WXDLLIMPEXP_FWD_BASE wxFFile; #endif // this symbol is defined for the platforms where file systems use volumes in // paths #if defined(__WINDOWS__) #define wxHAS_FILESYSTEM_VOLUMES #endif // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // the various values for the path format: this mainly affects the path // separator but also whether or not the path has the drive part (as under // Windows) enum wxPathFormat { wxPATH_NATIVE = 0, // the path format for the current platform wxPATH_UNIX, wxPATH_BEOS = wxPATH_UNIX, wxPATH_MAC, wxPATH_DOS, wxPATH_WIN = wxPATH_DOS, wxPATH_OS2 = wxPATH_DOS, wxPATH_VMS, wxPATH_MAX // Not a valid value for specifying path format }; // different conventions that may be used with GetHumanReadableSize() enum wxSizeConvention { wxSIZE_CONV_TRADITIONAL, // 1024 bytes = 1 KB wxSIZE_CONV_IEC, // 1024 bytes = 1 KiB wxSIZE_CONV_SI // 1000 bytes = 1 KB }; // the kind of normalization to do with the file name: these values can be // or'd together to perform several operations at once enum wxPathNormalize { wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute wxPATH_NORM_LONG = 0x0020, // make the path the long form wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE }; // what exactly should GetPath() return? enum { wxPATH_NO_SEPARATOR = 0x0000, // for symmetry with wxPATH_GET_SEPARATOR wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator }; // Mkdir flags enum { wxPATH_MKDIR_FULL = 0x0001 // create directories recursively }; // Rmdir flags enum { wxPATH_RMDIR_FULL = 0x0001, // delete with subdirectories if empty wxPATH_RMDIR_RECURSIVE = 0x0002 // delete all recursively (dangerous!) }; // FileExists flags enum { wxFILE_EXISTS_REGULAR = 0x0001, // check for existence of a regular file wxFILE_EXISTS_DIR = 0x0002, // check for existence of a directory wxFILE_EXISTS_SYMLINK = 0x1004, // check for existence of a symbolic link; // also sets wxFILE_EXISTS_NO_FOLLOW as // it would never be satisfied otherwise wxFILE_EXISTS_DEVICE = 0x0008, // check for existence of a device wxFILE_EXISTS_FIFO = 0x0016, // check for existence of a FIFO wxFILE_EXISTS_SOCKET = 0x0032, // check for existence of a socket // gap for future types wxFILE_EXISTS_NO_FOLLOW = 0x1000, // don't dereference a contained symlink wxFILE_EXISTS_ANY = 0x1FFF // check for existence of anything }; #if wxUSE_LONGLONG // error code of wxFileName::GetSize() extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize; #endif // wxUSE_LONGLONG // ---------------------------------------------------------------------------- // wxFileName: encapsulates a file path // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxFileName { public: // constructors and assignment // the usual stuff wxFileName() { Clear(); } wxFileName(const wxFileName& filepath) { Assign(filepath); } // from a full filename: if it terminates with a '/', a directory path // is contructed (the name will be empty), otherwise a file name and // extension are extracted from it wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE ) { Assign( fullpath, format ); m_dontFollowLinks = false; } // from a directory name and a file name wxFileName(const wxString& path, const wxString& name, wxPathFormat format = wxPATH_NATIVE) { Assign(path, name, format); m_dontFollowLinks = false; } // from a volume, directory name, file base name and extension wxFileName(const wxString& volume, const wxString& path, const wxString& name, const wxString& ext, wxPathFormat format = wxPATH_NATIVE) { Assign(volume, path, name, ext, format); m_dontFollowLinks = false; } // from a directory name, file base name and extension wxFileName(const wxString& path, const wxString& name, const wxString& ext, wxPathFormat format = wxPATH_NATIVE) { Assign(path, name, ext, format); m_dontFollowLinks = false; } // the same for delayed initialization void Assign(const wxFileName& filepath); void Assign(const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE); void Assign(const wxString& volume, const wxString& path, const wxString& name, const wxString& ext, bool hasExt, wxPathFormat format = wxPATH_NATIVE); void Assign(const wxString& volume, const wxString& path, const wxString& name, const wxString& ext, wxPathFormat format = wxPATH_NATIVE) { Assign(volume, path, name, ext, !ext.empty(), format); } void Assign(const wxString& path, const wxString& name, wxPathFormat format = wxPATH_NATIVE); void Assign(const wxString& path, const wxString& name, const wxString& ext, wxPathFormat format = wxPATH_NATIVE); void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE); // assorted assignment operators wxFileName& operator=(const wxFileName& filename) { if (this != &filename) Assign(filename); return *this; } wxFileName& operator=(const wxString& filename) { Assign(filename); return *this; } // reset all components to default, uninitialized state void Clear(); // static pseudo constructors static wxFileName FileName(const wxString& file, wxPathFormat format = wxPATH_NATIVE); static wxFileName DirName(const wxString& dir, wxPathFormat format = wxPATH_NATIVE); // file tests // is the filename valid at all? bool IsOk() const { // we're fine if we have the path or the name or if we're a root dir return m_dirs.size() != 0 || !m_name.empty() || !m_relative || !m_ext.empty() || m_hasExt; } // does the file with this name exist? bool FileExists() const; static bool FileExists( const wxString &file ); // does the directory with this name exist? bool DirExists() const; static bool DirExists( const wxString &dir ); // does anything at all with this name (i.e. file, directory or some // other file system object such as a device, socket, ...) exist? bool Exists(int flags = wxFILE_EXISTS_ANY) const; static bool Exists(const wxString& path, int flags = wxFILE_EXISTS_ANY); // checks on most common flags for files/directories; // more platform-specific features (like e.g. Unix permissions) are not // available in wxFileName bool IsDirWritable() const { return wxIsWritable(GetPath()); } static bool IsDirWritable(const wxString &path) { return wxDirExists(path) && wxIsWritable(path); } bool IsDirReadable() const { return wxIsReadable(GetPath()); } static bool IsDirReadable(const wxString &path) { return wxDirExists(path) && wxIsReadable(path); } // NOTE: IsDirExecutable() is not present because the meaning of "executable" // directory is very platform-dependent and also not so useful bool IsFileWritable() const { return wxIsWritable(GetFullPath()); } static bool IsFileWritable(const wxString &path) { return wxFileExists(path) && wxIsWritable(path); } bool IsFileReadable() const { return wxIsReadable(GetFullPath()); } static bool IsFileReadable(const wxString &path) { return wxFileExists(path) && wxIsReadable(path); } bool IsFileExecutable() const { return wxIsExecutable(GetFullPath()); } static bool IsFileExecutable(const wxString &path) { return wxFileExists(path) && wxIsExecutable(path); } // set the file permissions to a combination of wxPosixPermissions enum // values bool SetPermissions(int permissions); // time functions #if wxUSE_DATETIME // set the file last access/mod and creation times // (any of the pointers may be NULL) bool SetTimes(const wxDateTime *dtAccess, const wxDateTime *dtMod, const wxDateTime *dtCreate) const; // set the access and modification times to the current moment bool Touch() const; // return the last access, last modification and create times // (any of the pointers may be NULL) bool GetTimes(wxDateTime *dtAccess, wxDateTime *dtMod, wxDateTime *dtCreate) const; // convenience wrapper: get just the last mod time of the file wxDateTime GetModificationTime() const { wxDateTime dtMod; (void)GetTimes(NULL, &dtMod, NULL); return dtMod; } #endif // wxUSE_DATETIME // various file/dir operations // retrieve the value of the current working directory void AssignCwd(const wxString& volume = wxEmptyString); static wxString GetCwd(const wxString& volume = wxEmptyString); // change the current working directory bool SetCwd() const; static bool SetCwd( const wxString &cwd ); // get the value of user home (Unix only mainly) void AssignHomeDir(); static wxString GetHomeDir(); // get the system temporary directory static wxString GetTempDir(); #if wxUSE_FILE || wxUSE_FFILE // get a temp file name starting with the specified prefix void AssignTempFileName(const wxString& prefix); static wxString CreateTempFileName(const wxString& prefix); #endif // wxUSE_FILE #if wxUSE_FILE // get a temp file name starting with the specified prefix and open the // file passed to us using this name for writing (atomically if // possible) void AssignTempFileName(const wxString& prefix, wxFile *fileTemp); static wxString CreateTempFileName(const wxString& prefix, wxFile *fileTemp); #endif // wxUSE_FILE #if wxUSE_FFILE // get a temp file name starting with the specified prefix and open the // file passed to us using this name for writing (atomically if // possible) void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp); static wxString CreateTempFileName(const wxString& prefix, wxFFile *fileTemp); #endif // wxUSE_FFILE // directory creation and removal. bool Mkdir(int perm = wxS_DIR_DEFAULT, int flags = 0) const; static bool Mkdir(const wxString &dir, int perm = wxS_DIR_DEFAULT, int flags = 0); bool Rmdir(int flags = 0) const; static bool Rmdir(const wxString &dir, int flags = 0); // operations on the path // normalize the path: with the default flags value, the path will be // made absolute, without any ".." and "." and all environment // variables will be expanded in it // // this may be done using another (than current) value of cwd bool Normalize(int flags = wxPATH_NORM_ALL, const wxString& cwd = wxEmptyString, wxPathFormat format = wxPATH_NATIVE); // get a path path relative to the given base directory, i.e. opposite // of Normalize // // pass an empty string to get a path relative to the working directory // // returns true if the file name was modified, false if we failed to do // anything with it (happens when the file is on a different volume, // for example) bool MakeRelativeTo(const wxString& pathBase = wxEmptyString, wxPathFormat format = wxPATH_NATIVE); // make the path absolute // // this may be done using another (than current) value of cwd bool MakeAbsolute(const wxString& cwd = wxEmptyString, wxPathFormat format = wxPATH_NATIVE) { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | wxPATH_NORM_TILDE, cwd, format); } // If the path is a symbolic link (Unix-only), indicate that all // filesystem operations on this path should be performed on the link // itself and not on the file it points to, as is the case by default. // // No effect if this is not a symbolic link. void DontFollowLink() { m_dontFollowLinks = true; } // If the path is a symbolic link (Unix-only), returns whether various // file operations should act on the link itself, or on its target. // // This does not test if the path is really a symlink or not. bool ShouldFollowLink() const { return !m_dontFollowLinks; } #if defined(__WIN32__) && wxUSE_OLE // if the path is a shortcut, return the target and optionally, // the arguments bool GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, wxString* arguments = NULL) const; #endif // if the path contains the value of the environment variable named envname // then this function replaces it with the string obtained from // wxString::Format(replacementFmtString, value_of_envname_variable) // // Example: // wxFileName fn("/usr/openwin/lib/someFile"); // fn.ReplaceEnvVariable("OPENWINHOME"); // // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile" bool ReplaceEnvVariable(const wxString& envname, const wxString& replacementFmtString = "$%s", wxPathFormat format = wxPATH_NATIVE); // replaces, if present in the path, the home directory for the given user // (see wxGetHomeDir) with a tilde bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE); // Comparison // compares with the rules of the given platforms format bool SameAs(const wxFileName& filepath, wxPathFormat format = wxPATH_NATIVE) const; // compare with another filename object bool operator==(const wxFileName& filename) const { return SameAs(filename); } bool operator!=(const wxFileName& filename) const { return !SameAs(filename); } // compare with a filename string interpreted as a native file name bool operator==(const wxString& filename) const { return SameAs(wxFileName(filename)); } bool operator!=(const wxString& filename) const { return !SameAs(wxFileName(filename)); } // are the file names of this type cases sensitive? static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); // is this filename absolute? bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; // is this filename relative? bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const { return !IsAbsolute(format); } // Returns the characters that aren't allowed in filenames // on the specified platform. static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE); // Information about path format // get the string separating the volume from the path for this format, // return an empty string if this format doesn't support the notion of // volumes at all static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); // get the string of path separators for this format static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); // get the string of path terminators, i.e. characters which terminate the // path static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); // get the canonical path separator for this format static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) { return GetPathSeparators(format)[0u]; } // is the char a path separator for this format? static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); // is this is a DOS path which beings with a windows unique volume name // ('\\?\Volume{guid}\')? static bool IsMSWUniqueVolumeNamePath(const wxString& path, wxPathFormat format = wxPATH_NATIVE); // Dir accessors size_t GetDirCount() const { return m_dirs.size(); } bool AppendDir(const wxString& dir); void PrependDir(const wxString& dir); bool InsertDir(size_t before, const wxString& dir); void RemoveDir(size_t pos); void RemoveLastDir() { RemoveDir(GetDirCount() - 1); } // Other accessors void SetExt( const wxString &ext ) { m_ext = ext; m_hasExt = !m_ext.empty(); } void ClearExt() { m_ext.clear(); m_hasExt = false; } void SetEmptyExt() { m_ext.clear(); m_hasExt = true; } wxString GetExt() const { return m_ext; } bool HasExt() const { return m_hasExt; } void SetName( const wxString &name ) { m_name = name; } wxString GetName() const { return m_name; } bool HasName() const { return !m_name.empty(); } void SetVolume( const wxString &volume ) { m_volume = volume; } wxString GetVolume() const { return m_volume; } bool HasVolume() const { return !m_volume.empty(); } // full name is the file name + extension (but without the path) void SetFullName(const wxString& fullname); wxString GetFullName() const; const wxArrayString& GetDirs() const { return m_dirs; } // flags are combination of wxPATH_GET_XXX flags wxString GetPath(int flags = wxPATH_GET_VOLUME, wxPathFormat format = wxPATH_NATIVE) const; // Replace current path with this one void SetPath( const wxString &path, wxPathFormat format = wxPATH_NATIVE ); // Construct full path with name and ext wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const; // Return the short form of the path (returns identity on non-Windows platforms) wxString GetShortPath() const; // Return the long form of the path (returns identity on non-Windows platforms) wxString GetLongPath() const; // Is this a file or directory (not necessarily an existing one) bool IsDir() const { return m_name.empty() && m_ext.empty(); } // various helpers // get the canonical path format for this platform static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE ); // split a fullpath into the volume, path, (base) name and extension // (all of the pointers can be NULL) static void SplitPath(const wxString& fullpath, wxString *volume, wxString *path, wxString *name, wxString *ext, bool *hasExt = NULL, wxPathFormat format = wxPATH_NATIVE); static void SplitPath(const wxString& fullpath, wxString *volume, wxString *path, wxString *name, wxString *ext, wxPathFormat format) { SplitPath(fullpath, volume, path, name, ext, NULL, format); } // compatibility version: volume is part of path static void SplitPath(const wxString& fullpath, wxString *path, wxString *name, wxString *ext, wxPathFormat format = wxPATH_NATIVE); // split a path into volume and pure path part static void SplitVolume(const wxString& fullpathWithVolume, wxString *volume, wxString *path, wxPathFormat format = wxPATH_NATIVE); // strip the file extension: "foo.bar" => "foo" (but ".baz" => ".baz") static wxString StripExtension(const wxString& fullpath); #ifdef wxHAS_FILESYSTEM_VOLUMES // return the string representing a file system volume, or drive static wxString GetVolumeString(char drive, int flags = wxPATH_GET_SEPARATOR); #endif // wxHAS_FILESYSTEM_VOLUMES // File size #if wxUSE_LONGLONG // returns the size of the given filename wxULongLong GetSize() const; static wxULongLong GetSize(const wxString &file); // returns the size in a human readable form wxString GetHumanReadableSize(const wxString& nullsize = wxGetTranslation("Not available"), int precision = 1, wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const; static wxString GetHumanReadableSize(const wxULongLong& sz, const wxString& nullsize = wxGetTranslation("Not available"), int precision = 1, wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL); #endif // wxUSE_LONGLONG // deprecated methods, don't use any more // -------------------------------------- wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } private: // check whether this dir is valid for Append/Prepend/InsertDir() static bool IsValidDirComponent(const wxString& dir); // the drive/volume/device specification (always empty for Unix) wxString m_volume; // the path components of the file wxArrayString m_dirs; // the file name and extension (empty for directories) wxString m_name, m_ext; // when m_dirs is empty it may mean either that we have no path at all or // that our path is '/', i.e. the root directory // // we use m_relative to distinguish between these two cases, it will be // true in the former and false in the latter // // NB: the path is not absolute just because m_relative is false, it still // needs the drive (i.e. volume) in some formats (Windows) bool m_relative; // when m_ext is empty, it may be because we don't have any extension or // because we have an empty extension // // the difference is important as file with name "foo" and without // extension has full name "foo" while with empty extension it is "foo." bool m_hasExt; // by default, symlinks are dereferenced but this flag can be set with // DontFollowLink() to change this and make different operations work on // this file path itself instead of the target of the symlink bool m_dontFollowLinks; }; #endif // _WX_FILENAME_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/anidecod.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/anidecod.h // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation // Author: Francesco Montorsi // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ANIDECOD_H #define _WX_ANIDECOD_H #include "wx/defs.h" #if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) #include "wx/stream.h" #include "wx/image.h" #include "wx/animdecod.h" #include "wx/dynarray.h" class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); // -------------------------------------------------------------------------- // wxANIDecoder class // -------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder { public: // constructor, destructor, etc. wxANIDecoder(); ~wxANIDecoder(); virtual wxSize GetFrameSize(unsigned int frame) const wxOVERRIDE; virtual wxPoint GetFramePosition(unsigned int frame) const wxOVERRIDE; virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const wxOVERRIDE; virtual long GetDelay(unsigned int frame) const wxOVERRIDE; virtual wxColour GetTransparentColour(unsigned int frame) const wxOVERRIDE; // implementation of wxAnimationDecoder's pure virtuals virtual bool Load( wxInputStream& stream ) wxOVERRIDE; bool ConvertToImage(unsigned int frame, wxImage *image) const wxOVERRIDE; wxAnimationDecoder *Clone() const wxOVERRIDE { return new wxANIDecoder; } wxAnimationType GetType() const wxOVERRIDE { return wxANIMATION_TYPE_ANI; } private: // wxAnimationDecoder pure virtual: virtual bool DoCanRead( wxInputStream& stream ) const wxOVERRIDE; // modifies current stream position (see wxAnimationDecoder::CanRead) // frames stored as wxImage(s): ANI files are meant to be used mostly for animated // cursors and thus they do not use any optimization to encode differences between // two frames: they are just a list of images to display sequentially. wxImageArray m_images; // the info about each image stored in m_images. // NB: m_info.GetCount() may differ from m_images.GetCount()! wxANIFrameInfoArray m_info; // this is the wxCURHandler used to load the ICON chunk of the ANI files static wxCURHandler sm_handler; wxDECLARE_NO_COPY_CLASS(wxANIDecoder); }; #endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) #endif // _WX_ANIDECOD_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/setup_inc.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/setup_inc.h // Purpose: setup.h settings // Author: Vadim Zeitlin // Modified by: // Created: // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ---------------------------------------------------------------------------- // global settings // ---------------------------------------------------------------------------- // define this to 0 when building wxBase library - this can also be done from // makefile/project file overriding the value here #ifndef wxUSE_GUI #define wxUSE_GUI 1 #endif // wxUSE_GUI // ---------------------------------------------------------------------------- // compatibility settings // ---------------------------------------------------------------------------- // This setting determines the compatibility with 2.8 API: set it to 0 to // flag all cases of using deprecated functions. // // Default is 1 but please try building your code with 0 as the default will // change to 0 in the next version and the deprecated functions will disappear // in the version after it completely. // // Recommended setting: 0 (please update your code) #define WXWIN_COMPATIBILITY_2_8 0 // This setting determines the compatibility with 3.0 API: set it to 0 to // flag all cases of using deprecated functions. // // Default is 1 but please try building your code with 0 as the default will // change to 0 in the next version and the deprecated functions will disappear // in the version after it completely. // // Recommended setting: 0 (please update your code) #define WXWIN_COMPATIBILITY_3_0 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of // the current font. // // Default is 0 // // Recommended setting: 0 #define wxDIALOG_UNIT_COMPATIBILITY 0 // Provide unsafe implicit conversions in wxString to "const char*" or // "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). // // Default is 1 but only for compatibility reasons, it is recommended to set // this to 0 because converting wxString to a narrow (non-Unicode) string may // fail unless a locale using UTF-8 encoding is used, which is never the case // under MSW, for example, hence such conversions can result in silent data // loss. // // Recommended setting: 0 #define wxUSE_UNSAFE_WXSTRING_CONV 1 // If set to 1, enables "reproducible builds", i.e. build output should be // exactly the same if the same build is redone again. As using __DATE__ and // __TIME__ macros clearly makes the build irreproducible, setting this option // to 1 disables their use in the library code. // // Default is 0 // // Recommended setting: 0 #define wxUSE_REPRODUCIBLE_BUILD 0 // ---------------------------------------------------------------------------- // debugging settings // ---------------------------------------------------------------------------- // wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no // need to define it here. You may do it for two reasons: either completely // disable/compile out the asserts in release version (then do it inside #ifdef // NDEBUG) or, on the contrary, enable more asserts, including the usually // disabled ones, in the debug build (then do it inside #ifndef NDEBUG) // // #ifdef NDEBUG // #define wxDEBUG_LEVEL 0 // #else // #define wxDEBUG_LEVEL 2 // #endif // wxHandleFatalExceptions() may be used to catch the program faults at run // time and, instead of terminating the program with a usual GPF message box, // call the user-defined wxApp::OnFatalException() function. If you set // wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. // // This setting is for Win32 only and can only be enabled if your compiler // supports Win32 structured exception handling (currently only VC++ does) // // Default is 1 // // Recommended setting: 1 if your compiler supports it. #define wxUSE_ON_FATAL_EXCEPTION 1 // Set this to 1 to be able to generate a human-readable (unlike // machine-readable minidump created by wxCrashReport::Generate()) stack back // trace when your program crashes using wxStackWalker // // Default is 1 if supported by the compiler. // // Recommended setting: 1, set to 0 if your programs never crash #define wxUSE_STACKWALKER 1 // Set this to 1 to compile in wxDebugReport class which allows you to create // and optionally upload to your web site a debug report consisting of back // trace of the crash (if wxUSE_STACKWALKER == 1) and other information. // // Default is 1 if supported by the compiler. // // Recommended setting: 1, it is compiled into a separate library so there // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 // Generic comment about debugging settings: they are very useful if you don't // use any other memory leak detection tools such as Purify/BoundsChecker, but // are probably redundant otherwise. Also, Visual C++ CRT has the same features // as wxWidgets memory debugging subsystem built in since version 5.0 and you // may prefer to use it instead of built in memory debugging code because it is // faster and more fool proof. // // Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG // is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) // and if __NO_VC_CRTDBG__ is not defined. // The rest of the options in this section are obsolete and not supported, // enable them at your own risk. // If 1, enables wxDebugContext, for writing error messages to file, etc. If // __WXDEBUG__ is not defined, will still use the normal memory operators. // // Default is 0 // // Recommended setting: 0 #define wxUSE_DEBUG_CONTEXT 0 // If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* // __WXDEBUG__ is also defined. // // WARNING: this code may not work with all architectures, especially if // alignment is an issue. This switch is currently ignored for mingw / cygwin // // Default is 0 // // Recommended setting: 1 if you are not using a memory debugging tool, else 0 #define wxUSE_MEMORY_TRACING 0 // In debug mode, cause new and delete to be redefined globally. // If this causes problems (e.g. link errors which is a common problem // especially if you use another library which also redefines the global new // and delete), set this to 0. // This switch is currently ignored for mingw / cygwin // // Default is 0 // // Recommended setting: 0 #define wxUSE_GLOBAL_MEMORY_OPERATORS 0 // In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If // this causes problems (e.g. link errors), set this to 0. You may need to set // this to 0 if using templates (at least for VC++). This switch is currently // ignored for MinGW/Cygwin. // // Default is 0 // // Recommended setting: 0 #define wxUSE_DEBUG_NEW_ALWAYS 0 // ---------------------------------------------------------------------------- // Unicode support // ---------------------------------------------------------------------------- // These settings are obsolete: the library is always built in Unicode mode // now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if // absolutely necessary -- updating it is strongly recommended as the ANSI mode // will disappear completely in future wxWidgets releases. #ifndef wxUSE_UNICODE #define wxUSE_UNICODE 1 #endif // wxUSE_WCHAR_T is required by wxWidgets now, don't change. #define wxUSE_WCHAR_T 1 // ---------------------------------------------------------------------------- // global features // ---------------------------------------------------------------------------- // Compile library in exception-safe mode? If set to 1, the library will try to // behave correctly in presence of exceptions (even though it still will not // use the exceptions itself) and notify the user code about any unhandled // exceptions. If set to 0, propagation of the exceptions through the library // code will lead to undefined behaviour -- but the code itself will be // slightly smaller and faster. // // Note that like wxUSE_THREADS this option is automatically set to 0 if // wxNO_EXCEPTIONS is defined. // // Default is 1 // // Recommended setting: depends on whether you intend to use C++ exceptions // in your own code (1 if you do, 0 if you don't) #define wxUSE_EXCEPTIONS 1 // Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI // // Default is 0 // // Recommended setting: 0 (this is still work in progress...) #define wxUSE_EXTENDED_RTTI 0 // Support for message/error logging. This includes wxLogXXX() functions and // wxLog and derived classes. Don't set this to 0 unless you really know what // you are doing. // // Default is 1 // // Recommended setting: 1 (always) #define wxUSE_LOG 1 // Recommended setting: 1 #define wxUSE_LOGWINDOW 1 // Recommended setting: 1 #define wxUSE_LOGGUI 1 // Recommended setting: 1 #define wxUSE_LOG_DIALOG 1 // Support for command line parsing using wxCmdLineParser class. // // Default is 1 // // Recommended setting: 1 (can be set to 0 if you don't use the cmd line) #define wxUSE_CMDLINE_PARSER 1 // Support for multithreaded applications: if 1, compile in thread classes // (thread.h) and make the library a bit more thread safe. Although thread // support is quite stable by now, you may still consider recompiling the // library without it if you have no use for it - this will result in a // somewhat smaller and faster operation. // // Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset // to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in // build/msw/config.* file this value will have no effect. // // Default is 1 // // Recommended setting: 0 unless you do plan to develop MT applications #define wxUSE_THREADS 1 // If enabled, compiles wxWidgets streams classes // // wx stream classes are used for image IO, process IO redirection, network // protocols implementation and much more and so disabling this results in a // lot of other functionality being lost. // // Default is 1 // // Recommended setting: 1 as setting it to 0 disables many other things #define wxUSE_STREAMS 1 // Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. // Note that if the system's implementation does not support positional // parameters, setting this to 1 forces the use of the wxWidgets implementation // of wxVsnprintf. The standard vsnprintf() supports positional parameters on // many Unix systems but usually doesn't under Windows. // // Positional parameters are very useful when translating a program since using // them in formatting strings allow translators to correctly reorder the // translated sentences. // // Default is 1 // // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 // Enable the use of compiler-specific thread local storage keyword, if any. // This is used for wxTLS_XXX() macros implementation and normally should use // the compiler-provided support as it's simpler and more efficient, but is // disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets // is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under // XP as this triggers a bug in compiler TLS support that results in crashes // when any TLS variables are used. // // If you're absolutely sure that your build of wxWidgets is never going to be // used in such situation, either because it's not going to be linked from any // kind of plugin or because you only target Vista or later systems, you can // set this to 2 to force the use of compiler TLS even under MSW. // // Default is 1 meaning that compiler TLS is used only if it's 100% safe. // // Recommended setting: 2 if you want to have maximal performance and don't // care about the scenario described above. #define wxUSE_COMPILER_TLS 1 // ---------------------------------------------------------------------------- // Interoperability with the standard library. // ---------------------------------------------------------------------------- // Set wxUSE_STL to 1 to enable maximal interoperability with the standard // library, even at the cost of backwards compatibility. // // Default is 0 // // Recommended setting: 0 as the options below already provide a relatively // good level of interoperability and changing this option arguably isn't worth // diverging from the official builds of the library. #define wxUSE_STL 0 // This is not a real option but is used as the default value for // wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. // // Set it to 0 if you want to disable the use of all standard classes // completely for some reason. #define wxUSE_STD_DEFAULT 1 // Use standard C++ containers where it can be done without breaking backwards // compatibility. // // This provides better interoperability with the standard library, e.g. with // this option on it's possible to insert std::vector<> into many wxWidgets // containers directly. // // Default is 1. // // Recommended setting is 1 unless you want to avoid all dependencies on the // standard library. #define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT // Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> // and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but // usually more limited) implementations are used which allows to avoid the // dependency on the C++ run-time library. // // Default is 0 for compatibility reasons. // // Recommended setting: 1 unless compatibility with the official wxWidgets // build and/or the existing code is a concern. #define wxUSE_STD_CONTAINERS 0 // Use standard C++ streams if 1 instead of wx streams in some places. If // disabled, wx streams are used everywhere and wxWidgets doesn't depend on the // standard streams library. // // Notice that enabling this does not replace wx streams with std streams // everywhere, in a lot of places wx streams are used no matter what. // // Default is 1 if compiler supports it. // // Recommended setting: 1 if you use the standard streams anyhow and so // dependency on the standard streams library is not a // problem #define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT // Enable minimal interoperability with the standard C++ string class if 1. // "Minimal" means that wxString can be constructed from std::string or // std::wstring but can't be implicitly converted to them. You need to enable // the option below for the latter. // // Default is 1 for most compilers. // // Recommended setting: 1 unless you want to ensure your program doesn't use // the standard C++ library at all. #define wxUSE_STD_STRING wxUSE_STD_DEFAULT // Make wxString as much interchangeable with std::[w]string as possible, in // particular allow implicit conversion of wxString to either of these classes. // This comes at a price (or a benefit, depending on your point of view) of not // allowing implicit conversion to "const char *" and "const wchar_t *". // // Because a lot of existing code relies on these conversions, this option is // disabled by default but can be enabled for your build if you don't care // about compatibility. // // Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. // // Recommended setting: 0 to remain compatible with the official builds of // wxWidgets. #define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL // VC++ 4.2 and above allows <iostream> and <iostream.h> but you can't mix // them. Set this option to 1 to use <iostream.h>, 0 to use <iostream>. // // Note that newer compilers (including VC++ 7.1 and later) don't support // wxUSE_IOSTREAMH == 1 and so <iostream> will be used anyhow. // // Default is 0. // // Recommended setting: 0, only set to 1 if you use a really old compiler #define wxUSE_IOSTREAMH 0 // ---------------------------------------------------------------------------- // non GUI features selection // ---------------------------------------------------------------------------- // Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit // integer which is implemented in terms of native 64 bit integers if any or // uses emulation otherwise. // // This class is required by wxDateTime and so you should enable it if you want // to use wxDateTime. For most modern platforms, it will use the native 64 bit // integers in which case (almost) all of its functions are inline and it // almost does not take any space, so there should be no reason to switch it // off. // // Recommended setting: 1 #define wxUSE_LONGLONG 1 // Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for // storing binary data in wxConfig on most platforms. // // Default is 1. // // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_BASE64 1 // Set this to 1 to be able to use wxEventLoop even in console applications // (i.e. using base library only, without GUI). This is mostly useful for // processing socket events but is also necessary to use timers in console // applications // // Default is 1. // // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_CONSOLE_EVENTLOOP 1 // Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level // POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. // // Default is 1 // // Recommended setting: 1 (wxFile is highly recommended as it is required by // i18n code, wxFileConfig and others) #define wxUSE_FILE 1 #define wxUSE_FFILE 1 // Use wxFSVolume class providing access to the configured/active mount points // // Default is 1 // // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_FSVOLUME 1 // Use wxSecretStore class for storing passwords using OS-specific facilities. // // Default is 1 // // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system // // Default is 1 // // Recommended setting: 1 (may be disabled to save space, but not much) #define wxUSE_STDPATHS 1 // use wxTextBuffer class: required by wxTextFile #define wxUSE_TEXTBUFFER 1 // use wxTextFile class: requires wxFile and wxTextBuffer, required by // wxFileConfig #define wxUSE_TEXTFILE 1 // i18n support: _() macro, wxLocale class. Requires wxTextFile. #define wxUSE_INTL 1 // Provide wxFoo_l() functions similar to standard foo() functions but taking // an extra locale parameter. // // Notice that this is fully implemented only for the systems providing POSIX // xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary // almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will // only work for the current user locale and "C" locale. You can use // wxHAS_XLOCALE_SUPPORT to test whether the full support is available. // // Default is 1 // // Recommended setting: 1 but may be disabled if you are writing programs // running only in C locale anyhow #define wxUSE_XLOCALE 1 // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which // allow to manipulate dates, times and time intervals. // // Requires: wxUSE_LONGLONG // // Default is 1 // // Recommended setting: 1 #define wxUSE_DATETIME 1 // Set wxUSE_TIMER to 1 to compile wxTimer class // // Default is 1 // // Recommended setting: 1 #define wxUSE_TIMER 1 // Use wxStopWatch clas. // // Default is 1 // // Recommended setting: 1 (needed by wxSocket) #define wxUSE_STOPWATCH 1 // Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher // // Default is 1 // // Recommended setting: 1 #define wxUSE_FSWATCHER 1 // Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes // which allow the application to store its settings in the persistent // storage. Setting this to 1 will also enable on-demand creation of the // global config object in wxApp. // // See also wxUSE_CONFIG_NATIVE below. // // Recommended setting: 1 #define wxUSE_CONFIG 1 // If wxUSE_CONFIG is 1, you may choose to use either the native config // classes under Windows (using .INI files under Win16 and the registry under // Win32) or the portable text file format used by the config classes under // Unix. // // Default is 1 to use native classes. Note that you may still use // wxFileConfig even if you set this to 1 - just the config object created by // default for the applications needs will be a wxRegConfig or wxIniConfig and // not wxFileConfig. // // Recommended setting: 1 #define wxUSE_CONFIG_NATIVE 1 // If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows // to connect/disconnect from the network and be notified whenever the dial-up // network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. // // Default is 1. // // Recommended setting: 1 #define wxUSE_DIALUP_MANAGER 1 // Compile in classes for run-time DLL loading and function calling. // Required by wxUSE_DIALUP_MANAGER. // // This setting is for Win32 only // // Default is 1. // // Recommended setting: 1 #define wxUSE_DYNLIB_CLASS 1 // experimental, don't use for now #define wxUSE_DYNAMIC_LOADER 1 // Set to 1 to use socket classes #define wxUSE_SOCKETS 1 // Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) // // Notice that currently setting this option under Windows will result in // programs which can only run on recent OS versions (with ws2_32.dll // installed) which is why it is disabled by default. // // Default is 1. // // Recommended setting: 1 if you need IPv6 support #define wxUSE_IPV6 0 // Set to 1 to enable virtual file systems (required by wxHTML) #define wxUSE_FILESYSTEM 1 // Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) #define wxUSE_FS_ZIP 1 // Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) #define wxUSE_FS_ARCHIVE 1 // Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) #define wxUSE_FS_INET 1 // wxArchive classes for accessing archives such as zip and tar #define wxUSE_ARCHIVE_STREAMS 1 // Set to 1 to compile wxZipInput/OutputStream classes. #define wxUSE_ZIPSTREAM 1 // Set to 1 to compile wxTarInput/OutputStream classes. #define wxUSE_TARSTREAM 1 // Set to 1 to compile wxZlibInput/OutputStream classes. Also required by // wxUSE_LIBPNG #define wxUSE_ZLIB 1 // Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream // classes. // // Notice that if you enable this build option when not using configure or // CMake, you need to ensure that liblzma headers and libraries are available // (i.e. by building the library yourself or downloading its binaries) and can // be found, either by copying them to one of the locations searched by the // compiler/linker by default (e.g. any of the directories in the INCLUDE or // LIB environment variables, respectively, when using MSVC) or modify the // make- or project files to add references to these directories. // // Default is 0 under MSW, auto-detected by configure. // // Recommended setting: 1 if you need LZMA compression. #define wxUSE_LIBLZMA 0 // If enabled, the code written by Apple will be used to write, in a portable // way, float on the disk. See extended.c for the license which is different // from wxWidgets one. // // Default is 1. // // Recommended setting: 1 unless you don't like the license terms (unlikely) #define wxUSE_APPLE_IEEE 1 // Joystick support class #define wxUSE_JOYSTICK 1 // wxFontEnumerator class #define wxUSE_FONTENUM 1 // wxFontMapper class #define wxUSE_FONTMAP 1 // wxMimeTypesManager class #define wxUSE_MIMETYPE 1 // wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP // or wxURL you need to set this to 1. // // Default is 1. // // Recommended setting: 1 #define wxUSE_PROTOCOL 1 // The settings for the individual URL schemes #define wxUSE_PROTOCOL_FILE 1 #define wxUSE_PROTOCOL_FTP 1 #define wxUSE_PROTOCOL_HTTP 1 // Define this to use wxURL class. #define wxUSE_URL 1 // Define this to use native platform url and protocol support. // Currently valid only for MS-Windows. // Note: if you set this to 1, you can open ftp/http/gopher sites // and obtain a valid input stream for these sites // even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. // Doing so reduces the code size. // // This code is experimental and subject to change. #define wxUSE_URL_NATIVE 0 // Support for wxVariant class used in several places throughout the library, // notably in wxDataViewCtrl API. // // Default is 1. // // Recommended setting: 1 unless you want to reduce the library size as much as // possible in which case setting this to 0 can gain up to 100KB. #define wxUSE_VARIANT 1 // Support for wxAny class, the successor for wxVariant. // // Default is 1. // // Recommended setting: 1 unless you want to reduce the library size by a small amount, // or your compiler cannot for some reason cope with complexity of templates used. #define wxUSE_ANY 1 // Support for regular expression matching via wxRegEx class: enable this to // use POSIX regular expressions in your code. You need to compile regex // library from src/regex to use it under Windows. // // Default is 0 // // Recommended setting: 1 if your compiler supports it, if it doesn't please // contribute us a makefile for src/regex for it #define wxUSE_REGEX 1 // wxSystemOptions class #define wxUSE_SYSTEM_OPTIONS 1 // wxSound class #define wxUSE_SOUND 1 // Use wxMediaCtrl // // Default is 1. // // Recommended setting: 1 #define wxUSE_MEDIACTRL 1 // Use wxWidget's XRC XML-based resource system. Recommended. // // Default is 1 // // Recommended setting: 1 (requires wxUSE_XML) #define wxUSE_XRC 1 // XML parsing classes. Note that their API will change in the future, so // using wxXmlDocument and wxXmlNode in your app is not recommended. // // Default is the same as wxUSE_XRC, i.e. 1 by default. // // Recommended setting: 1 (required by XRC) #define wxUSE_XML wxUSE_XRC // Use wxWidget's AUI docking system // // Default is 1 // // Recommended setting: 1 #define wxUSE_AUI 1 // Use wxWidget's Ribbon classes for interfaces // // Default is 1 // // Recommended setting: 1 #define wxUSE_RIBBON 1 // Use wxPropertyGrid. // // Default is 1 // // Recommended setting: 1 #define wxUSE_PROPGRID 1 // Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. // // Default is 1 // // Recommended setting: 1 #define wxUSE_STC 1 // Use wxWidget's web viewing classes // // Default is 1 // // Recommended setting: 1 #define wxUSE_WEBVIEW 1 // Use the IE wxWebView backend // // Default is 1 on MSW // // Recommended setting: 1 #ifdef __WXMSW__ #define wxUSE_WEBVIEW_IE 1 #else #define wxUSE_WEBVIEW_IE 0 #endif // Use the WebKit wxWebView backend // // Default is 1 on GTK and OSX // // Recommended setting: 1 #if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) #define wxUSE_WEBVIEW_WEBKIT 1 #else #define wxUSE_WEBVIEW_WEBKIT 0 #endif // Use the WebKit2 wxWebView backend // // Default is 1 on GTK3 // // Recommended setting: 1 #if defined(__WXGTK3__) #define wxUSE_WEBVIEW_WEBKIT2 1 #else #define wxUSE_WEBVIEW_WEBKIT2 0 #endif // Enable wxGraphicsContext and related classes for a modern 2D drawing API. // // Default is 1 except if you're using a compiler without support for GDI+ // under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are // known to have them). For other compilers (e.g. older mingw32) you may need // to install the headers (and just the headers) yourself. If you do, change // the setting below manually. // // Recommended setting: 1 if supported by the compilation environment // Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() // here as this file is included from wx/platform.h before they're defined. #if defined(_MSC_VER) || \ (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) #define wxUSE_GRAPHICS_CONTEXT 1 #else // Disable support for other Windows compilers, enable it if your compiler // comes with new enough SDK or you installed the headers manually. // // Notice that this will be set by configure under non-Windows platforms // anyhow so the value there is not important. #define wxUSE_GRAPHICS_CONTEXT 0 #endif // Enable wxGraphicsContext implementation using Cairo library. // // This is not needed under Windows and detected automatically by configure // under other systems, however you may set this to 1 manually if you installed // Cairo under Windows yourself and prefer to use it instead the native GDI+ // implementation. // // Default is 0 // // Recommended setting: 0 #define wxUSE_CAIRO 0 // ---------------------------------------------------------------------------- // Individual GUI controls // ---------------------------------------------------------------------------- // You must set wxUSE_CONTROLS to 1 if you are using any controls at all // (without it, wxControl class is not compiled) // // Default is 1 // // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 // Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). // Currently markup is supported only by a few controls and only some ports but // their number will increase with time. // // Default is 1 // // Recommended setting: 1 (may be set to 0 if you want to save on code size) #define wxUSE_MARKUP 1 // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // // Default is 1 // // Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) #define wxUSE_POPUPWIN 1 // wxTipWindow allows to implement the custom tooltips, it is used by the // context help classes. Requires wxUSE_POPUPWIN. // // Default is 1 // // Recommended setting: 1 (may be set to 0) #define wxUSE_TIPWINDOW 1 // Each of the settings below corresponds to one wxWidgets control. They are // all switched on by default but may be disabled if you are sure that your // program (including any standard dialogs it can show!) doesn't need them and // if you desperately want to save some space. If you use any of these you must // set wxUSE_CONTROLS as well. // // Default is 1 // // Recommended setting: 1 #define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl #define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton #define wxUSE_BMPBUTTON 1 // wxBitmapButton #define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl #define wxUSE_CHECKBOX 1 // wxCheckBox #define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) #define wxUSE_CHOICE 1 // wxChoice #define wxUSE_COLLPANE 1 // wxCollapsiblePane #define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl #define wxUSE_COMBOBOX 1 // wxComboBox #define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton #define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl #define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl #define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox #define wxUSE_FILECTRL 1 // wxFileCtrl #define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl #define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl #define wxUSE_GAUGE 1 // wxGauge #define wxUSE_HEADERCTRL 1 // wxHeaderCtrl #define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl #define wxUSE_LISTBOX 1 // wxListBox #define wxUSE_LISTCTRL 1 // wxListCtrl #define wxUSE_RADIOBOX 1 // wxRadioBox #define wxUSE_RADIOBTN 1 // wxRadioButton #define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog #define wxUSE_SCROLLBAR 1 // wxScrollBar #define wxUSE_SEARCHCTRL 1 // wxSearchCtrl #define wxUSE_SLIDER 1 // wxSlider #define wxUSE_SPINBTN 1 // wxSpinButton #define wxUSE_SPINCTRL 1 // wxSpinCtrl #define wxUSE_STATBOX 1 // wxStaticBox #define wxUSE_STATLINE 1 // wxStaticLine #define wxUSE_STATTEXT 1 // wxStaticText #define wxUSE_STATBMP 1 // wxStaticBitmap #define wxUSE_TEXTCTRL 1 // wxTextCtrl #define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl #define wxUSE_TOGGLEBTN 1 // requires wxButton #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // // Default is 1 // // Recommended setting: 1 #define wxUSE_STATUSBAR 1 // Two status bar implementations are available under Win32: the generic one // or the wrapper around native control. For native look and feel the native // version should be used. // // Default is 1 for the platforms where native status bar is supported. // // Recommended setting: 1 (there is no advantage in using the generic one) #define wxUSE_NATIVE_STATUSBAR 1 // wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar // classes at all. Otherwise, use the native toolbar class unless // wxUSE_TOOLBAR_NATIVE is 0. // // Default is 1 for all settings. // // Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. #define wxUSE_TOOLBAR 1 #define wxUSE_TOOLBAR_NATIVE 1 // wxNotebook is a control with several "tabs" located on one of its sides. It // may be used to logically organise the data presented to the user instead of // putting everything in one huge dialog. It replaces wxTabControl and related // classes of wxWin 1.6x. // // Default is 1. // // Recommended setting: 1 #define wxUSE_NOTEBOOK 1 // wxListbook control is similar to wxNotebook but uses wxListCtrl instead of // the tabs // // Default is 1. // // Recommended setting: 1 #define wxUSE_LISTBOOK 1 // wxChoicebook control is similar to wxNotebook but uses wxChoice instead of // the tabs // // Default is 1. // // Recommended setting: 1 #define wxUSE_CHOICEBOOK 1 // wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of // the tabs // // Default is 1. // // Recommended setting: 1 #define wxUSE_TREEBOOK 1 // wxToolbook control is similar to wxNotebook but uses wxToolBar instead of // tabs // // Default is 1. // // Recommended setting: 1 #define wxUSE_TOOLBOOK 1 // wxTaskBarIcon is a small notification icon shown in the system toolbar or // dock. // // Default is 1. // // Recommended setting: 1 (but can be set to 0 if you don't need it) #define wxUSE_TASKBARICON 1 // wxGrid class // // Default is 1, set to 0 to cut down compilation time and binaries size if you // don't use it. // // Recommended setting: 1 // #define wxUSE_GRID 1 // wxMiniFrame class: a frame with narrow title bar // // Default is 1. // // Recommended setting: 1 (it doesn't cost almost anything) #define wxUSE_MINIFRAME 1 // wxComboCtrl and related classes: combobox with custom popup window and // not necessarily a listbox. // // Default is 1. // // Recommended setting: 1 but can be safely set to 0 except for wxUniv where it // it used by wxComboBox #define wxUSE_COMBOCTRL 1 // wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox // items. // // Default is 1. // // Recommended setting: 1 but can be safely set to 0, except where it is // needed as a base class for generic wxBitmapComboBox. #define wxUSE_ODCOMBOBOX 1 // wxBitmapComboBox is a combobox that can have images in front of text items. // // Default is 1. // // Recommended setting: 1 but can be safely set to 0 #define wxUSE_BITMAPCOMBOBOX 1 // wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items // up and down in it. It is also used as part of wxRearrangeDialog. // // Default is 1. // // Recommended setting: 1 but can be safely set to 0 (currently used only by // wxHeaderCtrl) #define wxUSE_REARRANGECTRL 1 // wxAddRemoveCtrl is a composite control containing a control showing some // items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ // "-" buttons allowing to add and remove items to/from the control. // // Default is 1. // // Recommended setting: 1 but can be safely set to 0 if you don't need it (not // used by the library itself). #define wxUSE_ADDREMOVECTRL 1 // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- // wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) #define wxUSE_ACCEL 1 // Use the standard art provider. The icons returned by this provider are // embedded into the library as XPMs so disabling it reduces the library size // somewhat but this should only be done if you use your own custom art // provider returning the icons or never use any icons not provided by the // native art provider (which might not be implemented at all for some // platforms) or by the Tango icons provider (if it's not itself disabled // below). // // Default is 1. // // Recommended setting: 1 unless you use your own custom art provider. #define wxUSE_ARTPROVIDER_STD 1 // Use art provider providing Tango icons: this art provider has higher quality // icons than the default ones using smaller size XPM icons without // transparency but the embedded PNG icons add to the library size. // // Default is 1 under non-GTK ports. Under wxGTK the native art provider using // the GTK+ stock icons replaces it so it is normally not necessary. // // Recommended setting: 1 but can be turned off to reduce the library size. #define wxUSE_ARTPROVIDER_TANGO 1 // Hotkey support (currently Windows only) #define wxUSE_HOTKEY 1 // Use wxCaret: a class implementing a "cursor" in a text control (called caret // under Windows). // // Default is 1. // // Recommended setting: 1 (can be safely set to 0, not used by the library) #define wxUSE_CARET 1 // Use wxDisplay class: it allows enumerating all displays on a system and // their geometries as well as finding the display on which the given point or // window lies. // // Default is 1. // // Recommended setting: 1 if you need it, can be safely set to 0 otherwise #define wxUSE_DISPLAY 1 // Miscellaneous geometry code: needed for Canvas library #define wxUSE_GEOMETRY 1 // Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and // wxListCtrl. // // Default is 1. // // Recommended setting: 1 (set it to 0 if you don't use any of the controls // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 // Use wxInfoBar class. // // Default is 1. // // Recommended setting: 1 (but can be disabled without problems as nothing // depends on it) #define wxUSE_INFOBAR 1 // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. // // Recommended setting: 1 (can't be disabled under MSW) #define wxUSE_MENUS 1 // Use wxNotificationMessage. // // wxNotificationMessage allows to show non-intrusive messages to the user // using balloons, banners, popups or whatever is the appropriate method for // the current platform. // // Default is 1. // // Recommended setting: 1 #define wxUSE_NOTIFICATION_MESSAGE 1 // wxPreferencesEditor provides a common API for different ways of presenting // the standard "Preferences" or "Properties" dialog under different platforms // (e.g. some use modal dialogs, some use modeless ones; some apply the changes // immediately while others require an explicit "Apply" button). // // Default is 1. // // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 // wxFont::AddPrivateFont() allows to use fonts not installed on the system by // loading them from font files during run-time. // // Default is 1 except under Unix where it will be turned off by configure if // the required libraries are not available or not new enough. // // Recommended setting: 1 (but can be safely disabled if you don't use it and // want to avoid extra dependencies under Linux, for example). #define wxUSE_PRIVATE_FONTS 1 // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // // Default is 1. // // Recommended setting: 1 (but can be safely set to 0 if you don't need it) #define wxUSE_RICHTOOLTIP 1 // Use wxSashWindow class. // // Default is 1. // // Recommended setting: 1 #define wxUSE_SASH 1 // Use wxSplitterWindow class. // // Default is 1. // // Recommended setting: 1 #define wxUSE_SPLITTER 1 // Use wxToolTip and wxWindow::Set/GetToolTip() methods. // // Default is 1. // // Recommended setting: 1 #define wxUSE_TOOLTIPS 1 // wxValidator class and related methods #define wxUSE_VALIDATORS 1 // Use reference counted ID management: this means that wxWidgets will track // the automatically allocated ids (those used when you use wxID_ANY when // creating a window, menu or toolbar item &c) instead of just supposing that // the program never runs out of them. This is mostly useful only under wxMSW // where the total ids range is limited to SHRT_MIN..SHRT_MAX and where // long-running programs can run into problems with ids reuse without this. On // the other platforms, where the ids have the full int range, this shouldn't // be necessary. #ifdef __WXMSW__ #define wxUSE_AUTOID_MANAGEMENT 1 #else #define wxUSE_AUTOID_MANAGEMENT 0 #endif // ---------------------------------------------------------------------------- // common dialogs // ---------------------------------------------------------------------------- // On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. // file selector, printer dialog). Switching this off also switches off the // printing architecture and interactive wxPrinterDC. // // Default is 1 // // Recommended setting: 1 (unless it really doesn't work) #define wxUSE_COMMON_DIALOGS 1 // wxBusyInfo displays window with message when app is busy. Works in same way // as wxBusyCursor #define wxUSE_BUSYINFO 1 // Use single/multiple choice dialogs. // // Default is 1 // // Recommended setting: 1 (used in the library itself) #define wxUSE_CHOICEDLG 1 // Use colour picker dialog // // Default is 1 // // Recommended setting: 1 #define wxUSE_COLOURDLG 1 // wxDirDlg class for getting a directory name from user #define wxUSE_DIRDLG 1 // TODO: setting to choose the generic or native one // Use file open/save dialogs. // // Default is 1 // // Recommended setting: 1 (used in many places in the library itself) #define wxUSE_FILEDLG 1 // Use find/replace dialogs. // // Default is 1 // // Recommended setting: 1 (but may be safely set to 0) #define wxUSE_FINDREPLDLG 1 // Use font picker dialog // // Default is 1 // // Recommended setting: 1 (used in the library itself) #define wxUSE_FONTDLG 1 // Use wxMessageDialog and wxMessageBox. // // Default is 1 // // Recommended setting: 1 (used in the library itself) #define wxUSE_MSGDLG 1 // progress dialog class for lengthy operations #define wxUSE_PROGRESSDLG 1 // Set to 0 to disable the use of the native progress dialog (currently only // available under MSW and suffering from some bugs there, hence this option). #define wxUSE_NATIVE_PROGRESSDLG 1 // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 // text entry dialog and wxGetTextFromUser function #define wxUSE_TEXTDLG 1 // number entry dialog #define wxUSE_NUMBERDLG 1 // splash screen class #define wxUSE_SPLASH 1 // wizards #define wxUSE_WIZARDDLG 1 // Compile in wxAboutBox() function showing the standard "About" dialog. // // Default is 1 // // Recommended setting: 1 but can be set to 0 to save some space if you don't // use this function #define wxUSE_ABOUTDLG 1 // wxFileHistory class // // Default is 1 // // Recommended setting: 1 #define wxUSE_FILE_HISTORY 1 // ---------------------------------------------------------------------------- // Metafiles support // ---------------------------------------------------------------------------- // Windows supports the graphics format known as metafile which, though not // portable, is widely used under Windows and so is supported by wxWidgets // (under Windows only, of course). Both the so-called "Window MetaFiles" or // WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by // default, EMFs will be used. This may be changed by setting // wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. // You may also set wxUSE_METAFILE to 0 to not compile in any metafile // related classes at all. // // Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. // // Recommended setting: default or 0 for everything for portable programs. #define wxUSE_METAFILE 1 #define wxUSE_ENH_METAFILE 1 #define wxUSE_WIN_METAFILES_ALWAYS 0 // ---------------------------------------------------------------------------- // Big GUI components // ---------------------------------------------------------------------------- // Set to 0 to disable MDI support. // // Requires wxUSE_NOTEBOOK under platforms other than MSW. // // Default is 1. // // Recommended setting: 1, can be safely set to 0. #define wxUSE_MDI 1 // Set to 0 to disable document/view architecture #define wxUSE_DOC_VIEW_ARCHITECTURE 1 // Set to 0 to disable MDI document/view architecture // // Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE #define wxUSE_MDI_ARCHITECTURE 1 // Set to 0 to disable print/preview architecture code #define wxUSE_PRINTING_ARCHITECTURE 1 // wxHTML sublibrary allows to display HTML in wxWindow programs and much, // much more. // // Default is 1. // // Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a // smaller library. #define wxUSE_HTML 1 // Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL // headers and libraries to be able to compile the library with wxUSE_GLCANVAS // set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the // list of libraries used to link your application (although this is done // implicitly for Microsoft Visual C++ users). // // Default is 1. // // Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 // otherwise. #define wxUSE_GLCANVAS 1 // wxRichTextCtrl allows editing of styled text. // // Default is 1. // // Recommended setting: 1, set to 0 if you want compile a // smaller library. #define wxUSE_RICHTEXT 1 // ---------------------------------------------------------------------------- // Data transfer // ---------------------------------------------------------------------------- // Use wxClipboard class for clipboard copy/paste. // // Default is 1. // // Recommended setting: 1 #define wxUSE_CLIPBOARD 1 // Use wxDataObject and related classes. Needed for clipboard and OLE drag and // drop // // Default is 1. // // Recommended setting: 1 #define wxUSE_DATAOBJ 1 // Use wxDropTarget and wxDropSource classes for drag and drop (this is // different from "built in" drag and drop in wxTreeCtrl which is always // available). Requires wxUSE_DATAOBJ. // // Default is 1. // // Recommended setting: 1 #define wxUSE_DRAG_AND_DROP 1 // Use wxAccessible for enhanced and customisable accessibility. // Depends on wxUSE_OLE on MSW. // // Default is 1 on MSW, 0 elsewhere. // // Recommended setting (at present): 1 (MSW-only) #ifdef __WXMSW__ #define wxUSE_ACCESSIBILITY 1 #else #define wxUSE_ACCESSIBILITY 0 #endif // ---------------------------------------------------------------------------- // miscellaneous settings // ---------------------------------------------------------------------------- // wxSingleInstanceChecker class allows to verify at startup if another program // instance is running. // // Default is 1 // // Recommended setting: 1 (the class is tiny, disabling it won't save much // space) #define wxUSE_SNGLINST_CHECKER 1 #define wxUSE_DRAGIMAGE 1 #define wxUSE_IPC 1 // 0 for no interprocess comms #define wxUSE_HELP 1 // 0 for no help facility // Should we use MS HTML help for wxHelpController? If disabled, neither // wxCHMHelpController nor wxBestHelpController are available. // // Default is 1 under MSW, 0 is always used for the other platforms. // // Recommended setting: 1, only set to 0 if you have trouble compiling // wxCHMHelpController (could be a problem with really ancient compilers) #define wxUSE_MS_HTML_HELP 1 // Use wxHTML-based help controller? #define wxUSE_WXHTML_HELP 1 #define wxUSE_CONSTRAINTS 1 // 0 for no window layout constraint system #define wxUSE_SPLINES 1 // 0 for no splines #define wxUSE_MOUSEWHEEL 1 // Include mouse wheel support // Compile wxUIActionSimulator class? #define wxUSE_UIACTIONSIMULATOR 1 // ---------------------------------------------------------------------------- // wxDC classes for various output formats // ---------------------------------------------------------------------------- // Set to 1 for PostScript device context. #define wxUSE_POSTSCRIPT 0 // Set to 1 to use font metric files in GetTextExtent #define wxUSE_AFM_FOR_POSTSCRIPT 1 // Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows // to create files in SVG (Scalable Vector Graphics) format. #define wxUSE_SVG 1 // Should wxDC provide SetTransformMatrix() and related methods? // // Default is 1 but can be set to 0 if this functionality is not used. Notice // that currently wxMSW, wxGTK3 support this for wxDC and all platforms support // this for wxGCDC so setting this to 0 doesn't change much if neither of these // is used (although it will still save a few bytes probably). // // Recommended setting: 1. #define wxUSE_DC_TRANSFORM_MATRIX 1 // ---------------------------------------------------------------------------- // image format support // ---------------------------------------------------------------------------- // wxImage supports many different image formats which can be configured at // compile-time. BMP is always supported, others are optional and can be safely // disabled if you don't plan to use images in such format sometimes saving // substantial amount of code in the final library. // // Some formats require an extra library which is included in wxWin sources // which is mentioned if it is the case. // Set to 1 for wxImage support (recommended). #define wxUSE_IMAGE 1 // Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. #define wxUSE_LIBPNG 1 // Set to 1 for JPEG format support (requires libjpeg) #define wxUSE_LIBJPEG 1 // Set to 1 for TIFF format support (requires libtiff) #define wxUSE_LIBTIFF 1 // Set to 1 for TGA format support (loading only) #define wxUSE_TGA 1 // Set to 1 for GIF format support #define wxUSE_GIF 1 // Set to 1 for PNM format support #define wxUSE_PNM 1 // Set to 1 for PCX format support #define wxUSE_PCX 1 // Set to 1 for IFF format support (Amiga format) #define wxUSE_IFF 0 // Set to 1 for XPM format support #define wxUSE_XPM 1 // Set to 1 for MS Icons and Cursors format support #define wxUSE_ICO_CUR 1 // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 // ---------------------------------------------------------------------------- // wxUniversal-only options // ---------------------------------------------------------------------------- // Set to 1 to enable compilation of all themes, this is the default #define wxUSE_ALL_THEMES 1 // Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES // is unset, if it is set these options are not used; notice that metal theme // uses Win32 one #define wxUSE_THEME_GTK 0 #define wxUSE_THEME_METAL 0 #define wxUSE_THEME_MONO 0 #define wxUSE_THEME_WIN32 0
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/zstream.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/zstream.h // Purpose: Memory stream classes // Author: Guilhem Lavaux // Modified by: Mike Wetherell // Created: 11/07/98 // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_WXZSTREAM_H__ #define _WX_WXZSTREAM_H__ #include "wx/defs.h" #if wxUSE_ZLIB && wxUSE_STREAMS #include "wx/stream.h" #include "wx/versioninfo.h" // Compression level enum wxZlibCompressionLevels { wxZ_DEFAULT_COMPRESSION = -1, wxZ_NO_COMPRESSION = 0, wxZ_BEST_SPEED = 1, wxZ_BEST_COMPRESSION = 9 }; // Flags enum wxZLibFlags { wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum wxZLIB_ZLIB = 1, // zlib header and checksum wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ wxZLIB_AUTO = 3 // autodetect header zlib or gzip }; class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { public: wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO); wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO); virtual ~wxZlibInputStream(); char Peek() wxOVERRIDE { return wxInputStream::Peek(); } wxFileOffset GetLength() const wxOVERRIDE { return wxInputStream::GetLength(); } static bool CanHandleGZip(); bool SetDictionary(const char *data, size_t datalen); bool SetDictionary(const wxMemoryBuffer &buf); protected: size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } private: void Init(int flags); protected: size_t m_z_size; unsigned char *m_z_buffer; struct z_stream_s *m_inflate; wxFileOffset m_pos; wxDECLARE_NO_COPY_CLASS(wxZlibInputStream); }; class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { public: wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB); wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB); virtual ~wxZlibOutputStream() { Close(); } void Sync() wxOVERRIDE { DoFlush(false); } bool Close() wxOVERRIDE; wxFileOffset GetLength() const wxOVERRIDE { return m_pos; } static bool CanHandleGZip(); bool SetDictionary(const char *data, size_t datalen); bool SetDictionary(const wxMemoryBuffer &buf); protected: size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } virtual void DoFlush(bool final); private: void Init(int level, int flags); protected: size_t m_z_size; unsigned char *m_z_buffer; struct z_stream_s *m_deflate; wxFileOffset m_pos; wxDECLARE_NO_COPY_CLASS(wxZlibOutputStream); }; class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory { public: wxZlibClassFactory(); wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } const wxChar * const *GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const wxOVERRIDE; private: wxDECLARE_DYNAMIC_CLASS(wxZlibClassFactory); }; class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory { public: wxGzipClassFactory(); wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } const wxChar * const *GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const wxOVERRIDE; private: wxDECLARE_DYNAMIC_CLASS(wxGzipClassFactory); }; WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo(); #endif // wxUSE_ZLIB && wxUSE_STREAMS #endif // _WX_WXZSTREAM_H__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/version.h
/* * Name: wx/version.h * Purpose: wxWidgets version numbers * Author: Julian Smart * Modified by: Ryan Norton (Converted to C) * Created: 29/01/98 * Copyright: (c) 1998 Julian Smart * Licence: wxWindows licence */ /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ #ifndef _WX_VERSION_H_ #define _WX_VERSION_H_ #include "wx/cpp.h" /* for wxSTRINGIZE */ /* the constants below must be changed with each new version */ /* ---------------------------------------------------------------------------- */ /* Don't forget to update WX_CURRENT, WX_REVISION and WX_AGE in build/bakefiles/version.bkl and regenerate the makefiles when you change this! */ /* NB: this file is parsed by automatic tools so don't change its format! */ #define wxMAJOR_VERSION 3 #define wxMINOR_VERSION 1 #define wxRELEASE_NUMBER 2 #define wxSUBRELEASE_NUMBER 0 #define wxVERSION_STRING wxT("wxWidgets 3.1.2") /* nothing to update below this line when updating the version */ /* ---------------------------------------------------------------------------- */ /* Users can pre-define wxABI_VERSION to a lower value in their * makefile/project settings to compile code that will be binary compatible * with earlier versions of the ABI within the same minor version (between * minor versions binary compatibility breaks anyway). The default is the * version of wxWidgets being used. A single number with two decimal digits * for each component, e.g. 20601 for 2.6.1 */ #ifndef wxABI_VERSION #define wxABI_VERSION ( wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 ) #endif /* helpers for wxVERSION_NUM_XXX */ #define wxMAKE_VERSION_STRING(x, y, z) \ wxSTRINGIZE(x) wxSTRINGIZE(y) wxSTRINGIZE(z) #define wxMAKE_VERSION_DOT_STRING(x, y, z) \ wxSTRINGIZE(x) "." wxSTRINGIZE(y) "." wxSTRINGIZE(z) #define wxMAKE_VERSION_STRING_T(x, y, z) \ wxSTRINGIZE_T(x) wxSTRINGIZE_T(y) wxSTRINGIZE_T(z) #define wxMAKE_VERSION_DOT_STRING_T(x, y, z) \ wxSTRINGIZE_T(x) wxT(".") wxSTRINGIZE_T(y) wxT(".") wxSTRINGIZE_T(z) /* these are used by src/msw/version.rc and should always be ASCII, not Unicode */ #define wxVERSION_NUM_STRING \ wxMAKE_VERSION_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) #define wxVERSION_NUM_DOT_STRING \ wxMAKE_VERSION_DOT_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) /* those are Unicode-friendly */ #define wxVERSION_NUM_STRING_T \ wxMAKE_VERSION_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) #define wxVERSION_NUM_DOT_STRING_T \ wxMAKE_VERSION_DOT_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) /* some more defines, not really sure if they're [still] useful */ #define wxVERSION_NUMBER ( (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER ) #define wxBETA_NUMBER 0 #define wxVERSION_FLOAT ( wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) ) /* check if the current version is at least major.minor.release */ #define wxCHECK_VERSION(major,minor,release) \ (wxMAJOR_VERSION > (major) || \ (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \ (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release))) /* the same but check the subrelease also */ #define wxCHECK_VERSION_FULL(major,minor,release,subrel) \ (wxCHECK_VERSION(major, minor, release) && \ ((major) != wxMAJOR_VERSION || \ (minor) != wxMINOR_VERSION || \ (release) != wxRELEASE_NUMBER || \ (subrel) <= wxSUBRELEASE_NUMBER)) #endif /* _WX_VERSION_H_ */
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/imagpng.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/imagpng.h // Purpose: wxImage PNG handler // Author: Robert Roebling // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_IMAGPNG_H_ #define _WX_IMAGPNG_H_ #include "wx/defs.h" //----------------------------------------------------------------------------- // wxPNGHandler //----------------------------------------------------------------------------- #if wxUSE_LIBPNG #include "wx/image.h" #include "wx/versioninfo.h" #define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") #define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") #define wxIMAGE_OPTION_PNG_FILTER wxT("PngF") #define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL wxT("PngZL") #define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL wxT("PngZM") #define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS") #define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB") enum { wxPNG_TYPE_COLOUR = 0, wxPNG_TYPE_GREY = 2, wxPNG_TYPE_GREY_RED = 3, wxPNG_TYPE_PALETTE = 4 }; class WXDLLIMPEXP_CORE wxPNGHandler: public wxImageHandler { public: inline wxPNGHandler() { m_name = wxT("PNG file"); m_extension = wxT("png"); m_type = wxBITMAP_TYPE_PNG; m_mime = wxT("image/png"); } static wxVersionInfo GetLibraryVersionInfo(); #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: wxDECLARE_DYNAMIC_CLASS(wxPNGHandler); }; #endif // wxUSE_LIBPNG #endif // _WX_IMAGPNG_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/headerctrl.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/headerctrl.h // Purpose: wxHeaderCtrlBase class: interface of wxHeaderCtrl // Author: Vadim Zeitlin // Created: 2008-12-01 // Copyright: (c) 2008 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_HEADERCTRL_H_ #define _WX_HEADERCTRL_H_ #include "wx/control.h" #if wxUSE_HEADERCTRL #include "wx/dynarray.h" #include "wx/vector.h" #include "wx/headercol.h" // notice that the classes in this header are defined in the core library even // although currently they're only used by wxGrid which is in wxAdv because we // plan to use it in wxListCtrl which is in core too in the future class WXDLLIMPEXP_FWD_CORE wxHeaderCtrlEvent; // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- enum { // allow column drag and drop wxHD_ALLOW_REORDER = 0x0001, // allow hiding (and showing back) the columns using the menu shown by // right clicking the header wxHD_ALLOW_HIDE = 0x0002, // force putting column images on right wxHD_BITMAP_ON_RIGHT = 0x0004, // style used by default when creating the control wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER }; extern WXDLLIMPEXP_DATA_CORE(const char) wxHeaderCtrlNameStr[]; // ---------------------------------------------------------------------------- // wxHeaderCtrlBase defines the interface of a header control // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxHeaderCtrlBase : public wxControl { public: /* Derived classes must provide default ctor as well as a ctor and Create() function with the following signatures: wxHeaderCtrl(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHD_DEFAULT_STYLE, const wxString& name = wxHeaderCtrlNameStr); bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHD_DEFAULT_STYLE, const wxString& name = wxHeaderCtrlNameStr); */ // column-related methods // ---------------------- // set the number of columns in the control // // this also calls UpdateColumn() for all columns void SetColumnCount(unsigned int count); // return the number of columns in the control as set by SetColumnCount() unsigned int GetColumnCount() const { return DoGetCount(); } // return whether the control has any columns bool IsEmpty() const { return DoGetCount() == 0; } // update the column with the given index void UpdateColumn(unsigned int idx) { wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); DoUpdate(idx); } // columns order // ------------- // set the columns order: the array defines the column index which appears // the given position, it must have GetColumnCount() elements and contain // all indices exactly once void SetColumnsOrder(const wxArrayInt& order); wxArrayInt GetColumnsOrder() const; // get the index of the column at the given display position unsigned int GetColumnAt(unsigned int pos) const; // get the position at which this column is currently displayed unsigned int GetColumnPos(unsigned int idx) const; // reset the columns order to the natural one void ResetColumnsOrder(); // helper function used by the generic version of this control and also // wxGrid: reshuffles the array of column indices indexed by positions // (i.e. using the same convention as for SetColumnsOrder()) so that the // column with the given index is found at the specified position static void MoveColumnInOrderArray(wxArrayInt& order, unsigned int idx, unsigned int pos); // UI helpers // ---------- #if wxUSE_MENUS // show the popup menu containing all columns with check marks for the ones // which are currently shown and return true if something was done using it // (in this case UpdateColumnVisibility() will have been called) or false // if the menu was cancelled // // this is called from the default right click handler for the controls // with wxHD_ALLOW_HIDE style bool ShowColumnsMenu(const wxPoint& pt, const wxString& title = wxString()); // append the entries for all our columns to the given menu, with the // currently visible columns being checked // // this is used by ShowColumnsMenu() but can also be used if you use your // own custom columns menu but nevertheless want to show all the columns in // it // // the ids of the items corresponding to the columns are consecutive and // start from idColumnsBase void AddColumnsItems(wxMenu& menu, int idColumnsBase = 0); #endif // wxUSE_MENUS // show the columns customization dialog and return true if something was // changed using it (in which case UpdateColumnVisibility() and/or // UpdateColumnsOrder() will have been called) // // this is called by the control itself from ShowColumnsMenu() (which in // turn is only called by the control if wxHD_ALLOW_HIDE style was // specified) and if the control has wxHD_ALLOW_REORDER style as well bool ShowCustomizeDialog(); // compute column title width int GetColumnTitleWidth(const wxHeaderColumn& col); // implementation only from now on // ------------------------------- // the user doesn't need to TAB to this control virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; } // this method is only overridden in order to synchronize the control with // the main window when it is scrolled, the derived class must implement // DoScrollHorz() virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL) wxOVERRIDE; protected: // this method must be implemented by the derived classes to return the // information for the given column virtual const wxHeaderColumn& GetColumn(unsigned int idx) const = 0; // this method is called from the default EVT_HEADER_SEPARATOR_DCLICK // handler to update the fitting column width of the given column, it // should return true if the width was really updated virtual bool UpdateColumnWidthToFit(unsigned int WXUNUSED(idx), int WXUNUSED(widthTitle)) { return false; } // this method is called from ShowColumnsMenu() and must be overridden to // update the internal column visibility (there is no need to call // UpdateColumn() from here, this will be done internally) virtual void UpdateColumnVisibility(unsigned int WXUNUSED(idx), bool WXUNUSED(show)) { wxFAIL_MSG( "must be overridden if called" ); } // this method is called from ShowCustomizeDialog() to reorder all columns // at once and should be implemented for controls using wxHD_ALLOW_REORDER // style (there is no need to call SetColumnsOrder() from here, this is // done by the control itself) virtual void UpdateColumnsOrder(const wxArrayInt& WXUNUSED(order)) { wxFAIL_MSG( "must be overridden if called" ); } // this method can be overridden in the derived classes to do something // (e.g. update/resize some internal data structures) before the number of // columns in the control changes virtual void OnColumnCountChanging(unsigned int WXUNUSED(count)) { } // helper function for the derived classes: update the array of column // indices after the number of columns changed void DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int count); protected: // this window doesn't look nice with the border so don't use it by default virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } private: // methods implementing our public API and defined in platform-specific // implementations virtual void DoSetCount(unsigned int count) = 0; virtual unsigned int DoGetCount() const = 0; virtual void DoUpdate(unsigned int idx) = 0; virtual void DoScrollHorz(int dx) = 0; virtual void DoSetColumnsOrder(const wxArrayInt& order) = 0; virtual wxArrayInt DoGetColumnsOrder() const = 0; // event handlers void OnSeparatorDClick(wxHeaderCtrlEvent& event); #if wxUSE_MENUS void OnRClick(wxHeaderCtrlEvent& event); #endif // wxUSE_MENUS wxDECLARE_EVENT_TABLE(); }; // ---------------------------------------------------------------------------- // wxHeaderCtrl: port-specific header control implementation, notice that this // is still an ABC which is meant to be used as part of another // control, see wxHeaderCtrlSimple for a standalone version // ---------------------------------------------------------------------------- #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/headerctrl.h" #else #define wxHAS_GENERIC_HEADERCTRL #include "wx/generic/headerctrlg.h" #endif // platform // ---------------------------------------------------------------------------- // wxHeaderCtrlSimple: concrete header control which can be used standalone // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxHeaderCtrlSimple : public wxHeaderCtrl { public: // control creation // ---------------- wxHeaderCtrlSimple() { Init(); } wxHeaderCtrlSimple(wxWindow *parent, wxWindowID winid = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHD_DEFAULT_STYLE, const wxString& name = wxHeaderCtrlNameStr) { Init(); Create(parent, winid, pos, size, style, name); } // managing the columns // -------------------- // insert the column at the given position, using GetColumnCount() as // position appends it at the end void InsertColumn(const wxHeaderColumnSimple& col, unsigned int idx) { wxCHECK_RET( idx <= GetColumnCount(), "invalid column index" ); DoInsert(col, idx); } // append the column to the end of the control void AppendColumn(const wxHeaderColumnSimple& col) { DoInsert(col, GetColumnCount()); } // delete the column at the given index void DeleteColumn(unsigned int idx) { wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); DoDelete(idx); } // delete all the existing columns void DeleteAllColumns(); // modifying columns // ----------------- // show or hide the column, notice that even when a column is hidden we // still account for it when using indices void ShowColumn(unsigned int idx, bool show = true) { wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); DoShowColumn(idx, show); } void HideColumn(unsigned int idx) { ShowColumn(idx, false); } // indicate that the column is used for sorting void ShowSortIndicator(unsigned int idx, bool ascending = true) { wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); DoShowSortIndicator(idx, ascending); } // remove the sort indicator completely void RemoveSortIndicator(); protected: // implement/override base class methods virtual const wxHeaderColumn& GetColumn(unsigned int idx) const wxOVERRIDE; virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle) wxOVERRIDE; // and define another one to be overridden in the derived classes: it // should return the best width for the given column contents or -1 if not // implemented, we use it to implement UpdateColumnWidthToFit() virtual int GetBestFittingWidth(unsigned int WXUNUSED(idx)) const { return -1; } private: // functions implementing our public API void DoInsert(const wxHeaderColumnSimple& col, unsigned int idx); void DoDelete(unsigned int idx); void DoShowColumn(unsigned int idx, bool show); void DoShowSortIndicator(unsigned int idx, bool ascending); // common part of all ctors void Init(); // bring the column count in sync with the number of columns we store void UpdateColumnCount() { SetColumnCount(static_cast<int>(m_cols.size())); } // all our current columns typedef wxVector<wxHeaderColumnSimple> Columns; Columns m_cols; // the column currently used for sorting or -1 if none unsigned int m_sortKey; wxDECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple); }; // ---------------------------------------------------------------------------- // wxHeaderCtrl events // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxHeaderCtrlEvent : public wxNotifyEvent { public: wxHeaderCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) : wxNotifyEvent(commandType, winid), m_col(-1), m_width(0), m_order(static_cast<unsigned int>(-1)) { } wxHeaderCtrlEvent(const wxHeaderCtrlEvent& event) : wxNotifyEvent(event), m_col(event.m_col), m_width(event.m_width), m_order(event.m_order) { } // the column which this event pertains to: valid for all header events int GetColumn() const { return m_col; } void SetColumn(int col) { m_col = col; } // the width of the column: valid for column resizing/dragging events only int GetWidth() const { return m_width; } void SetWidth(int width) { m_width = width; } // the new position of the column: for end reorder events only unsigned int GetNewOrder() const { return m_order; } void SetNewOrder(unsigned int order) { m_order = order; } virtual wxEvent *Clone() const wxOVERRIDE { return new wxHeaderCtrlEvent(*this); } protected: // the column affected by the event int m_col; // the current width for the dragging events int m_width; // the new column position for end reorder event unsigned int m_order; private: wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHeaderCtrlEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_CLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_CLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_CLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DCLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_DCLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_DCLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_SEPARATOR_DCLICK, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_RESIZE, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RESIZING, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_RESIZE, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_REORDER, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_REORDER, wxHeaderCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DRAGGING_CANCELLED, wxHeaderCtrlEvent ); typedef void (wxEvtHandler::*wxHeaderCtrlEventFunction)(wxHeaderCtrlEvent&); #define wxHeaderCtrlEventHandler(func) \ wxEVENT_HANDLER_CAST(wxHeaderCtrlEventFunction, func) #define wx__DECLARE_HEADER_EVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_HEADER_ ## evt, id, wxHeaderCtrlEventHandler(fn)) #define EVT_HEADER_CLICK(id, fn) wx__DECLARE_HEADER_EVT(CLICK, id, fn) #define EVT_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_CLICK, id, fn) #define EVT_HEADER_MIDDLE_CLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_CLICK, id, fn) #define EVT_HEADER_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(DCLICK, id, fn) #define EVT_HEADER_RIGHT_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_DCLICK, id, fn) #define EVT_HEADER_MIDDLE_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_DCLICK, id, fn) #define EVT_HEADER_SEPARATOR_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(SEPARATOR_DCLICK, id, fn) #define EVT_HEADER_BEGIN_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_RESIZE, id, fn) #define EVT_HEADER_RESIZING(id, fn) wx__DECLARE_HEADER_EVT(RESIZING, id, fn) #define EVT_HEADER_END_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(END_RESIZE, id, fn) #define EVT_HEADER_BEGIN_REORDER(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_REORDER, id, fn) #define EVT_HEADER_END_REORDER(id, fn) wx__DECLARE_HEADER_EVT(END_REORDER, id, fn) #define EVT_HEADER_DRAGGING_CANCELLED(id, fn) wx__DECLARE_HEADER_EVT(DRAGGING_CANCELLED, id, fn) // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_HEADER_CLICK wxEVT_HEADER_CLICK #define wxEVT_COMMAND_HEADER_RIGHT_CLICK wxEVT_HEADER_RIGHT_CLICK #define wxEVT_COMMAND_HEADER_MIDDLE_CLICK wxEVT_HEADER_MIDDLE_CLICK #define wxEVT_COMMAND_HEADER_DCLICK wxEVT_HEADER_DCLICK #define wxEVT_COMMAND_HEADER_RIGHT_DCLICK wxEVT_HEADER_RIGHT_DCLICK #define wxEVT_COMMAND_HEADER_MIDDLE_DCLICK wxEVT_HEADER_MIDDLE_DCLICK #define wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK wxEVT_HEADER_SEPARATOR_DCLICK #define wxEVT_COMMAND_HEADER_BEGIN_RESIZE wxEVT_HEADER_BEGIN_RESIZE #define wxEVT_COMMAND_HEADER_RESIZING wxEVT_HEADER_RESIZING #define wxEVT_COMMAND_HEADER_END_RESIZE wxEVT_HEADER_END_RESIZE #define wxEVT_COMMAND_HEADER_BEGIN_REORDER wxEVT_HEADER_BEGIN_REORDER #define wxEVT_COMMAND_HEADER_END_REORDER wxEVT_HEADER_END_REORDER #define wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED wxEVT_HEADER_DRAGGING_CANCELLED #endif // wxUSE_HEADERCTRL #endif // _WX_HEADERCTRL_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/systhemectrl.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/systhemectrl.h // Purpose: Class to make controls appear in the systems theme // Author: Tobias Taschner // Created: 2014-08-14 // Copyright: (c) 2014 wxWidgets development team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SYSTHEMECTRL_H #define _WX_SYSTHEMECTRL_H #include "wx/defs.h" #if defined(__WXMSW__) && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__) #define wxHAS_SYSTEM_THEMED_CONTROL #endif class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_CORE wxSystemThemedControlBase { public: wxSystemThemedControlBase() { } virtual ~wxSystemThemedControlBase() { } protected: // This method is virtual and can be overridden, e.g. composite controls do // it to enable the system theme for all of their parts. virtual void DoEnableSystemTheme #ifdef wxHAS_SYSTEM_THEMED_CONTROL // Only __WXMSW__ has a non-trivial implementation currently. (bool enable, wxWindow* window); #else (bool WXUNUSED(enable), wxWindow* WXUNUSED(window)) { } #endif // wxHAS_SYSTEM_THEMED_CONTROL wxDECLARE_NO_COPY_CLASS(wxSystemThemedControlBase); }; // This class used CRTP, i.e. it should be instantiated for the real base class // and inherited from. template <class C> class wxSystemThemedControl : public C, public wxSystemThemedControlBase { public: wxSystemThemedControl() { } void EnableSystemTheme(bool enable = true) { DoEnableSystemTheme(enable, this); } protected: wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxSystemThemedControl, C); }; #endif // _WX_SYSTHEMECTRL_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/strvararg.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/strvararg.h // Purpose: macros for implementing type-safe vararg passing of strings // Author: Vaclav Slavik // Created: 2007-02-19 // Copyright: (c) 2007 REA Elektronik GmbH // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_STRVARARG_H_ #define _WX_STRVARARG_H_ #include "wx/platform.h" #include "wx/cpp.h" #include "wx/chartype.h" #include "wx/strconv.h" #include "wx/buffer.h" #include "wx/unichar.h" #if defined(HAVE_TYPE_TRAITS) #include <type_traits> #elif defined(HAVE_TR1_TYPE_TRAITS) #ifdef __VISUALC__ #include <type_traits> #else #include <tr1/type_traits> #endif #endif class WXDLLIMPEXP_FWD_BASE wxCStrData; class WXDLLIMPEXP_FWD_BASE wxString; // ---------------------------------------------------------------------------- // WX_DEFINE_VARARG_FUNC* macros // ---------------------------------------------------------------------------- // This macro is used to implement type-safe wrappers for variadic functions // that accept strings as arguments. This makes it possible to pass char*, // wchar_t* or even wxString (as opposed to having to use wxString::c_str()) // to e.g. wxPrintf(). // // This is done by defining a set of N template function taking 1..N arguments // (currently, N is set to 30 in this header). These functions are just thin // wrappers around another variadic function ('impl' or 'implUtf8' arguments, // see below) and the only thing the wrapper does is that it normalizes the // arguments passed in so that they are of the type expected by variadic // functions taking string arguments, i.e., char* or wchar_t*, depending on the // build: // * char* in the current locale's charset in ANSI build // * char* with UTF-8 encoding if wxUSE_UNICODE_UTF8 and the app is running // under an UTF-8 locale // * wchar_t* if wxUSE_UNICODE_WCHAR or if wxUSE_UNICODE_UTF8 and the current // locale is not UTF-8 // // Note that wxFormatString *must* be used for the format parameter of these // functions, otherwise the implementation won't work correctly. Furthermore, // it must be passed by value, not reference, because it's modified by the // vararg templates internally. // // Parameters: // [ there are examples in square brackets showing values of the parameters // for the wxFprintf() wrapper for fprintf() function with the following // prototype: // int wxFprintf(FILE *stream, const wxString& format, ...); ] // // rettype Functions' return type [int] // name Name of the function [fprintf] // numfixed The number of leading "fixed" (i.e., not variadic) // arguments of the function (e.g. "stream" and "format" // arguments of fprintf()); their type is _not_ converted // using wxArgNormalizer<T>, unlike the rest of // the function's arguments [2] // fixed List of types of the leading "fixed" arguments, in // parenthesis [(FILE*,const wxString&)] // impl Name of the variadic function that implements 'name' for // the native strings representation (wchar_t* if // wxUSE_UNICODE_WCHAR or wxUSE_UNICODE_UTF8 when running under // non-UTF8 locale, char* in ANSI build) [wxCrt_Fprintf] // implUtf8 Like 'impl', but for the UTF-8 char* version to be used // if wxUSE_UNICODE_UTF8 and running under UTF-8 locale // (ignored otherwise) [fprintf] // #define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl, implUtf8) \ _WX_VARARG_DEFINE_FUNC_N0(rettype, name, impl, implUtf8, numfixed, fixed) \ WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8) // ditto, but without the version with 0 template/vararg arguments #define WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, \ numfixed, fixed, impl, implUtf8) \ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ _WX_VARARG_DEFINE_FUNC, \ rettype, name, impl, implUtf8, numfixed, fixed) // Like WX_DEFINE_VARARG_FUNC, but for variadic functions that don't return // a value. #define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl, implUtf8) \ _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ _WX_VARARG_DEFINE_FUNC_VOID, \ void, name, impl, implUtf8, numfixed, fixed) // Like WX_DEFINE_VARARG_FUNC_VOID, but instead of wrapping an implementation // function, does nothing in defined functions' bodies. // // Used to implement wxLogXXX functions if wxUSE_LOG=0. #define WX_DEFINE_VARARG_FUNC_NOP(name, numfixed, fixed) \ _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ _WX_VARARG_DEFINE_FUNC_NOP, \ void, name, dummy, dummy, numfixed, fixed) // Like WX_DEFINE_VARARG_FUNC_CTOR, but for defining template constructors #define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl, implUtf8) \ _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \ _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ _WX_VARARG_DEFINE_FUNC_CTOR, \ void, name, impl, implUtf8, numfixed, fixed) // ---------------------------------------------------------------------------- // wxFormatString // ---------------------------------------------------------------------------- // This class must be used for format string argument of the functions // defined using WX_DEFINE_VARARG_FUNC_* macros. It converts the string to // char* or wchar_t* for passing to implementation function efficiently (i.e. // without keeping the converted string in memory for longer than necessary, // like c_str()). It also converts format string to the correct form that // accounts for string changes done by wxArgNormalizer<> // // Note that this class can _only_ be used for function arguments! class WXDLLIMPEXP_BASE wxFormatString { public: wxFormatString(const char *str) : m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} wxFormatString(const wchar_t *str) : m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} wxFormatString(const wxString& str) : m_str(&str), m_cstr(NULL) {} wxFormatString(const wxCStrData& str) : m_str(NULL), m_cstr(&str) {} wxFormatString(const wxScopedCharBuffer& str) : m_char(str), m_str(NULL), m_cstr(NULL) {} wxFormatString(const wxScopedWCharBuffer& str) : m_wchar(str), m_str(NULL), m_cstr(NULL) {} // Possible argument types. These are or-combinable for wxASSERT_ARG_TYPE // convenience. Some of the values are or-combined with another value, this // expresses "supertypes" for use with wxASSERT_ARG_TYPE masks. For example, // a char* string is also a pointer and an integer is also a char. enum ArgumentType { Arg_Unused = 0, // not used at all; the value of 0 is chosen to // conveniently pass wxASSERT_ARG_TYPE's check Arg_Char = 0x0001, // character as char %c Arg_Pointer = 0x0002, // %p Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too) Arg_Int = 0x0008 | Arg_Char, // (ints can be used with %c) #if SIZEOF_INT == SIZEOF_LONG Arg_LongInt = Arg_Int, #else Arg_LongInt = 0x0010, #endif #if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == SIZEOF_LONG Arg_LongLongInt = Arg_LongInt, #elif defined(wxLongLong_t) Arg_LongLongInt = 0x0020, #endif Arg_Double = 0x0040, Arg_LongDouble = 0x0080, #if defined(wxSIZE_T_IS_UINT) Arg_Size_t = Arg_Int, #elif defined(wxSIZE_T_IS_ULONG) Arg_Size_t = Arg_LongInt, #elif defined(SIZEOF_LONG_LONG) && SIZEOF_SIZE_T == SIZEOF_LONG_LONG Arg_Size_t = Arg_LongLongInt, #else Arg_Size_t = 0x0100, #endif Arg_IntPtr = 0x0200, // %n -- store # of chars written Arg_ShortIntPtr = 0x0400, Arg_LongIntPtr = 0x0800, Arg_Unknown = 0x8000 // unrecognized specifier (likely error) }; // returns the type of format specifier for n-th variadic argument (this is // not necessarily n-th format specifier if positional specifiers are used); // called by wxArgNormalizer<> specializations to get information about // n-th variadic argument desired representation ArgumentType GetArgumentType(unsigned n) const; // returns the value passed to ctor, only converted to wxString, similarly // to other InputAsXXX() methods wxString InputAsString() const; #if !wxUSE_UNICODE_WCHAR operator const char*() const { return const_cast<wxFormatString*>(this)->AsChar(); } private: // InputAsChar() returns the value passed to ctor, only converted // to char, while AsChar() takes the string returned by InputAsChar() // and does format string conversion on it as well (and similarly for // ..AsWChar() below) const char* InputAsChar(); const char* AsChar(); wxScopedCharBuffer m_convertedChar; #endif // !wxUSE_UNICODE_WCHAR #if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY public: operator const wchar_t*() const { return const_cast<wxFormatString*>(this)->AsWChar(); } private: const wchar_t* InputAsWChar(); const wchar_t* AsWChar(); wxScopedWCharBuffer m_convertedWChar; #endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY private: wxScopedCharBuffer m_char; wxScopedWCharBuffer m_wchar; // NB: we can use a pointer here, because wxFormatString is only used // as function argument, so it has shorter life than the string // passed to the ctor const wxString * const m_str; const wxCStrData * const m_cstr; wxDECLARE_NO_ASSIGN_CLASS(wxFormatString); }; // these two helper classes are used to find wxFormatString argument among fixed // arguments passed to a vararg template struct wxFormatStringArgument { wxFormatStringArgument(const wxFormatString *s = NULL) : m_str(s) {} const wxFormatString *m_str; // overriding this operator allows us to reuse _WX_VARARG_JOIN macro wxFormatStringArgument operator,(const wxFormatStringArgument& a) const { wxASSERT_MSG( m_str == NULL || a.m_str == NULL, "can't have two format strings in vararg function" ); return wxFormatStringArgument(m_str ? m_str : a.m_str); } operator const wxFormatString*() const { return m_str; } }; template<typename T> struct wxFormatStringArgumentFinder { static wxFormatStringArgument find(T) { // by default, arguments are not format strings, so return "not found" return wxFormatStringArgument(); } }; template<> struct wxFormatStringArgumentFinder<const wxFormatString&> { static wxFormatStringArgument find(const wxFormatString& arg) { return wxFormatStringArgument(&arg); } }; template<> struct wxFormatStringArgumentFinder<wxFormatString> : public wxFormatStringArgumentFinder<const wxFormatString&> {}; // avoid passing big objects by value to wxFormatStringArgumentFinder::find() // (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!): template<> struct wxFormatStringArgumentFinder<wxString> : public wxFormatStringArgumentFinder<const wxString&> {}; template<> struct wxFormatStringArgumentFinder<wxScopedCharBuffer> : public wxFormatStringArgumentFinder<const wxScopedCharBuffer&> {}; template<> struct wxFormatStringArgumentFinder<wxScopedWCharBuffer> : public wxFormatStringArgumentFinder<const wxScopedWCharBuffer&> {}; template<> struct wxFormatStringArgumentFinder<wxCharBuffer> : public wxFormatStringArgumentFinder<const wxCharBuffer&> {}; template<> struct wxFormatStringArgumentFinder<wxWCharBuffer> : public wxFormatStringArgumentFinder<const wxWCharBuffer&> {}; // ---------------------------------------------------------------------------- // wxArgNormalizer*<T> converters // ---------------------------------------------------------------------------- #if wxDEBUG_LEVEL // Check that the format specifier for index-th argument in 'fmt' has // the correct type (one of wxFormatString::Arg_XXX or-combination in // 'expected_mask'). #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \ wxSTATEMENT_MACRO_BEGIN \ if ( !fmt ) \ break; \ const int argtype = fmt->GetArgumentType(index); \ wxASSERT_MSG( (argtype & (expected_mask)) == argtype, \ "format specifier doesn't match argument type" ); \ wxSTATEMENT_MACRO_END #else // Just define it to suppress "unused parameter" warnings for the // parameters which we don't use otherwise #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \ wxUnusedVar(fmt); \ wxUnusedVar(index) #endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL #if defined(HAVE_TYPE_TRAITS) || defined(HAVE_TR1_TYPE_TRAITS) // Note: this type is misnamed, so that the error message is easier to // understand (no error happens for enums, because the IsEnum=true case is // specialized). template<bool IsEnum> struct wxFormatStringSpecifierNonPodType {}; template<> struct wxFormatStringSpecifierNonPodType<true> { enum { value = wxFormatString::Arg_Int }; }; template<typename T> struct wxFormatStringSpecifier { #ifdef HAVE_TYPE_TRAITS typedef std::is_enum<T> is_enum; #elif defined HAVE_TR1_TYPE_TRAITS typedef std::tr1::is_enum<T> is_enum; #endif enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value }; }; #else // !HAVE_(TR1_)TYPE_TRAITS template<typename T> struct wxFormatStringSpecifier { // We can't detect enums without is_enum, so the only thing we can // do is to accept unknown types. However, the only acceptable unknown // types still are enums, which are promoted to ints, so return Arg_Int // here. This will at least catch passing of non-POD types through ... at // runtime. // // Furthermore, if the compiler doesn't have partial template // specialization, we didn't cover pointers either. enum { value = wxFormatString::Arg_Int }; }; #endif // HAVE_TR1_TYPE_TRAITS/!HAVE_TR1_TYPE_TRAITS template<typename T> struct wxFormatStringSpecifier<T*> { enum { value = wxFormatString::Arg_Pointer }; }; template<typename T> struct wxFormatStringSpecifier<const T*> { enum { value = wxFormatString::Arg_Pointer }; }; #define wxFORMAT_STRING_SPECIFIER(T, arg) \ template<> struct wxFormatStringSpecifier<T> \ { \ enum { value = arg }; \ }; wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(short int, wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(short unsigned int, wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(long int, wxFormatString::Arg_LongInt) wxFORMAT_STRING_SPECIFIER(long unsigned int, wxFormatString::Arg_LongInt) #ifdef wxLongLong_t wxFORMAT_STRING_SPECIFIER(wxLongLong_t, wxFormatString::Arg_LongLongInt) wxFORMAT_STRING_SPECIFIER(wxULongLong_t, wxFormatString::Arg_LongLongInt) #endif wxFORMAT_STRING_SPECIFIER(float, wxFormatString::Arg_Double) wxFORMAT_STRING_SPECIFIER(double, wxFormatString::Arg_Double) wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble) #if wxWCHAR_T_IS_REAL_TYPE wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int) #endif #if !wxUSE_UNICODE wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) #endif wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String) wxFORMAT_STRING_SPECIFIER(int*, wxFormatString::Arg_IntPtr | wxFormatString::Arg_Pointer) wxFORMAT_STRING_SPECIFIER(short int*, wxFormatString::Arg_ShortIntPtr | wxFormatString::Arg_Pointer) wxFORMAT_STRING_SPECIFIER(long int*, wxFormatString::Arg_LongIntPtr | wxFormatString::Arg_Pointer) #undef wxFORMAT_STRING_SPECIFIER // Converts an argument passed to wxPrint etc. into standard form expected, // by wxXXX functions, e.g. all strings (wxString, char*, wchar_t*) are // converted into wchar_t* or char* depending on the build. template<typename T> struct wxArgNormalizer { // Ctor. 'value' is the value passed as variadic argument, 'fmt' is pointer // to printf-like format string or NULL if the variadic function doesn't // use format string and 'index' is index of 'value' in variadic arguments // list (starting at 1) wxArgNormalizer(T value, const wxFormatString *fmt, unsigned index) : m_value(value) { wxASSERT_ARG_TYPE( fmt, index, wxFormatStringSpecifier<T>::value ); } // Returns the value in a form that can be safely passed to real vararg // functions. In case of strings, this is char* in ANSI build and wchar_t* // in Unicode build. T get() const { return m_value; } T m_value; }; // normalizer for passing arguments to functions working with wchar_t* (and // until ANSI build is removed, char* in ANSI build as well - FIXME-UTF8) // string representation #if !wxUSE_UTF8_LOCALE_ONLY template<typename T> struct wxArgNormalizerWchar : public wxArgNormalizer<T> { wxArgNormalizerWchar(T value, const wxFormatString *fmt, unsigned index) : wxArgNormalizer<T>(value, fmt, index) {} }; #endif // !wxUSE_UTF8_LOCALE_ONLY // normalizer for passing arguments to functions working with UTF-8 encoded // char* strings #if wxUSE_UNICODE_UTF8 template<typename T> struct wxArgNormalizerUtf8 : public wxArgNormalizer<T> { wxArgNormalizerUtf8(T value, const wxFormatString *fmt, unsigned index) : wxArgNormalizer<T>(value, fmt, index) {} }; #define wxArgNormalizerNative wxArgNormalizerUtf8 #else // wxUSE_UNICODE_WCHAR #define wxArgNormalizerNative wxArgNormalizerWchar #endif // wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_UTF8 // special cases for converting strings: // base class for wxArgNormalizer<T> specializations that need to do conversion; // CharType is either wxStringCharType or wchar_t in UTF-8 build when wrapping // widechar CRT function template<typename CharType> struct wxArgNormalizerWithBuffer { typedef wxScopedCharTypeBuffer<CharType> CharBuffer; wxArgNormalizerWithBuffer() {} wxArgNormalizerWithBuffer(const CharBuffer& buf, const wxFormatString *fmt, unsigned index) : m_value(buf) { wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); } const CharType *get() const { return m_value; } CharBuffer m_value; }; // string objects: template<> struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxString&> { wxArgNormalizerNative(const wxString& s, const wxFormatString *fmt, unsigned index) : m_value(s) { wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); } const wxStringCharType *get() const; const wxString& m_value; }; // c_str() values: template<> struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxCStrData&> { wxArgNormalizerNative(const wxCStrData& value, const wxFormatString *fmt, unsigned index) : m_value(value) { wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); } const wxStringCharType *get() const; const wxCStrData& m_value; }; // wxString/wxCStrData conversion to wchar_t* value #if wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY template<> struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxString&> : public wxArgNormalizerWithBuffer<wchar_t> { wxArgNormalizerWchar(const wxString& s, const wxFormatString *fmt, unsigned index); }; template<> struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxCStrData&> : public wxArgNormalizerWithBuffer<wchar_t> { wxArgNormalizerWchar(const wxCStrData& s, const wxFormatString *fmt, unsigned index); }; #endif // wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY // C string pointers of the wrong type (wchar_t* for ANSI or UTF8 build, // char* for wchar_t Unicode build or UTF8): #if wxUSE_UNICODE_WCHAR template<> struct wxArgNormalizerWchar<const char*> : public wxArgNormalizerWithBuffer<wchar_t> { wxArgNormalizerWchar(const char* s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {} }; #elif wxUSE_UNICODE_UTF8 template<> struct wxArgNormalizerUtf8<const wchar_t*> : public wxArgNormalizerWithBuffer<char> { wxArgNormalizerUtf8(const wchar_t* s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerWithBuffer<char>(wxConvUTF8.cWC2MB(s), fmt, index) {} }; template<> struct wxArgNormalizerUtf8<const char*> : public wxArgNormalizerWithBuffer<char> { wxArgNormalizerUtf8(const char* s, const wxFormatString *fmt, unsigned index) { wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); if ( wxLocaleIsUtf8 ) { m_value = wxScopedCharBuffer::CreateNonOwned(s); } else { // convert to widechar string first: wxScopedWCharBuffer buf(wxConvLibc.cMB2WC(s)); // then to UTF-8: if ( buf ) m_value = wxConvUTF8.cWC2MB(buf); } } }; // UTF-8 build needs conversion to wchar_t* too: #if !wxUSE_UTF8_LOCALE_ONLY template<> struct wxArgNormalizerWchar<const char*> : public wxArgNormalizerWithBuffer<wchar_t> { wxArgNormalizerWchar(const char* s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {} }; #endif // !wxUSE_UTF8_LOCALE_ONLY #else // ANSI - FIXME-UTF8 template<> struct wxArgNormalizerWchar<const wchar_t*> : public wxArgNormalizerWithBuffer<char> { wxArgNormalizerWchar(const wchar_t* s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerWithBuffer<char>(wxConvLibc.cWC2MB(s), fmt, index) {} }; #endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI // this macro is used to implement specialization that are exactly same as // some other specialization, i.e. to "forward" the implementation (e.g. for // T=wxString and T=const wxString&). Note that the ctor takes BaseT argument, // not T! #if wxUSE_UNICODE_UTF8 #if wxUSE_UTF8_LOCALE_ONLY #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT) #else // possibly non-UTF8 locales #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT); \ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT) #endif #else // wxUSE_UNICODE_WCHAR #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT) #endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR #define _WX_ARG_NORMALIZER_FORWARD_IMPL(Normalizer, T, BaseT) \ template<> \ struct Normalizer<T> : public Normalizer<BaseT> \ { \ Normalizer(BaseT value, \ const wxFormatString *fmt, unsigned index) \ : Normalizer<BaseT>(value, fmt, index) {} \ } // non-reference versions of specializations for string objects WX_ARG_NORMALIZER_FORWARD(wxString, const wxString&); WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&); // versions for passing non-const pointers: WX_ARG_NORMALIZER_FORWARD(char*, const char*); WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*); // versions for passing wx[W]CharBuffer: WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*); WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*); WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*); WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*); WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*); WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*); WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*); WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*); // versions for std::[w]string: #if wxUSE_STD_STRING #include "wx/stringimpl.h" #if !wxUSE_UTF8_LOCALE_ONLY template<> struct wxArgNormalizerWchar<const std::string&> : public wxArgNormalizerWchar<const char*> { wxArgNormalizerWchar(const std::string& s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerWchar<const char*>(s.c_str(), fmt, index) {} }; template<> struct wxArgNormalizerWchar<const wxStdWideString&> : public wxArgNormalizerWchar<const wchar_t*> { wxArgNormalizerWchar(const wxStdWideString& s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerWchar<const wchar_t*>(s.c_str(), fmt, index) {} }; #endif // !wxUSE_UTF8_LOCALE_ONLY #if wxUSE_UNICODE_UTF8 template<> struct wxArgNormalizerUtf8<const std::string&> : public wxArgNormalizerUtf8<const char*> { wxArgNormalizerUtf8(const std::string& s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerUtf8<const char*>(s.c_str(), fmt, index) {} }; template<> struct wxArgNormalizerUtf8<const wxStdWideString&> : public wxArgNormalizerUtf8<const wchar_t*> { wxArgNormalizerUtf8(const wxStdWideString& s, const wxFormatString *fmt, unsigned index) : wxArgNormalizerUtf8<const wchar_t*>(s.c_str(), fmt, index) {} }; #endif // wxUSE_UNICODE_UTF8 WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&); WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&); #endif // wxUSE_STD_STRING // versions for wxUniChar, wxUniCharRef: // (this is same for UTF-8 and Wchar builds, we just convert to wchar_t) template<> struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t> { wxArgNormalizer(const wxUniChar& s, const wxFormatString *fmt, unsigned index) : wxArgNormalizer<wchar_t>(wx_truncate_cast(wchar_t, s.GetValue()), fmt, index) {} }; // for wchar_t, default handler does the right thing // char has to be treated differently in Unicode builds: a char argument may // be used either for a character value (which should be converted into // wxUniChar) or as an integer value (which should be left as-is). We take // advantage of the fact that both char and wchar_t are converted into int // in variadic arguments here. #if wxUSE_UNICODE template<typename T> struct wxArgNormalizerNarrowChar { wxArgNormalizerNarrowChar(T value, const wxFormatString *fmt, unsigned index) { wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_Char | wxFormatString::Arg_Int ); // FIXME-UTF8: which one is better default in absence of fmt string // (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)? if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char ) m_value = wx_truncate_cast(T, wxUniChar(value).GetValue()); else m_value = value; } int get() const { return m_value; } T m_value; }; template<> struct wxArgNormalizer<char> : public wxArgNormalizerNarrowChar<char> { wxArgNormalizer(char value, const wxFormatString *fmt, unsigned index) : wxArgNormalizerNarrowChar<char>(value, fmt, index) {} }; template<> struct wxArgNormalizer<unsigned char> : public wxArgNormalizerNarrowChar<unsigned char> { wxArgNormalizer(unsigned char value, const wxFormatString *fmt, unsigned index) : wxArgNormalizerNarrowChar<unsigned char>(value, fmt, index) {} }; template<> struct wxArgNormalizer<signed char> : public wxArgNormalizerNarrowChar<signed char> { wxArgNormalizer(signed char value, const wxFormatString *fmt, unsigned index) : wxArgNormalizerNarrowChar<signed char>(value, fmt, index) {} }; #endif // wxUSE_UNICODE // convert references: WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&); WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&); WX_ARG_NORMALIZER_FORWARD(wxUniCharRef, const wxUniChar&); WX_ARG_NORMALIZER_FORWARD(const wchar_t&, wchar_t); WX_ARG_NORMALIZER_FORWARD(const char&, char); WX_ARG_NORMALIZER_FORWARD(const unsigned char&, unsigned char); WX_ARG_NORMALIZER_FORWARD(const signed char&, signed char); #undef WX_ARG_NORMALIZER_FORWARD #undef _WX_ARG_NORMALIZER_FORWARD_IMPL // NB: Don't #undef wxASSERT_ARG_TYPE here as it's also used in wx/longlong.h. // ---------------------------------------------------------------------------- // WX_VA_ARG_STRING // ---------------------------------------------------------------------------- // Replacement for va_arg() for use with strings in functions that accept // strings normalized by wxArgNormalizer<T>: struct WXDLLIMPEXP_BASE wxArgNormalizedString { wxArgNormalizedString(const void* ptr) : m_ptr(ptr) {} // returns true if non-NULL string was passed in bool IsValid() const { return m_ptr != NULL; } operator bool() const { return IsValid(); } // extracts the string, returns empty string if NULL was passed in wxString GetString() const; operator wxString() const; private: const void *m_ptr; }; #define WX_VA_ARG_STRING(ap) wxArgNormalizedString(va_arg(ap, const void*)) // ---------------------------------------------------------------------------- // implementation of the WX_DEFINE_VARARG_* macros // ---------------------------------------------------------------------------- // NB: The vararg emulation code is limited to 30 variadic and 4 fixed // arguments at the moment. // If you need more variadic arguments, you need to // 1) increase the value of _WX_VARARG_MAX_ARGS // 2) add _WX_VARARG_JOIN_* and _WX_VARARG_ITER_* up to the new // _WX_VARARG_MAX_ARGS value to the lists below // If you need more fixed arguments, you need to // 1) increase the value of _WX_VARARG_MAX_FIXED_ARGS // 2) add _WX_VARARG_FIXED_EXPAND_* and _WX_VARARG_FIXED_UNUSED_EXPAND_* // macros below #define _WX_VARARG_MAX_ARGS 30 #define _WX_VARARG_MAX_FIXED_ARGS 4 #define _WX_VARARG_JOIN_1(m) m(1) #define _WX_VARARG_JOIN_2(m) _WX_VARARG_JOIN_1(m), m(2) #define _WX_VARARG_JOIN_3(m) _WX_VARARG_JOIN_2(m), m(3) #define _WX_VARARG_JOIN_4(m) _WX_VARARG_JOIN_3(m), m(4) #define _WX_VARARG_JOIN_5(m) _WX_VARARG_JOIN_4(m), m(5) #define _WX_VARARG_JOIN_6(m) _WX_VARARG_JOIN_5(m), m(6) #define _WX_VARARG_JOIN_7(m) _WX_VARARG_JOIN_6(m), m(7) #define _WX_VARARG_JOIN_8(m) _WX_VARARG_JOIN_7(m), m(8) #define _WX_VARARG_JOIN_9(m) _WX_VARARG_JOIN_8(m), m(9) #define _WX_VARARG_JOIN_10(m) _WX_VARARG_JOIN_9(m), m(10) #define _WX_VARARG_JOIN_11(m) _WX_VARARG_JOIN_10(m), m(11) #define _WX_VARARG_JOIN_12(m) _WX_VARARG_JOIN_11(m), m(12) #define _WX_VARARG_JOIN_13(m) _WX_VARARG_JOIN_12(m), m(13) #define _WX_VARARG_JOIN_14(m) _WX_VARARG_JOIN_13(m), m(14) #define _WX_VARARG_JOIN_15(m) _WX_VARARG_JOIN_14(m), m(15) #define _WX_VARARG_JOIN_16(m) _WX_VARARG_JOIN_15(m), m(16) #define _WX_VARARG_JOIN_17(m) _WX_VARARG_JOIN_16(m), m(17) #define _WX_VARARG_JOIN_18(m) _WX_VARARG_JOIN_17(m), m(18) #define _WX_VARARG_JOIN_19(m) _WX_VARARG_JOIN_18(m), m(19) #define _WX_VARARG_JOIN_20(m) _WX_VARARG_JOIN_19(m), m(20) #define _WX_VARARG_JOIN_21(m) _WX_VARARG_JOIN_20(m), m(21) #define _WX_VARARG_JOIN_22(m) _WX_VARARG_JOIN_21(m), m(22) #define _WX_VARARG_JOIN_23(m) _WX_VARARG_JOIN_22(m), m(23) #define _WX_VARARG_JOIN_24(m) _WX_VARARG_JOIN_23(m), m(24) #define _WX_VARARG_JOIN_25(m) _WX_VARARG_JOIN_24(m), m(25) #define _WX_VARARG_JOIN_26(m) _WX_VARARG_JOIN_25(m), m(26) #define _WX_VARARG_JOIN_27(m) _WX_VARARG_JOIN_26(m), m(27) #define _WX_VARARG_JOIN_28(m) _WX_VARARG_JOIN_27(m), m(28) #define _WX_VARARG_JOIN_29(m) _WX_VARARG_JOIN_28(m), m(29) #define _WX_VARARG_JOIN_30(m) _WX_VARARG_JOIN_29(m), m(30) #define _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(1,a,b,c,d,e,f) #define _WX_VARARG_ITER_2(m,a,b,c,d,e,f) _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(2,a,b,c,d,e,f) #define _WX_VARARG_ITER_3(m,a,b,c,d,e,f) _WX_VARARG_ITER_2(m,a,b,c,d,e,f) m(3,a,b,c,d,e,f) #define _WX_VARARG_ITER_4(m,a,b,c,d,e,f) _WX_VARARG_ITER_3(m,a,b,c,d,e,f) m(4,a,b,c,d,e,f) #define _WX_VARARG_ITER_5(m,a,b,c,d,e,f) _WX_VARARG_ITER_4(m,a,b,c,d,e,f) m(5,a,b,c,d,e,f) #define _WX_VARARG_ITER_6(m,a,b,c,d,e,f) _WX_VARARG_ITER_5(m,a,b,c,d,e,f) m(6,a,b,c,d,e,f) #define _WX_VARARG_ITER_7(m,a,b,c,d,e,f) _WX_VARARG_ITER_6(m,a,b,c,d,e,f) m(7,a,b,c,d,e,f) #define _WX_VARARG_ITER_8(m,a,b,c,d,e,f) _WX_VARARG_ITER_7(m,a,b,c,d,e,f) m(8,a,b,c,d,e,f) #define _WX_VARARG_ITER_9(m,a,b,c,d,e,f) _WX_VARARG_ITER_8(m,a,b,c,d,e,f) m(9,a,b,c,d,e,f) #define _WX_VARARG_ITER_10(m,a,b,c,d,e,f) _WX_VARARG_ITER_9(m,a,b,c,d,e,f) m(10,a,b,c,d,e,f) #define _WX_VARARG_ITER_11(m,a,b,c,d,e,f) _WX_VARARG_ITER_10(m,a,b,c,d,e,f) m(11,a,b,c,d,e,f) #define _WX_VARARG_ITER_12(m,a,b,c,d,e,f) _WX_VARARG_ITER_11(m,a,b,c,d,e,f) m(12,a,b,c,d,e,f) #define _WX_VARARG_ITER_13(m,a,b,c,d,e,f) _WX_VARARG_ITER_12(m,a,b,c,d,e,f) m(13,a,b,c,d,e,f) #define _WX_VARARG_ITER_14(m,a,b,c,d,e,f) _WX_VARARG_ITER_13(m,a,b,c,d,e,f) m(14,a,b,c,d,e,f) #define _WX_VARARG_ITER_15(m,a,b,c,d,e,f) _WX_VARARG_ITER_14(m,a,b,c,d,e,f) m(15,a,b,c,d,e,f) #define _WX_VARARG_ITER_16(m,a,b,c,d,e,f) _WX_VARARG_ITER_15(m,a,b,c,d,e,f) m(16,a,b,c,d,e,f) #define _WX_VARARG_ITER_17(m,a,b,c,d,e,f) _WX_VARARG_ITER_16(m,a,b,c,d,e,f) m(17,a,b,c,d,e,f) #define _WX_VARARG_ITER_18(m,a,b,c,d,e,f) _WX_VARARG_ITER_17(m,a,b,c,d,e,f) m(18,a,b,c,d,e,f) #define _WX_VARARG_ITER_19(m,a,b,c,d,e,f) _WX_VARARG_ITER_18(m,a,b,c,d,e,f) m(19,a,b,c,d,e,f) #define _WX_VARARG_ITER_20(m,a,b,c,d,e,f) _WX_VARARG_ITER_19(m,a,b,c,d,e,f) m(20,a,b,c,d,e,f) #define _WX_VARARG_ITER_21(m,a,b,c,d,e,f) _WX_VARARG_ITER_20(m,a,b,c,d,e,f) m(21,a,b,c,d,e,f) #define _WX_VARARG_ITER_22(m,a,b,c,d,e,f) _WX_VARARG_ITER_21(m,a,b,c,d,e,f) m(22,a,b,c,d,e,f) #define _WX_VARARG_ITER_23(m,a,b,c,d,e,f) _WX_VARARG_ITER_22(m,a,b,c,d,e,f) m(23,a,b,c,d,e,f) #define _WX_VARARG_ITER_24(m,a,b,c,d,e,f) _WX_VARARG_ITER_23(m,a,b,c,d,e,f) m(24,a,b,c,d,e,f) #define _WX_VARARG_ITER_25(m,a,b,c,d,e,f) _WX_VARARG_ITER_24(m,a,b,c,d,e,f) m(25,a,b,c,d,e,f) #define _WX_VARARG_ITER_26(m,a,b,c,d,e,f) _WX_VARARG_ITER_25(m,a,b,c,d,e,f) m(26,a,b,c,d,e,f) #define _WX_VARARG_ITER_27(m,a,b,c,d,e,f) _WX_VARARG_ITER_26(m,a,b,c,d,e,f) m(27,a,b,c,d,e,f) #define _WX_VARARG_ITER_28(m,a,b,c,d,e,f) _WX_VARARG_ITER_27(m,a,b,c,d,e,f) m(28,a,b,c,d,e,f) #define _WX_VARARG_ITER_29(m,a,b,c,d,e,f) _WX_VARARG_ITER_28(m,a,b,c,d,e,f) m(29,a,b,c,d,e,f) #define _WX_VARARG_ITER_30(m,a,b,c,d,e,f) _WX_VARARG_ITER_29(m,a,b,c,d,e,f) m(30,a,b,c,d,e,f) #define _WX_VARARG_FIXED_EXPAND_1(t1) \ t1 f1 #define _WX_VARARG_FIXED_EXPAND_2(t1,t2) \ t1 f1, t2 f2 #define _WX_VARARG_FIXED_EXPAND_3(t1,t2,t3) \ t1 f1, t2 f2, t3 f3 #define _WX_VARARG_FIXED_EXPAND_4(t1,t2,t3,t4) \ t1 f1, t2 f2, t3 f3, t4 f4 #define _WX_VARARG_FIXED_UNUSED_EXPAND_1(t1) \ t1 WXUNUSED(f1) #define _WX_VARARG_FIXED_UNUSED_EXPAND_2(t1,t2) \ t1 WXUNUSED(f1), t2 WXUNUSED(f2) #define _WX_VARARG_FIXED_UNUSED_EXPAND_3(t1,t2,t3) \ t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3) #define _WX_VARARG_FIXED_UNUSED_EXPAND_4(t1,t2,t3,t4) \ t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3), t4 WXUNUSED(f4) #define _WX_VARARG_FIXED_TYPEDEFS_1(t1) \ typedef t1 TF1 #define _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2) \ _WX_VARARG_FIXED_TYPEDEFS_1(t1); typedef t2 TF2 #define _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3) \ _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2); typedef t3 TF3 #define _WX_VARARG_FIXED_TYPEDEFS_4(t1,t2,t3,t4) \ _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3); typedef t4 TF4 // This macro expands N-items tuple of fixed arguments types into part of // function's declaration. For example, // "_WX_VARARG_FIXED_EXPAND(3, (int, char*, int))" expands into // "int f1, char* f2, int f3". #define _WX_VARARG_FIXED_EXPAND(N, args) \ _WX_VARARG_FIXED_EXPAND_IMPL(N, args) #define _WX_VARARG_FIXED_EXPAND_IMPL(N, args) \ _WX_VARARG_FIXED_EXPAND_##N args // Ditto for unused arguments #define _WX_VARARG_FIXED_UNUSED_EXPAND(N, args) \ _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) #define _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) \ _WX_VARARG_FIXED_UNUSED_EXPAND_##N args // Declarates typedefs for fixed arguments types; i-th fixed argument types // will have TFi typedef. #define _WX_VARARG_FIXED_TYPEDEFS(N, args) \ _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) #define _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) \ _WX_VARARG_FIXED_TYPEDEFS_##N args // This macro calls another macro 'm' passed as second argument 'N' times, // with its only argument set to 1..N, and concatenates the results using // comma as separator. // // An example: // #define foo(i) x##i // // this expands to "x1,x2,x3,x4" // _WX_VARARG_JOIN(4, foo) // // // N must not be greater than _WX_VARARG_MAX_ARGS (=30). #define _WX_VARARG_JOIN(N, m) _WX_VARARG_JOIN_IMPL(N, m) #define _WX_VARARG_JOIN_IMPL(N, m) _WX_VARARG_JOIN_##N(m) // This macro calls another macro 'm' passed as second argument 'N' times, with // its first argument set to 1..N and the remaining arguments set to 'a', 'b', // 'c', 'd', 'e' and 'f'. The results are separated with whitespace in the // expansion. // // An example: // // this macro expands to: // // foo(1,a,b,c,d,e,f) // // foo(2,a,b,c,d,e,f) // // foo(3,a,b,c,d,e,f) // _WX_VARARG_ITER(3, foo, a, b, c, d, e, f) // // N must not be greater than _WX_VARARG_MAX_ARGS (=30). #define _WX_VARARG_ITER(N,m,a,b,c,d,e,f) \ _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) #define _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) \ _WX_VARARG_ITER_##N(m,a,b,c,d,e,f) // Generates code snippet for i-th "variadic" argument in vararg function's // prototype: #define _WX_VARARG_ARG(i) T##i a##i // Like _WX_VARARG_ARG_UNUSED, but outputs argument's type with WXUNUSED: #define _WX_VARARG_ARG_UNUSED(i) T##i WXUNUSED(a##i) // Generates code snippet for i-th type in vararg function's template<...>: #define _WX_VARARG_TEMPL(i) typename T##i // Generates code snippet for passing i-th argument of vararg function // wrapper to its implementation, normalizing it in the process: #define _WX_VARARG_PASS_WCHAR(i) \ wxArgNormalizerWchar<T##i>(a##i, fmt, i).get() #define _WX_VARARG_PASS_UTF8(i) \ wxArgNormalizerUtf8<T##i>(a##i, fmt, i).get() // And the same for fixed arguments, _not_ normalizing it: #define _WX_VARARG_PASS_FIXED(i) f##i #define _WX_VARARG_FIND_FMT(i) \ (wxFormatStringArgumentFinder<TF##i>::find(f##i)) #define _WX_VARARG_FORMAT_STRING(numfixed, fixed) \ _WX_VARARG_FIXED_TYPEDEFS(numfixed, fixed); \ const wxFormatString *fmt = \ (_WX_VARARG_JOIN(numfixed, _WX_VARARG_FIND_FMT)) #if wxUSE_UNICODE_UTF8 #define _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed) \ return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_UTF8)) #define _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed) \ return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED)) #endif // wxUSE_UNICODE_UTF8 #define _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) \ return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \ _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR)) #define _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) \ return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED)) #if wxUSE_UNICODE_UTF8 #if wxUSE_UTF8_LOCALE_ONLY #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_UTF8 #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_UTF8 #else // possibly non-UTF8 locales #define _WX_VARARG_DO_CALL(return_kw, impl, implUtf8, N, numfixed) \ if ( wxLocaleIsUtf8 ) \ _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed);\ else \ _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) #define _WX_VARARG_DO_CALL0(return_kw, impl, implUtf8, numfixed) \ if ( wxLocaleIsUtf8 ) \ _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed); \ else \ _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) #endif // wxUSE_UTF8_LOCALE_ONLY or not #else // wxUSE_UNICODE_WCHAR or ANSI #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_WCHAR #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_WCHAR #endif // wxUSE_UNICODE_UTF8 / wxUSE_UNICODE_WCHAR // Macro to be used with _WX_VARARG_ITER in the implementation of // WX_DEFINE_VARARG_FUNC (see its documentation for the meaning of arguments) #define _WX_VARARG_DEFINE_FUNC(N, rettype, name, \ impl, implUtf8, numfixed, fixed) \ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ { \ _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ _WX_VARARG_DO_CALL(return, impl, implUtf8, N, numfixed); \ } #define _WX_VARARG_DEFINE_FUNC_N0(rettype, name, \ impl, implUtf8, numfixed, fixed) \ inline rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ { \ _WX_VARARG_DO_CALL0(return, impl, implUtf8, numfixed); \ } // Macro to be used with _WX_VARARG_ITER in the implementation of // WX_DEFINE_VARARG_FUNC_VOID (see its documentation for the meaning of // arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's // requirements). #define _WX_VARARG_DEFINE_FUNC_VOID(N, rettype, name, \ impl, implUtf8, numfixed, fixed) \ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ { \ _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \ impl, implUtf8, N, numfixed); \ } #define _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \ inline void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ { \ _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \ impl, implUtf8, numfixed); \ } // Macro to be used with _WX_VARARG_ITER in the implementation of // WX_DEFINE_VARARG_FUNC_CTOR (see its documentation for the meaning of // arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's // requirements). #define _WX_VARARG_DEFINE_FUNC_CTOR(N, rettype, name, \ impl, implUtf8, numfixed, fixed) \ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ { \ _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \ impl, implUtf8, N, numfixed); \ } #define _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \ inline name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ { \ _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \ impl, implUtf8, numfixed); \ } // Macro to be used with _WX_VARARG_ITER in the implementation of // WX_DEFINE_VARARG_FUNC_NOP, i.e. empty stub for a disabled vararg function. // The rettype and impl arguments are ignored. #define _WX_VARARG_DEFINE_FUNC_NOP(N, rettype, name, \ impl, implUtf8, numfixed, fixed) \ template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed), \ _WX_VARARG_JOIN(N, _WX_VARARG_ARG_UNUSED)) \ {} #define _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \ inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \ {} #endif // _WX_STRVARARG_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/artprov.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/artprov.h // Purpose: wxArtProvider class // Author: Vaclav Slavik // Modified by: // Created: 18/03/2002 // Copyright: (c) Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ARTPROV_H_ #define _WX_ARTPROV_H_ #include "wx/string.h" #include "wx/bitmap.h" #include "wx/icon.h" #include "wx/iconbndl.h" class WXDLLIMPEXP_FWD_CORE wxArtProvidersList; class WXDLLIMPEXP_FWD_CORE wxArtProviderCache; class wxArtProviderModule; // ---------------------------------------------------------------------------- // Types // ---------------------------------------------------------------------------- typedef wxString wxArtClient; typedef wxString wxArtID; #define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + "_C") #define wxART_MAKE_CLIENT_ID(id) (#id "_C") #define wxART_MAKE_ART_ID_FROM_STR(id) (id) #define wxART_MAKE_ART_ID(id) (#id) // ---------------------------------------------------------------------------- // Art clients // ---------------------------------------------------------------------------- #define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) #define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) #define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) #define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) #define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) #define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) #define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON) #define wxART_LIST wxART_MAKE_CLIENT_ID(wxART_LIST) #define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) // ---------------------------------------------------------------------------- // Art IDs // ---------------------------------------------------------------------------- #define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) #define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) #define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) #define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) #define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) #define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) #define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) #define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) #define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) #define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) #define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) #define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) #define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) #define wxART_GOTO_FIRST wxART_MAKE_ART_ID(wxART_GOTO_FIRST) #define wxART_GOTO_LAST wxART_MAKE_ART_ID(wxART_GOTO_LAST) #define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) #define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE) #define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS) #define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) #define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) #define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) #define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) #define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) #define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) #define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK) #define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY) #define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM) #define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE) #define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) #define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN) #define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) #define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) #define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) #define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) #define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) #define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) #define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) #define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) #define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) #define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE) #define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY) #define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT) #define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE) #define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE) #define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW) #define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO) #define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO) #define wxART_PLUS wxART_MAKE_ART_ID(wxART_PLUS) #define wxART_MINUS wxART_MAKE_ART_ID(wxART_MINUS) #define wxART_CLOSE wxART_MAKE_ART_ID(wxART_CLOSE) #define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT) #define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) #define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) #define wxART_FULL_SCREEN wxART_MAKE_ART_ID(wxART_FULL_SCREEN) #define wxART_EDIT wxART_MAKE_ART_ID(wxART_EDIT) // ---------------------------------------------------------------------------- // wxArtProvider class // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxArtProvider : public wxObject { public: // Dtor removes the provider from providers stack if it's still on it virtual ~wxArtProvider(); // Does this platform implement native icons theme? static bool HasNativeProvider(); // Add new provider to the top of providers stack (i.e. the provider will // be queried first of all). static void Push(wxArtProvider *provider); // Add new provider to the bottom of providers stack (i.e. the provider // will be queried as the last one). static void PushBack(wxArtProvider *provider); #if WXWIN_COMPATIBILITY_2_8 // use PushBack(), it's the same thing static wxDEPRECATED( void Insert(wxArtProvider *provider) ); #endif // Remove latest added provider and delete it. static bool Pop(); // Remove provider from providers stack but don't delete it. static bool Remove(wxArtProvider *provider); // Delete the given provider and remove it from the providers stack. static bool Delete(wxArtProvider *provider); // Query the providers for bitmap with given ID and return it. Return // wxNullBitmap if no provider provides it. static wxBitmap GetBitmap(const wxArtID& id, const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize); // Query the providers for icon with given ID and return it. Return // wxNullIcon if no provider provides it. static wxIcon GetIcon(const wxArtID& id, const wxArtClient& client = wxART_OTHER, const wxSize& size = wxDefaultSize); // Helper used by GetMessageBoxIcon(): return the art id corresponding to // the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one // can be set) static wxArtID GetMessageBoxIconId(int flags); // Helper used by several generic classes: return the icon corresponding to // the standard wxICON_INFORMATION/WARNING/ERROR/QUESTION flags (only one // can be set) static wxIcon GetMessageBoxIcon(int flags) { return GetIcon(GetMessageBoxIconId(flags), wxART_MESSAGE_BOX); } // Query the providers for iconbundle with given ID and return it. Return // wxNullIconBundle if no provider provides it. static wxIconBundle GetIconBundle(const wxArtID& id, const wxArtClient& client = wxART_OTHER); // Gets native size for given 'client' or wxDefaultSize if it doesn't // have native equivalent static wxSize GetNativeSizeHint(const wxArtClient& client); // Get the size hint of an icon from a specific wxArtClient, queries // the topmost provider if platform_dependent = false static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false); // Rescale bitmap (used internally if requested size is other than the available). static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded); protected: friend class wxArtProviderModule; #if wxUSE_ARTPROVIDER_STD // Initializes default provider static void InitStdProvider(); #endif // wxUSE_ARTPROVIDER_STD // Initializes Tango-based icon provider #if wxUSE_ARTPROVIDER_TANGO static void InitTangoProvider(); #endif // wxUSE_ARTPROVIDER_TANGO // Initializes platform's native provider, if available (e.g. GTK2) static void InitNativeProvider(); // Destroy caches & all providers static void CleanUpProviders(); // Get the default size of an icon for a specific client virtual wxSize DoGetSizeHint(const wxArtClient& client) { return GetSizeHint(client, true); } // Derived classes must override CreateBitmap or CreateIconBundle // (or both) to create requested art resource. This method is called // only once per instance's lifetime for each requested wxArtID. virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), const wxArtClient& WXUNUSED(client), const wxSize& WXUNUSED(size)) { return wxNullBitmap; } virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id), const wxArtClient& WXUNUSED(client)) { return wxNullIconBundle; } private: static void CommonAddingProvider(); static wxIconBundle DoGetIconBundle(const wxArtID& id, const wxArtClient& client); private: // list of providers: static wxArtProvidersList *sm_providers; // art resources cache (so that CreateXXX is not called that often): static wxArtProviderCache *sm_cache; wxDECLARE_ABSTRACT_CLASS(wxArtProvider); }; #if !defined(__WXUNIVERSAL__) && \ ((defined(__WXGTK__) && defined(__WXGTK20__)) || defined(__WXMSW__) || \ defined(__WXMAC__)) // *some* (partial) native implementation of wxArtProvider exists; this is // not the same as wxArtProvider::HasNativeProvider()! #define wxHAS_NATIVE_ART_PROVIDER_IMPL #endif #endif // _WX_ARTPROV_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/encconv.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/encconv.h // Purpose: wxEncodingConverter class for converting between different // font encodings // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ENCCONV_H_ #define _WX_ENCCONV_H_ #include "wx/defs.h" #include "wx/object.h" #include "wx/fontenc.h" #include "wx/dynarray.h" // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- enum { wxCONVERT_STRICT, wxCONVERT_SUBSTITUTE }; enum { wxPLATFORM_CURRENT = -1, wxPLATFORM_UNIX = 0, wxPLATFORM_WINDOWS, wxPLATFORM_MAC }; // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray); //-------------------------------------------------------------------------------- // wxEncodingConverter // This class is capable of converting strings between any two // 8bit encodings/charsets. It can also convert from/to Unicode //-------------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject { public: wxEncodingConverter(); virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } // Initialize conversion. Both output or input encoding may // be wxFONTENCODING_UNICODE. // // All subsequent calls to Convert() will interpret it's argument // as a string in input_enc encoding and will output string in // output_enc encoding. // // You must call this method before calling Convert. You may call // it more than once in order to switch to another conversion // // Method affects behaviour of Convert() in case input character // cannot be converted because it does not exist in output encoding: // wxCONVERT_STRICT -- // follow behaviour of GNU Recode - just copy unconvertable // characters to output and don't change them (it's integer // value will stay the same) // wxCONVERT_SUBSTITUTE -- // try some (lossy) substitutions - e.g. replace // unconvertable latin capitals with acute by ordinary // capitals, replace en-dash or em-dash by '-' etc. // both modes guarantee that output string will have same length // as input string // // Returns false if given conversion is impossible, true otherwise // (conversion may be impossible either if you try to convert // to Unicode with non-Unicode build of wxWidgets or if input // or output encoding is not supported.) bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT); // Convert input string according to settings passed to Init. // Note that you must call Init before using Convert! bool Convert(const char* input, char* output) const; bool Convert(char* str) const { return Convert(str, str); } wxString Convert(const wxString& input) const; bool Convert(const char* input, wchar_t* output) const; bool Convert(const wchar_t* input, char* output) const; bool Convert(const wchar_t* input, wchar_t* output) const; bool Convert(wchar_t* str) const { return Convert(str, str); } // Return equivalent(s) for given font that are used // under given platform. wxPLATFORM_CURRENT means the plaform // this binary was compiled for // // Examples: // current platform enc returned value // ----------------------------------------------------- // unix CP1250 {ISO8859_2} // unix ISO8859_2 {} // windows ISO8859_2 {CP1250} // // Equivalence is defined in terms of convertibility: // 2 encodings are equivalent if you can convert text between // then without losing information (it may - and will - happen // that you lose special chars like quotation marks or em-dashes // but you shouldn't lose any diacritics and language-specific // characters when converting between equivalent encodings). // // Convert() method is not limited to converting between // equivalent encodings, it can convert between arbitrary // two encodings! // // Remember that this function does _NOT_ check for presence of // fonts in system. It only tells you what are most suitable // encodings. (It usually returns only one encoding) // // Note that argument enc itself may be present in returned array! // (so that you can -- as a side effect -- detect whether the // encoding is native for this platform or not) static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT); // Similar to GetPlatformEquivalent, but this one will return ALL // equivalent encodings, regardless the platform, including itself. static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc); // Return true if [any text in] one multibyte encoding can be // converted to another one losslessly. // // Do not call this with wxFONTENCODING_UNICODE, it doesn't make // sense (always works in one sense and always depends on the text // to convert in the other) static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut) { return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND; } private: wchar_t *m_Table; bool m_UnicodeInput, m_UnicodeOutput; bool m_JustCopy; wxDECLARE_NO_COPY_CLASS(wxEncodingConverter); }; #endif // _WX_ENCCONV_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/glcanvas.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/glcanvas.h // Purpose: wxGLCanvas base header // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_GLCANVAS_H_BASE_ #define _WX_GLCANVAS_H_BASE_ #include "wx/defs.h" #if wxUSE_GLCANVAS #include "wx/app.h" #include "wx/palette.h" #include "wx/window.h" class WXDLLIMPEXP_FWD_GL wxGLCanvas; class WXDLLIMPEXP_FWD_GL wxGLContext; // ---------------------------------------------------------------------------- // Constants for attributes list // ---------------------------------------------------------------------------- // Notice that not all implementation support options such as stereo, auxiliary // buffers, alpha channel, and accumulator buffer, use IsDisplaySupported() to // check for individual attributes support. enum { WX_GL_RGBA = 1, // use true color palette (on if no attrs specified) WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay WX_GL_DOUBLEBUFFER, // use double buffering (on if no attrs specified) WX_GL_STEREO, // use stereoscopic display WX_GL_AUX_BUFFERS, // number of auxiliary buffers WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits) WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits) WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits) WX_GL_MIN_ALPHA, // use alpha buffer with most bits (> MIN_ALPHA bits) WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32) WX_GL_STENCIL_SIZE, // bits for stencil buffer WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits) WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits) WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits) WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits) WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing) WX_GL_SAMPLES, // 4 for 2x2 antialiasing supersampling on most graphics cards WX_GL_FRAMEBUFFER_SRGB,// capability for sRGB framebuffer // Context attributes WX_GL_CORE_PROFILE, // use an OpenGL core profile WX_GL_MAJOR_VERSION, // major OpenGL version of the core profile WX_GL_MINOR_VERSION, // minor OpenGL version of the core profile wx_GL_COMPAT_PROFILE, // use compatible profile (use all versions features) WX_GL_FORWARD_COMPAT, // forward compatible context. OpenGL >= 3.0 WX_GL_ES2, // ES or ES2 context. WX_GL_DEBUG, // create a debug context WX_GL_ROBUST_ACCESS, // robustness. WX_GL_NO_RESET_NOTIFY, // never deliver notification of reset events WX_GL_LOSE_ON_RESET, // if graphics reset, all context state is lost WX_GL_RESET_ISOLATION, // protect other apps or share contexts from reset side-effects WX_GL_RELEASE_FLUSH, // on context release, flush pending commands WX_GL_RELEASE_NONE // on context release, pending commands are not flushed }; #define wxGLCanvasName wxT("GLCanvas") // ---------------------------------------------------------------------------- // wxGLAttribsBase: OpenGL rendering attributes // ---------------------------------------------------------------------------- class WXDLLIMPEXP_GL wxGLAttribsBase { public: wxGLAttribsBase() { Reset(); } // Setters void AddAttribute(int attribute) { m_GLValues.push_back(attribute); } // Search for searchVal and combine the next value with combineVal void AddAttribBits(int searchVal, int combineVal); // ARB functions necessity void SetNeedsARB(bool needsARB = true) { m_needsARB = needsARB; } // Delete contents void Reset() { m_GLValues.clear(); m_needsARB = false; } // Accessors const int* GetGLAttrs() const { return (m_GLValues.empty() || !m_GLValues[0]) ? NULL : &*m_GLValues.begin(); } int GetSize() const { return (int)(m_GLValues.size()); } // ARB function (e.g. wglCreateContextAttribsARB) is needed bool NeedsARB() const { return m_needsARB; } private: wxVector<int> m_GLValues; bool m_needsARB; }; // ---------------------------------------------------------------------------- // wxGLContextAttrs: OpenGL rendering context attributes // ---------------------------------------------------------------------------- class WXDLLIMPEXP_GL wxGLContextAttrs : public wxGLAttribsBase { public: // Setters, allowing chained calls wxGLContextAttrs& CoreProfile(); wxGLContextAttrs& MajorVersion(int val); wxGLContextAttrs& MinorVersion(int val); wxGLContextAttrs& OGLVersion(int vmayor, int vminor) { return MajorVersion(vmayor).MinorVersion(vminor); } wxGLContextAttrs& CompatibilityProfile(); wxGLContextAttrs& ForwardCompatible(); wxGLContextAttrs& ES2(); wxGLContextAttrs& DebugCtx(); wxGLContextAttrs& Robust(); wxGLContextAttrs& NoResetNotify(); wxGLContextAttrs& LoseOnReset(); wxGLContextAttrs& ResetIsolation(); wxGLContextAttrs& ReleaseFlush(int val = 1); //'int' allows future values wxGLContextAttrs& PlatformDefaults(); void EndList(); // No more values can be chained // Currently only used for X11 context creation bool x11Direct; // X11 direct render bool renderTypeRGBA; }; // ---------------------------------------------------------------------------- // wxGLAttributes: canvas configuration // ---------------------------------------------------------------------------- class WXDLLIMPEXP_GL wxGLAttributes : public wxGLAttribsBase { public: // Setters, allowing chained calls wxGLAttributes& RGBA(); wxGLAttributes& BufferSize(int val); wxGLAttributes& Level(int val); wxGLAttributes& DoubleBuffer(); wxGLAttributes& Stereo(); wxGLAttributes& AuxBuffers(int val); wxGLAttributes& MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha); wxGLAttributes& Depth(int val); wxGLAttributes& Stencil(int val); wxGLAttributes& MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha); wxGLAttributes& PlatformDefaults(); wxGLAttributes& Defaults(); wxGLAttributes& SampleBuffers(int val); wxGLAttributes& Samplers(int val); wxGLAttributes& FrameBuffersRGB(); void EndList(); // No more values can be chained // This function is undocumented and can not be chained on purpose! // To keep backwards compatibility with versions before wx3.1 we add here // the default values used in those versions for the case of NULL list. void AddDefaultsForWXBefore31(); }; // ---------------------------------------------------------------------------- // wxGLContextBase: OpenGL rendering context // ---------------------------------------------------------------------------- class WXDLLIMPEXP_GL wxGLContextBase : public wxObject { public: // The derived class should provide a ctor with this signature: // // wxGLContext(wxGLCanvas *win, // const wxGLContext *other = NULL, // const wxGLContextAttrs *ctxAttrs = NULL); // set this context as the current one virtual bool SetCurrent(const wxGLCanvas& win) const = 0; bool IsOK() { return m_isOk; } protected: bool m_isOk; }; // ---------------------------------------------------------------------------- // wxGLCanvasBase: window which can be used for OpenGL rendering // ---------------------------------------------------------------------------- class WXDLLIMPEXP_GL wxGLCanvasBase : public wxWindow { public: // default ctor doesn't initialize the window, use Create() later wxGLCanvasBase(); virtual ~wxGLCanvasBase(); /* The derived class should provide a ctor with this signature: wxGLCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxGLCanvasName, const wxPalette& palette = wxNullPalette); */ // operations // ---------- // set the given context associated with this window as the current one bool SetCurrent(const wxGLContext& context) const; // flush the back buffer (if we have it) virtual bool SwapBuffers() = 0; // accessors // --------- // check if the given attributes are supported without creating a canvas static bool IsDisplaySupported(const wxGLAttributes& dispAttrs); static bool IsDisplaySupported(const int *attribList); #if wxUSE_PALETTE const wxPalette *GetPalette() const { return &m_palette; } #endif // wxUSE_PALETTE // miscellaneous helper functions // ------------------------------ // call glcolor() for the colour with the given name, return false if // colour not found bool SetColour(const wxString& colour); // return true if the extension with given name is supported // // notice that while this function is implemented for all of GLX, WGL and // AGL the extensions names are usually not the same for different // platforms and so the code using it still usually uses conditional // compilation static bool IsExtensionSupported(const char *extension); // Get the wxGLContextAttrs object filled with the context-related values // of the list of attributes passed at ctor when no wxGLAttributes is used // as a parameter wxGLContextAttrs& GetGLCTXAttrs() { return m_GLCTXAttrs; } // deprecated methods using the implicit wxGLContext #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED( wxGLContext* GetContext() const ); wxDEPRECATED( void SetCurrent() ); wxDEPRECATED( void OnSize(wxSizeEvent& event) ); #endif // WXWIN_COMPATIBILITY_2_8 #ifdef __WXUNIVERSAL__ // resolve the conflict with wxWindowUniv::SetCurrent() virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); } #endif protected: // override this to implement SetColour() in GL_INDEX_MODE // (currently only implemented in wxX11 and wxMotif ports) virtual int GetColourIndex(const wxColour& WXUNUSED(col)) { return -1; } // check if the given extension name is present in the space-separated list // of extensions supported by the current implementation such as returned // by glXQueryExtensionsString() or glGetString(GL_EXTENSIONS) static bool IsExtensionInList(const char *list, const char *extension); // For the case of "int* attribList" at ctor is != 0 wxGLContextAttrs m_GLCTXAttrs; // Extract pixel format and context attributes. // Return false if an unknown attribute is found. static bool ParseAttribList(const int* attribList, wxGLAttributes& dispAttrs, wxGLContextAttrs* ctxAttrs = NULL); #if wxUSE_PALETTE // create default palette if we're not using RGBA mode // (not supported in most ports) virtual wxPalette CreateDefaultPalette() { return wxNullPalette; } wxPalette m_palette; #endif // wxUSE_PALETTE #if WXWIN_COMPATIBILITY_2_8 wxGLContext *m_glContext; #endif // WXWIN_COMPATIBILITY_2_8 }; // ---------------------------------------------------------------------------- // wxGLApp: a special wxApp subclass for OpenGL applications which must be used // to select a visual compatible with the given attributes // ---------------------------------------------------------------------------- class WXDLLIMPEXP_GL wxGLAppBase : public wxApp { public: wxGLAppBase() : wxApp() { } // use this in the constructor of the user-derived wxGLApp class to // determine if an OpenGL rendering context with these attributes // is available - returns true if so, false if not. virtual bool InitGLVisual(const int *attribList) = 0; }; #if defined(__WXMSW__) #include "wx/msw/glcanvas.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/glcanvas.h" #elif defined(__WXGTK20__) #include "wx/gtk/glcanvas.h" #elif defined(__WXGTK__) #include "wx/gtk1/glcanvas.h" #elif defined(__WXMAC__) #include "wx/osx/glcanvas.h" #elif defined(__WXQT__) #include "wx/qt/glcanvas.h" #else #error "wxGLCanvas not supported in this wxWidgets port" #endif // wxMac and wxMSW don't need anything extra in wxGLAppBase, so declare it here #ifndef wxGL_APP_DEFINED class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase { public: wxGLApp() : wxGLAppBase() { } virtual bool InitGLVisual(const int *attribList) wxOVERRIDE; private: wxDECLARE_DYNAMIC_CLASS(wxGLApp); }; #endif // !wxGL_APP_DEFINED // ---------------------------------------------------------------------------- // wxGLAPI: an API wrapper that allows the use of 'old' APIs even on OpenGL // platforms that don't support it natively anymore, if the APIs are available // it's a mere redirect // ---------------------------------------------------------------------------- #ifndef wxUSE_OPENGL_EMULATION #define wxUSE_OPENGL_EMULATION 0 #endif class WXDLLIMPEXP_GL wxGLAPI : public wxObject { public: wxGLAPI(); ~wxGLAPI(); static void glFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); static void glBegin(GLenum mode); static void glTexCoord2f(GLfloat s, GLfloat t); static void glVertex3f(GLfloat x, GLfloat y, GLfloat z); static void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); static void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); static void glColor3f(GLfloat r, GLfloat g, GLfloat b); static void glEnd(); }; #endif // wxUSE_GLCANVAS #endif // _WX_GLCANVAS_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/window.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/window.h // Purpose: wxWindowBase class - the interface of wxWindow // Author: Vadim Zeitlin // Modified by: Ron Lee // Created: 01/02/97 // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_WINDOW_H_BASE_ #define _WX_WINDOW_H_BASE_ // ---------------------------------------------------------------------------- // headers which we must include here // ---------------------------------------------------------------------------- #include "wx/event.h" // the base class #include "wx/list.h" // defines wxWindowList #include "wx/cursor.h" // we have member variables of these classes #include "wx/font.h" // so we can't do without them #include "wx/colour.h" #include "wx/region.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/validate.h" // for wxDefaultValidator (always include it) #if wxUSE_PALETTE #include "wx/palette.h" #endif // wxUSE_PALETTE #if wxUSE_ACCEL #include "wx/accel.h" #endif // wxUSE_ACCEL #if wxUSE_ACCESSIBILITY #include "wx/access.h" #endif // when building wxUniv/Foo we don't want the code for native menu use to be // compiled in - it should only be used when building real wxFoo #ifdef __WXUNIVERSAL__ #define wxUSE_MENUS_NATIVE 0 #else // !__WXUNIVERSAL__ #define wxUSE_MENUS_NATIVE wxUSE_MENUS #endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxCaret; class WXDLLIMPEXP_FWD_CORE wxControl; class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxDropTarget; class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; class WXDLLIMPEXP_FWD_CORE wxSizer; class WXDLLIMPEXP_FWD_CORE wxToolTip; class WXDLLIMPEXP_FWD_CORE wxWindowBase; class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxScrollHelper; #if wxUSE_ACCESSIBILITY class WXDLLIMPEXP_FWD_CORE wxAccessible; #endif // ---------------------------------------------------------------------------- // helper stuff used by wxWindow // ---------------------------------------------------------------------------- // struct containing all the visual attributes of a control struct WXDLLIMPEXP_CORE wxVisualAttributes { // the font used for control label/text inside it wxFont font; // the foreground colour wxColour colFg; // the background colour, may be wxNullColour if the controls background // colour is not solid wxColour colBg; }; // different window variants, on platforms like e.g. mac uses different // rendering sizes enum wxWindowVariant { wxWINDOW_VARIANT_NORMAL, // Normal size wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal) wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal) wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal) wxWINDOW_VARIANT_MAX }; #if wxUSE_SYSTEM_OPTIONS #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant") #endif // valid values for Show/HideWithEffect() enum wxShowEffect { wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_ROLL_TO_LEFT, wxSHOW_EFFECT_ROLL_TO_RIGHT, wxSHOW_EFFECT_ROLL_TO_TOP, wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_SLIDE_TO_LEFT, wxSHOW_EFFECT_SLIDE_TO_RIGHT, wxSHOW_EFFECT_SLIDE_TO_TOP, wxSHOW_EFFECT_SLIDE_TO_BOTTOM, wxSHOW_EFFECT_BLEND, wxSHOW_EFFECT_EXPAND, wxSHOW_EFFECT_MAX }; // Values for EnableTouchEvents() mask. enum { wxTOUCH_NONE = 0x0000, wxTOUCH_VERTICAL_PAN_GESTURE = 0x0001, wxTOUCH_HORIZONTAL_PAN_GESTURE = 0x0002, wxTOUCH_PAN_GESTURES = wxTOUCH_VERTICAL_PAN_GESTURE | wxTOUCH_HORIZONTAL_PAN_GESTURE, wxTOUCH_ZOOM_GESTURE = 0x0004, wxTOUCH_ROTATE_GESTURE = 0x0008, wxTOUCH_PRESS_GESTURES = 0x0010, wxTOUCH_ALL_GESTURES = 0x001f }; // flags for SendSizeEvent() enum { wxSEND_EVENT_POST = 1 }; // ---------------------------------------------------------------------------- // (pseudo)template list classes // ---------------------------------------------------------------------------- WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLIMPEXP_CORE); // ---------------------------------------------------------------------------- // global variables // ---------------------------------------------------------------------------- extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows; // declared here for compatibility only, main declaration is in wx/app.h extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; // ---------------------------------------------------------------------------- // wxWindowBase is the base class for all GUI controls/widgets, this is the public // interface of this class. // // Event handler: windows have themselves as their event handlers by default, // but their event handlers could be set to another object entirely. This // separation can reduce the amount of derivation required, and allow // alteration of a window's functionality (e.g. by a resource editor that // temporarily switches event handlers). // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxWindowBase : public wxEvtHandler { public: // creating the window // ------------------- // default ctor, initializes everything which can be initialized before // Create() wxWindowBase() ; virtual ~wxWindowBase(); // deleting the window // ------------------- // ask the window to close itself, return true if the event handler // honoured our request bool Close( bool force = false ); // the following functions delete the C++ objects (the window itself // or its children) as well as the GUI windows and normally should // never be used directly // delete window unconditionally (dangerous!), returns true if ok virtual bool Destroy(); // delete all children of this window, returns true if ok bool DestroyChildren(); // is the window being deleted? bool IsBeingDeleted() const; // window attributes // ----------------- // label is just the same as the title (but for, e.g., buttons it // makes more sense to speak about labels), title access // is available from wxTLW classes only (frames, dialogs) virtual void SetLabel(const wxString& label) = 0; virtual wxString GetLabel() const = 0; // the window name is used for resource setting in X, it is not the // same as the window title/label virtual void SetName( const wxString &name ) { m_windowName = name; } virtual wxString GetName() const { return m_windowName; } // sets the window variant, calls internally DoSetVariant if variant // has changed void SetWindowVariant(wxWindowVariant variant); wxWindowVariant GetWindowVariant() const { return m_windowVariant; } // get or change the layout direction (LTR or RTL) for this window, // wxLayout_Default is returned if layout direction is not supported virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; } virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { } // mirror coordinates for RTL layout if this window uses it and if the // mirroring is not done automatically like Win32 virtual wxCoord AdjustForLayoutDirection(wxCoord x, wxCoord width, wxCoord widthTotal) const; // window id uniquely identifies the window among its siblings unless // it is wxID_ANY which means "don't care" virtual void SetId( wxWindowID winid ) { m_windowId = winid; } wxWindowID GetId() const { return m_windowId; } // generate a unique id (or count of them consecutively), returns a // valid id in the auto-id range or wxID_NONE if failed. If using // autoid management, it will mark the id as reserved until it is // used (by assigning it to a wxWindowIDRef) or unreserved. static wxWindowID NewControlId(int count = 1) { return wxIdManager::ReserveId(count); } // If an ID generated from NewControlId is not assigned to a wxWindowIDRef, // it must be unreserved static void UnreserveControlId(wxWindowID id, int count = 1) { wxIdManager::UnreserveId(id, count); } // moving/resizing // --------------- // set the window size and/or position void SetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ) { DoSetSize(x, y, width, height, sizeFlags); } void SetSize( int width, int height ) { DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); } void SetSize( const wxSize& size ) { SetSize( size.x, size.y); } void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } void Move(int x, int y, int flags = wxSIZE_USE_EXISTING) { DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); } void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING) { Move(pt.x, pt.y, flags); } void SetPosition(const wxPoint& pt) { Move(pt); } // Z-order virtual void Raise() = 0; virtual void Lower() = 0; // client size is the size of area available for subwindows void SetClientSize( int width, int height ) { DoSetClientSize(width, height); } void SetClientSize( const wxSize& size ) { DoSetClientSize(size.x, size.y); } void SetClientSize(const wxRect& rect) { SetClientSize( rect.width, rect.height ); } // get the window position (pointers may be NULL): notice that it is in // client coordinates for child windows and screen coordinates for the // top level ones, use GetScreenPosition() if you need screen // coordinates for all kinds of windows void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); } wxPoint GetPosition() const { int x, y; DoGetPosition(&x, &y); return wxPoint(x, y); } // get the window position in screen coordinates void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); } wxPoint GetScreenPosition() const { int x, y; DoGetScreenPosition(&x, &y); return wxPoint(x, y); } // get the window size (pointers may be NULL) void GetSize( int *w, int *h ) const { DoGetSize(w, h); } wxSize GetSize() const { int w, h; DoGetSize(& w, & h); return wxSize(w, h); } void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); } wxSize GetClientSize() const { int w, h; DoGetClientSize(&w, &h); return wxSize(w, h); } // get the position and size at once wxRect GetRect() const { int x, y, w, h; GetPosition(&x, &y); GetSize(&w, &h); return wxRect(x, y, w, h); } wxRect GetScreenRect() const { int x, y, w, h; GetScreenPosition(&x, &y); GetSize(&w, &h); return wxRect(x, y, w, h); } // get the origin of the client area of the window relative to the // window top left corner (the client area may be shifted because of // the borders, scrollbars, other decorations...) virtual wxPoint GetClientAreaOrigin() const; // get the client rectangle in window (i.e. client) coordinates wxRect GetClientRect() const { return wxRect(GetClientAreaOrigin(), GetClientSize()); } // client<->window size conversion virtual wxSize ClientToWindowSize(const wxSize& size) const; virtual wxSize WindowToClientSize(const wxSize& size) const; // get the size best suited for the window (in fact, minimal // acceptable size using which it will still look "nice" in // most situations) wxSize GetBestSize() const; void GetBestSize(int *w, int *h) const { wxSize s = GetBestSize(); if ( w ) *w = s.x; if ( h ) *h = s.y; } // Determine the best size in the other direction if one of them is // fixed. This is used with windows that can wrap their contents and // returns input-independent best size for the others. int GetBestHeight(int width) const; int GetBestWidth(int height) const; void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; } wxScrollHelper *GetScrollHelper() { return m_scrollHelper; } // reset the cached best size value so it will be recalculated the // next time it is needed. void InvalidateBestSize(); void CacheBestSize(const wxSize& size) const { wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; } // This function will merge the window's best size into the window's // minimum size, giving priority to the min size components, and // returns the results. virtual wxSize GetEffectiveMinSize() const; #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_MSG("use GetEffectiveMinSize() instead") wxSize GetBestFittingSize() const; #endif // WXWIN_COMPATIBILITY_2_8 // A 'Smart' SetSize that will fill in default size values with 'best' // size. Sets the minsize to what was passed in. void SetInitialSize(const wxSize& size=wxDefaultSize); #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_MSG("use SetInitialSize() instead") void SetBestFittingSize(const wxSize& size=wxDefaultSize); #endif // WXWIN_COMPATIBILITY_2_8 // the generic centre function - centers the window on parent by` // default or on screen if it doesn't have parent or // wxCENTER_ON_SCREEN flag is given void Centre(int dir = wxBOTH) { DoCentre(dir); } void Center(int dir = wxBOTH) { DoCentre(dir); } // centre with respect to the parent window void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); } void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); } // set window size to wrap around its children virtual void Fit(); // set virtual size to satisfy children virtual void FitInside(); // SetSizeHints is actually for setting the size hints // for the wxTLW for a Window Manager - hence the name - // and it is therefore overridden in wxTLW to do that. // In wxWindow(Base), it has (unfortunately) been abused // to mean the same as SetMinSize() and SetMaxSize(). virtual void SetSizeHints( int minW, int minH, int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, int incW = wxDefaultCoord, int incH = wxDefaultCoord ) { DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); } void SetSizeHints( const wxSize& minSize, const wxSize& maxSize=wxDefaultSize, const wxSize& incSize=wxDefaultSize) { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); } #if WXWIN_COMPATIBILITY_2_8 // these are useless and do nothing since wxWidgets 2.9 wxDEPRECATED( virtual void SetVirtualSizeHints( int minW, int minH, int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ) ); wxDEPRECATED( void SetVirtualSizeHints( const wxSize& minSize, const wxSize& maxSize=wxDefaultSize) ); #endif // WXWIN_COMPATIBILITY_2_8 // Call these to override what GetBestSize() returns. This // method is only virtual because it is overridden in wxTLW // as a different API for SetSizeHints(). virtual void SetMinSize(const wxSize& minSize); virtual void SetMaxSize(const wxSize& maxSize); // Like Set*Size, but for client, not window, size virtual void SetMinClientSize(const wxSize& size) { SetMinSize(ClientToWindowSize(size)); } virtual void SetMaxClientSize(const wxSize& size) { SetMaxSize(ClientToWindowSize(size)); } // Override these methods to impose restrictions on min/max size. // The easier way is to call SetMinSize() and SetMaxSize() which // will have the same effect. Doing both is non-sense. virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); } virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); } // Like Get*Size, but for client, not window, size virtual wxSize GetMinClientSize() const { return WindowToClientSize(GetMinSize()); } virtual wxSize GetMaxClientSize() const { return WindowToClientSize(GetMaxSize()); } // Get the min and max values one by one int GetMinWidth() const { return GetMinSize().x; } int GetMinHeight() const { return GetMinSize().y; } int GetMaxWidth() const { return GetMaxSize().x; } int GetMaxHeight() const { return GetMaxSize().y; } // Methods for accessing the virtual size of a window. For most // windows this is just the client area of the window, but for // some like scrolled windows it is more or less independent of // the screen window size. You may override the DoXXXVirtual // methods below for classes where that is the case. void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } wxSize GetVirtualSize() const { return DoGetVirtualSize(); } void GetVirtualSize( int *x, int *y ) const { wxSize s( DoGetVirtualSize() ); if( x ) *x = s.GetWidth(); if( y ) *y = s.GetHeight(); } // Override these methods for windows that have a virtual size // independent of their client size. e.g. the virtual area of a // wxScrolledWindow. virtual void DoSetVirtualSize( int x, int y ); virtual wxSize DoGetVirtualSize() const; // Return the largest of ClientSize and BestSize (as determined // by a sizer, interior children, or other means) virtual wxSize GetBestVirtualSize() const { wxSize client( GetClientSize() ); wxSize best( GetBestSize() ); return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) ); } // returns the magnification of the content of this window // e.g. 2.0 for a window on a retina screen virtual double GetContentScaleFactor() const; // return the size of the left/right and top/bottom borders in x and y // components of the result respectively virtual wxSize GetWindowBorderSize() const; // wxSizer and friends use this to give a chance to a component to recalc // its min size once one of the final size components is known. Override // this function when that is useful (such as for wxStaticText which can // stretch over several lines). Parameter availableOtherDir // tells the item how much more space there is available in the opposite // direction (-1 if unknown). virtual bool InformFirstDirection(int direction, int size, int availableOtherDir); // sends a size event to the window using its current size -- this has an // effect of refreshing the window layout // // by default the event is sent, i.e. processed immediately, but if flags // value includes wxSEND_EVENT_POST then it's posted, i.e. only schedule // for later processing virtual void SendSizeEvent(int flags = 0); // this is a safe wrapper for GetParent()->SendSizeEvent(): it checks that // we have a parent window and it's not in process of being deleted // // this is used by controls such as tool/status bars changes to which must // also result in parent re-layout void SendSizeEventToParent(int flags = 0); // this is a more readable synonym for SendSizeEvent(wxSEND_EVENT_POST) void PostSizeEvent() { SendSizeEvent(wxSEND_EVENT_POST); } // this is the same as SendSizeEventToParent() but using PostSizeEvent() void PostSizeEventToParent() { SendSizeEventToParent(wxSEND_EVENT_POST); } // These functions should be used before repositioning the children of // this window to reduce flicker or, in MSW case, even avoid display // corruption in some situations (so they're more than just optimization). // // EndRepositioningChildren() should be called if and only if // BeginRepositioningChildren() returns true. To ensure that this is always // done automatically, use ChildrenRepositioningGuard class below. virtual bool BeginRepositioningChildren() { return false; } virtual void EndRepositioningChildren() { } // A simple helper which ensures that EndRepositioningChildren() is called // from its dtor if and only if calling BeginRepositioningChildren() from // the ctor returned true. class ChildrenRepositioningGuard { public: // Notice that window can be NULL here, for convenience. In this case // this class simply doesn't do anything. explicit ChildrenRepositioningGuard(wxWindowBase* win) : m_win(win), m_callEnd(win && win->BeginRepositioningChildren()) { } ~ChildrenRepositioningGuard() { if ( m_callEnd ) m_win->EndRepositioningChildren(); } private: wxWindowBase* const m_win; const bool m_callEnd; wxDECLARE_NO_COPY_CLASS(ChildrenRepositioningGuard); }; // window state // ------------ // returns true if window was shown/hidden, false if the nothing was // done (window was already shown/hidden) virtual bool Show( bool show = true ); bool Hide() { return Show(false); } // show or hide the window with a special effect, not implemented on // most platforms (where it is the same as Show()/Hide() respectively) // // timeout specifies how long the animation should take, in ms, the // default value of 0 means to use the default (system-dependent) value virtual bool ShowWithEffect(wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout) = 0) { return Show(); } virtual bool HideWithEffect(wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout) = 0) { return Hide(); } // returns true if window was enabled/disabled, false if nothing done virtual bool Enable( bool enable = true ); bool Disable() { return Enable(false); } virtual bool IsShown() const { return m_isShown; } // returns true if the window is really enabled and false otherwise, // whether because it had been explicitly disabled itself or because // its parent is currently disabled -- then this method returns false // whatever is the intrinsic state of this window, use IsThisEnabled(0 // to retrieve it. In other words, this relation always holds: // // IsEnabled() == IsThisEnabled() && parent.IsEnabled() // bool IsEnabled() const; // returns the internal window state independently of the parent(s) // state, i.e. the state in which the window would be if all its // parents were enabled (use IsEnabled() above to get the effective // window state) bool IsThisEnabled() const { return m_isEnabled; } // returns true if the window is visible, i.e. IsShown() returns true // if called on it and all its parents up to the first TLW virtual bool IsShownOnScreen() const; // get/set window style (setting style won't update the window and so // is only useful for internal usage) virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; } virtual long GetWindowStyleFlag() const { return m_windowStyle; } // just some (somewhat shorter) synonyms void SetWindowStyle( long style ) { SetWindowStyleFlag(style); } long GetWindowStyle() const { return GetWindowStyleFlag(); } // check if the flag is set bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; } virtual bool IsRetained() const { return HasFlag(wxRETAINED); } // turn the flag on if it had been turned off before and vice versa, // return true if the flag is currently turned on bool ToggleWindowStyle(int flag); // extra style: the less often used style bits which can't be set with // SetWindowStyleFlag() virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } long GetExtraStyle() const { return m_exStyle; } bool HasExtraStyle(int exFlag) const { return (m_exStyle & exFlag) != 0; } #if WXWIN_COMPATIBILITY_2_8 // make the window modal (all other windows unresponsive) wxDEPRECATED( virtual void MakeModal(bool modal = true) ); #endif // (primitive) theming support // --------------------------- virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; } virtual bool GetThemeEnabled() const { return m_themeEnabled; } // focus and keyboard handling // --------------------------- // set focus to this window virtual void SetFocus() = 0; // set focus to this window as the result of a keyboard action virtual void SetFocusFromKbd() { SetFocus(); } // return the window which currently has the focus or NULL static wxWindow *FindFocus(); static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; // return true if the window has focus (handles composite windows // correctly - returns true if GetMainWindowOfCompositeControl() // has focus) virtual bool HasFocus() const; // can this window have focus in principle? // // the difference between AcceptsFocus[FromKeyboard]() and CanAcceptFocus // [FromKeyboard]() is that the former functions are meant to be // overridden in the derived classes to simply return false if the // control can't have focus, while the latter are meant to be used by // this class clients and take into account the current window state virtual bool AcceptsFocus() const { return true; } // can this window or one of its children accept focus? // // usually it's the same as AcceptsFocus() but is overridden for // container windows virtual bool AcceptsFocusRecursively() const { return AcceptsFocus(); } // can this window be given focus by keyboard navigation? if not, the // only way to give it focus (provided it accepts it at all) is to // click it virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); } // Can this window be focused right now, in its current state? This // shouldn't be called at all if AcceptsFocus() returns false. // // It is a convenient helper for the various functions using it below // but also a hook allowing to override the default logic for some rare // cases (currently just wxRadioBox in wxMSW) when it's inappropriate. virtual bool CanBeFocused() const { return IsShown() && IsEnabled(); } // can this window itself have focus? bool IsFocusable() const { return AcceptsFocus() && CanBeFocused(); } // can this window have focus right now? // // if this method returns true, it means that calling SetFocus() will // put focus either to this window or one of its children, if you need // to know whether this window accepts focus itself, use IsFocusable() bool CanAcceptFocus() const { return AcceptsFocusRecursively() && CanBeFocused(); } // can this window be assigned focus from keyboard right now? bool CanAcceptFocusFromKeyboard() const { return AcceptsFocusFromKeyboard() && CanBeFocused(); } // call this when the return value of AcceptsFocus() changes virtual void SetCanFocus(bool WXUNUSED(canFocus)) { } // navigates inside this window bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward) { return DoNavigateIn(flags); } // navigates in the specified direction from this window, this is // equivalent to GetParent()->NavigateIn() bool Navigate(int flags = wxNavigationKeyEvent::IsForward) { return m_parent && ((wxWindowBase *)m_parent)->DoNavigateIn(flags); } // this function will generate the appropriate call to Navigate() if the // key event is one normally used for keyboard navigation and return true // in this case bool HandleAsNavigationKey(const wxKeyEvent& event); // move this window just before/after the specified one in tab order // (the other window must be our sibling!) void MoveBeforeInTabOrder(wxWindow *win) { DoMoveInTabOrder(win, OrderBefore); } void MoveAfterInTabOrder(wxWindow *win) { DoMoveInTabOrder(win, OrderAfter); } // parent/children relations // ------------------------- // get the list of children const wxWindowList& GetChildren() const { return m_children; } wxWindowList& GetChildren() { return m_children; } // needed just for extended runtime const wxWindowList& GetWindowChildren() const { return GetChildren() ; } // get the window before/after this one in the parents children list, // returns NULL if this is the first/last window wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); } wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); } // get the parent or the parent of the parent wxWindow *GetParent() const { return m_parent; } inline wxWindow *GetGrandParent() const; // is this window a top level one? virtual bool IsTopLevel() const; // is this window a child or grand child of this one (inside the same // TLW)? bool IsDescendant(wxWindowBase* win) const; // it doesn't really change parent, use Reparent() instead void SetParent( wxWindowBase *parent ); // change the real parent of this window, return true if the parent // was changed, false otherwise (error or newParent == oldParent) virtual bool Reparent( wxWindowBase *newParent ); // implementation mostly virtual void AddChild( wxWindowBase *child ); virtual void RemoveChild( wxWindowBase *child ); // returns true if the child is in the client area of the window, i.e. is // not scrollbar, toolbar etc. virtual bool IsClientAreaChild(const wxWindow *WXUNUSED(child)) const { return true; } // looking for windows // ------------------- // find window among the descendants of this one either by id or by // name (return NULL if not found) wxWindow *FindWindow(long winid) const; wxWindow *FindWindow(const wxString& name) const; // Find a window among any window (all return NULL if not found) static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL ); static wxWindow *FindWindowByName( const wxString& name, const wxWindow *parent = NULL ); static wxWindow *FindWindowByLabel( const wxString& label, const wxWindow *parent = NULL ); // event handler stuff // ------------------- // get the current event handler wxEvtHandler *GetEventHandler() const { return m_eventHandler; } // replace the event handler (allows to completely subclass the // window) void SetEventHandler( wxEvtHandler *handler ); // push/pop event handler: allows to chain a custom event handler to // already existing ones void PushEventHandler( wxEvtHandler *handler ); wxEvtHandler *PopEventHandler( bool deleteHandler = false ); // find the given handler in the event handler chain and remove (but // not delete) it from the event handler chain, return true if it was // found and false otherwise (this also results in an assert failure so // this function should only be called when the handler is supposed to // be there) bool RemoveEventHandler(wxEvtHandler *handler); // Process an event by calling GetEventHandler()->ProcessEvent(): this // is a straightforward replacement for ProcessEvent() itself which // shouldn't be used directly with windows as it doesn't take into // account any event handlers associated with the window bool ProcessWindowEvent(wxEvent& event) { return GetEventHandler()->ProcessEvent(event); } // Call GetEventHandler()->ProcessEventLocally(): this should be used // instead of calling ProcessEventLocally() directly on the window // itself as this wouldn't take any pushed event handlers into account // correctly bool ProcessWindowEventLocally(wxEvent& event) { return GetEventHandler()->ProcessEventLocally(event); } // Process an event by calling GetEventHandler()->ProcessEvent() and // handling any exceptions thrown by event handlers. It's mostly useful // when processing wx events when called from C code (e.g. in GTK+ // callback) when the exception wouldn't correctly propagate to // wxEventLoop. bool HandleWindowEvent(wxEvent& event) const; // disable wxEvtHandler double-linked list mechanism: virtual void SetNextHandler(wxEvtHandler *handler) wxOVERRIDE; virtual void SetPreviousHandler(wxEvtHandler *handler) wxOVERRIDE; protected: // NOTE: we change the access specifier of the following wxEvtHandler functions // so that the user won't be able to call them directly. // Calling wxWindow::ProcessEvent in fact only works when there are NO // event handlers pushed on the window. // To ensure correct operation, instead of wxWindow::ProcessEvent // you must always call wxWindow::GetEventHandler()->ProcessEvent() // or HandleWindowEvent(). // The same holds for all other wxEvtHandler functions. using wxEvtHandler::ProcessEvent; using wxEvtHandler::ProcessEventLocally; #if wxUSE_THREADS using wxEvtHandler::ProcessThreadEvent; #endif using wxEvtHandler::SafelyProcessEvent; using wxEvtHandler::ProcessPendingEvents; using wxEvtHandler::AddPendingEvent; using wxEvtHandler::QueueEvent; public: // validators // ---------- #if wxUSE_VALIDATORS // a window may have an associated validator which is used to control // user input virtual void SetValidator( const wxValidator &validator ); virtual wxValidator *GetValidator() { return m_windowValidator; } #endif // wxUSE_VALIDATORS // dialog oriented functions // ------------------------- // validate the correctness of input, return true if ok virtual bool Validate(); // transfer data between internal and GUI representations virtual bool TransferDataToWindow(); virtual bool TransferDataFromWindow(); virtual void InitDialog(); #if wxUSE_ACCEL // accelerators // ------------ virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) { m_acceleratorTable = accel; } wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } #endif // wxUSE_ACCEL #if wxUSE_HOTKEY // hot keys (system wide accelerators) // ----------------------------------- virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); virtual bool UnregisterHotKey(int hotkeyId); #endif // wxUSE_HOTKEY // translation between different units // ----------------------------------- // DPI-independent pixels, or DIPs, are pixel values for the standard // 96 DPI display, they are scaled to take the current resolution into // account (i.e. multiplied by the same factor as returned by // GetContentScaleFactor()) if necessary for the current platform. // // Currently the conversion factor is the same for all windows but this // will change with the monitor-specific resolution support in the // future, so prefer using the non-static member functions. // // Similarly, currently in practice the factor is the same in both // horizontal and vertical directions, but this could, in principle, // change too, so prefer using the overloads taking wxPoint or wxSize. static wxSize FromDIP(const wxSize& sz, const wxWindowBase* w); static wxPoint FromDIP(const wxPoint& pt, const wxWindowBase* w) { const wxSize sz = FromDIP(wxSize(pt.x, pt.y), w); return wxPoint(sz.x, sz.y); } static int FromDIP(int d, const wxWindowBase* w) { return FromDIP(wxSize(d, 0), w).x; } wxSize FromDIP(const wxSize& sz) const { return FromDIP(sz, this); } wxPoint FromDIP(const wxPoint& pt) const { return FromDIP(pt, this); } int FromDIP(int d) const { return FromDIP(d, this); } static wxSize ToDIP(const wxSize& sz, const wxWindowBase* w); static wxPoint ToDIP(const wxPoint& pt, const wxWindowBase* w) { const wxSize sz = ToDIP(wxSize(pt.x, pt.y), w); return wxPoint(sz.x, sz.y); } static int ToDIP(int d, const wxWindowBase* w) { return ToDIP(wxSize(d, 0), w).x; } wxSize ToDIP(const wxSize& sz) const { return ToDIP(sz, this); } wxPoint ToDIP(const wxPoint& pt) const { return ToDIP(pt, this); } int ToDIP(int d) const { return ToDIP(d, this); } // Dialog units are based on the size of the current font. wxPoint ConvertPixelsToDialog( const wxPoint& pt ) const; wxPoint ConvertDialogToPixels( const wxPoint& pt ) const; wxSize ConvertPixelsToDialog( const wxSize& sz ) const { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } wxSize ConvertDialogToPixels( const wxSize& sz ) const { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } // mouse functions // --------------- // move the mouse to the specified position virtual void WarpPointer(int x, int y) = 0; // start or end mouse capture, these functions maintain the stack of // windows having captured the mouse and after calling ReleaseMouse() // the mouse is not released but returns to the window which had had // captured it previously (if any) void CaptureMouse(); void ReleaseMouse(); // get the window which currently captures the mouse or NULL static wxWindow *GetCapture(); // does this window have the capture? virtual bool HasCapture() const { return (wxWindow *)this == GetCapture(); } // enable the specified touch events for this window, return false if // the requested events are not supported virtual bool EnableTouchEvents(int WXUNUSED(eventsMask)) { return false; } // painting the window // ------------------- // mark the specified rectangle (or the whole window) as "dirty" so it // will be repainted virtual void Refresh( bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL ) = 0; // a less awkward wrapper for Refresh void RefreshRect(const wxRect& rect, bool eraseBackground = true) { Refresh(eraseBackground, &rect); } // repaint all invalid areas of the window immediately virtual void Update() { } // clear the window background virtual void ClearBackground(); // freeze the window: don't redraw it until it is thawed void Freeze(); // thaw the window: redraw it after it had been frozen void Thaw(); // return true if window had been frozen and not unthawed yet bool IsFrozen() const { return m_freezeCount != 0; } // adjust DC for drawing on this window virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { } // enable or disable double buffering virtual void SetDoubleBuffered(bool WXUNUSED(on)) { } // return true if the window contents is double buffered by the system virtual bool IsDoubleBuffered() const { return false; } // the update region of the window contains the areas which must be // repainted by the program const wxRegion& GetUpdateRegion() const { return m_updateRegion; } wxRegion& GetUpdateRegion() { return m_updateRegion; } // get the update rectangle region bounding box in client coords wxRect GetUpdateClientRect() const; // these functions verify whether the given point/rectangle belongs to // (or at least intersects with) the update region virtual bool DoIsExposed( int x, int y ) const; virtual bool DoIsExposed( int x, int y, int w, int h ) const; bool IsExposed( int x, int y ) const { return DoIsExposed(x, y); } bool IsExposed( int x, int y, int w, int h ) const { return DoIsExposed(x, y, w, h); } bool IsExposed( const wxPoint& pt ) const { return DoIsExposed(pt.x, pt.y); } bool IsExposed( const wxRect& rect ) const { return DoIsExposed(rect.x, rect.y, rect.width, rect.height); } // colours, fonts and cursors // -------------------------- // get the default attributes for the controls of this class: we // provide a virtual function which can be used to query the default // attributes of an existing control and a static function which can // be used even when no existing object of the given class is // available, but which won't return any styles specific to this // particular control, of course (e.g. "Ok" button might have // different -- bold for example -- font) virtual wxVisualAttributes GetDefaultAttributes() const { return GetClassDefaultAttributes(GetWindowVariant()); } static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); // set/retrieve the window colours (system defaults are used by // default): SetXXX() functions return true if colour was changed, // SetDefaultXXX() reset the "m_inheritXXX" flag after setting the // value to prevent it from being inherited by our children virtual bool SetBackgroundColour(const wxColour& colour); void SetOwnBackgroundColour(const wxColour& colour) { if ( SetBackgroundColour(colour) ) m_inheritBgCol = false; } wxColour GetBackgroundColour() const; bool InheritsBackgroundColour() const { return m_inheritBgCol; } bool UseBgCol() const { return m_hasBgCol; } bool UseBackgroundColour() const { return UseBgCol(); } virtual bool SetForegroundColour(const wxColour& colour); void SetOwnForegroundColour(const wxColour& colour) { if ( SetForegroundColour(colour) ) m_inheritFgCol = false; } wxColour GetForegroundColour() const; bool UseForegroundColour() const { return m_hasFgCol; } bool InheritsForegroundColour() const { return m_inheritFgCol; } // Set/get the background style. virtual bool SetBackgroundStyle(wxBackgroundStyle style); wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } // returns true if the control has "transparent" areas such as a // wxStaticText and wxCheckBox and the background should be adapted // from a parent window virtual bool HasTransparentBackground() { return false; } // Returns true if background transparency is supported for this // window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) // has a chance of succeeding. If reason argument is non-NULL, returns a // user-readable explanation of why it isn't supported if the return // value is false. virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; // set/retrieve the font for the window (SetFont() returns true if the // font really changed) virtual bool SetFont(const wxFont& font) = 0; void SetOwnFont(const wxFont& font) { if ( SetFont(font) ) m_inheritFont = false; } wxFont GetFont() const; // set/retrieve the cursor for this window (SetCursor() returns true // if the cursor was really changed) virtual bool SetCursor( const wxCursor &cursor ); const wxCursor& GetCursor() const { return m_cursor; } #if wxUSE_CARET // associate a caret with the window void SetCaret(wxCaret *caret); // get the current caret (may be NULL) wxCaret *GetCaret() const { return m_caret; } #endif // wxUSE_CARET // get the (average) character size for the current font virtual int GetCharHeight() const = 0; virtual int GetCharWidth() const = 0; // get the width/height/... of the text using current or specified // font void GetTextExtent(const wxString& string, int *x, int *y, int *descent = NULL, int *externalLeading = NULL, const wxFont *font = NULL) const { DoGetTextExtent(string, x, y, descent, externalLeading, font); } wxSize GetTextExtent(const wxString& string) const { wxCoord w, h; GetTextExtent(string, &w, &h); return wxSize(w, h); } // client <-> screen coords // ------------------------ // translate to/from screen/client coordinates (pointers may be NULL) void ClientToScreen( int *x, int *y ) const { DoClientToScreen(x, y); } void ScreenToClient( int *x, int *y ) const { DoScreenToClient(x, y); } // wxPoint interface to do the same thing wxPoint ClientToScreen(const wxPoint& pt) const { int x = pt.x, y = pt.y; DoClientToScreen(&x, &y); return wxPoint(x, y); } wxPoint ScreenToClient(const wxPoint& pt) const { int x = pt.x, y = pt.y; DoScreenToClient(&x, &y); return wxPoint(x, y); } // test where the given (in client coords) point lies wxHitTest HitTest(wxCoord x, wxCoord y) const { return DoHitTest(x, y); } wxHitTest HitTest(const wxPoint& pt) const { return DoHitTest(pt.x, pt.y); } // misc // ---- // get the window border style from the given flags: this is different from // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to // translate wxBORDER_DEFAULT to something reasonable wxBorder GetBorder(long flags) const; // get border for the flags of this window wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); } // send wxUpdateUIEvents to this window, and children if recurse is true virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); // do the window-specific processing after processing the update event virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; #if wxUSE_MENUS // show popup menu at the given position, generate events for the items // selected in it bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) { return PopupMenu(menu, pos.x, pos.y); } bool PopupMenu(wxMenu *menu, int x, int y); // simply return the id of the selected item or wxID_NONE without // generating any events int GetPopupMenuSelectionFromUser(wxMenu& menu, const wxPoint& pos = wxDefaultPosition) { return DoGetPopupMenuSelectionFromUser(menu, pos.x, pos.y); } int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y) { return DoGetPopupMenuSelectionFromUser(menu, x, y); } #endif // wxUSE_MENUS // override this method to return true for controls having multiple pages virtual bool HasMultiplePages() const { return false; } // scrollbars // ---------- // can the window have the scrollbar in this orientation? virtual bool CanScroll(int orient) const; // does the window have the scrollbar in this orientation? bool HasScrollbar(int orient) const; // configure the window scrollbars virtual void SetScrollbar( int orient, int pos, int thumbvisible, int range, bool refresh = true ) = 0; virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0; virtual int GetScrollPos( int orient ) const = 0; virtual int GetScrollThumb( int orient ) const = 0; virtual int GetScrollRange( int orient ) const = 0; // scroll window to the specified position virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL ) = 0; // scrolls window by line/page: note that not all controls support this // // return true if the position changed, false otherwise virtual bool ScrollLines(int WXUNUSED(lines)) { return false; } virtual bool ScrollPages(int WXUNUSED(pages)) { return false; } // convenient wrappers for ScrollLines/Pages bool LineUp() { return ScrollLines(-1); } bool LineDown() { return ScrollLines(1); } bool PageUp() { return ScrollPages(-1); } bool PageDown() { return ScrollPages(1); } // call this to always show one or both scrollbars, even if the window // is big enough to not require them virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true, bool WXUNUSED(vert) = true) { } // return true if AlwaysShowScrollbars() had been called before for the // corresponding orientation virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const { return false; } // context-sensitive help // ---------------------- // these are the convenience functions wrapping wxHelpProvider methods #if wxUSE_HELP // associate this help text with this window void SetHelpText(const wxString& text); #if WXWIN_COMPATIBILITY_2_8 // Associate this help text with all windows with the same id as this one. // Don't use this, do wxHelpProvider::Get()->AddHelp(id, text); wxDEPRECATED( void SetHelpTextForId(const wxString& text) ); #endif // WXWIN_COMPATIBILITY_2_8 // get the help string associated with the given position in this window // // notice that pt may be invalid if event origin is keyboard or unknown // and this method should return the global window help text then virtual wxString GetHelpTextAtPoint(const wxPoint& pt, wxHelpEvent::Origin origin) const; // returns the position-independent help text wxString GetHelpText() const { return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown); } #else // !wxUSE_HELP // silently ignore SetHelpText() calls void SetHelpText(const wxString& WXUNUSED(text)) { } void SetHelpTextForId(const wxString& WXUNUSED(text)) { } #endif // wxUSE_HELP // tooltips // -------- #if wxUSE_TOOLTIPS // the easiest way to set a tooltip for a window is to use this method void SetToolTip( const wxString &tip ) { DoSetToolTipText(tip); } // attach a tooltip to the window, pointer can be NULL to remove // existing tooltip void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } // more readable synonym for SetToolTip(NULL) void UnsetToolTip() { SetToolTip(NULL); } // get the associated tooltip or NULL if none wxToolTip* GetToolTip() const { return m_tooltip; } wxString GetToolTipText() const; // Use the same tool tip as the given one (which can be NULL to indicate // that no tooltip should be used) for this window. This is currently only // used by wxCompositeWindow::DoSetToolTip() implementation and is not part // of the public wx API. // // Returns true if tip was valid and we copied it or false if it was NULL // and we reset our own tooltip too. bool CopyToolTip(wxToolTip *tip); #else // !wxUSE_TOOLTIPS // make it much easier to compile apps in an environment // that doesn't support tooltips void SetToolTip(const wxString & WXUNUSED(tip)) { } void UnsetToolTip() { } #endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS // drag and drop // ------------- #if wxUSE_DRAG_AND_DROP // set/retrieve the drop target associated with this window (may be // NULL; it's owned by the window and will be deleted by it) virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } // Accept files for dragging virtual void DragAcceptFiles(bool accept) #ifdef __WXMSW__ // it does have common implementation but not for MSW which has its own // native version of it = 0 #endif // __WXMSW__ ; #endif // wxUSE_DRAG_AND_DROP // constraints and sizers // ---------------------- #if wxUSE_CONSTRAINTS // set the constraints for this window or retrieve them (may be NULL) void SetConstraints( wxLayoutConstraints *constraints ); wxLayoutConstraints *GetConstraints() const { return m_constraints; } // implementation only void UnsetConstraints(wxLayoutConstraints *c); wxWindowList *GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn; } void AddConstraintReference(wxWindowBase *otherWin); void RemoveConstraintReference(wxWindowBase *otherWin); void DeleteRelatedConstraints(); void ResetConstraints(); // these methods may be overridden for special layout algorithms virtual void SetConstraintSizes(bool recurse = true); virtual bool LayoutPhase1(int *noChanges); virtual bool LayoutPhase2(int *noChanges); virtual bool DoPhase(int phase); // these methods are virtual but normally won't be overridden virtual void SetSizeConstraint(int x, int y, int w, int h); virtual void MoveConstraint(int x, int y); virtual void GetSizeConstraint(int *w, int *h) const ; virtual void GetClientSizeConstraint(int *w, int *h) const ; virtual void GetPositionConstraint(int *x, int *y) const ; #endif // wxUSE_CONSTRAINTS // when using constraints or sizers, it makes sense to update // children positions automatically whenever the window is resized // - this is done if autoLayout is on void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; } bool GetAutoLayout() const { return m_autoLayout; } // lay out the window and its children virtual bool Layout(); // sizers void SetSizer(wxSizer *sizer, bool deleteOld = true ); void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ); wxSizer *GetSizer() const { return m_windowSizer; } // Track if this window is a member of a sizer void SetContainingSizer(wxSizer* sizer); wxSizer *GetContainingSizer() const { return m_containingSizer; } // accessibility // ---------------------- #if wxUSE_ACCESSIBILITY // Override to create a specific accessible object. virtual wxAccessible* CreateAccessible() { return NULL; } // Sets the accessible object. void SetAccessible(wxAccessible* accessible) ; // Returns the accessible object. wxAccessible* GetAccessible() { return m_accessible; } // Returns the accessible object, calling CreateAccessible if necessary. // May return NULL, in which case system-provide accessible is used. wxAccessible* GetOrCreateAccessible() ; #endif // Set window transparency if the platform supports it virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; } virtual bool CanSetTransparent() { return false; } // implementation // -------------- // event handlers void OnSysColourChanged( wxSysColourChangedEvent& event ); void OnInitDialog( wxInitDialogEvent &event ); void OnMiddleClick( wxMouseEvent& event ); #if wxUSE_HELP void OnHelp(wxHelpEvent& event); #endif // wxUSE_HELP // virtual function for implementing internal idle // behaviour virtual void OnInternalIdle(); // Send idle event to window and all subwindows // Returns true if more idle time is requested. virtual bool SendIdleEvents(wxIdleEvent& event); // get the handle of the window for the underlying window system: this // is only used for wxWin itself or for user code which wants to call // platform-specific APIs virtual WXWidget GetHandle() const = 0; // associate the window with a new native handle virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { } // dissociate the current native handle from the window virtual void DissociateHandle() { } #if wxUSE_PALETTE // Store the palette used by DCs in wxWindow so that the dcs can share // a palette. And we can respond to palette messages. wxPalette GetPalette() const { return m_palette; } // When palette is changed tell the DC to set the system palette to the // new one. void SetPalette(const wxPalette& pal); // return true if we have a specific palette bool HasCustomPalette() const { return m_hasCustomPalette; } // return the first parent window with a custom palette or NULL wxWindow *GetAncestorWithCustomPalette() const; #endif // wxUSE_PALETTE // inherit the parents visual attributes if they had been explicitly set // by the user (i.e. we don't inherit default attributes) and if we don't // have our own explicitly set virtual void InheritAttributes(); // returns false from here if this window doesn't want to inherit the // parents colours even if InheritAttributes() would normally do it // // this just provides a simple way to customize InheritAttributes() // behaviour in the most common case virtual bool ShouldInheritColours() const { return false; } // returns true if the window can be positioned outside of parent's client // area (normal windows can't, but e.g. menubar or statusbar can): virtual bool CanBeOutsideClientArea() const { return false; } // returns true if the platform should explicitly apply a theme border. Currently // used only by Windows virtual bool CanApplyThemeBorder() const { return true; } // returns the main window of composite control; this is the window // that FindFocus returns if the focus is in one of composite control's // windows virtual wxWindow *GetMainWindowOfCompositeControl() { return (wxWindow*)this; } enum NavigationKind { Navigation_Tab, Navigation_Accel }; // If this function returns true, keyboard events of the given kind can't // escape from it. A typical example of such "navigation domain" is a top // level window because pressing TAB in one of them must not transfer focus // to a different top level window. But it's not limited to them, e.g. MDI // children frames are not top level windows (and their IsTopLevel() // returns false) but still are self-contained navigation domains for the // purposes of TAB navigation -- but not for the accelerators. virtual bool IsTopNavigationDomain(NavigationKind WXUNUSED(kind)) const { return false; } protected: // helper for the derived class Create() methods: the first overload, with // validator parameter, should be used for child windows while the second // one is used for top level ones bool CreateBase(wxWindowBase *parent, wxWindowID winid, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPanelNameStr); bool CreateBase(wxWindowBase *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size, long style, const wxString& name); // event handling specific to wxWindow virtual bool TryBefore(wxEvent& event) wxOVERRIDE; virtual bool TryAfter(wxEvent& event) wxOVERRIDE; enum WindowOrder { OrderBefore, // insert before the given window OrderAfter // insert after the given window }; // common part of GetPrev/NextSibling() wxWindow *DoGetSibling(WindowOrder order) const; // common part of MoveBefore/AfterInTabOrder() virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move); // implementation of Navigate() and NavigateIn() virtual bool DoNavigateIn(int flags); #if wxUSE_CONSTRAINTS // satisfy the constraints for the windows but don't set the window sizes void SatisfyConstraints(); #endif // wxUSE_CONSTRAINTS // Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted // to true void SendDestroyEvent(); // this method should be implemented to use operating system specific code // to really enable/disable the widget, it will only be called when we // really need to enable/disable window and so no additional checks on the // widgets state are necessary virtual void DoEnable(bool WXUNUSED(enable)) { } // the window id - a number which uniquely identifies a window among // its siblings unless it is wxID_ANY wxWindowIDRef m_windowId; // the parent window of this window (or NULL) and the list of the children // of this window wxWindow *m_parent; wxWindowList m_children; // the minimal allowed size for the window (no minimal size if variable(s) // contain(s) wxDefaultCoord) int m_minWidth, m_minHeight, m_maxWidth, m_maxHeight; // event handler for this window: usually is just 'this' but may be // changed with SetEventHandler() wxEvtHandler *m_eventHandler; #if wxUSE_VALIDATORS // associated validator or NULL if none wxValidator *m_windowValidator; #endif // wxUSE_VALIDATORS #if wxUSE_DRAG_AND_DROP wxDropTarget *m_dropTarget; #endif // wxUSE_DRAG_AND_DROP // visual window attributes wxCursor m_cursor; wxFont m_font; // see m_hasFont wxColour m_backgroundColour, // m_hasBgCol m_foregroundColour; // m_hasFgCol #if wxUSE_CARET wxCaret *m_caret; #endif // wxUSE_CARET // the region which should be repainted in response to paint event wxRegion m_updateRegion; #if wxUSE_ACCEL // the accelerator table for the window which translates key strokes into // command events wxAcceleratorTable m_acceleratorTable; #endif // wxUSE_ACCEL // the tooltip for this window (may be NULL) #if wxUSE_TOOLTIPS wxToolTip *m_tooltip; #endif // wxUSE_TOOLTIPS // constraints and sizers #if wxUSE_CONSTRAINTS // the constraints for this window or NULL wxLayoutConstraints *m_constraints; // constraints this window is involved in wxWindowList *m_constraintsInvolvedIn; #endif // wxUSE_CONSTRAINTS // this window's sizer wxSizer *m_windowSizer; // The sizer this window is a member of, if any wxSizer *m_containingSizer; // Layout() window automatically when its size changes? bool m_autoLayout:1; // window state bool m_isShown:1; bool m_isEnabled:1; bool m_isBeingDeleted:1; // was the window colours/font explicitly changed by user? bool m_hasBgCol:1; bool m_hasFgCol:1; bool m_hasFont:1; // and should it be inherited by children? bool m_inheritBgCol:1; bool m_inheritFgCol:1; bool m_inheritFont:1; // window attributes long m_windowStyle, m_exStyle; wxString m_windowName; bool m_themeEnabled; wxBackgroundStyle m_backgroundStyle; #if wxUSE_PALETTE wxPalette m_palette; bool m_hasCustomPalette; #endif // wxUSE_PALETTE #if wxUSE_ACCESSIBILITY wxAccessible* m_accessible; #endif // Virtual size (scrolling) wxSize m_virtualSize; wxScrollHelper *m_scrollHelper; wxWindowVariant m_windowVariant ; // override this to change the default (i.e. used when no style is // specified) border for the window class virtual wxBorder GetDefaultBorder() const; // this allows you to implement standard control borders without // repeating the code in different classes that are not derived from // wxControl virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; } // Get the default size for the new window if no explicit size given. TLWs // have their own default size so this is just for non top-level windows. static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; } static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; } // Used to save the results of DoGetBestSize so it doesn't need to be // recalculated each time the value is needed. wxSize m_bestSizeCache; #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_MSG("use SetInitialSize() instead.") void SetBestSize(const wxSize& size); wxDEPRECATED_MSG("use SetInitialSize() instead.") virtual void SetInitialBestSize(const wxSize& size); #endif // WXWIN_COMPATIBILITY_2_8 // more pure virtual functions // --------------------------- // NB: we must have DoSomething() function when Something() is an overloaded // method: indeed, we can't just have "virtual Something()" in case when // the function is overloaded because then we'd have to make virtual all // the variants (otherwise only the virtual function may be called on a // pointer to derived class according to C++ rules) which is, in // general, absolutely not needed. So instead we implement all // overloaded Something()s in terms of DoSomething() which will be the // only one to be virtual. // text extent virtual void DoGetTextExtent(const wxString& string, int *x, int *y, int *descent = NULL, int *externalLeading = NULL, const wxFont *font = NULL) const = 0; // coordinates translation virtual void DoClientToScreen( int *x, int *y ) const = 0; virtual void DoScreenToClient( int *x, int *y ) const = 0; virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; // capture/release the mouse, used by Capture/ReleaseMouse() virtual void DoCaptureMouse() = 0; virtual void DoReleaseMouse() = 0; // retrieve the position/size of the window virtual void DoGetPosition(int *x, int *y) const = 0; virtual void DoGetScreenPosition(int *x, int *y) const; virtual void DoGetSize(int *width, int *height) const = 0; virtual void DoGetClientSize(int *width, int *height) const = 0; // get the size which best suits the window: for a control, it would be // the minimal size which doesn't truncate the control, for a panel - the // same size as it would have after a call to Fit() virtual wxSize DoGetBestSize() const; // this method can be overridden instead of DoGetBestSize() if it computes // the best size of the client area of the window only, excluding borders // (GetBorderSize() will be used to add them) virtual wxSize DoGetBestClientSize() const { return wxDefaultSize; } // These two methods can be overridden to implement intelligent // width-for-height and/or height-for-width best size determination for the // window. By default the fixed best size is used. virtual int DoGetBestClientHeight(int WXUNUSED(width)) const { return wxDefaultCoord; } virtual int DoGetBestClientWidth(int WXUNUSED(height)) const { return wxDefaultCoord; } // this is the virtual function to be overridden in any derived class which // wants to change how SetSize() or Move() works - it is called by all // versions of these functions in the base class virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) = 0; // same as DoSetSize() for the client size virtual void DoSetClientSize(int width, int height) = 0; virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ); // return the total size of the window borders, i.e. the sum of the widths // of the left and the right border in the x component of the returned size // and the sum of the heights of the top and bottom borders in the y one // // NB: this is currently only implemented properly for wxMSW, wxGTK and // wxUniv and doesn't behave correctly in the presence of scrollbars in // the other ports virtual wxSize DoGetBorderSize() const; // move the window to the specified location and resize it: this is called // from both DoSetSize() and DoSetClientSize() and would usually just // reposition this window except for composite controls which will want to // arrange themselves inside the given rectangle // // Important note: the coordinates passed to this method are in parent's // *window* coordinates and not parent's client coordinates (as the values // passed to DoSetSize and returned by DoGetPosition are)! virtual void DoMoveWindow(int x, int y, int width, int height) = 0; // centre the window in the specified direction on parent, note that // wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for // TLWs virtual void DoCentre(int dir); #if wxUSE_TOOLTIPS virtual void DoSetToolTipText( const wxString &tip ); virtual void DoSetToolTip( wxToolTip *tip ); #endif // wxUSE_TOOLTIPS #if wxUSE_MENUS virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0; #endif // wxUSE_MENUS // Makes an adjustment to the window position to make it relative to the // parents client area, e.g. if the parent is a frame with a toolbar, its // (0, 0) is just below the toolbar virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags = 0) const; // implements the window variants virtual void DoSetWindowVariant( wxWindowVariant variant ) ; // really freeze/thaw the window (should have port-specific implementation) virtual void DoFreeze() { } virtual void DoThaw() { } // Must be called when mouse capture is lost to send // wxMouseCaptureLostEvent to windows on capture stack. static void NotifyCaptureLost(); private: // recursively call our own and our children DoEnable() when the // enabled/disabled status changed because a parent window had been // enabled/disabled void NotifyWindowOnEnableChange(bool enabled); #if wxUSE_MENUS // temporary event handlers used by GetPopupMenuSelectionFromUser() void InternalOnPopupMenu(wxCommandEvent& event); void InternalOnPopupMenuUpdate(wxUpdateUIEvent& event); // implementation of the public GetPopupMenuSelectionFromUser() method int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y); #endif // wxUSE_MENUS // layout the window children when its size changes unless this was // explicitly disabled with SetAutoLayout(false) void InternalOnSize(wxSizeEvent& event); // base for dialog unit conversion, i.e. average character size wxSize GetDlgUnitBase() const; // number of Freeze() calls minus the number of Thaw() calls: we're frozen // (i.e. not being updated) if it is positive unsigned int m_freezeCount; wxDECLARE_ABSTRACT_CLASS(wxWindowBase); wxDECLARE_NO_COPY_CLASS(wxWindowBase); wxDECLARE_EVENT_TABLE(); }; #if WXWIN_COMPATIBILITY_2_8 // Inlines for some deprecated methods inline wxSize wxWindowBase::GetBestFittingSize() const { return GetEffectiveMinSize(); } inline void wxWindowBase::SetBestFittingSize(const wxSize& size) { SetInitialSize(size); } inline void wxWindowBase::SetBestSize(const wxSize& size) { SetInitialSize(size); } inline void wxWindowBase::SetInitialBestSize(const wxSize& size) { SetInitialSize(size); } #endif // WXWIN_COMPATIBILITY_2_8 // ---------------------------------------------------------------------------- // now include the declaration of wxWindow class // ---------------------------------------------------------------------------- // include the declaration of the platform-specific class #if defined(__WXMSW__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowMSW #else // !wxUniv #define wxWindowMSW wxWindow #endif // wxUniv/!wxUniv #include "wx/msw/window.h" #elif defined(__WXMOTIF__) #include "wx/motif/window.h" #elif defined(__WXGTK20__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowGTK #else // !wxUniv #define wxWindowGTK wxWindow #endif // wxUniv #include "wx/gtk/window.h" #ifdef __WXGTK3__ #define wxHAVE_DPI_INDEPENDENT_PIXELS #endif #elif defined(__WXGTK__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowGTK #else // !wxUniv #define wxWindowGTK wxWindow #endif // wxUniv #include "wx/gtk1/window.h" #elif defined(__WXX11__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowX11 #else // !wxUniv #define wxWindowX11 wxWindow #endif // wxUniv #include "wx/x11/window.h" #elif defined(__WXDFB__) #define wxWindowNative wxWindowDFB #include "wx/dfb/window.h" #elif defined(__WXMAC__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowMac #else // !wxUniv #define wxWindowMac wxWindow #endif // wxUniv #include "wx/osx/window.h" #define wxHAVE_DPI_INDEPENDENT_PIXELS #elif defined(__WXQT__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowQt #else // !wxUniv #define wxWindowQt wxWindow #endif // wxUniv #include "wx/qt/window.h" #endif // for wxUniversal, we now derive the real wxWindow from wxWindow<platform>, // for the native ports we already have defined it above #if defined(__WXUNIVERSAL__) #ifndef wxWindowNative #error "wxWindowNative must be defined above!" #endif #include "wx/univ/window.h" #endif // wxUniv // ---------------------------------------------------------------------------- // inline functions which couldn't be declared in the class body because of // forward dependencies // ---------------------------------------------------------------------------- inline wxWindow *wxWindowBase::GetGrandParent() const { return m_parent ? m_parent->GetParent() : NULL; } #ifdef wxHAVE_DPI_INDEPENDENT_PIXELS // FromDIP() and ToDIP() become trivial in this case, so make them inline to // avoid any overhead. /* static */ inline wxSize wxWindowBase::FromDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) { return sz; } /* static */ inline wxSize wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) { return sz; } #endif // wxHAVE_DPI_INDEPENDENT_PIXELS // ---------------------------------------------------------------------------- // global functions // ---------------------------------------------------------------------------- // Find the wxWindow at the current mouse position, also returning the mouse // position. extern WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPointer(wxPoint& pt); // Get the current mouse position. extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition(); // get the currently active window of this application or NULL extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow(); // get the (first) top level parent window WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win); #if wxUSE_ACCESSIBILITY // ---------------------------------------------------------------------------- // accessible object for windows // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxWindowAccessible: public wxAccessible { public: wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); } virtual ~wxWindowAccessible() {} // Overridables // Can return either a child object, or an integer // representing the child element, starting from 1. virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject) wxOVERRIDE; // Returns the rectangle for this object (id = 0) or a child element (id > 0). virtual wxAccStatus GetLocation(wxRect& rect, int elementId) wxOVERRIDE; // Navigates from fromId to toId/toObject. virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, int* toId, wxAccessible** toObject) wxOVERRIDE; // Gets the name of the specified object. virtual wxAccStatus GetName(int childId, wxString* name) wxOVERRIDE; // Gets the number of children. virtual wxAccStatus GetChildCount(int* childCount) wxOVERRIDE; // Gets the specified child (starting from 1). // If *child is NULL and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. virtual wxAccStatus GetChild(int childId, wxAccessible** child) wxOVERRIDE; // Gets the parent, or NULL. virtual wxAccStatus GetParent(wxAccessible** parent) wxOVERRIDE; // Performs the default action. childId is 0 (the action for this object) // or > 0 (the action for a child). // Return wxACC_NOT_SUPPORTED if there is no default action for this // window (e.g. an edit control). virtual wxAccStatus DoDefaultAction(int childId) wxOVERRIDE; // Gets the default action for this object (0) or > 0 (the action for a child). // Return wxACC_OK even if there is no action. actionName is the action, or the empty // string if there is no action. // The retrieved string describes the action that is performed on an object, // not what the object does as a result. For example, a toolbar button that prints // a document has a default action of "Press" rather than "Prints the current document." virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName) wxOVERRIDE; // Returns the description for this object or a child. virtual wxAccStatus GetDescription(int childId, wxString* description) wxOVERRIDE; // Returns help text for this object or a child, similar to tooltip text. virtual wxAccStatus GetHelpText(int childId, wxString* helpText) wxOVERRIDE; // Returns the keyboard shortcut for this object or child. // Return e.g. ALT+K virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut) wxOVERRIDE; // Returns a role constant. virtual wxAccStatus GetRole(int childId, wxAccRole* role) wxOVERRIDE; // Returns a state constant. virtual wxAccStatus GetState(int childId, long* state) wxOVERRIDE; // Returns a localized string representing the value for the object // or child. virtual wxAccStatus GetValue(int childId, wxString* strValue) wxOVERRIDE; // Selects the object or child. virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) wxOVERRIDE; // Gets the window with the keyboard focus. // If childId is 0 and child is NULL, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. virtual wxAccStatus GetFocus(int* childId, wxAccessible** child) wxOVERRIDE; #if wxUSE_VARIANT // Gets a variant representing the selected children // of this object. // Acceptable values: // - a null variant (IsNull() returns true) // - a list variant (GetType() == wxT("list") // - an integer representing the selected child element, // or 0 if this object is selected (GetType() == wxT("long") // - a "void*" pointer to a wxAccessible child object virtual wxAccStatus GetSelections(wxVariant* selections) wxOVERRIDE; #endif // wxUSE_VARIANT }; #endif // wxUSE_ACCESSIBILITY #endif // _WX_WINDOW_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/appprogress.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/appprogress.h // Purpose: wxAppProgressIndicator interface. // Author: Chaobin Zhang <[email protected]> // Created: 2014-09-05 // Copyright: (c) 2014 wxWidgets development team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_APPPROG_H_ #define _WX_APPPROG_H_ #include "wx/defs.h" class WXDLLIMPEXP_CORE wxAppProgressIndicatorBase { public: wxAppProgressIndicatorBase() {} virtual ~wxAppProgressIndicatorBase() {} virtual bool IsAvailable() const = 0; virtual void SetValue(int value) = 0; virtual void SetRange(int range) = 0; virtual void Pulse() = 0; virtual void Reset() = 0; private: wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase); }; #if defined(__WXMSW__) && wxUSE_TASKBARBUTTON #include "wx/msw/appprogress.h" #elif defined(__WXOSX_COCOA__) #include "wx/osx/appprogress.h" #else class wxAppProgressIndicator : public wxAppProgressIndicatorBase { public: wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = NULL, int WXUNUSED(maxValue) = 100) { } virtual bool IsAvailable() const wxOVERRIDE { return false; } virtual void SetValue(int WXUNUSED(value)) wxOVERRIDE { } virtual void SetRange(int WXUNUSED(range)) wxOVERRIDE { } virtual void Pulse() wxOVERRIDE { } virtual void Reset() wxOVERRIDE { } }; #endif #endif // _WX_APPPROG_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/busyinfo.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/busyinfo.h // Purpose: Information window (when app is busy) // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __BUSYINFO_H_BASE__ #define __BUSYINFO_H_BASE__ #include "wx/defs.h" #if wxUSE_BUSYINFO #include "wx/colour.h" #include "wx/icon.h" class WXDLLIMPEXP_FWD_CORE wxWindow; // This class is used to pass all the various parameters to wxBusyInfo ctor. // According to the usual naming conventions (see wxAboutDialogInfo, // wxFontInfo, ...) it would be called wxBusyInfoInfo, but this would have been // rather strange, so we call it wxBusyInfoFlags instead. // // Methods are mostly self-explanatory except for the difference between "Text" // and "Label": the former can contain markup, while the latter is just plain // string which is not parsed in any way. class wxBusyInfoFlags { public: wxBusyInfoFlags() { m_parent = NULL; m_alpha = wxALPHA_OPAQUE; } wxBusyInfoFlags& Parent(wxWindow* parent) { m_parent = parent; return *this; } wxBusyInfoFlags& Icon(const wxIcon& icon) { m_icon = icon; return *this; } wxBusyInfoFlags& Title(const wxString& title) { m_title = title; return *this; } wxBusyInfoFlags& Text(const wxString& text) { m_text = text; return *this; } wxBusyInfoFlags& Label(const wxString& label) { m_label = label; return *this; } wxBusyInfoFlags& Foreground(const wxColour& foreground) { m_foreground = foreground; return *this; } wxBusyInfoFlags& Background(const wxColour& background) { m_background = background; return *this; } wxBusyInfoFlags& Transparency(wxByte alpha) { m_alpha = alpha; return *this; } private: wxWindow* m_parent; wxIcon m_icon; wxString m_title, m_text, m_label; wxColour m_foreground, m_background; wxByte m_alpha; friend class wxBusyInfo; }; #include "wx/generic/busyinfo.h" #endif // wxUSE_BUSYINFO #endif // __BUSYINFO_H_BASE__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/selstore.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/selstore.h // Purpose: wxSelectionStore stores selected items in a control // Author: Vadim Zeitlin // Modified by: // Created: 08.06.03 (extracted from src/generic/listctrl.cpp) // Copyright: (c) 2000-2003 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_SELSTORE_H_ #define _WX_SELSTORE_H_ #include "wx/dynarray.h" // ---------------------------------------------------------------------------- // wxSelectedIndices is just a sorted array of indices // ---------------------------------------------------------------------------- inline int CMPFUNC_CONV wxUIntCmp(unsigned n1, unsigned n2) { return (int)(n1 - n2); } WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(unsigned, wxUIntCmp, wxSelectedIndices); // ---------------------------------------------------------------------------- // wxSelectionStore is used to store the selected items in the virtual // controls, i.e. it is well suited for storing even when the control contains // a huge (practically infinite) number of items. // // Of course, internally it still has to store the selected items somehow (as // an array currently) but the advantage is that it can handle the selection // of all items (common operation) efficiently and that it could be made even // smarter in the future (e.g. store the selections as an array of ranges + // individual items) without changing its API. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxSelectionStore { public: wxSelectionStore() : m_itemsSel(wxUIntCmp) { Init(); } // set the total number of items we handle void SetItemCount(unsigned count); // special case of SetItemCount(0) void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } // must be called when new items are inserted/added void OnItemsInserted(unsigned item, unsigned numItems); // must be called when an items is deleted void OnItemDelete(unsigned item); // more efficient version for notifying the selection about deleting // several items at once, return true if any of them were selected bool OnItemsDeleted(unsigned item, unsigned numItems); // select one item, use SelectRange() insted if possible! // // returns true if the items selection really changed bool SelectItem(unsigned item, bool select = true); // select the range of items (inclusive) // // return true and fill the itemsChanged array with the indices of items // which have changed state if "few" of them did, otherwise return false // (meaning that too many items changed state to bother counting them // individually) bool SelectRange(unsigned itemFrom, unsigned itemTo, bool select = true, wxArrayInt *itemsChanged = NULL); // return true if the given item is selected bool IsSelected(unsigned item) const; // return true if no items are currently selected bool IsEmpty() const { return m_defaultState ? m_itemsSel.size() == m_count : m_itemsSel.empty(); } // return the total number of selected items unsigned GetSelectedCount() const { return m_defaultState ? m_count - m_itemsSel.GetCount() : m_itemsSel.GetCount(); } // type of a "cookie" used to preserve the iteration state, this is an // opaque type, don't rely on its current representation typedef size_t IterationState; // constant representing absence of selection and hence end of iteration static const unsigned NO_SELECTION; // get the first selected item in index order, return NO_SELECTION if none unsigned GetFirstSelectedItem(IterationState& cookie) const; // get the next selected item, return NO_SELECTION if no more unsigned GetNextSelectedItem(IterationState& cookie) const; private: // (re)init void Init() { m_count = 0; m_defaultState = false; } // the total number of items we handle unsigned m_count; // the default state: normally, false (i.e. off) but maybe set to true if // there are more selected items than non selected ones - this allows to // handle selection of all items efficiently bool m_defaultState; // the array of items whose selection state is different from default wxSelectedIndices m_itemsSel; wxDECLARE_NO_COPY_CLASS(wxSelectionStore); }; #endif // _WX_SELSTORE_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/docmdi.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/docmdi.h // Purpose: Frame classes for MDI document/view applications // Author: Julian Smart // Created: 01/02/97 // Copyright: (c) 1997 Julian Smart // (c) 2010 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DOCMDI_H_ #define _WX_DOCMDI_H_ #include "wx/defs.h" #if wxUSE_MDI_ARCHITECTURE #include "wx/docview.h" #include "wx/mdi.h" // Define MDI versions of the doc-view frame classes. Note that we need to // define them as classes for wxRTTI, otherwise we could simply define them as // typedefs. // ---------------------------------------------------------------------------- // An MDI document parent frame // ---------------------------------------------------------------------------- typedef wxDocParentFrameAny<wxMDIParentFrame> wxDocMDIParentFrameBase; class WXDLLIMPEXP_CORE wxDocMDIParentFrame : public wxDocMDIParentFrameBase { public: wxDocMDIParentFrame() : wxDocMDIParentFrameBase() { } wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr) : wxDocMDIParentFrameBase(manager, parent, id, title, pos, size, style, name) { } private: wxDECLARE_CLASS(wxDocMDIParentFrame); wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame); }; // ---------------------------------------------------------------------------- // An MDI document child frame // ---------------------------------------------------------------------------- typedef wxDocChildFrameAny<wxMDIChildFrame, wxMDIParentFrame> wxDocMDIChildFrameBase; class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase { public: wxDocMDIChildFrame() { } wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr) : wxDocMDIChildFrameBase(doc, view, parent, id, title, pos, size, style, name) { } private: wxDECLARE_CLASS(wxDocMDIChildFrame); wxDECLARE_NO_COPY_CLASS(wxDocMDIChildFrame); }; #endif // wxUSE_MDI_ARCHITECTURE #endif // _WX_DOCMDI_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/overlay.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/overlay.h // Purpose: wxOverlay class // Author: Stefan Csomor // Modified by: // Created: 2006-10-20 // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_OVERLAY_H_ #define _WX_OVERLAY_H_ #include "wx/defs.h" #if defined(__WXDFB__) #define wxHAS_NATIVE_OVERLAY 1 #elif defined(__WXOSX__) && wxOSX_USE_COCOA #define wxHAS_NATIVE_OVERLAY 1 #else // don't define wxHAS_NATIVE_OVERLAY #endif // ---------------------------------------------------------------------------- // creates an overlay over an existing window, allowing for manipulations like // rubberbanding etc. This API is not stable yet, not to be used outside wx // internal code // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_CORE wxOverlay { public: wxOverlay(); ~wxOverlay(); // clears the overlay without restoring the former state // to be done eg when the window content has been changed and repainted void Reset(); // returns (port-specific) implementation of the overlay wxOverlayImpl *GetImpl() { return m_impl; } private: friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay; // returns true if it has been setup bool IsOk(); void Init(wxDC* dc, int x , int y , int width , int height); void BeginDrawing(wxDC* dc); void EndDrawing(wxDC* dc); void Clear(wxDC* dc); wxOverlayImpl* m_impl; bool m_inDrawing; wxDECLARE_NO_COPY_CLASS(wxOverlay); }; class WXDLLIMPEXP_CORE wxDCOverlay { public: // connects this overlay to the corresponding drawing dc, if the overlay is // not initialized yet this call will do so wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height); // convenience wrapper that behaves the same using the entire area of the dc wxDCOverlay(wxOverlay &overlay, wxDC *dc); // removes the connection between the overlay and the dc virtual ~wxDCOverlay(); // clears the layer, restoring the state at the last init void Clear(); private: void Init(wxDC *dc, int x , int y , int width , int height); wxOverlay& m_overlay; wxDC* m_dc; wxDECLARE_NO_COPY_CLASS(wxDCOverlay); }; #endif // _WX_OVERLAY_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dc.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/dc.h // Purpose: wxDC class // Author: Vadim Zeitlin // Modified by: // Created: 05/25/99 // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DC_H_BASE_ #define _WX_DC_H_BASE_ // ---------------------------------------------------------------------------- // headers which we must include here // ---------------------------------------------------------------------------- #include "wx/object.h" // the base class #include "wx/intl.h" // for wxLayoutDirection #include "wx/colour.h" // we have member variables of these classes #include "wx/font.h" // so we can't do without them #include "wx/bitmap.h" // for wxNullBitmap #include "wx/brush.h" #include "wx/pen.h" #include "wx/palette.h" #include "wx/dynarray.h" #include "wx/math.h" #include "wx/image.h" #include "wx/region.h" #include "wx/affinematrix2d.h" #define wxUSE_NEW_DC 1 class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxClientDC; class WXDLLIMPEXP_FWD_CORE wxPaintDC; class WXDLLIMPEXP_FWD_CORE wxWindowDC; class WXDLLIMPEXP_FWD_CORE wxScreenDC; class WXDLLIMPEXP_FWD_CORE wxMemoryDC; class WXDLLIMPEXP_FWD_CORE wxPrinterDC; class WXDLLIMPEXP_FWD_CORE wxPrintData; class WXDLLIMPEXP_FWD_CORE wxWindow; #if wxUSE_GRAPHICS_CONTEXT class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; #endif // Logical ops enum wxRasterOperationMode { wxCLEAR, // 0 wxXOR, // src XOR dst wxINVERT, // NOT dst wxOR_REVERSE, // src OR (NOT dst) wxAND_REVERSE, // src AND (NOT dst) wxCOPY, // src wxAND, // src AND dst wxAND_INVERT, // (NOT src) AND dst wxNO_OP, // dst wxNOR, // (NOT src) AND (NOT dst) wxEQUIV, // (NOT src) XOR dst wxSRC_INVERT, // (NOT src) wxOR_INVERT, // (NOT src) OR dst wxNAND, // (NOT src) OR (NOT dst) wxOR, // src OR dst wxSET // 1 #if WXWIN_COMPATIBILITY_2_8 ,wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET #endif //WXWIN_COMPATIBILITY_2_8 }; // Flood styles enum wxFloodFillStyle { wxFLOOD_SURFACE = 1, wxFLOOD_BORDER }; // Mapping modes enum wxMappingMode { wxMM_TEXT = 1, wxMM_METRIC, wxMM_LOMETRIC, wxMM_TWIPS, wxMM_POINTS }; // Description of text characteristics. struct wxFontMetrics { wxFontMetrics() { height = ascent = descent = internalLeading = externalLeading = averageWidth = 0; } int height, // Total character height. ascent, // Part of the height above the baseline. descent, // Part of the height below the baseline. internalLeading, // Intra-line spacing. externalLeading, // Inter-line spacing. averageWidth; // Average font width, a.k.a. "x-width". }; #if WXWIN_COMPATIBILITY_2_8 //----------------------------------------------------------------------------- // wxDrawObject helper class //----------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDrawObject { public: wxDEPRECATED_CONSTRUCTOR(wxDrawObject)() : m_isBBoxValid(false) , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) { } virtual ~wxDrawObject() { } virtual void Draw(wxDC&) const { } virtual void CalcBoundingBox(wxCoord x, wxCoord y) { if ( m_isBBoxValid ) { if ( x < m_minX ) m_minX = x; if ( y < m_minY ) m_minY = y; if ( x > m_maxX ) m_maxX = x; if ( y > m_maxY ) m_maxY = y; } else { m_isBBoxValid = true; m_minX = x; m_minY = y; m_maxX = x; m_maxY = y; } } void ResetBoundingBox() { m_isBBoxValid = false; m_minX = m_maxX = m_minY = m_maxY = 0; } // Get the final bounding box of the PostScript or Metafile picture. wxCoord MinX() const { return m_minX; } wxCoord MaxX() const { return m_maxX; } wxCoord MinY() const { return m_minY; } wxCoord MaxY() const { return m_maxY; } //to define the type of object for derived objects virtual int GetType()=0; protected: //for boundingbox calculation bool m_isBBoxValid:1; //for boundingbox calculation wxCoord m_minX, m_minY, m_maxX, m_maxY; }; #endif // WXWIN_COMPATIBILITY_2_8 //----------------------------------------------------------------------------- // wxDCFactory //----------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxDCImpl; class WXDLLIMPEXP_CORE wxDCFactory { public: wxDCFactory() {} virtual ~wxDCFactory() {} virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0; virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0; virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0; virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0; virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0; virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0; virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0; #if wxUSE_PRINTING_ARCHITECTURE virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0; #endif static void Set(wxDCFactory *factory); static wxDCFactory *Get(); private: static wxDCFactory *m_factory; }; //----------------------------------------------------------------------------- // wxNativeDCFactory //----------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory { public: wxNativeDCFactory() {} virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) wxOVERRIDE; virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) wxOVERRIDE; virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) wxOVERRIDE; virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) wxOVERRIDE; virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) wxOVERRIDE; virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) wxOVERRIDE; virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) wxOVERRIDE; #if wxUSE_PRINTING_ARCHITECTURE virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) wxOVERRIDE; #endif }; //----------------------------------------------------------------------------- // wxDCImpl //----------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDCImpl: public wxObject { public: wxDCImpl( wxDC *owner ); virtual ~wxDCImpl(); wxDC *GetOwner() const { return m_owner; } wxWindow* GetWindow() const { return m_window; } virtual bool IsOk() const { return m_ok; } // query capabilities virtual bool CanDrawBitmap() const = 0; virtual bool CanGetTextExtent() const = 0; // get Cairo context virtual void* GetCairoContext() const { return NULL; } virtual void* GetHandle() const { return NULL; } // query dimension, colour deps, resolution virtual void DoGetSize(int *width, int *height) const = 0; void GetSize(int *width, int *height) const { DoGetSize(width, height); return ; } wxSize GetSize() const { int w, h; DoGetSize(&w, &h); return wxSize(w, h); } virtual void DoGetSizeMM(int* width, int* height) const = 0; virtual int GetDepth() const = 0; virtual wxSize GetPPI() const = 0; // Right-To-Left (RTL) modes virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { } virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; } // page and document virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; } virtual void EndDoc() { } virtual void StartPage() { } virtual void EndPage() { } // flushing the content of this dc immediately eg onto screen virtual void Flush() { } // bounding box virtual void CalcBoundingBox(wxCoord x, wxCoord y) { // Bounding box is internally stored in device units. x = LogicalToDeviceX(x); y = LogicalToDeviceY(y); if ( m_isBBoxValid ) { if ( x < m_minX ) m_minX = x; if ( y < m_minY ) m_minY = y; if ( x > m_maxX ) m_maxX = x; if ( y > m_maxY ) m_maxY = y; } else { m_isBBoxValid = true; m_minX = x; m_minY = y; m_maxX = x; m_maxY = y; } } void ResetBoundingBox() { m_isBBoxValid = false; m_minX = m_maxX = m_minY = m_maxY = 0; } // Get bounding box in logical units. wxCoord MinX() const { return m_isBBoxValid ? DeviceToLogicalX(m_minX) : 0; } wxCoord MaxX() const { return m_isBBoxValid ? DeviceToLogicalX(m_maxX) : 0; } wxCoord MinY() const { return m_isBBoxValid ? DeviceToLogicalY(m_minY) : 0; } wxCoord MaxY() const { return m_isBBoxValid ? DeviceToLogicalY(m_maxY) : 0; } // setters and getters virtual void SetFont(const wxFont& font) = 0; virtual const wxFont& GetFont() const { return m_font; } virtual void SetPen(const wxPen& pen) = 0; virtual const wxPen& GetPen() const { return m_pen; } virtual void SetBrush(const wxBrush& brush) = 0; virtual const wxBrush& GetBrush() const { return m_brush; } virtual void SetBackground(const wxBrush& brush) = 0; virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } virtual void SetBackgroundMode(int mode) = 0; virtual int GetBackgroundMode() const { return m_backgroundMode; } virtual void SetTextForeground(const wxColour& colour) { m_textForegroundColour = colour; } virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; } virtual void SetTextBackground(const wxColour& colour) { m_textBackgroundColour = colour; } virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; } #if wxUSE_PALETTE virtual void SetPalette(const wxPalette& palette) = 0; #endif // wxUSE_PALETTE // inherit the DC attributes (font and colours) from the given window // // this is called automatically when a window, client or paint DC is // created virtual void InheritAttributes(wxWindow *win); // logical functions virtual void SetLogicalFunction(wxRasterOperationMode function) = 0; virtual wxRasterOperationMode GetLogicalFunction() const { return m_logicalFunction; } // text measurement virtual wxCoord GetCharHeight() const = 0; virtual wxCoord GetCharWidth() const = 0; // The derived classes should really override DoGetFontMetrics() to return // the correct values in the future but for now provide a default // implementation in terms of DoGetTextExtent() to avoid breaking the // compilation of all other ports as wxMSW is the only one to implement it. virtual void DoGetFontMetrics(int *height, int *ascent, int *descent, int *internalLeading, int *externalLeading, int *averageWidth) const; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, const wxFont *theFont = NULL) const = 0; virtual void GetMultiLineTextExtent(const wxString& string, wxCoord *width, wxCoord *height, wxCoord *heightLine = NULL, const wxFont *font = NULL) const; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; // clearing virtual void Clear() = 0; // clipping // Note that this pure virtual method has an implementation that updates // the values returned by DoGetClippingBox() and so can be called from the // derived class overridden version if it makes sense (i.e. if the clipping // box coordinates are not already updated in some other way). virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) = 0; // NB: this function works with device coordinates, not the logical ones! virtual void DoSetDeviceClippingRegion(const wxRegion& region) = 0; // Method used to implement wxDC::GetClippingBox(). // // Default implementation returns values stored in m_clip[XY][12] member // variables, so this method doesn't need to be overridden if they're kept // up to date. virtual bool DoGetClippingRect(wxRect& rect) const; #if WXWIN_COMPATIBILITY_3_0 // This method is kept for backwards compatibility but shouldn't be used // nor overridden in the new code, implement DoGetClippingRect() above // instead. wxDEPRECATED_BUT_USED_INTERNALLY( virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const ); #endif // WXWIN_COMPATIBILITY_3_0 virtual void DestroyClippingRegion() { ResetClipping(); } // coordinates conversions and transforms virtual wxCoord DeviceToLogicalX(wxCoord x) const; virtual wxCoord DeviceToLogicalY(wxCoord y) const; virtual wxCoord DeviceToLogicalXRel(wxCoord x) const; virtual wxCoord DeviceToLogicalYRel(wxCoord y) const; virtual wxCoord LogicalToDeviceX(wxCoord x) const; virtual wxCoord LogicalToDeviceY(wxCoord y) const; virtual wxCoord LogicalToDeviceXRel(wxCoord x) const; virtual wxCoord LogicalToDeviceYRel(wxCoord y) const; virtual void SetMapMode(wxMappingMode mode); virtual wxMappingMode GetMapMode() const { return m_mappingMode; } virtual void SetUserScale(double x, double y); virtual void GetUserScale(double *x, double *y) const { if ( x ) *x = m_userScaleX; if ( y ) *y = m_userScaleY; } virtual void SetLogicalScale(double x, double y); virtual void GetLogicalScale(double *x, double *y) const { if ( x ) *x = m_logicalScaleX; if ( y ) *y = m_logicalScaleY; } virtual void SetLogicalOrigin(wxCoord x, wxCoord y); virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const { if ( x ) *x = m_logicalOriginX; if ( y ) *y = m_logicalOriginY; } virtual void SetDeviceOrigin(wxCoord x, wxCoord y); virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const { if ( x ) *x = m_deviceOriginX; if ( y ) *y = m_deviceOriginY; } #if wxUSE_DC_TRANSFORM_MATRIX // Transform matrix support is not available in most ports right now // (currently only wxMSW provides it) so do nothing in these methods by // default. virtual bool CanUseTransformMatrix() const { return false; } virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix)) { return false; } virtual wxAffineMatrix2D GetTransformMatrix() const { return wxAffineMatrix2D(); } virtual void ResetTransformMatrix() { } #endif // wxUSE_DC_TRANSFORM_MATRIX virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y ); virtual void ComputeScaleAndOrigin(); // this needs to overidden if the axis is inverted virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); virtual double GetContentScaleFactor() const { return m_contentScaleFactor; } #ifdef __WXMSW__ // Native Windows functions using the underlying HDC don't honour GDI+ // transformations which may be applied to it. Using this function we can // transform the coordinates manually before passing them to such functions // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a // wxGCDC. virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const { return r; } #endif // __WXMSW__ // --------------------------------------------------------- // the actual drawing API virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, wxFloodFillStyle style = wxFLOOD_SURFACE) = 0; virtual void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST); virtual void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter); virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0; virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0; virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0; virtual void DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) = 0; virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height); virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea) = 0; virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) = 0; virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; virtual void DoCrossHair(wxCoord x, wxCoord y) = 0; virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0; virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = false) = 0; virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0; virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) = 0; virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) = 0; virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight, wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const { return wxNullBitmap; } virtual void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset ) = 0; virtual void DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset ); virtual void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0; virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle); void DrawPolygon(const wxPointList *list, wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle ); #if wxUSE_SPLINES void DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3); void DrawSpline(int n, const wxPoint points[]); void DrawSpline(const wxPointList *points) { DoDrawSpline(points); } virtual void DoDrawSpline(const wxPointList *points); #endif // --------------------------------------------------------- // wxMemoryDC Impl API virtual void DoSelect(const wxBitmap& WXUNUSED(bmp)) { } virtual const wxBitmap& GetSelectedBitmap() const { return wxNullBitmap; } virtual wxBitmap& GetSelectedBitmap() { return wxNullBitmap; } // --------------------------------------------------------- // wxPrinterDC Impl API virtual wxRect GetPaperRect() const { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); } virtual int GetResolution() const { return -1; } #if wxUSE_GRAPHICS_CONTEXT virtual wxGraphicsContext* GetGraphicsContext() const { return NULL; } virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) ) {} #endif private: wxDC *m_owner; protected: // This method exists for backwards compatibility only (while it's not // documented, there are derived classes using it outside wxWidgets // itself), don't use it in any new code and just call wxDCImpl version of // DestroyClippingRegion() to reset the clipping information instead. void ResetClipping() { m_clipping = false; m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; } // returns adjustment factor for converting wxFont "point size"; in wx // it is point size on screen and needs to be multiplied by this value // for rendering on higher-resolution DCs such as printer ones static float GetFontPointSizeAdjustment(float dpi); // Return the number of pixels per mm in the horizontal and vertical // directions, respectively. // // If the physical size of the DC is not known, or doesn't make sense, as // for a SVG DC, for example, a fixed value corresponding to the standard // DPI is used. double GetMMToPXx() const; double GetMMToPXy() const; // window on which the DC draws or NULL wxWindow *m_window; // flags bool m_colour:1; bool m_ok:1; bool m_clipping:1; bool m_isInteractive:1; bool m_isBBoxValid:1; // coordinate system variables wxCoord m_logicalOriginX, m_logicalOriginY; wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner // is not at 0,0. This was the case under // Mac's GrafPorts (coordinate system // used toplevel window's origin) and // e.g. for Postscript, where the native // origin in the bottom left corner. double m_logicalScaleX, m_logicalScaleY; double m_userScaleX, m_userScaleY; double m_scaleX, m_scaleY; // calculated from logical scale and user scale int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes double m_contentScaleFactor; // used by high resolution displays (retina) // Pixel per mm in horizontal and vertical directions. // // These variables are computed on demand by GetMMToPX[xy]() functions, // don't access them directly other than for assigning to them. mutable double m_mm_to_pix_x, m_mm_to_pix_y; // bounding and clipping boxes wxCoord m_minX, m_minY, m_maxX, m_maxY; // Bounding box is stored in device units. wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; // Clipping box is stored in logical units. wxRasterOperationMode m_logicalFunction; int m_backgroundMode; wxMappingMode m_mappingMode; wxPen m_pen; wxBrush m_brush; wxBrush m_backgroundBrush; wxColour m_textForegroundColour; wxColour m_textBackgroundColour; wxFont m_font; #if wxUSE_PALETTE wxPalette m_palette; bool m_hasCustomPalette; #endif // wxUSE_PALETTE private: // Return the full DC area in logical coordinates. wxRect GetLogicalArea() const; wxDECLARE_ABSTRACT_CLASS(wxDCImpl); }; class WXDLLIMPEXP_CORE wxDC : public wxObject { public: // copy attributes (font, colours and writing direction) from another DC void CopyAttributes(const wxDC& dc); virtual ~wxDC() { delete m_pimpl; } wxDCImpl *GetImpl() { return m_pimpl; } const wxDCImpl *GetImpl() const { return m_pimpl; } wxWindow *GetWindow() const { return m_pimpl->GetWindow(); } void *GetHandle() const { return m_pimpl->GetHandle(); } bool IsOk() const { return m_pimpl && m_pimpl->IsOk(); } // query capabilities bool CanDrawBitmap() const { return m_pimpl->CanDrawBitmap(); } bool CanGetTextExtent() const { return m_pimpl->CanGetTextExtent(); } // query dimension, colour deps, resolution void GetSize(int *width, int *height) const { m_pimpl->DoGetSize(width, height); } wxSize GetSize() const { return m_pimpl->GetSize(); } void GetSizeMM(int* width, int* height) const { m_pimpl->DoGetSizeMM(width, height); } wxSize GetSizeMM() const { int w, h; m_pimpl->DoGetSizeMM(&w, &h); return wxSize(w, h); } int GetDepth() const { return m_pimpl->GetDepth(); } wxSize GetPPI() const { return m_pimpl->GetPPI(); } virtual int GetResolution() const { return m_pimpl->GetResolution(); } double GetContentScaleFactor() const { return m_pimpl->GetContentScaleFactor(); } // Right-To-Left (RTL) modes void SetLayoutDirection(wxLayoutDirection dir) { m_pimpl->SetLayoutDirection( dir ); } wxLayoutDirection GetLayoutDirection() const { return m_pimpl->GetLayoutDirection(); } // page and document bool StartDoc(const wxString& message) { return m_pimpl->StartDoc(message); } void EndDoc() { m_pimpl->EndDoc(); } void StartPage() { m_pimpl->StartPage(); } void EndPage() { m_pimpl->EndPage(); } // bounding box void CalcBoundingBox(wxCoord x, wxCoord y) { m_pimpl->CalcBoundingBox(x,y); } void ResetBoundingBox() { m_pimpl->ResetBoundingBox(); } wxCoord MinX() const { return m_pimpl->MinX(); } wxCoord MaxX() const { return m_pimpl->MaxX(); } wxCoord MinY() const { return m_pimpl->MinY(); } wxCoord MaxY() const { return m_pimpl->MaxY(); } // setters and getters void SetFont(const wxFont& font) { m_pimpl->SetFont( font ); } const wxFont& GetFont() const { return m_pimpl->GetFont(); } void SetPen(const wxPen& pen) { m_pimpl->SetPen( pen ); } const wxPen& GetPen() const { return m_pimpl->GetPen(); } void SetBrush(const wxBrush& brush) { m_pimpl->SetBrush( brush ); } const wxBrush& GetBrush() const { return m_pimpl->GetBrush(); } void SetBackground(const wxBrush& brush) { m_pimpl->SetBackground( brush ); } const wxBrush& GetBackground() const { return m_pimpl->GetBackground(); } void SetBackgroundMode(int mode) { m_pimpl->SetBackgroundMode( mode ); } int GetBackgroundMode() const { return m_pimpl->GetBackgroundMode(); } void SetTextForeground(const wxColour& colour) { m_pimpl->SetTextForeground(colour); } const wxColour& GetTextForeground() const { return m_pimpl->GetTextForeground(); } void SetTextBackground(const wxColour& colour) { m_pimpl->SetTextBackground(colour); } const wxColour& GetTextBackground() const { return m_pimpl->GetTextBackground(); } #if wxUSE_PALETTE void SetPalette(const wxPalette& palette) { m_pimpl->SetPalette(palette); } #endif // wxUSE_PALETTE // logical functions void SetLogicalFunction(wxRasterOperationMode function) { m_pimpl->SetLogicalFunction(function); } wxRasterOperationMode GetLogicalFunction() const { return m_pimpl->GetLogicalFunction(); } // text measurement wxCoord GetCharHeight() const { return m_pimpl->GetCharHeight(); } wxCoord GetCharWidth() const { return m_pimpl->GetCharWidth(); } wxFontMetrics GetFontMetrics() const { wxFontMetrics fm; m_pimpl->DoGetFontMetrics(&fm.height, &fm.ascent, &fm.descent, &fm.internalLeading, &fm.externalLeading, &fm.averageWidth); return fm; } void GetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, const wxFont *theFont = NULL) const { m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } wxSize GetTextExtent(const wxString& string) const { wxCoord w, h; m_pimpl->DoGetTextExtent(string, &w, &h); return wxSize(w, h); } void GetMultiLineTextExtent(const wxString& string, wxCoord *width, wxCoord *height, wxCoord *heightLine = NULL, const wxFont *font = NULL) const { m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); } wxSize GetMultiLineTextExtent(const wxString& string) const { wxCoord w, h; m_pimpl->GetMultiLineTextExtent(string, &w, &h); return wxSize(w, h); } bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const { return m_pimpl->DoGetPartialTextExtents(text, widths); } // clearing void Clear() { m_pimpl->Clear(); } // clipping void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { m_pimpl->DoSetClippingRegion(x, y, width, height); } void SetClippingRegion(const wxPoint& pt, const wxSize& sz) { m_pimpl->DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } void SetClippingRegion(const wxRect& rect) { m_pimpl->DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } // unlike the functions above, the coordinates of the region used in this // one are in device coordinates, not the logical ones void SetDeviceClippingRegion(const wxRegion& region) { m_pimpl->DoSetDeviceClippingRegion(region); } // this function is deprecated because its name is confusing: you may // expect it to work with logical coordinates but, in fact, it does exactly // the same thing as SetDeviceClippingRegion() // // please review the code using it and either replace it with calls to // SetDeviceClippingRegion() or correct it if it was [wrongly] passing // logical coordinates to this function wxDEPRECATED_INLINE(void SetClippingRegion(const wxRegion& region), SetDeviceClippingRegion(region); ) void DestroyClippingRegion() { m_pimpl->DestroyClippingRegion(); } bool GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const { wxRect r; const bool clipping = m_pimpl->DoGetClippingRect(r); if ( x ) *x = r.x; if ( y ) *y = r.y; if ( w ) *w = r.width; if ( h ) *h = r.height; return clipping; } bool GetClippingBox(wxRect& rect) const { return m_pimpl->DoGetClippingRect(rect); } // coordinates conversions and transforms wxCoord DeviceToLogicalX(wxCoord x) const { return m_pimpl->DeviceToLogicalX(x); } wxCoord DeviceToLogicalY(wxCoord y) const { return m_pimpl->DeviceToLogicalY(y); } wxCoord DeviceToLogicalXRel(wxCoord x) const { return m_pimpl->DeviceToLogicalXRel(x); } wxCoord DeviceToLogicalYRel(wxCoord y) const { return m_pimpl->DeviceToLogicalYRel(y); } wxCoord LogicalToDeviceX(wxCoord x) const { return m_pimpl->LogicalToDeviceX(x); } wxCoord LogicalToDeviceY(wxCoord y) const { return m_pimpl->LogicalToDeviceY(y); } wxCoord LogicalToDeviceXRel(wxCoord x) const { return m_pimpl->LogicalToDeviceXRel(x); } wxCoord LogicalToDeviceYRel(wxCoord y) const { return m_pimpl->LogicalToDeviceYRel(y); } void SetMapMode(wxMappingMode mode) { m_pimpl->SetMapMode(mode); } wxMappingMode GetMapMode() const { return m_pimpl->GetMapMode(); } void SetUserScale(double x, double y) { m_pimpl->SetUserScale(x,y); } void GetUserScale(double *x, double *y) const { m_pimpl->GetUserScale( x, y ); } void SetLogicalScale(double x, double y) { m_pimpl->SetLogicalScale( x, y ); } void GetLogicalScale(double *x, double *y) const { m_pimpl->GetLogicalScale( x, y ); } void SetLogicalOrigin(wxCoord x, wxCoord y) { m_pimpl->SetLogicalOrigin(x,y); } void GetLogicalOrigin(wxCoord *x, wxCoord *y) const { m_pimpl->DoGetLogicalOrigin(x, y); } wxPoint GetLogicalOrigin() const { wxCoord x, y; m_pimpl->DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } void SetDeviceOrigin(wxCoord x, wxCoord y) { m_pimpl->SetDeviceOrigin( x, y); } void GetDeviceOrigin(wxCoord *x, wxCoord *y) const { m_pimpl->DoGetDeviceOrigin(x, y); } wxPoint GetDeviceOrigin() const { wxCoord x, y; m_pimpl->DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } void SetAxisOrientation(bool xLeftRight, bool yBottomUp) { m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); } #if wxUSE_DC_TRANSFORM_MATRIX bool CanUseTransformMatrix() const { return m_pimpl->CanUseTransformMatrix(); } bool SetTransformMatrix(const wxAffineMatrix2D &matrix) { return m_pimpl->SetTransformMatrix(matrix); } wxAffineMatrix2D GetTransformMatrix() const { return m_pimpl->GetTransformMatrix(); } void ResetTransformMatrix() { m_pimpl->ResetTransformMatrix(); } #endif // wxUSE_DC_TRANSFORM_MATRIX // mostly internal void SetDeviceLocalOrigin( wxCoord x, wxCoord y ) { m_pimpl->SetDeviceLocalOrigin( x, y ); } // ----------------------------------------------- // the actual drawing API bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, wxFloodFillStyle style = wxFLOOD_SURFACE) { return m_pimpl->DoFloodFill(x, y, col, style); } bool FloodFill(const wxPoint& pt, const wxColour& col, wxFloodFillStyle style = wxFLOOD_SURFACE) { return m_pimpl->DoFloodFill(pt.x, pt.y, col, style); } // fill the area specified by rect with a radial gradient, starting from // initialColour in the centre of the cercle and fading to destColour. void GradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour) { m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour, wxPoint(rect.GetWidth() / 2, rect.GetHeight() / 2)); } void GradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) { m_pimpl->DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } // fill the area specified by rect with a linear gradient void GradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST) { m_pimpl->DoGradientFillLinear(rect, initialColour, destColour, nDirection); } bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const { return m_pimpl->DoGetPixel(x, y, col); } bool GetPixel(const wxPoint& pt, wxColour *col) const { return m_pimpl->DoGetPixel(pt.x, pt.y, col); } void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { m_pimpl->DoDrawLine(x1, y1, x2, y2); } void DrawLine(const wxPoint& pt1, const wxPoint& pt2) { m_pimpl->DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } void CrossHair(wxCoord x, wxCoord y) { m_pimpl->DoCrossHair(x, y); } void CrossHair(const wxPoint& pt) { m_pimpl->DoCrossHair(pt.x, pt.y); } void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc) { m_pimpl->DoDrawArc(x1, y1, x2, y2, xc, yc); } void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) { m_pimpl->DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { m_pimpl->DoDrawCheckMark(x, y, width, height); } void DrawCheckMark(const wxRect& rect) { m_pimpl->DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea) { m_pimpl->DoDrawEllipticArc(x, y, w, h, sa, ea); } void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea) { m_pimpl->DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } void DrawPoint(wxCoord x, wxCoord y) { m_pimpl->DoDrawPoint(x, y); } void DrawPoint(const wxPoint& pt) { m_pimpl->DoDrawPoint(pt.x, pt.y); } void DrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) { m_pimpl->DoDrawLines(n, points, xoffset, yoffset); } void DrawLines(const wxPointList *list, wxCoord xoffset = 0, wxCoord yoffset = 0) { m_pimpl->DrawLines( list, xoffset, yoffset ); } #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED( void DrawLines(const wxList *list, wxCoord xoffset = 0, wxCoord yoffset = 0) ); #endif // WXWIN_COMPATIBILITY_2_8 void DrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) { m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } void DrawPolygon(const wxPointList *list, wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); } void DrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) { m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED( void DrawPolygon(const wxList *list, wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) ); #endif // WXWIN_COMPATIBILITY_2_8 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { m_pimpl->DoDrawRectangle(x, y, width, height); } void DrawRectangle(const wxPoint& pt, const wxSize& sz) { m_pimpl->DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } void DrawRectangle(const wxRect& rect) { m_pimpl->DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { m_pimpl->DoDrawRoundedRectangle(x, y, width, height, radius); } void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius) { m_pimpl->DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } void DrawRoundedRectangle(const wxRect& r, double radius) { m_pimpl->DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) { m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } void DrawCircle(const wxPoint& pt, wxCoord radius) { m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); } void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { m_pimpl->DoDrawEllipse(x, y, width, height); } void DrawEllipse(const wxPoint& pt, const wxSize& sz) { m_pimpl->DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } void DrawEllipse(const wxRect& rect) { m_pimpl->DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) { m_pimpl->DoDrawIcon(icon, x, y); } void DrawIcon(const wxIcon& icon, const wxPoint& pt) { m_pimpl->DoDrawIcon(icon, pt.x, pt.y); } void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = false) { m_pimpl->DoDrawBitmap(bmp, x, y, useMask); } void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = false) { m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); } void DrawText(const wxString& text, wxCoord x, wxCoord y) { m_pimpl->DoDrawText(text, x, y); } void DrawText(const wxString& text, const wxPoint& pt) { m_pimpl->DoDrawText(text, pt.x, pt.y); } void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { m_pimpl->DoDrawRotatedText(text, x, y, angle); } void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) { m_pimpl->DoDrawRotatedText(text, pt.x, pt.y, angle); } // this version puts both optional bitmap and the text into the given // rectangle and aligns is as specified by alignment parameter; it also // will emphasize the character with the given index if it is != -1 and // return the bounding rectangle if required void DrawLabel(const wxString& text, const wxBitmap& image, const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, wxRect *rectBounding = NULL); void DrawLabel(const wxString& text, const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1) { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) { return m_pimpl->DoBlit(xdest, ydest, width, height, source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); } bool Blit(const wxPoint& destPt, const wxSize& sz, wxDC *source, const wxPoint& srcPt, wxRasterOperationMode rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition) { return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); } bool StretchBlit(wxCoord dstX, wxCoord dstY, wxCoord dstWidth, wxCoord dstHeight, wxDC *source, wxCoord srcX, wxCoord srcY, wxCoord srcWidth, wxCoord srcHeight, wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord) { return m_pimpl->DoStretchBlit(dstX, dstY, dstWidth, dstHeight, source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY); } bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize, wxDC *source, const wxPoint& srcPt, const wxSize& srcSize, wxRasterOperationMode rop = wxCOPY, bool useMask = false, const wxPoint& srcMaskPt = wxDefaultPosition) { return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y, source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y); } wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const { return m_pimpl->DoGetAsBitmap(subrect); } #if wxUSE_SPLINES void DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3) { m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); } void DrawSpline(int n, const wxPoint points[]) { m_pimpl->DrawSpline(n,points); } void DrawSpline(const wxPointList *points) { m_pimpl->DrawSpline(points); } #endif // wxUSE_SPLINES #if WXWIN_COMPATIBILITY_2_8 // for compatibility with the old code when wxCoord was long everywhere wxDEPRECATED( void GetTextExtent(const wxString& string, long *x, long *y, long *descent = NULL, long *externalLeading = NULL, const wxFont *theFont = NULL) const ); wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const ); wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const ); wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const ); wxDEPRECATED( void DrawObject(wxDrawObject* drawobject) ); #endif // WXWIN_COMPATIBILITY_2_8 #ifdef __WXMSW__ // GetHDC() is the simplest way to retrieve an HDC From a wxDC but only // works if this wxDC is GDI-based and fails for GDI+ contexts (and // anything else without HDC, e.g. wxPostScriptDC) WXHDC GetHDC() const; // don't use these methods manually, use GetTempHDC() instead virtual WXHDC AcquireHDC() { return GetHDC(); } virtual void ReleaseHDC(WXHDC WXUNUSED(hdc)) { } // helper class holding the result of GetTempHDC() with std::auto_ptr<>-like // semantics, i.e. it is moved when copied class TempHDC { public: TempHDC(wxDC& dc) : m_dc(dc), m_hdc(dc.AcquireHDC()) { } TempHDC(const TempHDC& thdc) : m_dc(thdc.m_dc), m_hdc(thdc.m_hdc) { const_cast<TempHDC&>(thdc).m_hdc = 0; } ~TempHDC() { if ( m_hdc ) m_dc.ReleaseHDC(m_hdc); } WXHDC GetHDC() const { return m_hdc; } private: wxDC& m_dc; WXHDC m_hdc; wxDECLARE_NO_ASSIGN_CLASS(TempHDC); }; // GetTempHDC() also works for wxGCDC (but still not for wxPostScriptDC &c) TempHDC GetTempHDC() { return TempHDC(*this); } #endif // __WXMSW__ #if wxUSE_GRAPHICS_CONTEXT virtual wxGraphicsContext* GetGraphicsContext() const { return m_pimpl->GetGraphicsContext(); } virtual void SetGraphicsContext( wxGraphicsContext* ctx ) { m_pimpl->SetGraphicsContext(ctx); } #endif protected: // ctor takes ownership of the pointer wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { } wxDCImpl * const m_pimpl; private: wxDECLARE_ABSTRACT_CLASS(wxDC); wxDECLARE_NO_COPY_CLASS(wxDC); }; // ---------------------------------------------------------------------------- // helper class: you can use it to temporarily change the DC text colour and // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDCTextColourChanger { public: wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) { Set(col); } ~wxDCTextColourChanger() { if ( m_colFgOld.IsOk() ) m_dc.SetTextForeground(m_colFgOld); } void Set(const wxColour& col) { if ( !m_colFgOld.IsOk() ) m_colFgOld = m_dc.GetTextForeground(); m_dc.SetTextForeground(col); } private: wxDC& m_dc; wxColour m_colFgOld; wxDECLARE_NO_COPY_CLASS(wxDCTextColourChanger); }; // ---------------------------------------------------------------------------- // helper class: you can use it to temporarily change the DC pen and // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDCPenChanger { public: wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen()) { m_dc.SetPen(pen); } ~wxDCPenChanger() { if ( m_penOld.IsOk() ) m_dc.SetPen(m_penOld); } private: wxDC& m_dc; wxPen m_penOld; wxDECLARE_NO_COPY_CLASS(wxDCPenChanger); }; // ---------------------------------------------------------------------------- // helper class: you can use it to temporarily change the DC brush and // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDCBrushChanger { public: wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush()) { m_dc.SetBrush(brush); } ~wxDCBrushChanger() { if ( m_brushOld.IsOk() ) m_dc.SetBrush(m_brushOld); } private: wxDC& m_dc; wxBrush m_brushOld; wxDECLARE_NO_COPY_CLASS(wxDCBrushChanger); }; // ---------------------------------------------------------------------------- // another small helper class: sets the clipping region in its ctor and // destroys it in the dtor // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDCClipper { public: wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc) { Init(r.GetBox()); } wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) { Init(r); } wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) { Init(wxRect(x, y, w, h)); } ~wxDCClipper() { m_dc.DestroyClippingRegion(); if ( m_restoreOld ) m_dc.SetClippingRegion(m_oldClipRect); } private: // Common part of all ctors. void Init(const wxRect& r) { m_restoreOld = m_dc.GetClippingBox(m_oldClipRect); m_dc.SetClippingRegion(r); } wxDC& m_dc; wxRect m_oldClipRect; bool m_restoreOld; wxDECLARE_NO_COPY_CLASS(wxDCClipper); }; // ---------------------------------------------------------------------------- // helper class: you can use it to temporarily change the DC font and // restore it automatically when the object goes out of scope // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDCFontChanger { public: wxDCFontChanger(wxDC& dc) : m_dc(dc), m_fontOld() { } wxDCFontChanger(wxDC& dc, const wxFont& font) : m_dc(dc), m_fontOld(dc.GetFont()) { m_dc.SetFont(font); } void Set(const wxFont& font) { if ( !m_fontOld.IsOk() ) m_fontOld = m_dc.GetFont(); m_dc.SetFont(font); } ~wxDCFontChanger() { if ( m_fontOld.IsOk() ) m_dc.SetFont(m_fontOld); } private: wxDC& m_dc; wxFont m_fontOld; wxDECLARE_NO_COPY_CLASS(wxDCFontChanger); }; #endif // _WX_DC_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/mousemanager.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/mousemanager.h // Purpose: wxMouseEventsManager class declaration // Author: Vadim Zeitlin // Created: 2009-04-20 // Copyright: (c) 2009 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_MOUSEMANAGER_H_ #define _WX_MOUSEMANAGER_H_ #include "wx/event.h" // ---------------------------------------------------------------------------- // wxMouseEventsManager // ---------------------------------------------------------------------------- /* This class handles mouse events and synthesizes high-level notifications such as clicks and drag events from low level mouse button presses and mouse movement events. It is useful because handling the mouse events is less obvious than might seem at a first glance: for example, clicks on an object should only be generated if the mouse was both pressed and released over it and not just released (so it requires storing the previous state) and dragging shouldn't start before the mouse moves away far enough. This class encapsulates all these dull details for controls containing multiple items which can be identified by a positive integer index and you just need to implement its pure virtual functions to use it. */ class WXDLLIMPEXP_CORE wxMouseEventsManager : public wxEvtHandler { public: // a mouse event manager is always associated with a window and must be // deleted by the window when it is destroyed so if it is created using the // default ctor Create() must be called later wxMouseEventsManager() { Init(); } wxMouseEventsManager(wxWindow *win) { Init(); Create(win); } bool Create(wxWindow *win); virtual ~wxMouseEventsManager(); protected: // called to find the item at the given position: return wxNOT_FOUND (-1) // if there is no item here virtual int MouseHitTest(const wxPoint& pos) = 0; // called when the user clicked (i.e. pressed and released mouse over the // same item), should normally generate a notification about this click and // return true if it was handled or false otherwise, determining whether // the original mouse event is skipped or not virtual bool MouseClicked(int item) = 0; // called to start dragging the given item, should generate the appropriate // BEGIN_DRAG event and return false if dragging this item was forbidden virtual bool MouseDragBegin(int item, const wxPoint& pos) = 0; // called while the item is being dragged, should normally update the // feedback on screen (usually using wxOverlay) virtual void MouseDragging(int item, const wxPoint& pos) = 0; // called when the mouse is released after dragging the item virtual void MouseDragEnd(int item, const wxPoint& pos) = 0; // called when mouse capture is lost while dragging the item, should remove // the visual feedback drawn by MouseDragging() virtual void MouseDragCancelled(int item) = 0; // you don't need to override those but you will want to do if it your // control renders pressed items differently // called when the item is becomes pressed, can be used to change its // appearance virtual void MouseClickBegin(int WXUNUSED(item)) { } // called if the mouse capture was lost while the item was pressed, can be // used to restore the default item appearance if it was changed in // MouseClickBegin() virtual void MouseClickCancelled(int WXUNUSED(item)) { } private: /* Here is a small diagram explaining the switches between different states: /---------->NORMAL<--------------- Drag end / / / | event / / | | ^ / / | | | Click / N | | mouse | mouse up event / | | down | | / | | DRAGGING | / | | ^ Y|/ N \ v |Y +-------------+ +--------+ N +-----------+ |On same item?| |On item?| -----------|Begin drag?| +-------------+ +--------+ / +-----------+ ^ | / ^ | | / | \ mouse | / mouse moved | \ up v v far enough / \--------PRESSED-------------------/ There are also transitions from PRESSED and DRAGGING to NORMAL in case the mouse capture is lost or Escape key is pressed which are not shown. */ enum State { State_Normal, // initial, default state State_Pressed, // mouse was pressed over an item State_Dragging // the item is being dragged }; // common part of both ctors void Init(); // various event handlers void OnCaptureLost(wxMouseCaptureLostEvent& event); void OnLeftDown(wxMouseEvent& event); void OnLeftUp(wxMouseEvent& event); void OnMove(wxMouseEvent& event); // the associated window, never NULL except between the calls to the // default ctor and Create() wxWindow *m_win; // the current state State m_state; // the details of the operation currently in progress, only valid if // m_state is not normal // the item being pressed or dragged (always valid, i.e. != wxNOT_FOUND if // m_state != State_Normal) int m_item; // the position of the last mouse event of interest: either mouse press in // State_Pressed or last movement event in State_Dragging wxPoint m_posLast; wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxMouseEventsManager); }; #endif // _WX_MOUSEMANAGER_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/wx.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/wx.h // Purpose: wxWidgets central header including the most often used ones // Author: Julian Smart // Modified by: // Created: 01/02/97 // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_WX_H_ #define _WX_WX_H_ #include "wx/defs.h" #include "wx/object.h" #include "wx/dynarray.h" #include "wx/list.h" #include "wx/hash.h" #include "wx/string.h" #include "wx/hashmap.h" #include "wx/arrstr.h" #include "wx/intl.h" #include "wx/log.h" #include "wx/event.h" #include "wx/app.h" #include "wx/utils.h" #include "wx/stream.h" #include "wx/memory.h" #include "wx/math.h" #include "wx/stopwatch.h" #include "wx/timer.h" #include "wx/module.h" #include "wx/wxcrt.h" #include "wx/wxcrtvararg.h" #if wxUSE_GUI #include "wx/window.h" #include "wx/containr.h" #include "wx/panel.h" #include "wx/toplevel.h" #include "wx/frame.h" #include "wx/gdicmn.h" #include "wx/gdiobj.h" #include "wx/region.h" #include "wx/bitmap.h" #include "wx/image.h" #include "wx/colour.h" #include "wx/font.h" #include "wx/dc.h" #include "wx/dcclient.h" #include "wx/dcmemory.h" #include "wx/dcprint.h" #include "wx/dcscreen.h" #include "wx/button.h" #include "wx/menuitem.h" #include "wx/menu.h" #include "wx/pen.h" #include "wx/brush.h" #include "wx/palette.h" #include "wx/icon.h" #include "wx/cursor.h" #include "wx/dialog.h" #include "wx/settings.h" #include "wx/msgdlg.h" #include "wx/dataobj.h" #include "wx/control.h" #include "wx/ctrlsub.h" #include "wx/bmpbuttn.h" #include "wx/checkbox.h" #include "wx/checklst.h" #include "wx/choice.h" #include "wx/scrolbar.h" #include "wx/stattext.h" #include "wx/statbmp.h" #include "wx/statbox.h" #include "wx/listbox.h" #include "wx/radiobox.h" #include "wx/radiobut.h" #include "wx/textctrl.h" #include "wx/slider.h" #include "wx/gauge.h" #include "wx/scrolwin.h" #include "wx/dirdlg.h" #include "wx/toolbar.h" #include "wx/combobox.h" #include "wx/layout.h" #include "wx/sizer.h" #include "wx/statusbr.h" #include "wx/choicdlg.h" #include "wx/textdlg.h" #include "wx/filedlg.h" // this one is included by exactly one file (mdi.cpp) during wx build so even // although we keep it here for the library users, don't include it to avoid // bloating the PCH and (worse) rebuilding the entire library when it changes // when building the library itself #ifndef WXBUILDING #include "wx/mdi.h" #endif // always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator #include "wx/validate.h" #if wxUSE_VALIDATORS #include "wx/valtext.h" #endif // wxUSE_VALIDATORS #endif // wxUSE_GUI #endif // _WX_WX_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/msgdlg.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/msgdlg.h // Purpose: common header and base class for wxMessageDialog // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_MSGDLG_H_BASE_ #define _WX_MSGDLG_H_BASE_ #include "wx/defs.h" #if wxUSE_MSGDLG #include "wx/dialog.h" #include "wx/stockitem.h" extern WXDLLIMPEXP_DATA_CORE(const char) wxMessageBoxCaptionStr[]; // ---------------------------------------------------------------------------- // wxMessageDialogBase: base class defining wxMessageDialog interface // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxMessageDialogBase : public wxDialog { public: // helper class for SetXXXLabels() methods: it makes it possible to pass // either a stock id (wxID_CLOSE) or a string ("&Close") to them class ButtonLabel { public: // ctors are not explicit, objects of this class can be implicitly // constructed from either stock ids or strings ButtonLabel(int stockId) : m_stockId(stockId) { wxASSERT_MSG( wxIsStockID(stockId), "invalid stock id" ); } ButtonLabel(const wxString& label) : m_label(label), m_stockId(wxID_NONE) { } ButtonLabel(const char *label) : m_label(label), m_stockId(wxID_NONE) { } ButtonLabel(const wchar_t *label) : m_label(label), m_stockId(wxID_NONE) { } ButtonLabel(const wxCStrData& label) : m_label(label), m_stockId(wxID_NONE) { } // default copy ctor and dtor are ok // get the string label, whether it was originally specified directly // or as a stock id -- this is only useful for platforms without native // stock items id support wxString GetAsString() const { return m_stockId == wxID_NONE ? m_label : wxGetStockLabel(m_stockId, wxSTOCK_FOR_BUTTON); } // return the stock id or wxID_NONE if this is not a stock label int GetStockId() const { return m_stockId; } private: // the label if explicitly given or empty if this is a stock item const wxString m_label; // the stock item id or wxID_NONE if m_label should be used const int m_stockId; }; // ctors wxMessageDialogBase() { m_dialogStyle = 0; } wxMessageDialogBase(wxWindow *parent, const wxString& message, const wxString& caption, long style) : m_message(message), m_caption(caption) { m_parent = GetParentForModalDialog(parent, style); SetMessageDialogStyle(style); } // virtual dtor for the base class virtual ~wxMessageDialogBase() { } wxString GetCaption() const { return m_caption; } // Title and caption are the same thing, GetCaption() mostly exists just // for compatibility. virtual void SetTitle(const wxString& title) wxOVERRIDE { m_caption = title; } virtual wxString GetTitle() const wxOVERRIDE { return m_caption; } virtual void SetMessage(const wxString& message) { m_message = message; } wxString GetMessage() const { return m_message; } void SetExtendedMessage(const wxString& extendedMessage) { m_extendedMessage = extendedMessage; } wxString GetExtendedMessage() const { return m_extendedMessage; } // change the dialog style flag void SetMessageDialogStyle(long style) { wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO), "wxYES and wxNO may only be used together" ); wxASSERT_MSG( !(style & wxYES) || !(style & wxOK), "wxOK and wxYES/wxNO can't be used together" ); // It is common to specify just the icon, without wxOK, in the existing // code, especially one written by Windows programmers as MB_OK is 0 // and so they're used to omitting wxOK. Don't complain about it but // just add wxOK implicitly for compatibility. if ( !(style & wxYES) && !(style & wxOK) ) style |= wxOK; wxASSERT_MSG( (style & wxID_OK) != wxID_OK, "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" ); wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO), "wxNO_DEFAULT is invalid without wxNO" ); wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL), "wxCANCEL_DEFAULT is invalid without wxCANCEL" ); wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT), "only one default button can be specified" ); m_dialogStyle = style; } long GetMessageDialogStyle() const { return m_dialogStyle; } // customization of the message box buttons virtual bool SetYesNoLabels(const ButtonLabel& yes,const ButtonLabel& no) { DoSetCustomLabel(m_yes, yes); DoSetCustomLabel(m_no, no); return true; } virtual bool SetYesNoCancelLabels(const ButtonLabel& yes, const ButtonLabel& no, const ButtonLabel& cancel) { DoSetCustomLabel(m_yes, yes); DoSetCustomLabel(m_no, no); DoSetCustomLabel(m_cancel, cancel); return true; } virtual bool SetOKLabel(const ButtonLabel& ok) { DoSetCustomLabel(m_ok, ok); return true; } virtual bool SetOKCancelLabels(const ButtonLabel& ok, const ButtonLabel& cancel) { DoSetCustomLabel(m_ok, ok); DoSetCustomLabel(m_cancel, cancel); return true; } virtual bool SetHelpLabel(const ButtonLabel& help) { DoSetCustomLabel(m_help, help); return true; } // test if any custom labels were set bool HasCustomLabels() const { return !(m_ok.empty() && m_cancel.empty() && m_help.empty() && m_yes.empty() && m_no.empty()); } // these functions return the label to be used for the button which is // either a custom label explicitly set by the user or the default label, // i.e. they always return a valid string wxString GetYesLabel() const { return m_yes.empty() ? GetDefaultYesLabel() : m_yes; } wxString GetNoLabel() const { return m_no.empty() ? GetDefaultNoLabel() : m_no; } wxString GetOKLabel() const { return m_ok.empty() ? GetDefaultOKLabel() : m_ok; } wxString GetCancelLabel() const { return m_cancel.empty() ? GetDefaultCancelLabel() : m_cancel; } wxString GetHelpLabel() const { return m_help.empty() ? GetDefaultHelpLabel() : m_help; } // based on message dialog style, returns exactly one of: wxICON_NONE, // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION, // wxICON_AUTH_NEEDED virtual long GetEffectiveIcon() const { if ( m_dialogStyle & wxICON_NONE ) return wxICON_NONE; else if ( m_dialogStyle & wxICON_ERROR ) return wxICON_ERROR; else if ( m_dialogStyle & wxICON_WARNING ) return wxICON_WARNING; else if ( m_dialogStyle & wxICON_QUESTION ) return wxICON_QUESTION; else if ( m_dialogStyle & wxICON_INFORMATION ) return wxICON_INFORMATION; else if ( m_dialogStyle & wxYES ) return wxICON_QUESTION; else return wxICON_INFORMATION; } protected: // for the platforms not supporting separate main and extended messages // this function should be used to combine both of them in a single string wxString GetFullMessage() const { wxString msg = m_message; if ( !m_extendedMessage.empty() ) msg << "\n\n" << m_extendedMessage; return msg; } wxString m_message, m_extendedMessage, m_caption; long m_dialogStyle; // this function is called by our public SetXXXLabels() and should assign // the value to var with possibly some transformation (e.g. Cocoa version // currently uses this to remove any accelerators from the button strings // while GTK+ one handles stock items specifically here) virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label) { var = label.GetAsString(); } // these functions return the custom label or empty string and should be // used only in specific circumstances such as creating the buttons with // these labels (in which case it makes sense to only use a custom label if // it was really given and fall back on stock label otherwise), use the // Get{Yes,No,OK,Cancel}Label() methods above otherwise const wxString& GetCustomYesLabel() const { return m_yes; } const wxString& GetCustomNoLabel() const { return m_no; } const wxString& GetCustomOKLabel() const { return m_ok; } const wxString& GetCustomHelpLabel() const { return m_help; } const wxString& GetCustomCancelLabel() const { return m_cancel; } private: // these functions may be overridden to provide different defaults for the // default button labels (this is used by wxGTK) virtual wxString GetDefaultYesLabel() const { return wxGetTranslation("Yes"); } virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); } virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); } virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); } virtual wxString GetDefaultHelpLabel() const { return wxGetTranslation("Help"); } // labels for the buttons, initially empty meaning that the defaults should // be used, use GetYes/No/OK/CancelLabel() to access them wxString m_yes, m_no, m_ok, m_cancel, m_help; wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase); }; #include "wx/generic/msgdlgg.h" #if defined(__WX_COMPILING_MSGDLGG_CPP__) || \ defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \ (defined(__WXGTK__) && !defined(__WXGTK20__)) #define wxMessageDialog wxGenericMessageDialog #elif defined(__WXMSW__) #include "wx/msw/msgdlg.h" #elif defined(__WXMOTIF__) #include "wx/motif/msgdlg.h" #elif defined(__WXGTK20__) #include "wx/gtk/msgdlg.h" #elif defined(__WXMAC__) #include "wx/osx/msgdlg.h" #elif defined(__WXQT__) #include "wx/qt/msgdlg.h" #endif // ---------------------------------------------------------------------------- // wxMessageBox: the simplest way to use wxMessageDialog // ---------------------------------------------------------------------------- int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, long style = wxOK | wxCENTRE, wxWindow *parent = NULL, int x = wxDefaultCoord, int y = wxDefaultCoord); #endif // wxUSE_MSGDLG #endif // _WX_MSGDLG_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/tls.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/tls.h // Purpose: Implementation of thread local storage // Author: Vadim Zeitlin // Created: 2008-08-08 // Copyright: (c) 2008 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_TLS_H_ #define _WX_TLS_H_ #include "wx/defs.h" // ---------------------------------------------------------------------------- // check for compiler support of thread-specific variables // ---------------------------------------------------------------------------- // when not using threads at all, there is no need for thread-specific // values to be really thread-specific #if !wxUSE_THREADS #define wxHAS_COMPILER_TLS #define wxTHREAD_SPECIFIC_DECL // otherwise try to find the compiler-specific way to handle TLS unless // explicitly disabled by setting wxUSE_COMPILER_TLS to 0 (it is 1 by default). #elif wxUSE_COMPILER_TLS // __thread keyword is not supported correctly by MinGW, at least in some // configurations, see http://sourceforge.net/support/tracker.php?aid=2837047 // and when in doubt we prefer to not use it at all. #if defined(HAVE___THREAD_KEYWORD) && !defined(__MINGW32__) #define wxHAS_COMPILER_TLS #define wxTHREAD_SPECIFIC_DECL __thread // MSVC has its own version which might be supported by some other Windows // compilers, to be tested #elif defined(__VISUALC__) #define wxHAS_COMPILER_TLS #define wxTHREAD_SPECIFIC_DECL __declspec(thread) #endif // compilers #endif // wxUSE_COMPILER_TLS // ---------------------------------------------------------------------------- // define wxTLS_TYPE() // ---------------------------------------------------------------------------- #ifdef wxHAS_COMPILER_TLS #define wxTLS_TYPE(T) wxTHREAD_SPECIFIC_DECL T #define wxTLS_TYPE_REF(T) T& #define wxTLS_PTR(var) (&(var)) #define wxTLS_VALUE(var) (var) #else // !wxHAS_COMPILER_TLS extern "C" { typedef void (*wxTlsDestructorFunction)(void*); } #if defined(__WINDOWS__) #include "wx/msw/tls.h" #elif defined(__UNIX__) #include "wx/unix/tls.h" #else // TODO: we could emulate TLS for such platforms... #error Neither compiler nor OS support thread-specific variables. #endif #include <stdlib.h> // for calloc() // wxTlsValue<T> represents a thread-specific value of type T but, unlike // with native compiler thread-specific variables, it behaves like a // (never NULL) pointer to T and so needs to be dereferenced before use // // Note: T must be a POD! // // Note: On Unix, thread-specific T value is freed when the thread exits. // On Windows, thread-specific values are freed later, when given // wxTlsValue<T> is destroyed. The only exception to this is the // value for the main thread, which is always freed when // wxTlsValue<T> is destroyed. template <typename T> class wxTlsValue { public: typedef T ValueType; // ctor doesn't do anything, the object is created on first access wxTlsValue() : m_key(free) {} // dtor is only called in the main thread context and so is not enough // to free memory allocated by us for the other threads, we use // destructor function when using Pthreads for this (which is not // called for the main thread as it doesn't call pthread_exit() but // just to be safe we also reset the key anyhow) ~wxTlsValue() { if ( m_key.Get() ) m_key.Set(NULL); // this deletes the value } // access the object creating it on demand ValueType *Get() { void *value = m_key.Get(); if ( !value ) { // ValueType must be POD to be used in wxHAS_COMPILER_TLS case // anyhow (at least gcc doesn't accept non-POD values being // declared with __thread) so initialize it as a POD too value = calloc(1, sizeof(ValueType)); if ( !m_key.Set(value) ) { free(value); // this will probably result in a crash in the caller but // it's arguably better to crash immediately instead of // slowly dying from out-of-memory errors which would // happen as the next access to this object would allocate // another ValueType instance and so on forever value = NULL; } } return static_cast<ValueType *>(value); } // pointer-like accessors ValueType *operator->() { return Get(); } ValueType& operator*() { return *Get(); } private: wxTlsKey m_key; wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T); }; #define wxTLS_TYPE(T) wxTlsValue<T> #define wxTLS_TYPE_REF(T) wxTLS_TYPE(T)& #define wxTLS_PTR(var) ((var).Get()) #define wxTLS_VALUE(var) (*(var)) #endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS #endif // _WX_TLS_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/stockitem.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/stockitem.h // Purpose: stock items helpers (privateh header) // Author: Vaclav Slavik // Modified by: // Created: 2004-08-15 // Copyright: (c) Vaclav Slavik, 2004 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_STOCKITEM_H_ #define _WX_STOCKITEM_H_ #include "wx/defs.h" #include "wx/chartype.h" #include "wx/string.h" #include "wx/accel.h" // ---------------------------------------------------------------------------- // Helper functions for stock items handling: // ---------------------------------------------------------------------------- // Returns true if the ID is in the list of recognized stock actions WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id); // Returns true of the label is empty or label of a stock button with // given ID WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label); enum wxStockLabelQueryFlag { wxSTOCK_NOFLAGS = 0, wxSTOCK_WITH_MNEMONIC = 1, wxSTOCK_WITH_ACCELERATOR = 2, // by default, stock items text is returned with ellipsis, if appropriate, // this flag allows to avoid having it wxSTOCK_WITHOUT_ELLIPSIS = 4, // return label for button, not menu item: buttons should always use // mnemonics and never use ellipsis wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC }; // Returns label that should be used for given stock UI element (e.g. "&OK" // for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character // is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator // for given ID is concatenated to the label using \t as separator WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id, long flags = wxSTOCK_WITH_MNEMONIC); #if wxUSE_ACCEL // Returns the accelerator that should be used for given stock UI element // (e.g. "Ctrl+x" for wxSTOCK_EXIT) WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); #endif // wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to // wxGetStockHelpString() about the context where the help string is to be used enum wxStockHelpStringClient { wxSTOCK_MENU // help string to use for menu items }; // Returns an help string for the given stock UI element and for the given "context". WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id, wxStockHelpStringClient client = wxSTOCK_MENU); #ifdef __WXGTK20__ // Translates stock ID to GTK+'s stock item string identifier: WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id); #endif #endif // _WX_STOCKITEM_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/windowid.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/windowid.h // Purpose: wxWindowID class - a class for managing window ids // Author: Brian Vanderburg II // Created: 2007-09-21 // Copyright: (c) 2007 Brian Vanderburg II // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_WINDOWID_H_ #define _WX_WINDOWID_H_ // NB: do not include defs.h as we are included from it typedef int wxWindowID; // ---------------------------------------------------------------------------- // wxWindowIDRef: reference counted id value // ---------------------------------------------------------------------------- // A wxWindowIDRef object wraps an id value and marks it as (un)used as // necessary. All ids returned from wxWindow::NewControlId() should be assigned // to an instance of this class to ensure that the id is marked as being in // use. // // This class is always defined but it is trivial if wxUSE_AUTOID_MANAGEMENT is // off. class WXDLLIMPEXP_CORE wxWindowIDRef { public: // default ctor wxWindowIDRef() { m_id = wxID_NONE; } // ctor taking id values wxWindowIDRef(int id) { Init(id); } wxWindowIDRef(long id) { Init(wxWindowID(id)); } wxWindowIDRef(const wxWindowIDRef& id) { Init(id.m_id); } // dtor ~wxWindowIDRef() { Assign(wxID_NONE); } // assignment wxWindowIDRef& operator=(int id) { Assign(id); return *this; } wxWindowIDRef& operator=(long id) { Assign(wxWindowID(id)); return *this; } wxWindowIDRef& operator=(const wxWindowIDRef& id) { if (&id != this) Assign(id.m_id); return *this; } // access to the stored id value wxWindowID GetValue() const { return m_id; } operator wxWindowID() const { return m_id; } private: #if wxUSE_AUTOID_MANAGEMENT // common part of all ctors: call Assign() for our new id void Init(wxWindowID id) { // m_id must be initialized before calling Assign() m_id = wxID_NONE; Assign(id); } // increase reference count of id, decrease the one of m_id void Assign(wxWindowID id); #else // !wxUSE_AUTOID_MANAGEMENT // trivial stubs for the functions above void Init(wxWindowID id) { m_id = id; } void Assign(wxWindowID id) { m_id = id; } #endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT wxWindowID m_id; }; // comparison operators inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs) { return lhs.GetValue() == rhs.GetValue(); } inline bool operator==(const wxWindowIDRef& lhs, int rhs) { return lhs.GetValue() == rhs; } inline bool operator==(const wxWindowIDRef& lhs, long rhs) { return lhs.GetValue() == rhs; } inline bool operator==(int lhs, const wxWindowIDRef& rhs) { return rhs == lhs; } inline bool operator==(long lhs, const wxWindowIDRef& rhs) { return rhs == lhs; } inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs) { return !(lhs == rhs); } inline bool operator!=(const wxWindowIDRef& lhs, int rhs) { return !(lhs == rhs); } inline bool operator!=(const wxWindowIDRef& lhs, long rhs) { return !(lhs == rhs); } inline bool operator!=(int lhs, const wxWindowIDRef& rhs) { return !(lhs == rhs); } inline bool operator!=(long lhs, const wxWindowIDRef& rhs) { return !(lhs == rhs); } // ---------------------------------------------------------------------------- // wxIdManager // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxIdManager { public: // This returns an id value and not an wxWindowIDRef. The returned value // should be assigned a.s.a.p to a wxWindowIDRef. The IDs are marked as // reserved so that another call to ReserveId before assigning the id to a // wxWindowIDRef will not use the same ID static wxWindowID ReserveId(int count = 1); // This will release an unused reserved ID. This should only be called // if the ID returned by ReserveId was NOT assigned to a wxWindowIDRef // for some purpose, maybe an early return from a function static void UnreserveId(wxWindowID id, int count = 1); }; #endif // _WX_WINDOWID_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/xtitypes.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/xtitypes.h // Purpose: enum, set, basic types support // Author: Stefan Csomor // Modified by: Francesco Montorsi // Created: 27/07/03 // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _XTITYPES_H_ #define _XTITYPES_H_ #include "wx/defs.h" #if wxUSE_EXTENDED_RTTI #include "wx/string.h" #include "wx/hashmap.h" #include "wx/arrstr.h" #include "wx/flags.h" #include "wx/intl.h" #include "wx/log.h" #include <typeinfo> class WXDLLIMPEXP_BASE wxClassInfo; // ---------------------------------------------------------------------------- // Enum Support // // In the header files XTI requires no change from pure c++ code, however in the // implementation, an enum needs to be enumerated e.g.: // // wxBEGIN_ENUM( wxFlavor ) // wxENUM_MEMBER( Vanilla ) // wxENUM_MEMBER( Chocolate ) // wxENUM_MEMBER( Strawberry ) // wxEND_ENUM( wxFlavor ) // ---------------------------------------------------------------------------- struct WXDLLIMPEXP_BASE wxEnumMemberData { const wxChar* m_name; int m_value; }; class WXDLLIMPEXP_BASE wxEnumData { public: wxEnumData( wxEnumMemberData* data ); // returns true if the member has been found and sets the int value // pointed to accordingly (if ptr != null ) // if not found returns false, value left unchanged bool HasEnumMemberValue( const wxChar *name, int *value = NULL ) const; // returns the value of the member, if not found in debug mode an // assert is issued, in release 0 is returned int GetEnumMemberValue(const wxChar *name ) const; // returns the name of the enum member having the passed in value // returns an empty string if not found const wxChar *GetEnumMemberName(int value) const; // returns the number of members in this enum int GetEnumCount() const { return m_count; } // returns the value of the nth member int GetEnumMemberValueByIndex( int n ) const; // returns the value of the nth member const wxChar *GetEnumMemberNameByIndex( int n ) const; private: wxEnumMemberData *m_members; int m_count; }; #define wxBEGIN_ENUM( e ) \ wxEnumMemberData s_enumDataMembers##e[] = { #define wxENUM_MEMBER( v ) { wxT(#v), v }, #define wxEND_ENUM( e ) \ { NULL, 0 } }; \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \ template<> void wxStringReadValue(const wxString& s, e &data ) \ { data = (e) s_enumData##e.GetEnumMemberValue(s.c_str()); } \ template<> void wxStringWriteValue(wxString &s, const e &data ) \ { s = s_enumData##e.GetEnumMemberName((int)data); } \ void FromLong##e( long data, wxAny& result ) \ { result = wxAny((e)data); } \ void ToLong##e( const wxAny& data, long &result ) \ { result = (long) (data).As(static_cast<e*>(NULL)); } \ \ wxTO_STRING_IMP( e ) \ wxFROM_STRING_IMP( e ) \ wxEnumTypeInfo s_typeInfo##e(wxT_ENUM, &s_enumData##e, \ &wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \ &FromLong##e, typeid(e).name() ); // ---------------------------------------------------------------------------- // Set Support // // in the header : // // enum wxFlavor // { // Vanilla, // Chocolate, // Strawberry, // }; // // typedef wxBitset<wxFlavor> wxCoupe; // // in the implementation file : // // wxBEGIN_ENUM( wxFlavor ) // wxENUM_MEMBER( Vanilla ) // wxENUM_MEMBER( Chocolate ) // wxENUM_MEMBER( Strawberry ) // wxEND_ENUM( wxFlavor ) // // wxIMPLEMENT_SET_STREAMING( wxCoupe, wxFlavor ) // // implementation note: no partial specialization for streaming, but a delegation // to a different class // // ---------------------------------------------------------------------------- void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s, wxArrayString &array ); template<typename e> void wxSetFromString(const wxString &s, wxBitset<e> &data ) { wxEnumData* edata = wxGetEnumData((e) 0); data.reset(); wxArrayString array; wxSetStringToArray( s, array ); wxString flag; for ( int i = 0; i < array.Count(); ++i ) { flag = array[i]; int ivalue; if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) { data.set( (e) ivalue ); } } } template<typename e> void wxSetToString( wxString &s, const wxBitset<e> &data ) { wxEnumData* edata = wxGetEnumData((e) 0); int count = edata->GetEnumCount(); int i; s.Clear(); for ( i = 0; i < count; i++ ) { e value = (e) edata->GetEnumMemberValueByIndex(i); if ( data.test( value ) ) { // this could also be done by the templated calls if ( !s.empty() ) s += wxT("|"); s += edata->GetEnumMemberNameByIndex(i); } } } #define wxIMPLEMENT_SET_STREAMING(SetName,e) \ template<> void wxStringReadValue(const wxString &s, wxBitset<e> &data ) \ { wxSetFromString( s, data ); } \ template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \ { wxSetToString( s, data ); } \ void FromLong##SetName( long data, wxAny& result ) \ { result = wxAny(SetName((unsigned long)data)); } \ void ToLong##SetName( const wxAny& data, long &result ) \ { result = (long) (data).As(static_cast<SetName*>(NULL)).to_ulong(); } \ wxTO_STRING_IMP( SetName ) \ wxFROM_STRING_IMP( SetName ) \ wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \ &wxTO_STRING( SetName ), &wxFROM_STRING( SetName ), \ &ToLong##SetName, &FromLong##SetName, typeid(SetName).name() ); template<typename e> void wxFlagsFromString(const wxString &s, e &data ) { wxEnumData* edata = wxGetEnumData((e*) 0); data.m_data = 0; wxArrayString array; wxSetStringToArray( s, array ); wxString flag; for ( size_t i = 0; i < array.Count(); ++i ) { flag = array[i]; int ivalue; if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) { data.m_data |= ivalue; } } } template<typename e> void wxFlagsToString( wxString &s, const e& data ) { wxEnumData* edata = wxGetEnumData((e*) 0); int count = edata->GetEnumCount(); int i; s.Clear(); long dataValue = data.m_data; for ( i = 0; i < count; i++ ) { int value = edata->GetEnumMemberValueByIndex(i); // make this to allow for multi-bit constants to work if ( value && ( dataValue & value ) == value ) { // clear the flags we just set dataValue &= ~value; // this could also be done by the templated calls if ( !s.empty() ) s +=wxT("|"); s += edata->GetEnumMemberNameByIndex(i); } } } #define wxBEGIN_FLAGS( e ) \ wxEnumMemberData s_enumDataMembers##e[] = { #define wxFLAGS_MEMBER( v ) { wxT(#v), static_cast<int>(v) }, #define wxEND_FLAGS( e ) \ { NULL, 0 } }; \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData *wxGetEnumData(e*) { return &s_enumData##e; } \ template<> void wxStringReadValue(const wxString &s, e &data ) \ { wxFlagsFromString<e>( s, data ); } \ template<> void wxStringWriteValue( wxString &s, const e& data ) \ { wxFlagsToString<e>( s, data ); } \ void FromLong##e( long data, wxAny& result ) \ { result = wxAny(e(data)); } \ void ToLong##e( const wxAny& data, long &result ) \ { result = (long) (data).As(static_cast<e*>(NULL)).m_data; } \ wxTO_STRING_IMP( e ) \ wxFROM_STRING_IMP( e ) \ wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \ &wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \ &FromLong##e, typeid(e).name() ); // ---------------------------------------------------------------------------- // Type Information // ---------------------------------------------------------------------------- // All data exposed by the RTTI is characterized using the following classes. // The first characterization is done by wxTypeKind. All enums up to and including // wxT_CUSTOM represent so called simple types. These cannot be divided any further. // They can be converted to and from wxStrings, that's all. // Other wxTypeKinds can instead be splitted recursively into smaller parts until // the simple types are reached. enum wxTypeKind { wxT_VOID = 0, // unknown type wxT_BOOL, wxT_CHAR, wxT_UCHAR, wxT_INT, wxT_UINT, wxT_LONG, wxT_ULONG, wxT_LONGLONG, wxT_ULONGLONG, wxT_FLOAT, wxT_DOUBLE, wxT_STRING, // must be wxString wxT_SET, // must be wxBitset<> template wxT_ENUM, wxT_CUSTOM, // user defined type (e.g. wxPoint) wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM, wxT_OBJECT_PTR, // object reference wxT_OBJECT, // embedded object wxT_COLLECTION, // collection wxT_DELEGATE, // for connecting against an event source wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging }; class WXDLLIMPEXP_BASE wxAny; class WXDLLIMPEXP_BASE wxTypeInfo; WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE ); class WXDLLIMPEXP_BASE wxTypeInfo { public: typedef void (*wxVariant2StringFnc)( const wxAny& data, wxString &result ); typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result ); wxTypeInfo(wxTypeKind kind, wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, const wxString &name = wxEmptyString): m_toString(to), m_fromString(from), m_kind(kind), m_name(name) { Register(); } #if 0 // wxUSE_UNICODE wxTypeInfo(wxTypeKind kind, wxVariant2StringFnc to, wxString2VariantFnc from, const char *name): m_toString(to), m_fromString(from), m_kind(kind), m_name(wxString::FromAscii(name)) { Register(); } #endif virtual ~wxTypeInfo() { Unregister(); } // return the kind of this type (wxT_... constants) wxTypeKind GetKind() const { return m_kind; } // returns the unique name of this type const wxString& GetTypeName() const { return m_name; } // is this type a delegate type bool IsDelegateType() const { return m_kind == wxT_DELEGATE; } // is this type a custom type bool IsCustomType() const { return m_kind == wxT_CUSTOM; } // is this type an object type bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR; } // can the content of this type be converted to and from strings ? bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; } // convert a wxAny holding data of this type into a string void ConvertToString( const wxAny& data, wxString &result ) const { if ( m_toString ) (*m_toString)( data, result ); else wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); } // convert a string into a wxAny holding the corresponding data in this type void ConvertFromString( const wxString& data, wxAny &result ) const { if( m_fromString ) (*m_fromString)( data, result ); else wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); } // statics: // looks for the corresponding type, will return NULL if not found static wxTypeInfo *FindType( const wxString& typeName ); private: void Register(); void Unregister(); wxVariant2StringFnc m_toString; wxString2VariantFnc m_fromString; wxTypeKind m_kind; wxString m_name; // the static list of all types we know about static wxTypeInfoMap* ms_typeTable; }; class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo { public: wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, const wxString &name = wxEmptyString ) : wxTypeInfo( kind, to, from, name ) { wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); } }; class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo { public: wxCustomTypeInfo( const wxString &name, wxVariant2StringFnc to, wxString2VariantFnc from ) : wxTypeInfo( wxT_CUSTOM, to, from, name ) {} }; class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo { public: typedef void (*converterToLong_t)( const wxAny& data, long &result ); typedef void (*converterFromLong_t)( long data, wxAny &result ); wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to, wxString2VariantFnc from, converterToLong_t toLong, converterFromLong_t fromLong, const wxString &name ) : wxTypeInfo( kind, to, from, name ), m_toLong( toLong ), m_fromLong( fromLong ) { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET, wxT("Illegal Kind for Enum Type")); m_enumInfo = enumInfo; } const wxEnumData* GetEnumData() const { return m_enumInfo; } // convert a wxAny holding data of this type into a long void ConvertToLong( const wxAny& data, long &result ) const { if( m_toLong ) (*m_toLong)( data, result ); else wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); } // convert a long into a wxAny holding the corresponding data in this type void ConvertFromLong( long data, wxAny &result ) const { if( m_fromLong ) (*m_fromLong)( data, result ); else wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); } private: converterToLong_t m_toLong; converterFromLong_t m_fromLong; wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET }; class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo { public: wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo, wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, const wxString &name = wxEmptyString); const wxClassInfo *GetClassInfo() const { return m_classInfo; } private: wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL }; class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo { public: wxCollectionTypeInfo( const wxString &elementName, wxVariant2StringFnc to, wxString2VariantFnc from , const wxString &name) : wxTypeInfo( wxT_COLLECTION, to, from, name ) { m_elementTypeName = elementName; m_elementType = NULL; } const wxTypeInfo* GetElementType() const { if ( m_elementType == NULL ) m_elementType = wxTypeInfo::FindType( m_elementTypeName ); return m_elementType; } private: mutable wxTypeInfo * m_elementType; wxString m_elementTypeName; }; class WXDLLIMPEXP_BASE wxEventSourceTypeInfo : public wxTypeInfo { public: wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass, wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL ); wxEventSourceTypeInfo( int eventType, int lastEventType, wxClassInfo* eventClass, wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL ); int GetEventType() const { return m_eventType; } int GetLastEventType() const { return m_lastEventType; } const wxClassInfo* GetEventClass() const { return m_eventClass; } private: const wxClassInfo *m_eventClass; // (extended will merge into classinfo) int m_eventType; int m_lastEventType; }; template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo::FindType(typeid(T).name()); } // this macro is for usage with custom, non-object derived classes and structs, // wxPoint is such a custom type #if wxUSE_FUNC_TEMPLATE_POINTER #define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \ wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString); #else #define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \ void ToString##e( const wxAny& data, wxString &result ) \ { toString(data, result); } \ void FromString##e( const wxString& data, wxAny &result ) \ { fromString(data, result); } \ wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \ &ToString##e, &FromString##e); #endif #define wxCOLLECTION_TYPE_INFO( element, collection ) \ wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name(), \ NULL, NULL, typeid(collection).name() ); // sometimes a compiler invents specializations that are nowhere called, // use this macro to satisfy the refs, currently we don't have to play // tricks, but if we will have to according to the compiler, we will use // that macro for that #define wxILLEGAL_TYPE_SPECIALIZATION( a ) #endif // wxUSE_EXTENDED_RTTI #endif // _XTITYPES_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/arrstr.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/arrstr.h // Purpose: wxArrayString class // Author: Mattia Barbon and Vadim Zeitlin // Modified by: // Created: 07/07/03 // Copyright: (c) 2003 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_ARRSTR_H #define _WX_ARRSTR_H #include "wx/defs.h" #include "wx/string.h" #include "wx/dynarray.h" #if wxUSE_STD_CONTAINERS_COMPATIBLY #include <vector> #endif // these functions are only used in STL build now but we define them in any // case for compatibility with the existing code outside of the library which // could be using them inline int wxCMPFUNC_CONV wxStringSortAscending(const wxString& s1, const wxString& s2) { return s1.Cmp(s2); } inline int wxCMPFUNC_CONV wxStringSortDescending(const wxString& s1, const wxString& s2) { return wxStringSortAscending(s2, s1); } // This comparison function ignores case when comparing strings differing not // in case only, i.e. this ensures that "Aa" comes before "AB", unlike with // wxStringSortAscending(). inline int wxCMPFUNC_CONV wxDictionaryStringSortAscending(const wxString& s1, const wxString& s2) { const int cmp = s1.CmpNoCase(s2); return cmp ? cmp : s1.Cmp(s2); } inline int wxCMPFUNC_CONV wxDictionaryStringSortDescending(const wxString& s1, const wxString& s2) { return wxDictionaryStringSortAscending(s2, s1); } #if wxUSE_STD_CONTAINERS typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*); WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, wxARRAY_DUMMY_BASE, WXDLLIMPEXP_BASE); class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase { public: // type of function used by wxArrayString::Sort() typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, const wxString& second); wxArrayString() { } wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { } wxArrayString(size_t sz, const char** a); wxArrayString(size_t sz, const wchar_t** a); wxArrayString(size_t sz, const wxString* a); int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const; void Sort(bool reverseOrder = false); void Sort(CompareFunction function); void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); } size_t Add(const wxString& string, size_t copies = 1) { wxArrayStringBase::Add(string, copies); return size() - copies; } }; // Unlike all the other sorted arrays, this one uses a comparison function // taking objects by reference rather than value, so define a special functor // wrapping it. class wxSortedArrayString_SortFunction { public: typedef int (wxCMPFUNC_CONV *CMPFUNC)(const wxString&, const wxString&); explicit wxSortedArrayString_SortFunction(CMPFUNC f) : m_f(f) { } bool operator()(const wxString& s1, const wxString& s2) { return m_f(s1, s2) < 0; } private: CMPFUNC m_f; }; typedef wxBaseSortedArray<wxString, wxSortedArrayString_SortFunction> wxSortedArrayStringBase; class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase { public: wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending) { } wxSortedArrayString(const wxSortedArrayString& array) : wxSortedArrayStringBase(array) { } wxSortedArrayString(const wxArrayString& src) : wxSortedArrayStringBase(wxStringSortAscending) { reserve(src.size()); for ( size_t n = 0; n < src.size(); n++ ) Add(src[n]); } explicit wxSortedArrayString(wxArrayString::CompareFunction compareFunction) : wxSortedArrayStringBase(compareFunction) { } int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const; private: void Insert() { wxFAIL_MSG( "wxSortedArrayString::Insert() is not to be used" ); } void Sort() { wxFAIL_MSG( "wxSortedArrayString::Sort() is not to be used" ); } }; #else // if !wxUSE_STD_CONTAINERS #include "wx/beforestd.h" #include <iterator> #include "wx/afterstd.h" class WXDLLIMPEXP_BASE wxArrayString { public: // type of function used by wxArrayString::Sort() typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, const wxString& second); // type of function used by wxArrayString::Sort(), for compatibility with // wxArray typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first, wxString* second); // constructors and destructor // default ctor wxArrayString() { Init(false); } // if autoSort is true, the array is always sorted (in alphabetical order) // // NB: the reason for using int and not bool is that like this we can avoid // using this ctor for implicit conversions from "const char *" (which // we'd like to be implicitly converted to wxString instead!). This // wouldn't be needed if the 'explicit' keyword was supported by all // compilers, or if this was protected ctor for wxSortedArrayString, // but we're stuck with it now. explicit wxArrayString(int autoSort) { Init(autoSort != 0); } // C string array ctor wxArrayString(size_t sz, const char** a); wxArrayString(size_t sz, const wchar_t** a); // wxString string array ctor wxArrayString(size_t sz, const wxString* a); // copy ctor wxArrayString(const wxArrayString& array); // assignment operator wxArrayString& operator=(const wxArrayString& src); // not virtual, this class should not be derived from ~wxArrayString(); // memory management // empties the list, but doesn't release memory void Empty(); // empties the list and releases memory void Clear(); // preallocates memory for given number of items void Alloc(size_t nCount); // minimizes the memory usage (by freeing all extra memory) void Shrink(); // simple accessors // number of elements in the array size_t GetCount() const { return m_nCount; } // is it empty? bool IsEmpty() const { return m_nCount == 0; } // number of elements in the array (GetCount is preferred API) size_t Count() const { return m_nCount; } // items access (range checking is done in debug version) // get item at position uiIndex wxString& Item(size_t nIndex) { wxASSERT_MSG( nIndex < m_nCount, wxT("wxArrayString: index out of bounds") ); return m_pItems[nIndex]; } const wxString& Item(size_t nIndex) const { return const_cast<wxArrayString*>(this)->Item(nIndex); } // same as Item() wxString& operator[](size_t nIndex) { return Item(nIndex); } const wxString& operator[](size_t nIndex) const { return Item(nIndex); } // get last item wxString& Last() { wxASSERT_MSG( !IsEmpty(), wxT("wxArrayString: index out of bounds") ); return Item(GetCount() - 1); } const wxString& Last() const { return const_cast<wxArrayString*>(this)->Last(); } // item management // Search the element in the array, starting from the beginning if // bFromEnd is false or from end otherwise. If bCase, comparison is case // sensitive (default). Returns index of the first item matched or // wxNOT_FOUND int Index (const wxString& str, bool bCase = true, bool bFromEnd = false) const; // add new element at the end (if the array is not sorted), return its // index size_t Add(const wxString& str, size_t nInsert = 1); // add new element at given position void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1); // expand the array to have count elements void SetCount(size_t count); // remove first item matching this value void Remove(const wxString& sz); // remove item by index void RemoveAt(size_t nIndex, size_t nRemove = 1); // sorting // sort array elements in alphabetical order (or reversed alphabetical // order if reverseOrder parameter is true) void Sort(bool reverseOrder = false); // sort array elements using specified comparison function void Sort(CompareFunction compareFunction); void Sort(CompareFunction2 compareFunction); // comparison // compare two arrays case sensitively bool operator==(const wxArrayString& a) const; // compare two arrays case sensitively bool operator!=(const wxArrayString& a) const { return !(*this == a); } // STL-like interface typedef wxString value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type* iterator; typedef const value_type* const_iterator; typedef value_type& reference; typedef const value_type& const_reference; typedef int difference_type; typedef size_t size_type; // TODO: this code duplicates the one in dynarray.h class reverse_iterator { typedef wxString value_type; typedef value_type* pointer; typedef value_type& reference; typedef reverse_iterator itor; friend itor operator+(int o, const itor& it); friend itor operator+(const itor& it, int o); friend itor operator-(const itor& it, int o); friend difference_type operator -(const itor& i1, const itor& i2); public: pointer m_ptr; reverse_iterator() : m_ptr(NULL) { } explicit reverse_iterator(pointer ptr) : m_ptr(ptr) { } reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } pointer operator->() const { return m_ptr; } itor& operator++() { --m_ptr; return *this; } const itor operator++(int) { const reverse_iterator tmp = *this; --m_ptr; return tmp; } itor& operator--() { ++m_ptr; return *this; } const itor operator--(int) { const itor tmp = *this; ++m_ptr; return tmp; } bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } }; class const_reverse_iterator { typedef wxString value_type; typedef const value_type* pointer; typedef const value_type& reference; typedef const_reverse_iterator itor; friend itor operator+(int o, const itor& it); friend itor operator+(const itor& it, int o); friend itor operator-(const itor& it, int o); friend difference_type operator -(const itor& i1, const itor& i2); public: pointer m_ptr; const_reverse_iterator() : m_ptr(NULL) { } explicit const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } pointer operator->() const { return m_ptr; } itor& operator++() { --m_ptr; return *this; } const itor operator++(int) { const itor tmp = *this; --m_ptr; return tmp; } itor& operator--() { ++m_ptr; return *this; } const itor operator--(int) { const itor tmp = *this; ++m_ptr; return tmp; } bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } }; wxArrayString(const_iterator first, const_iterator last) { Init(false); assign(first, last); } wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } template <class Iterator> void assign(Iterator first, Iterator last) { clear(); reserve(std::distance(first, last)); for(; first != last; ++first) push_back(*first); } void assign(size_type n, const_reference v) { clear(); Add(v, n); } reference back() { return *(end() - 1); } const_reference back() const { return *(end() - 1); } iterator begin() { return m_pItems; } const_iterator begin() const { return m_pItems; } size_type capacity() const { return m_nSize; } void clear() { Clear(); } bool empty() const { return IsEmpty(); } iterator end() { return begin() + GetCount(); } const_iterator end() const { return begin() + GetCount(); } iterator erase(iterator first, iterator last) { size_t idx = first - begin(); RemoveAt(idx, last - first); return begin() + idx; } iterator erase(iterator it) { return erase(it, it + 1); } reference front() { return *begin(); } const_reference front() const { return *begin(); } void insert(iterator it, size_type n, const_reference v) { Insert(v, it - begin(), n); } iterator insert(iterator it, const_reference v = value_type()) { size_t idx = it - begin(); Insert(v, idx); return begin() + idx; } void insert(iterator it, const_iterator first, const_iterator last); size_type max_size() const { return INT_MAX; } void pop_back() { RemoveAt(GetCount() - 1); } void push_back(const_reference v) { Add(v); } reverse_iterator rbegin() { return reverse_iterator(end() - 1); } const_reverse_iterator rbegin() const { return const_reverse_iterator(end() - 1); } reverse_iterator rend() { return reverse_iterator(begin() - 1); } const_reverse_iterator rend() const { return const_reverse_iterator(begin() - 1); } void reserve(size_type n) /* base::reserve*/; void resize(size_type n, value_type v = value_type()); size_type size() const { return GetCount(); } void swap(wxArrayString& other) { wxSwap(m_nSize, other.m_nSize); wxSwap(m_nCount, other.m_nCount); wxSwap(m_pItems, other.m_pItems); wxSwap(m_autoSort, other.m_autoSort); } protected: void Init(bool autoSort); // common part of all ctors void Copy(const wxArrayString& src); // copies the contents of another array CompareFunction m_compareFunction; // set only from wxSortedArrayString private: // Allocate the new buffer big enough to hold m_nCount + nIncrement items and // return the pointer to the old buffer, which must be deleted by the caller // (if the old buffer is big enough, just return NULL). wxString *Grow(size_t nIncrement); size_t m_nSize, // current size of the array m_nCount; // current number of elements wxString *m_pItems; // pointer to data bool m_autoSort; // if true, keep the array always sorted }; class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString { public: wxSortedArrayString() : wxArrayString(true) { } wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) { Copy(array); } explicit wxSortedArrayString(CompareFunction compareFunction) : wxArrayString(true) { m_compareFunction = compareFunction; } }; #endif // !wxUSE_STD_CONTAINERS // this class provides a temporary wxString* from a // wxArrayString class WXDLLIMPEXP_BASE wxCArrayString { public: wxCArrayString( const wxArrayString& array ) : m_array( array ), m_strings( NULL ) { } ~wxCArrayString() { delete[] m_strings; } size_t GetCount() const { return m_array.GetCount(); } wxString* GetStrings() { if( m_strings ) return m_strings; const size_t count = m_array.GetCount(); m_strings = new wxString[count]; for( size_t i = 0; i < count; ++i ) m_strings[i] = m_array[i]; return m_strings; } wxString* Release() { wxString *r = GetStrings(); m_strings = NULL; return r; } private: const wxArrayString& m_array; wxString* m_strings; }; // ---------------------------------------------------------------------------- // helper functions for working with arrays // ---------------------------------------------------------------------------- // by default, these functions use the escape character to escape the // separators occurring inside the string to be joined, this can be disabled by // passing '\0' as escape WXDLLIMPEXP_BASE wxString wxJoin(const wxArrayString& arr, const wxChar sep, const wxChar escape = wxT('\\')); WXDLLIMPEXP_BASE wxArrayString wxSplit(const wxString& str, const wxChar sep, const wxChar escape = wxT('\\')); // ---------------------------------------------------------------------------- // This helper class allows to pass both C array of wxStrings or wxArrayString // using the same interface. // // Use it when you have two methods taking wxArrayString or (int, wxString[]), // that do the same thing. This class lets you iterate over input data in the // same way whether it is a raw array of strings or wxArrayString. // // The object does not take ownership of the data -- internally it keeps // pointers to the data, therefore the data must be disposed of by user // and only after this object is destroyed. Usually it is not a problem as // only temporary objects of this class are used. // ---------------------------------------------------------------------------- class wxArrayStringsAdapter { public: // construct an adapter from a wxArrayString wxArrayStringsAdapter(const wxArrayString& strings) : m_type(wxSTRING_ARRAY), m_size(strings.size()) { m_data.array = &strings; } // construct an adapter from a wxString[] wxArrayStringsAdapter(unsigned int n, const wxString *strings) : m_type(wxSTRING_POINTER), m_size(n) { m_data.ptr = strings; } #if wxUSE_STD_CONTAINERS_COMPATIBLY // construct an adapter from a vector of strings wxArrayStringsAdapter(const std::vector<wxString>& strings) : m_type(wxSTRING_POINTER), m_size(strings.size()) { m_data.ptr = m_size == 0 ? NULL : &strings[0]; } #endif // wxUSE_STD_CONTAINERS_COMPATIBLY // construct an adapter from a single wxString wxArrayStringsAdapter(const wxString& s) : m_type(wxSTRING_POINTER), m_size(1) { m_data.ptr = &s; } // default copy constructor is ok // iteration interface size_t GetCount() const { return m_size; } bool IsEmpty() const { return GetCount() == 0; } const wxString& operator[] (unsigned int i) const { wxASSERT_MSG( i < GetCount(), wxT("index out of bounds") ); if(m_type == wxSTRING_POINTER) return m_data.ptr[i]; return m_data.array->Item(i); } wxArrayString AsArrayString() const { if(m_type == wxSTRING_ARRAY) return *m_data.array; return wxArrayString(GetCount(), m_data.ptr); } private: // type of the data being held enum wxStringContainerType { wxSTRING_ARRAY, // wxArrayString wxSTRING_POINTER // wxString[] }; wxStringContainerType m_type; size_t m_size; union { const wxString * ptr; const wxArrayString * array; } m_data; wxDECLARE_NO_ASSIGN_CLASS(wxArrayStringsAdapter); }; #endif // _WX_ARRSTR_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/htmllbox.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/htmllbox.h // Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells // Author: Vadim Zeitlin // Modified by: // Created: 31.05.03 // Copyright: (c) 2003 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_HTMLLBOX_H_ #define _WX_HTMLLBOX_H_ #include "wx/vlbox.h" // base class #include "wx/html/htmlwin.h" #include "wx/ctrlsub.h" #if wxUSE_FILESYSTEM #include "wx/filesys.h" #endif // wxUSE_FILESYSTEM class WXDLLIMPEXP_FWD_HTML wxHtmlCell; class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxCache; class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxStyle; extern WXDLLIMPEXP_DATA_HTML(const char) wxHtmlListBoxNameStr[]; extern WXDLLIMPEXP_DATA_HTML(const char) wxSimpleHtmlListBoxNameStr[]; // ---------------------------------------------------------------------------- // wxHtmlListBox // ---------------------------------------------------------------------------- class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox, public wxHtmlWindowInterface, public wxHtmlWindowMouseHelper { wxDECLARE_ABSTRACT_CLASS(wxHtmlListBox); public: // constructors and such // --------------------- // default constructor, you must call Create() later wxHtmlListBox(); // normal constructor which calls Create() internally wxHtmlListBox(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxHtmlListBoxNameStr); // really creates the control and sets the initial number of items in it // (which may be changed later with SetItemCount()) // // the only special style which may be specified here is wxLB_MULTIPLE // // returns true on success or false if the control couldn't be created bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxHtmlListBoxNameStr); // destructor cleans up whatever resources we use virtual ~wxHtmlListBox(); // override some base class virtuals virtual void RefreshRow(size_t line) wxOVERRIDE; virtual void RefreshRows(size_t from, size_t to) wxOVERRIDE; virtual void RefreshAll() wxOVERRIDE; virtual void SetItemCount(size_t count) wxOVERRIDE; #if wxUSE_FILESYSTEM // retrieve the file system used by the wxHtmlWinParser: if you use // relative paths in your HTML, you should use its ChangePathTo() method wxFileSystem& GetFileSystem() { return m_filesystem; } const wxFileSystem& GetFileSystem() const { return m_filesystem; } #endif // wxUSE_FILESYSTEM virtual void OnInternalIdle() wxOVERRIDE; protected: // this method must be implemented in the derived class and should return // the body (i.e. without <html>) of the HTML for the given item virtual wxString OnGetItem(size_t n) const = 0; // this function may be overridden to decorate HTML returned by OnGetItem() virtual wxString OnGetItemMarkup(size_t n) const; // this method allows to customize the selection appearance: it may be used // to specify the colour of the text which normally has the given colour // colFg when it is inside the selection // // by default, the original colour is not used at all and all text has the // same (default for this system) colour inside selection virtual wxColour GetSelectedTextColour(const wxColour& colFg) const; // this is the same as GetSelectedTextColour() but allows to customize the // background colour -- this is even more rarely used as you can change it // globally using SetSelectionBackground() virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const; // we implement both of these functions in terms of OnGetItem(), they are // not supposed to be overridden by our descendants virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; virtual wxCoord OnMeasureItem(size_t n) const wxOVERRIDE; // override this one to draw custom background for selected items correctly virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; // this method may be overridden to handle clicking on a link in the // listbox (by default, clicks on links are simply ignored) virtual void OnLinkClicked(size_t n, const wxHtmlLinkInfo& link); // event handlers void OnSize(wxSizeEvent& event); void OnMouseMove(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& event); // common part of all ctors void Init(); // ensure that the given item is cached void CacheItem(size_t n) const; private: // wxHtmlWindowInterface methods: virtual void SetHTMLWindowTitle(const wxString& title) wxOVERRIDE; virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) wxOVERRIDE; virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, const wxString& url, wxString *redirect) const wxOVERRIDE; virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, const wxPoint& pos) const wxOVERRIDE; virtual wxWindow* GetHTMLWindow() wxOVERRIDE; virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE; virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE; virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) wxOVERRIDE; virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE; virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE; // returns index of item that contains given HTML cell size_t GetItemForCell(const wxHtmlCell *cell) const; // Create the cell for the given item, caller is responsible for freeing it. wxHtmlCell* CreateCellForItem(size_t n) const; // return physical coordinates of root wxHtmlCell of n-th item wxPoint GetRootCellCoords(size_t n) const; // Converts physical coordinates stored in @a pos into coordinates // relative to the root cell of the item under mouse cursor, if any. If no // cell is found under the cursor, returns false. Otherwise stores the new // coordinates back into @a pos and pointer to the cell under cursor into // @a cell and returns true. bool PhysicalCoordsToCell(wxPoint& pos, wxHtmlCell*& cell) const; // The opposite of PhysicalCoordsToCell: converts coordinates relative to // given cell to physical coordinates in the window wxPoint CellCoordsToPhysical(const wxPoint& pos, wxHtmlCell *cell) const; private: // this class caches the pre-parsed HTML to speed up display wxHtmlListBoxCache *m_cache; // HTML parser we use wxHtmlWinParser *m_htmlParser; #if wxUSE_FILESYSTEM // file system used by m_htmlParser wxFileSystem m_filesystem; #endif // wxUSE_FILESYSTEM // rendering style for the parser which allows us to customize our colours wxHtmlListBoxStyle *m_htmlRendStyle; // it calls our GetSelectedTextColour() and GetSelectedTextBgColour() friend class wxHtmlListBoxStyle; friend class wxHtmlListBoxWinInterface; wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxHtmlListBox); }; // ---------------------------------------------------------------------------- // wxSimpleHtmlListBox // ---------------------------------------------------------------------------- #define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN #define wxHLB_MULTIPLE wxLB_MULTIPLE class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : public wxWindowWithItems<wxHtmlListBox, wxItemContainer> { wxDECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox); public: // wxListbox-compatible constructors // --------------------------------- wxSimpleHtmlListBox() { } wxSimpleHtmlListBox(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSimpleHtmlListBoxNameStr) { Create(parent, id, pos, size, n, choices, style, validator, name); } wxSimpleHtmlListBox(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSimpleHtmlListBoxNameStr) { Create(parent, id, pos, size, choices, style, validator, name); } bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSimpleHtmlListBoxNameStr); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSimpleHtmlListBoxNameStr); virtual ~wxSimpleHtmlListBox(); // these must be overloaded otherwise the compiler will complain // about wxItemContainerImmutable::[G|S]etSelection being pure virtuals... void SetSelection(int n) wxOVERRIDE { wxVListBox::SetSelection(n); } int GetSelection() const wxOVERRIDE { return wxVListBox::GetSelection(); } // accessing strings // ----------------- virtual unsigned int GetCount() const wxOVERRIDE { return m_items.GetCount(); } virtual wxString GetString(unsigned int n) const wxOVERRIDE; // override default unoptimized wxItemContainer::GetStrings() function wxArrayString GetStrings() const { return m_items; } virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; // resolve ambiguity between wxItemContainer and wxVListBox versions void Clear() wxOVERRIDE; protected: virtual int DoInsertItems(const wxArrayStringsAdapter & items, unsigned int pos, void **clientData, wxClientDataType type) wxOVERRIDE; virtual void DoSetItemClientData(unsigned int n, void *clientData) wxOVERRIDE { m_HTMLclientData[n] = clientData; } virtual void *DoGetItemClientData(unsigned int n) const wxOVERRIDE { return m_HTMLclientData[n]; } // wxItemContainer methods virtual void DoClear() wxOVERRIDE; virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; // calls wxHtmlListBox::SetItemCount() and RefreshAll() void UpdateCount(); // override these functions just to change their visibility: users of // wxSimpleHtmlListBox shouldn't be allowed to call them directly! virtual void SetItemCount(size_t count) wxOVERRIDE { wxHtmlListBox::SetItemCount(count); } virtual void SetRowCount(size_t count) { wxHtmlListBox::SetRowCount(count); } virtual wxString OnGetItem(size_t n) const wxOVERRIDE { return m_items[n]; } virtual void InitEvent(wxCommandEvent& event, int n) wxOVERRIDE { // we're not a virtual control and we can include the string // of the item which was clicked: event.SetString(m_items[n]); wxVListBox::InitEvent(event, n); } wxArrayString m_items; wxArrayPtrVoid m_HTMLclientData; // Note: For the benefit of old compilers (like gcc-2.8) this should // not be named m_clientdata as that clashes with the name of an // anonymous struct member in wxEvtHandler, which we derive from. wxDECLARE_NO_COPY_CLASS(wxSimpleHtmlListBox); }; #endif // _WX_HTMLLBOX_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/datstrm.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/datstrm.h // Purpose: Data stream classes // Author: Guilhem Lavaux // Modified by: Mickael Gilabert // Created: 28/06/1998 // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DATSTREAM_H_ #define _WX_DATSTREAM_H_ #include "wx/stream.h" #include "wx/longlong.h" #include "wx/convauto.h" #if wxUSE_STREAMS // Common wxDataInputStream and wxDataOutputStream parameters. class WXDLLIMPEXP_BASE wxDataStreamBase { public: void BigEndianOrdered(bool be_order) { m_be_order = be_order; } // By default we use extended precision (80 bit) format for both float and // doubles. Call this function to switch to alternative representation in // which IEEE 754 single precision (32 bits) is used for floats and double // precision (64 bits) is used for doubles. void UseBasicPrecisions() { #if wxUSE_APPLE_IEEE m_useExtendedPrecision = false; #endif // wxUSE_APPLE_IEEE } // UseExtendedPrecision() is not very useful as it corresponds to the // default value, only call it in your code if you want the compilation // fail with the error when using wxWidgets library compiled without // extended precision support. #if wxUSE_APPLE_IEEE void UseExtendedPrecision() { m_useExtendedPrecision = true; } #endif // wxUSE_APPLE_IEEE #if wxUSE_UNICODE void SetConv( const wxMBConv &conv ); wxMBConv *GetConv() const { return m_conv; } #endif protected: // Ctor and dtor are both protected, this class is never used directly but // only by its derived classes. wxDataStreamBase(const wxMBConv& conv); ~wxDataStreamBase(); bool m_be_order; #if wxUSE_APPLE_IEEE bool m_useExtendedPrecision; #endif // wxUSE_APPLE_IEEE #if wxUSE_UNICODE wxMBConv *m_conv; #endif wxDECLARE_NO_COPY_CLASS(wxDataStreamBase); }; class WXDLLIMPEXP_BASE wxDataInputStream : public wxDataStreamBase { public: wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvUTF8); bool IsOk() { return m_input->IsOk(); } #if wxHAS_INT64 wxUint64 Read64(); #endif #if wxUSE_LONGLONG wxLongLong ReadLL(); #endif wxUint32 Read32(); wxUint16 Read16(); wxUint8 Read8(); double ReadDouble(); float ReadFloat(); wxString ReadString(); #if wxHAS_INT64 void Read64(wxUint64 *buffer, size_t size); void Read64(wxInt64 *buffer, size_t size); #endif #if defined(wxLongLong_t) && wxUSE_LONGLONG void Read64(wxULongLong *buffer, size_t size); void Read64(wxLongLong *buffer, size_t size); #endif #if wxUSE_LONGLONG void ReadLL(wxULongLong *buffer, size_t size); void ReadLL(wxLongLong *buffer, size_t size); #endif void Read32(wxUint32 *buffer, size_t size); void Read16(wxUint16 *buffer, size_t size); void Read8(wxUint8 *buffer, size_t size); void ReadDouble(double *buffer, size_t size); void ReadFloat(float *buffer, size_t size); wxDataInputStream& operator>>(wxString& s); wxDataInputStream& operator>>(wxInt8& c); wxDataInputStream& operator>>(wxInt16& i); wxDataInputStream& operator>>(wxInt32& i); wxDataInputStream& operator>>(wxUint8& c); wxDataInputStream& operator>>(wxUint16& i); wxDataInputStream& operator>>(wxUint32& i); #if wxHAS_INT64 wxDataInputStream& operator>>(wxUint64& i); wxDataInputStream& operator>>(wxInt64& i); #endif #if defined(wxLongLong_t) && wxUSE_LONGLONG wxDataInputStream& operator>>(wxULongLong& i); wxDataInputStream& operator>>(wxLongLong& i); #endif wxDataInputStream& operator>>(double& d); wxDataInputStream& operator>>(float& f); protected: wxInputStream *m_input; wxDECLARE_NO_COPY_CLASS(wxDataInputStream); }; class WXDLLIMPEXP_BASE wxDataOutputStream : public wxDataStreamBase { public: wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8); bool IsOk() { return m_output->IsOk(); } #if wxHAS_INT64 void Write64(wxUint64 i); void Write64(wxInt64 i); #endif #if wxUSE_LONGLONG void WriteLL(const wxLongLong &ll); void WriteLL(const wxULongLong &ll); #endif void Write32(wxUint32 i); void Write16(wxUint16 i); void Write8(wxUint8 i); void WriteDouble(double d); void WriteFloat(float f); void WriteString(const wxString& string); #if wxHAS_INT64 void Write64(const wxUint64 *buffer, size_t size); void Write64(const wxInt64 *buffer, size_t size); #endif #if defined(wxLongLong_t) && wxUSE_LONGLONG void Write64(const wxULongLong *buffer, size_t size); void Write64(const wxLongLong *buffer, size_t size); #endif #if wxUSE_LONGLONG void WriteLL(const wxULongLong *buffer, size_t size); void WriteLL(const wxLongLong *buffer, size_t size); #endif void Write32(const wxUint32 *buffer, size_t size); void Write16(const wxUint16 *buffer, size_t size); void Write8(const wxUint8 *buffer, size_t size); void WriteDouble(const double *buffer, size_t size); void WriteFloat(const float *buffer, size_t size); wxDataOutputStream& operator<<(const wxString& string); wxDataOutputStream& operator<<(wxInt8 c); wxDataOutputStream& operator<<(wxInt16 i); wxDataOutputStream& operator<<(wxInt32 i); wxDataOutputStream& operator<<(wxUint8 c); wxDataOutputStream& operator<<(wxUint16 i); wxDataOutputStream& operator<<(wxUint32 i); #if wxHAS_INT64 wxDataOutputStream& operator<<(wxUint64 i); wxDataOutputStream& operator<<(wxInt64 i); #endif #if defined(wxLongLong_t) && wxUSE_LONGLONG wxDataOutputStream& operator<<(const wxULongLong &i); wxDataOutputStream& operator<<(const wxLongLong &i); #endif wxDataOutputStream& operator<<(double d); wxDataOutputStream& operator<<(float f); protected: wxOutputStream *m_output; wxDECLARE_NO_COPY_CLASS(wxDataOutputStream); }; #endif // wxUSE_STREAMS #endif // _WX_DATSTREAM_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/clrpicker.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/clrpicker.h // Purpose: wxColourPickerCtrl base header // Author: Francesco Montorsi (based on Vadim Zeitlin's code) // Modified by: // Created: 14/4/2006 // Copyright: (c) Vadim Zeitlin, Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_CLRPICKER_H_BASE_ #define _WX_CLRPICKER_H_BASE_ #include "wx/defs.h" #if wxUSE_COLOURPICKERCTRL #include "wx/pickerbase.h" class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent; extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerWidgetNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[]; // show the colour in HTML form (#AABBCC) as colour button label #define wxCLRBTN_SHOW_LABEL 100 // the default style #define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL) // ---------------------------------------------------------------------------- // wxColourPickerWidgetBase: a generic abstract interface which must be // implemented by controls used by wxColourPickerCtrl // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxColourPickerWidgetBase { public: wxColourPickerWidgetBase() { m_colour = *wxBLACK; } virtual ~wxColourPickerWidgetBase() {} wxColour GetColour() const { return m_colour; } virtual void SetColour(const wxColour &col) { m_colour = col; UpdateColour(); } virtual void SetColour(const wxString &col) { m_colour.Set(col); UpdateColour(); } protected: virtual void UpdateColour() = 0; // the current colour (may be invalid if none) wxColour m_colour; }; // Styles which must be supported by all controls implementing wxColourPickerWidgetBase // NB: these styles must be defined to carefully-chosen values to // avoid conflicts with wxButton's styles // show the colour in HTML form (#AABBCC) as colour button label // (instead of no label at all) // NOTE: this style is supported just by wxColourButtonGeneric and // thus is not exposed in wxColourPickerCtrl #define wxCLRP_SHOW_LABEL 0x0008 #define wxCLRP_SHOW_ALPHA 0x0010 // map platform-dependent controls which implement the wxColourPickerWidgetBase // under the name "wxColourPickerWidget". // NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the // fact that all classes being mapped as wxColourPickerWidget have the // same prototype for their contructor (and also explains why we use // define instead of a typedef) // since GTK > 2.4, there is GtkColorButton #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/clrpicker.h" #define wxColourPickerWidget wxColourButton #elif defined(__WXQT__) && !defined(__WXUNIVERSAL__) #include "wx/qt/clrpicker.h" #else #include "wx/generic/clrpickerg.h" #define wxColourPickerWidget wxGenericColourButton #endif // ---------------------------------------------------------------------------- // wxColourPickerCtrl: platform-independent class which embeds a // platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is // used, a textctrl next to it. // ---------------------------------------------------------------------------- #define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) #define wxCLRP_DEFAULT_STYLE 0 class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase { public: wxColourPickerCtrl() {} virtual ~wxColourPickerCtrl() {} wxColourPickerCtrl(wxWindow *parent, wxWindowID id, const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxColourPickerCtrlNameStr) { Create(parent, id, col, pos, size, style, validator, name); } bool Create(wxWindow *parent, wxWindowID id, const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxColourPickerCtrlNameStr); public: // public API // get the colour chosen wxColour GetColour() const { return ((wxColourPickerWidget *)m_picker)->GetColour(); } // set currently displayed color void SetColour(const wxColour& col); // set colour using RGB(r,g,b) syntax or considering given text as a colour name; // returns true if the given text was successfully recognized. bool SetColour(const wxString& text); public: // internal functions // update the button colour to match the text control contents void UpdatePickerFromTextCtrl() wxOVERRIDE; // update the text control to match the button's colour void UpdateTextCtrlFromPicker() wxOVERRIDE; // event handler for our picker void OnColourChange(wxColourPickerEvent &); protected: virtual long GetPickerStyle(long style) const wxOVERRIDE { return (style & (wxCLRP_SHOW_LABEL | wxCLRP_SHOW_ALPHA)); } private: wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrl); }; // ---------------------------------------------------------------------------- // wxColourPickerEvent: used by wxColourPickerCtrl only // ---------------------------------------------------------------------------- wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent ); class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent { public: wxColourPickerEvent() {} wxColourPickerEvent(wxObject *generator, int id, const wxColour &col) : wxCommandEvent(wxEVT_COLOURPICKER_CHANGED, id), m_colour(col) { SetEventObject(generator); } wxColour GetColour() const { return m_colour; } void SetColour(const wxColour &c) { m_colour = c; } // default copy ctor, assignment operator and dtor are ok virtual wxEvent *Clone() const wxOVERRIDE { return new wxColourPickerEvent(*this); } private: wxColour m_colour; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent); }; // ---------------------------------------------------------------------------- // event types and macros // ---------------------------------------------------------------------------- typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&); #define wxColourPickerEventHandler(func) \ wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func) #define EVT_COLOURPICKER_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn)) // old wxEVT_COMMAND_* constant #define wxEVT_COMMAND_COLOURPICKER_CHANGED wxEVT_COLOURPICKER_CHANGED #endif // wxUSE_COLOURPICKERCTRL #endif // _WX_CLRPICKER_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dialup.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/dialup.h // Purpose: Network related wxWidgets classes and functions // Author: Vadim Zeitlin // Modified by: // Created: 07.07.99 // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DIALUP_H #define _WX_DIALUP_H #if wxUSE_DIALUP_MANAGER #include "wx/event.h" // ---------------------------------------------------------------------------- // misc // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_BASE wxArrayString; #define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com") // ---------------------------------------------------------------------------- // A class which groups functions dealing with connecting to the network from a // workstation using dial-up access to the net. There is at most one instance // of this class in the program accessed via GetDialUpManager(). // ---------------------------------------------------------------------------- /* TODO * * 1. more configurability for Unix: i.e. how to initiate the connection, how * to check for online status, &c. * 2. a function to enumerate all connections (ISPs) and show a dialog in * Dial() allowing to choose between them if no ISP given * 3. add an async version of dialing functions which notify the caller about * the progress (or may be even start another thread to monitor it) * 4. the static creation/accessor functions are not MT-safe - but is this * really crucial? I think we may suppose they're always called from the * main thread? */ class WXDLLIMPEXP_CORE wxDialUpManager { public: // this function should create and return the object of the // platform-specific class derived from wxDialUpManager. It's implemented // in the platform-specific source files. static wxDialUpManager *Create(); // could the dialup manager be initialized correctly? If this function // returns false, no other functions will work neither, so it's a good idea // to call this function and check its result before calling any other // wxDialUpManager methods virtual bool IsOk() const = 0; // virtual dtor for any base class virtual ~wxDialUpManager() { } // operations // ---------- // fills the array with the names of all possible values for the first // parameter to Dial() on this machine and returns their number (may be 0) virtual size_t GetISPNames(wxArrayString& names) const = 0; // dial the given ISP, use username and password to authentificate // // if no nameOfISP is given, the function will select the default one // // if no username/password are given, the function will try to do without // them, but will ask the user if really needed // // if async parameter is false, the function waits until the end of dialing // and returns true upon successful completion. // if async is true, the function only initiates the connection and returns // immediately - the result is reported via events (an event is sent // anyhow, but if dialing failed it will be a DISCONNECTED one) virtual bool Dial(const wxString& nameOfISP = wxEmptyString, const wxString& username = wxEmptyString, const wxString& password = wxEmptyString, bool async = true) = 0; // returns true if (async) dialing is in progress virtual bool IsDialing() const = 0; // cancel dialing the number initiated with Dial(async = true) // NB: this won't result in DISCONNECTED event being sent virtual bool CancelDialing() = 0; // hang up the currently active dial up connection virtual bool HangUp() = 0; // online status // ------------- // returns true if the computer has a permanent network connection (i.e. is // on a LAN) and so there is no need to use Dial() function to go online // // NB: this functions tries to guess the result and it is not always // guaranteed to be correct, so it's better to ask user for // confirmation or give him a possibility to override it virtual bool IsAlwaysOnline() const = 0; // returns true if the computer is connected to the network: under Windows, // this just means that a RAS connection exists, under Unix we check that // the "well-known host" (as specified by SetWellKnownHost) is reachable virtual bool IsOnline() const = 0; // sometimes the built-in logic for determining the online status may fail, // so, in general, the user should be allowed to override it. This function // allows to forcefully set the online status - whatever our internal // algorithm may think about it. virtual void SetOnlineStatus(bool isOnline = true) = 0; // set misc wxDialUpManager options // -------------------------------- // enable automatical checks for the connection status and sending of // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval // parameter is only for Unix where we do the check manually: under // Windows, the notification about the change of connection status is // instantenous. // // Returns false if couldn't set up automatic check for online status. virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0; // disable automatic check for connection status change - notice that the // wxEVT_DIALUP_XXX events won't be sent any more neither. virtual void DisableAutoCheckOnlineStatus() = 0; // additional Unix-only configuration // ---------------------------------- // under Unix, the value of well-known host is used to check whether we're // connected to the internet. It's unused under Windows, but this function // is always safe to call. The default value is www.yahoo.com. virtual void SetWellKnownHost(const wxString& hostname, int portno = 80) = 0; // Sets the commands to start up the network and to hang up again. Used by // the Unix implementations only. virtual void SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"), const wxString& commandHangup = wxT("/usr/bin/poff")) = 0; }; // ---------------------------------------------------------------------------- // wxDialUpManager events // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxDialUpEvent; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_CONNECTED, wxDialUpEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent ); // the event class for the dialup events class WXDLLIMPEXP_CORE wxDialUpEvent : public wxEvent { public: wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent) { SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED : wxEVT_DIALUP_DISCONNECTED); } // is this a CONNECTED or DISCONNECTED event? bool IsConnectedEvent() const { return GetEventType() == wxEVT_DIALUP_CONNECTED; } // does this event come from wxDialUpManager::Dial() or from some external // process (i.e. does it result from our own attempt to establish the // connection)? bool IsOwnEvent() const { return m_id != 0; } // implement the base class pure virtual virtual wxEvent *Clone() const wxOVERRIDE { return new wxDialUpEvent(*this); } private: wxDECLARE_NO_ASSIGN_CLASS(wxDialUpEvent); }; // the type of dialup event handler function typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&); #define wxDialUpEventHandler(func) \ wxEVENT_HANDLER_CAST(wxDialUpEventFunction, func) // macros to catch dialup events #define EVT_DIALUP_CONNECTED(func) \ wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func)) #define EVT_DIALUP_DISCONNECTED(func) \ wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func)) #endif // wxUSE_DIALUP_MANAGER #endif // _WX_DIALUP_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dcbuffer.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/dcbuffer.h // Purpose: wxBufferedDC class // Author: Ron Lee <[email protected]> // Modified by: Vadim Zeitlin (refactored, added bg preservation) // Created: 16/03/02 // Copyright: (c) Ron Lee // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DCBUFFER_H_ #define _WX_DCBUFFER_H_ #include "wx/dcmemory.h" #include "wx/dcclient.h" #include "wx/window.h" // Split platforms into two groups - those which have well-working // double-buffering by default, and those which do not. #if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) || defined(__WXQT__) #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1 #else #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0 #endif // ---------------------------------------------------------------------------- // Double buffering helper. // ---------------------------------------------------------------------------- // Assumes the buffer bitmap covers the entire scrolled window, // and prepares the window DC accordingly #define wxBUFFER_VIRTUAL_AREA 0x01 // Assumes the buffer bitmap only covers the client area; // does not prepare the window DC #define wxBUFFER_CLIENT_AREA 0x02 // Set when not using specific buffer bitmap. Note that this // is private style and not returned by GetStyle. #define wxBUFFER_USES_SHARED_BUFFER 0x04 class WXDLLIMPEXP_CORE wxBufferedDC : public wxMemoryDC { public: // Default ctor, must subsequently call Init for two stage construction. wxBufferedDC() : m_dc(NULL), m_buffer(NULL), m_style(0) { } // Construct a wxBufferedDC using a user supplied buffer. wxBufferedDC(wxDC *dc, wxBitmap& buffer = wxNullBitmap, int style = wxBUFFER_CLIENT_AREA) : m_dc(NULL), m_buffer(NULL) { Init(dc, buffer, style); } // Construct a wxBufferedDC with an internal buffer of 'area' // (where area is usually something like the size of the window // being buffered) wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA) : m_dc(NULL), m_buffer(NULL) { Init(dc, area, style); } // The usually desired action in the dtor is to blit the buffer. virtual ~wxBufferedDC() { if ( m_dc ) UnMask(); } // These reimplement the actions of the ctors for two stage creation void Init(wxDC *dc, wxBitmap& buffer = wxNullBitmap, int style = wxBUFFER_CLIENT_AREA) { InitCommon(dc, style); m_buffer = &buffer; UseBuffer(); } void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA) { InitCommon(dc, style); UseBuffer(area.x, area.y); } // Blits the buffer to the dc, and detaches the dc from the buffer (so it // can be effectively used once only). // // Usually called in the dtor or by the dtor of derived classes if the // BufferedDC must blit before the derived class (which may own the dc it's // blitting to) is destroyed. void UnMask(); // Set and get the style void SetStyle(int style) { m_style = style; } int GetStyle() const { return m_style & ~wxBUFFER_USES_SHARED_BUFFER; } private: // common part of Init()s void InitCommon(wxDC *dc, int style) { wxASSERT_MSG( !m_dc, wxT("wxBufferedDC already initialised") ); m_dc = dc; m_style = style; } // check that the bitmap is valid and use it void UseBuffer(wxCoord w = -1, wxCoord h = -1); // the underlying DC to which we copy everything drawn on this one in // UnMask() // // NB: Without the existence of a wxNullDC, this must be a pointer, else it // could probably be a reference. wxDC *m_dc; // the buffer (selected in this DC), initially invalid wxBitmap *m_buffer; // the buffering style int m_style; wxSize m_area; wxDECLARE_DYNAMIC_CLASS(wxBufferedDC); wxDECLARE_NO_COPY_CLASS(wxBufferedDC); }; // ---------------------------------------------------------------------------- // Double buffered PaintDC. // ---------------------------------------------------------------------------- // Creates a double buffered wxPaintDC, optionally allowing the // user to specify their own buffer to use. class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC { public: // If no bitmap is supplied by the user, a temporary one will be created. wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA) : m_paintdc(window) { // If we're buffering the virtual window, scale the paint DC as well if (style & wxBUFFER_VIRTUAL_AREA) window->PrepareDC( m_paintdc ); if( buffer.IsOk() ) Init(&m_paintdc, buffer, style); else Init(&m_paintdc, GetBufferedSize(window, style), style); } // If no bitmap is supplied by the user, a temporary one will be created. wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA) : m_paintdc(window) { // If we're using the virtual window, scale the paint DC as well if (style & wxBUFFER_VIRTUAL_AREA) window->PrepareDC( m_paintdc ); Init(&m_paintdc, GetBufferedSize(window, style), style); } // default copy ctor ok. virtual ~wxBufferedPaintDC() { // We must UnMask here, else by the time the base class // does it, the PaintDC will have already been destroyed. UnMask(); } protected: // return the size needed by the buffer: this depends on whether we're // buffering just the currently shown part or the total (scrolled) window static wxSize GetBufferedSize(wxWindow *window, int style) { return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize() : window->GetClientSize(); } private: wxPaintDC m_paintdc; wxDECLARE_ABSTRACT_CLASS(wxBufferedPaintDC); wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC); }; // // wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double- // buffering by default. Otherwise it is a wxBufferedPaintDC. Thus, // you can only expect it work with a simple constructor that // accepts single wxWindow* argument. // #if wxALWAYS_NATIVE_DOUBLE_BUFFER #define wxAutoBufferedPaintDCBase wxPaintDC #else #define wxAutoBufferedPaintDCBase wxBufferedPaintDC #endif class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase { public: wxAutoBufferedPaintDC(wxWindow* win) : wxAutoBufferedPaintDCBase(win) { wxASSERT_MSG( win->GetBackgroundStyle() == wxBG_STYLE_PAINT, "You need to call SetBackgroundStyle(wxBG_STYLE_PAINT) in ctor, " "and also, if needed, paint the background in wxEVT_PAINT handler." ); } virtual ~wxAutoBufferedPaintDC() { } private: wxDECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC); }; // Check if the window is natively double buffered and will return a wxPaintDC // if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility // to delete the wxDC pointer when finished with it. inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window) { if ( window->IsDoubleBuffered() ) return new wxPaintDC(window); else return new wxBufferedPaintDC(window); } #endif // _WX_DCBUFFER_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/uiaction.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/uiaction.h // Purpose: wxUIActionSimulator interface // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin // Created: 2010-03-06 // Copyright: (c) 2010 Kevin Ollivier // (c) 2010 Steven Lamerton // (c) 2010-2016 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_UIACTIONSIMULATOR_H_ #define _WX_UIACTIONSIMULATOR_H_ #include "wx/defs.h" #if wxUSE_UIACTIONSIMULATOR #include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants class WXDLLIMPEXP_CORE wxUIActionSimulator { public: wxUIActionSimulator(); ~wxUIActionSimulator(); // Mouse simulation // ---------------- // Low level methods bool MouseMove(long x, long y); bool MouseMove(const wxPoint& point) { return MouseMove(point.x, point.y); } bool MouseDown(int button = wxMOUSE_BTN_LEFT); bool MouseUp(int button = wxMOUSE_BTN_LEFT); // Higher level interface, use it if possible instead bool MouseClick(int button = wxMOUSE_BTN_LEFT); bool MouseDblClick(int button = wxMOUSE_BTN_LEFT); bool MouseDragDrop(long x1, long y1, long x2, long y2, int button = wxMOUSE_BTN_LEFT); bool MouseDragDrop(const wxPoint& p1, const wxPoint& p2, int button = wxMOUSE_BTN_LEFT) { return MouseDragDrop(p1.x, p1.y, p2.x, p2.y, button); } // Keyboard simulation // ------------------- // Low level methods for generating key presses and releases bool KeyDown(int keycode, int modifiers = wxMOD_NONE) { return Key(keycode, modifiers, true); } bool KeyUp(int keycode, int modifiers = wxMOD_NONE) { return Key(keycode, modifiers, false); } // Higher level methods for generating both the key press and release for a // single key or for all characters in the ASCII string "text" which can currently // contain letters, digits and characters for the definition of numbers [+-., ]. bool Char(int keycode, int modifiers = wxMOD_NONE); bool Text(const char *text); // Select the item with the given text in the currently focused control. bool Select(const wxString& text); private: // This is the common part of Key{Down,Up}() methods: while we keep them // separate at public API level for consistency with Mouse{Down,Up}(), at // implementation level it makes more sense to have them in a single // function. // // It calls DoModifiers() to simulate pressing the modifier keys if // necessary and then DoKey() for the key itself. bool Key(int keycode, int modifiers, bool isDown); // Call DoKey() for all modifier keys whose bits are set in the parameter. void SimulateModifiers(int modifier, bool isDown); // This pointer is allocated in the ctor and points to the // platform-specific implementation. class wxUIActionSimulatorImpl* const m_impl; wxDECLARE_NO_COPY_CLASS(wxUIActionSimulator); }; #endif // wxUSE_UIACTIONSIMULATOR #endif // _WX_UIACTIONSIMULATOR_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/socket.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/socket.h // Purpose: Socket handling classes // Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia // Modified by: // Created: April 1997 // Copyright: (c) Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SOCKET_H_ #define _WX_SOCKET_H_ #include "wx/defs.h" #if wxUSE_SOCKETS // --------------------------------------------------------------------------- // wxSocket headers // --------------------------------------------------------------------------- #include "wx/event.h" #include "wx/sckaddr.h" #include "wx/list.h" class wxSocketImpl; // ------------------------------------------------------------------------ // Types and constants // ------------------------------------------------------------------------ // Define the type of native sockets. #if defined(__WINDOWS__) // Although socket descriptors are still 32 bit values, even under Win64, // the socket type is 64 bit there. typedef wxUIntPtr wxSOCKET_T; #else typedef int wxSOCKET_T; #endif // Types of different socket notifications or events. // // NB: the values here should be consecutive and start with 0 as they are // used to construct the wxSOCKET_XXX_FLAG bit mask values below enum wxSocketNotify { wxSOCKET_INPUT, wxSOCKET_OUTPUT, wxSOCKET_CONNECTION, wxSOCKET_LOST }; enum { wxSOCKET_INPUT_FLAG = 1 << wxSOCKET_INPUT, wxSOCKET_OUTPUT_FLAG = 1 << wxSOCKET_OUTPUT, wxSOCKET_CONNECTION_FLAG = 1 << wxSOCKET_CONNECTION, wxSOCKET_LOST_FLAG = 1 << wxSOCKET_LOST }; // this is a combination of the bit masks defined above typedef int wxSocketEventFlags; enum wxSocketError { wxSOCKET_NOERROR = 0, wxSOCKET_INVOP, wxSOCKET_IOERR, wxSOCKET_INVADDR, wxSOCKET_INVSOCK, wxSOCKET_NOHOST, wxSOCKET_INVPORT, wxSOCKET_WOULDBLOCK, wxSOCKET_TIMEDOUT, wxSOCKET_MEMERR, wxSOCKET_OPTERR }; // socket options/flags bit masks enum { wxSOCKET_NONE = 0x0000, wxSOCKET_NOWAIT_READ = 0x0001, wxSOCKET_NOWAIT_WRITE = 0x0002, wxSOCKET_NOWAIT = wxSOCKET_NOWAIT_READ | wxSOCKET_NOWAIT_WRITE, wxSOCKET_WAITALL_READ = 0x0004, wxSOCKET_WAITALL_WRITE = 0x0008, wxSOCKET_WAITALL = wxSOCKET_WAITALL_READ | wxSOCKET_WAITALL_WRITE, wxSOCKET_BLOCK = 0x0010, wxSOCKET_REUSEADDR = 0x0020, wxSOCKET_BROADCAST = 0x0040, wxSOCKET_NOBIND = 0x0080 }; typedef int wxSocketFlags; // socket kind values (badly defined, don't use) enum wxSocketType { wxSOCKET_UNINIT, wxSOCKET_CLIENT, wxSOCKET_SERVER, wxSOCKET_BASE, wxSOCKET_DATAGRAM }; // event class WXDLLIMPEXP_FWD_NET wxSocketEvent; wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent); // -------------------------------------------------------------------------- // wxSocketBase // -------------------------------------------------------------------------- class WXDLLIMPEXP_NET wxSocketBase : public wxObject { public: // Public interface // ---------------- // ctors and dtors wxSocketBase(); wxSocketBase(wxSocketFlags flags, wxSocketType type); virtual ~wxSocketBase(); void Init(); bool Destroy(); // state bool Ok() const { return IsOk(); } bool IsOk() const { return m_impl != NULL; } bool Error() const { return LastError() != wxSOCKET_NOERROR; } bool IsClosed() const { return m_closed; } bool IsConnected() const { return m_connected; } bool IsData() { return WaitForRead(0, 0); } bool IsDisconnected() const { return !IsConnected(); } wxUint32 LastCount() const { return m_lcount; } wxUint32 LastReadCount() const { return m_lcount_read; } wxUint32 LastWriteCount() const { return m_lcount_write; } wxSocketError LastError() const; void SaveState(); void RestoreState(); // addresses virtual bool GetLocal(wxSockAddress& addr_man) const; virtual bool GetPeer(wxSockAddress& addr_man) const; virtual bool SetLocal(const wxIPV4address& local); // base IO virtual bool Close(); void ShutdownOutput(); wxSocketBase& Discard(); wxSocketBase& Peek(void* buffer, wxUint32 nbytes); wxSocketBase& Read(void* buffer, wxUint32 nbytes); wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes); wxSocketBase& Unread(const void *buffer, wxUint32 nbytes); wxSocketBase& Write(const void *buffer, wxUint32 nbytes); wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes); // all Wait() functions wait until their condition is satisfied or the // timeout expires; if seconds == -1 (default) then m_timeout value is used // // it is also possible to call InterruptWait() to cancel any current Wait() // wait for anything at all to happen with this socket bool Wait(long seconds = -1, long milliseconds = 0); // wait until we can read from or write to the socket without blocking // (notice that this does not mean that the operation will succeed but only // that it will return immediately) bool WaitForRead(long seconds = -1, long milliseconds = 0); bool WaitForWrite(long seconds = -1, long milliseconds = 0); // wait until the connection is terminated bool WaitForLost(long seconds = -1, long milliseconds = 0); void InterruptWait() { m_interrupt = true; } wxSocketFlags GetFlags() const { return m_flags; } void SetFlags(wxSocketFlags flags); virtual void SetTimeout(long seconds); long GetTimeout() const { return m_timeout; } bool GetOption(int level, int optname, void *optval, int *optlen); bool SetOption(int level, int optname, const void *optval, int optlen); wxUint32 GetLastIOSize() const { return m_lcount; } wxUint32 GetLastIOReadSize() const { return m_lcount_read; } wxUint32 GetLastIOWriteSize() const { return m_lcount_write; } // event handling void *GetClientData() const { return m_clientData; } void SetClientData(void *data) { m_clientData = data; } void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY); void SetNotify(wxSocketEventFlags flags); void Notify(bool notify); // Get the underlying socket descriptor. wxSOCKET_T GetSocket() const; // initialize/shutdown the sockets (done automatically so there is no need // to call these functions usually) // // should always be called from the main thread only so one of the cases // where they should indeed be called explicitly is when the first wxSocket // object in the application is created in a different thread static bool Initialize(); static void Shutdown(); // check if wxSocket had been already initialized // // notice that this function should be only called from the main thread as // otherwise it is inherently unsafe because Initialize/Shutdown() may be // called concurrently with it in the main thread static bool IsInitialized(); // Implementation from now on // -------------------------- // do not use, should be private (called from wxSocketImpl only) void OnRequest(wxSocketNotify notify); // do not use, not documented nor supported bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); } wxSocketType GetType() const { return m_type; } // Helper returning wxSOCKET_NONE if non-blocking sockets can be used, i.e. // the socket is being created in the main thread and the event loop is // running, or wxSOCKET_BLOCK otherwise. // // This is an internal function used only by wxWidgets itself, user code // should decide if it wants blocking sockets or not and use the // appropriate style instead of using it (but wxWidgets has to do it like // this for compatibility with the original network classes behaviour). static int GetBlockingFlagIfNeeded(); private: friend class wxSocketClient; friend class wxSocketServer; friend class wxDatagramSocket; // low level IO wxUint32 DoRead(void* buffer, wxUint32 nbytes); wxUint32 DoWrite(const void *buffer, wxUint32 nbytes); // wait until the given flags are set for this socket or the given timeout // (or m_timeout) expires // // notice that wxSOCKET_LOST_FLAG is always taken into account and the // function returns -1 if the connection was lost; otherwise it returns // true if any of the events specified by flags argument happened or false // if the timeout expired int DoWait(long timeout, wxSocketEventFlags flags); // a helper calling DoWait() using the same convention as the public // WaitForXXX() functions use, i.e. use our timeout if seconds == -1 or the // specified timeout otherwise int DoWait(long seconds, long milliseconds, wxSocketEventFlags flags); // another helper calling DoWait() using our m_timeout int DoWaitWithTimeout(wxSocketEventFlags flags) { return DoWait(m_timeout*1000, flags); } // pushback buffer void Pushback(const void *buffer, wxUint32 size); wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek); // store the given error as the LastError() void SetError(wxSocketError error); private: // socket wxSocketImpl *m_impl; // port-specific implementation wxSocketType m_type; // wxSocket type // state wxSocketFlags m_flags; // wxSocket flags bool m_connected; // connected? bool m_establishing; // establishing connection? bool m_reading; // busy reading? bool m_writing; // busy writing? bool m_closed; // was the other end closed? wxUint32 m_lcount; // last IO transaction size wxUint32 m_lcount_read; // last IO transaction size of Read() direction. wxUint32 m_lcount_write; // last IO transaction size of Write() direction. unsigned long m_timeout; // IO timeout value in seconds // (TODO: remove, wxSocketImpl has it too) wxList m_states; // stack of states (TODO: remove!) bool m_interrupt; // interrupt ongoing wait operations? bool m_beingDeleted; // marked for delayed deletion? wxIPV4address m_localAddress; // bind to local address? // pushback buffer void *m_unread; // pushback buffer wxUint32 m_unrd_size; // pushback buffer size wxUint32 m_unrd_cur; // pushback pointer (index into buffer) // events int m_id; // socket id wxEvtHandler *m_handler; // event handler void *m_clientData; // client data for events bool m_notify; // notify events to users? wxSocketEventFlags m_eventmask; // which events to notify? wxSocketEventFlags m_eventsgot; // collects events received in OnRequest() friend class wxSocketReadGuard; friend class wxSocketWriteGuard; wxDECLARE_CLASS(wxSocketBase); wxDECLARE_NO_COPY_CLASS(wxSocketBase); }; // -------------------------------------------------------------------------- // wxSocketServer // -------------------------------------------------------------------------- class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase { public: wxSocketServer(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); wxSocketBase* Accept(bool wait = true); bool AcceptWith(wxSocketBase& socket, bool wait = true); bool WaitForAccept(long seconds = -1, long milliseconds = 0); wxDECLARE_CLASS(wxSocketServer); wxDECLARE_NO_COPY_CLASS(wxSocketServer); }; // -------------------------------------------------------------------------- // wxSocketClient // -------------------------------------------------------------------------- class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase { public: wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); virtual bool Connect(const wxSockAddress& addr, bool wait = true); bool Connect(const wxSockAddress& addr, const wxSockAddress& local, bool wait = true); bool WaitOnConnect(long seconds = -1, long milliseconds = 0); // Sets initial socket buffer sizes using the SO_SNDBUF and SO_RCVBUF // options before calling connect (either one can be -1 to leave it // unchanged) void SetInitialSocketBuffers(int recv, int send) { m_initialRecvBufferSize = recv; m_initialSendBufferSize = send; } private: virtual bool DoConnect(const wxSockAddress& addr, const wxSockAddress* local, bool wait = true); // buffer sizes, -1 if unset and defaults should be used int m_initialRecvBufferSize; int m_initialSendBufferSize; wxDECLARE_CLASS(wxSocketClient); wxDECLARE_NO_COPY_CLASS(wxSocketClient); }; // -------------------------------------------------------------------------- // wxDatagramSocket // -------------------------------------------------------------------------- // WARNING: still in alpha stage class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase { public: wxDatagramSocket(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); wxDatagramSocket& RecvFrom(wxSockAddress& addr, void *buf, wxUint32 nBytes); wxDatagramSocket& SendTo(const wxSockAddress& addr, const void* buf, wxUint32 nBytes); /* TODO: bool Connect(wxSockAddress& addr); */ private: wxDECLARE_CLASS(wxDatagramSocket); wxDECLARE_NO_COPY_CLASS(wxDatagramSocket); }; // -------------------------------------------------------------------------- // wxSocketEvent // -------------------------------------------------------------------------- class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent { public: wxSocketEvent(int id = 0) : wxEvent(id, wxEVT_SOCKET) { } wxSocketNotify GetSocketEvent() const { return m_event; } wxSocketBase *GetSocket() const { return (wxSocketBase *) GetEventObject(); } void *GetClientData() const { return m_clientData; } virtual wxEvent *Clone() const wxOVERRIDE { return new wxSocketEvent(*this); } virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_SOCKET; } public: wxSocketNotify m_event; void *m_clientData; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent); }; typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); #define wxSocketEventHandler(func) \ wxEVENT_HANDLER_CAST(wxSocketEventFunction, func) #define EVT_SOCKET(id, func) \ wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func)) #endif // wxUSE_SOCKETS #endif // _WX_SOCKET_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/xtihandler.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/xtihandler.h // Purpose: XTI handlers // Author: Stefan Csomor // Modified by: Francesco Montorsi // Created: 27/07/03 // Copyright: (c) 1997 Julian Smart // (c) 2003 Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _XTIHANDLER_H_ #define _XTIHANDLER_H_ #include "wx/defs.h" #if wxUSE_EXTENDED_RTTI #include "wx/xti.h" // copied from event.h which cannot be included at this place class WXDLLIMPEXP_FWD_BASE wxEvent; #ifdef __VISUALC__ #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance #else #define wxMSVC_FWD_MULTIPLE_BASES #endif class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler; typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); typedef wxEventFunction wxObjectEventFunction; // ---------------------------------------------------------------------------- // Handler Info // // this describes an event sink // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxHandlerInfo { friend class WXDLLIMPEXP_BASE wxDynamicClassInfo; public: wxHandlerInfo(wxHandlerInfo* &iter, wxClassInfo* itsClass, const wxString& name, wxObjectEventFunction address, const wxClassInfo* eventClassInfo) : m_eventFunction(address), m_name(name), m_eventClassInfo(eventClassInfo), m_itsClass(itsClass) { Insert(iter); } ~wxHandlerInfo() { Remove(); } // return the name of this handler const wxString& GetName() const { return m_name; } // return the class info of the event const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo; } // get the handler function pointer wxObjectEventFunction GetEventFunction() const { return m_eventFunction; } // returns NULL if this is the last handler of this class wxHandlerInfo* GetNext() const { return m_next; } // return the class this property is declared in const wxClassInfo* GetDeclaringClass() const { return m_itsClass; } private: // inserts this handler at the end of the linked chain which begins // with "iter" handler. void Insert(wxHandlerInfo* &iter); // removes this handler from the linked chain of the m_itsClass handlers. void Remove(); wxObjectEventFunction m_eventFunction; wxString m_name; const wxClassInfo* m_eventClassInfo; wxHandlerInfo* m_next; wxClassInfo* m_itsClass; }; #define wxHANDLER(name,eventClassType) \ static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \ wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \ wxCLASSINFO( eventClassType ) ); #define wxBEGIN_HANDLERS_TABLE(theClass) \ wxHandlerInfo *theClass::GetHandlersStatic() \ { \ typedef theClass class_t; \ static wxHandlerInfo* first = NULL; #define wxEND_HANDLERS_TABLE() \ return first; } #define wxEMPTY_HANDLERS_TABLE(theClass) \ wxBEGIN_HANDLERS_TABLE(theClass) \ wxEND_HANDLERS_TABLE() #endif // wxUSE_EXTENDED_RTTI #endif // _XTIHANDLER_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/url.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/url.h // Purpose: URL parser // Author: Guilhem Lavaux // Modified by: Ryan Norton // Created: 20/07/1997 // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_URL_H #define _WX_URL_H #include "wx/defs.h" #if wxUSE_URL #include "wx/uri.h" #include "wx/protocol/protocol.h" #if wxUSE_PROTOCOL_HTTP #include "wx/protocol/http.h" #endif enum wxURLError { wxURL_NOERR = 0, wxURL_SNTXERR, wxURL_NOPROTO, wxURL_NOHOST, wxURL_NOPATH, wxURL_CONNERR, wxURL_PROTOERR }; #if wxUSE_URL_NATIVE class WXDLLIMPEXP_FWD_NET wxURL; class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject { public: virtual ~wxURLNativeImp() { } virtual wxInputStream *GetInputStream(wxURL *owner) = 0; }; #endif // wxUSE_URL_NATIVE class WXDLLIMPEXP_NET wxURL : public wxURI { public: wxURL(const wxString& sUrl = wxEmptyString); wxURL(const wxURI& uri); wxURL(const wxURL& url); virtual ~wxURL(); wxURL& operator = (const wxString& url); wxURL& operator = (const wxURI& uri); wxURL& operator = (const wxURL& url); wxProtocol& GetProtocol() { return *m_protocol; } wxURLError GetError() const { return m_error; } wxString GetURL() const { return m_url; } wxURLError SetURL(const wxString &url) { *this = url; return m_error; } bool IsOk() const { return m_error == wxURL_NOERR; } wxInputStream *GetInputStream(); #if wxUSE_PROTOCOL_HTTP static void SetDefaultProxy(const wxString& url_proxy); void SetProxy(const wxString& url_proxy); #endif // wxUSE_PROTOCOL_HTTP protected: static wxProtoInfo *ms_protocols; #if wxUSE_PROTOCOL_HTTP static wxHTTP *ms_proxyDefault; static bool ms_useDefaultProxy; wxHTTP *m_proxy; bool m_useProxy; #endif // wxUSE_PROTOCOL_HTTP #if wxUSE_URL_NATIVE friend class wxURLNativeImp; // pointer to a native URL implementation object wxURLNativeImp *m_nativeImp; // Creates on the heap and returns a native // implementation object for the current platform. static wxURLNativeImp *CreateNativeImpObject(); #endif // wxUSE_URL_NATIVE wxProtoInfo *m_protoinfo; wxProtocol *m_protocol; wxURLError m_error; wxString m_url; void Init(const wxString&); bool ParseURL(); void CleanData(); void Free(); bool FetchProtocol(); friend class wxProtoInfo; friend class wxURLModule; private: wxDECLARE_DYNAMIC_CLASS(wxURL); }; #endif // wxUSE_URL #endif // _WX_URL_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/notebook.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/notebook.h // Purpose: wxNotebook interface // Author: Vadim Zeitlin // Modified by: // Created: 01.02.01 // Copyright: (c) 1996-2000 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_NOTEBOOK_H_BASE_ #define _WX_NOTEBOOK_H_BASE_ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/defs.h" #if wxUSE_NOTEBOOK #include "wx/bookctrl.h" // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // wxNotebook hit results, use wxBK_HITTEST so other book controls can share them // if wxUSE_NOTEBOOK is disabled enum { wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE, wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON, wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL, wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM, wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE }; // wxNotebook flags // use common book wxBK_* flags for describing alignment #define wxNB_DEFAULT wxBK_DEFAULT #define wxNB_TOP wxBK_TOP #define wxNB_BOTTOM wxBK_BOTTOM #define wxNB_LEFT wxBK_LEFT #define wxNB_RIGHT wxBK_RIGHT #define wxNB_FIXEDWIDTH 0x0100 #define wxNB_MULTILINE 0x0200 #define wxNB_NOPAGETHEME 0x0400 typedef wxWindow wxNotebookPage; // so far, any window can be a page extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[]; #if wxUSE_EXTENDED_RTTI // ---------------------------------------------------------------------------- // XTI accessor // ---------------------------------------------------------------------------- class WXDLLEXPORT wxNotebookPageInfo : public wxObject { public: wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } virtual ~wxNotebookPageInfo() { } bool Create(wxNotebookPage *page, const wxString& text, bool selected, int imageId) { m_page = page; m_text = text; m_selected = selected; m_imageId = imageId; return true; } wxNotebookPage* GetPage() const { return m_page; } wxString GetText() const { return m_text; } bool GetSelected() const { return m_selected; } int GetImageId() const { return m_imageId; } private: wxNotebookPage *m_page; wxString m_text; bool m_selected; int m_imageId; wxDECLARE_DYNAMIC_CLASS(wxNotebookPageInfo); }; WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); #endif // ---------------------------------------------------------------------------- // wxNotebookBase: define wxNotebook interface // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase { public: // ctors // ----- wxNotebookBase() { } // wxNotebook-specific additions to wxBookCtrlBase interface // --------------------------------------------------------- // get the number of rows for a control with wxNB_MULTILINE style (not all // versions support it - they will always return 1 then) virtual int GetRowCount() const { return 1; } // set the padding between tabs (in pixels) virtual void SetPadding(const wxSize& padding) = 0; // set the size of the tabs for wxNB_FIXEDWIDTH controls virtual void SetTabSize(const wxSize& sz) = 0; // implement some base class functions virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; // On platforms that support it, get the theme page background colour, else invalid colour virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; } // send wxEVT_NOTEBOOK_PAGE_CHANGING/ED events // returns false if the change to nPage is vetoed by the program bool SendPageChangingEvent(int nPage); // sends the event about page change from old to new (or GetSelection() if // new is wxNOT_FOUND) void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND); #if wxUSE_EXTENDED_RTTI // XTI accessors virtual void AddPageInfo( wxNotebookPageInfo* info ); virtual const wxNotebookPageInfoList& GetPageInfos() const; #endif protected: #if wxUSE_EXTENDED_RTTI wxNotebookPageInfoList m_pageInfos; #endif wxDECLARE_NO_COPY_CLASS(wxNotebookBase); }; // ---------------------------------------------------------------------------- // notebook event class and related stuff // ---------------------------------------------------------------------------- // wxNotebookEvent is obsolete and defined for compatibility only (notice that // we use #define and not typedef to also keep compatibility with the existing // code which forward declares it) #define wxNotebookEvent wxBookCtrlEvent typedef wxBookCtrlEventFunction wxNotebookEventFunction; #define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func) wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); #define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) #define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) // ---------------------------------------------------------------------------- // wxNotebook class itself // ---------------------------------------------------------------------------- #if defined(__WXUNIVERSAL__) #include "wx/univ/notebook.h" #elif defined(__WXMSW__) #include "wx/msw/notebook.h" #elif defined(__WXMOTIF__) #include "wx/generic/notebook.h" #elif defined(__WXGTK20__) #include "wx/gtk/notebook.h" #elif defined(__WXGTK__) #include "wx/gtk1/notebook.h" #elif defined(__WXMAC__) #include "wx/osx/notebook.h" #elif defined(__WXQT__) #include "wx/qt/notebook.h" #endif // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED #define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING #endif // wxUSE_NOTEBOOK #endif // _WX_NOTEBOOK_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/msgout.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/msgout.h // Purpose: wxMessageOutput class. Shows a message to the user // Author: Mattia Barbon // Modified by: // Created: 17.07.02 // Copyright: (c) Mattia Barbon // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_MSGOUT_H_ #define _WX_MSGOUT_H_ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/defs.h" #include "wx/chartype.h" #include "wx/strvararg.h" // ---------------------------------------------------------------------------- // wxMessageOutput is a class abstracting formatted output target, i.e. // something you can printf() to // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMessageOutput { public: virtual ~wxMessageOutput() { } // gets the current wxMessageOutput object (may be NULL during // initialization or shutdown) static wxMessageOutput* Get(); // sets the global wxMessageOutput instance; returns the previous one static wxMessageOutput* Set(wxMessageOutput* msgout); // show a message to the user // void Printf(const wxString& format, ...) = 0; WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), DoPrintfWchar, DoPrintfUtf8) // called by DoPrintf() to output formatted string but can also be called // directly if no formatting is needed virtual void Output(const wxString& str) = 0; protected: #if !wxUSE_UTF8_LOCALE_ONLY void DoPrintfWchar(const wxChar *format, ...); #endif #if wxUSE_UNICODE_UTF8 void DoPrintfUtf8(const char *format, ...); #endif private: static wxMessageOutput* ms_msgOut; }; // ---------------------------------------------------------------------------- // helper mix-in for output targets that can use difference encodings // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMessageOutputWithConv { protected: explicit wxMessageOutputWithConv(const wxMBConv& conv) : m_conv(conv.Clone()) { } ~wxMessageOutputWithConv() { delete m_conv; } // return the string with "\n" appended if it doesn't already terminate // with it (in which case it's returned unchanged) wxString AppendLineFeedIfNeeded(const wxString& str); // Prepare the given string for output by appending a new line to it, if // necessary, and converting it to a narrow string using our conversion // object. wxCharBuffer PrepareForOutput(const wxString& str); const wxMBConv* const m_conv; }; // ---------------------------------------------------------------------------- // implementation which sends output to stderr or specified file // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput, protected wxMessageOutputWithConv { public: wxMessageOutputStderr(FILE *fp = stderr, const wxMBConv &conv = wxConvWhateverWorks); virtual void Output(const wxString& str) wxOVERRIDE; protected: FILE *m_fp; wxDECLARE_NO_COPY_CLASS(wxMessageOutputStderr); }; // ---------------------------------------------------------------------------- // implementation showing the message to the user in "best" possible way: // uses stderr or message box if available according to the flag given to ctor. // ---------------------------------------------------------------------------- enum wxMessageOutputFlags { wxMSGOUT_PREFER_STDERR = 0, // use stderr if available (this is the default) wxMSGOUT_PREFER_MSGBOX = 1 // always use message box if available }; class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutputStderr { public: wxMessageOutputBest(wxMessageOutputFlags flags = wxMSGOUT_PREFER_STDERR) : m_flags(flags) { } virtual void Output(const wxString& str) wxOVERRIDE; private: wxMessageOutputFlags m_flags; }; // ---------------------------------------------------------------------------- // implementation which shows output in a message box // ---------------------------------------------------------------------------- #if wxUSE_GUI && wxUSE_MSGDLG class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput { public: wxMessageOutputMessageBox() { } virtual void Output(const wxString& str) wxOVERRIDE; }; #endif // wxUSE_GUI && wxUSE_MSGDLG // ---------------------------------------------------------------------------- // implementation using the native way of outputting debug messages // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutputStderr { public: wxMessageOutputDebug() { } virtual void Output(const wxString& str) wxOVERRIDE; }; // ---------------------------------------------------------------------------- // implementation using wxLog (mainly for backwards compatibility) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput { public: wxMessageOutputLog() { } virtual void Output(const wxString& str) wxOVERRIDE; }; #endif // _WX_MSGOUT_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/imagtga.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/imagtga.h // Purpose: wxImage TGA handler // Author: Seth Jackson // Copyright: (c) 2005 Seth Jackson // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_IMAGTGA_H_ #define _WX_IMAGTGA_H_ #include "wx/image.h" //----------------------------------------------------------------------------- // wxTGAHandler //----------------------------------------------------------------------------- #if wxUSE_TGA class WXDLLIMPEXP_CORE wxTGAHandler : public wxImageHandler { public: wxTGAHandler() { m_name = wxT("TGA file"); m_extension = wxT("tga"); m_altExtensions.Add(wxT("tpic")); m_type = wxBITMAP_TYPE_TGA; m_mime = wxT("image/tga"); } #if wxUSE_STREAMS virtual bool LoadFile(wxImage* image, wxInputStream& stream, bool verbose = true, int index = -1) wxOVERRIDE; virtual bool SaveFile(wxImage* image, wxOutputStream& stream, bool verbose = true) wxOVERRIDE; protected: virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; #endif // wxUSE_STREAMS wxDECLARE_DYNAMIC_CLASS(wxTGAHandler); }; #endif // wxUSE_TGA #endif // _WX_IMAGTGA_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/sckaddr.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/sckaddr.h // Purpose: Network address classes // Author: Guilhem Lavaux // Modified by: Vadim Zeitlin to switch to wxSockAddressImpl implementation // Created: 26/04/1997 // Copyright: (c) 1997, 1998 Guilhem Lavaux // (c) 2008, 2009 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SCKADDR_H_ #define _WX_SCKADDR_H_ #include "wx/defs.h" #if wxUSE_SOCKETS #include "wx/string.h" class wxSockAddressImpl; // forward declare it instead of including the system headers defining it which // can bring in <windows.h> under Windows which we don't want to include from // public wx headers struct sockaddr; // Any socket address kind class WXDLLIMPEXP_NET wxSockAddress : public wxObject { public: enum Family { NONE, IPV4, IPV6, UNIX }; wxSockAddress(); wxSockAddress(const wxSockAddress& other); virtual ~wxSockAddress(); wxSockAddress& operator=(const wxSockAddress& other); virtual void Clear(); virtual Family Type() = 0; // accessors for the low level address represented by this object const sockaddr *GetAddressData() const; int GetAddressDataLen() const; // we need to be able to create copies of the addresses polymorphically // (i.e. without knowing the exact address class) virtual wxSockAddress *Clone() const = 0; // implementation only, don't use const wxSockAddressImpl& GetAddress() const { return *m_impl; } void SetAddress(const wxSockAddressImpl& address); protected: wxSockAddressImpl *m_impl; private: void Init(); wxDECLARE_ABSTRACT_CLASS(wxSockAddress); }; // An IP address (either IPv4 or IPv6) class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress { public: wxIPaddress() : wxSockAddress() { } wxIPaddress(const wxIPaddress& other) : wxSockAddress(other), m_origHostname(other.m_origHostname) { } bool operator==(const wxIPaddress& addr) const; bool Hostname(const wxString& name); bool Service(const wxString& name); bool Service(unsigned short port); bool LocalHost(); virtual bool IsLocalHost() const = 0; bool AnyAddress(); virtual wxString IPAddress() const = 0; wxString Hostname() const; unsigned short Service() const; wxString OrigHostname() const { return m_origHostname; } protected: // get m_impl initialized to the right family if it hadn't been done yet wxSockAddressImpl& GetImpl(); const wxSockAddressImpl& GetImpl() const { return const_cast<wxIPaddress *>(this)->GetImpl(); } // host name originally passed to Hostname() wxString m_origHostname; private: // create the wxSockAddressImpl object of the correct family if it's // currently uninitialized virtual void DoInitImpl() = 0; wxDECLARE_ABSTRACT_CLASS(wxIPaddress); }; // An IPv4 address class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress { public: wxIPV4address() : wxIPaddress() { } wxIPV4address(const wxIPV4address& other) : wxIPaddress(other) { } // implement wxSockAddress pure virtuals: virtual Family Type() wxOVERRIDE { return IPV4; } virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV4address(*this); } // implement wxIPaddress pure virtuals: virtual bool IsLocalHost() const wxOVERRIDE; virtual wxString IPAddress() const wxOVERRIDE; // IPv4-specific methods: bool Hostname(unsigned long addr); // make base class methods hidden by our overload visible using wxIPaddress::Hostname; bool BroadcastAddress(); private: virtual void DoInitImpl() wxOVERRIDE; wxDECLARE_DYNAMIC_CLASS(wxIPV4address); }; #if wxUSE_IPV6 // An IPv6 address class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress { public: wxIPV6address() : wxIPaddress() { } wxIPV6address(const wxIPV6address& other) : wxIPaddress(other) { } // implement wxSockAddress pure virtuals: virtual Family Type() wxOVERRIDE { return IPV6; } virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV6address(*this); } // implement wxIPaddress pure virtuals: virtual bool IsLocalHost() const wxOVERRIDE; virtual wxString IPAddress() const wxOVERRIDE; // IPv6-specific methods: bool Hostname(unsigned char addr[16]); using wxIPaddress::Hostname; private: virtual void DoInitImpl() wxOVERRIDE; wxDECLARE_DYNAMIC_CLASS(wxIPV6address); }; #endif // wxUSE_IPV6 // Unix domain sockets are only available under, well, Unix #if defined(__UNIX__) && !defined(__WINDOWS__) && !defined(__WINE__) #define wxHAS_UNIX_DOMAIN_SOCKETS #endif #ifdef wxHAS_UNIX_DOMAIN_SOCKETS // A Unix domain socket address class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress { public: wxUNIXaddress() : wxSockAddress() { } wxUNIXaddress(const wxUNIXaddress& other) : wxSockAddress(other) { } void Filename(const wxString& name); wxString Filename() const; virtual Family Type() wxOVERRIDE { return UNIX; } virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxUNIXaddress(*this); } private: wxSockAddressImpl& GetUNIX(); const wxSockAddressImpl& GetUNIX() const { return const_cast<wxUNIXaddress *>(this)->GetUNIX(); } wxDECLARE_DYNAMIC_CLASS(wxUNIXaddress); }; #endif // wxHAS_UNIX_DOMAIN_SOCKETS #endif // wxUSE_SOCKETS #endif // _WX_SCKADDR_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/helpbase.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/helpbase.h // Purpose: Help system base classes // Author: Julian Smart // Modified by: // Created: 04/01/98 // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_HELPBASEH__ #define _WX_HELPBASEH__ #include "wx/defs.h" #if wxUSE_HELP #include "wx/object.h" #include "wx/string.h" #include "wx/gdicmn.h" #include "wx/frame.h" // Flags for SetViewer #define wxHELP_NETSCAPE 1 // Search modes: enum wxHelpSearchMode { wxHELP_SEARCH_INDEX, wxHELP_SEARCH_ALL }; // Defines the API for help controllers class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject { public: inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } inline ~wxHelpControllerBase() {} // Must call this to set the filename and server name. // server is only required when implementing TCP/IP-based // help controllers. virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } // Set viewer: only relevant to some kinds of controller virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} // If file is "", reloads file given in Initialize virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; // Displays the contents virtual bool DisplayContents(void) = 0; // Display the given section virtual bool DisplaySection(int sectionNo) = 0; // Display the section using a context id virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; } // Display the text in a popup, if possible virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } // By default, uses KeywordSection to display a topic. Implementations // may override this for more specific behaviour. virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } virtual bool DisplayBlock(long blockNo) = 0; virtual bool KeywordSearch(const wxString& k, wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; /// Allows one to override the default settings for the help frame. virtual void SetFrameParameters(const wxString& WXUNUSED(title), const wxSize& WXUNUSED(size), const wxPoint& WXUNUSED(pos) = wxDefaultPosition, bool WXUNUSED(newFrameEachTime) = false) { // does nothing by default } /// Obtains the latest settings used by the help frame and the help /// frame. virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, wxPoint *WXUNUSED(pos) = NULL, bool *WXUNUSED(newFrameEachTime) = NULL) { return NULL; // does nothing by default } virtual bool Quit() = 0; virtual void OnQuit() {} /// Set the window that can optionally be used for the help window's parent. virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; } /// Get the window that can optionally be used for the help window's parent. virtual wxWindow* GetParentWindow() const { return m_parentWindow; } protected: wxWindow* m_parentWindow; private: wxDECLARE_CLASS(wxHelpControllerBase); }; #endif // wxUSE_HELP #endif // _WX_HELPBASEH__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/statline.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/statline.h // Purpose: wxStaticLine class interface // Author: Vadim Zeitlin // Created: 28.06.99 // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_STATLINE_H_BASE_ #define _WX_STATLINE_H_BASE_ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- // this defines wxUSE_STATLINE #include "wx/defs.h" #if wxUSE_STATLINE // the base class declaration #include "wx/control.h" // ---------------------------------------------------------------------------- // global variables // ---------------------------------------------------------------------------- // the default name for objects of class wxStaticLine extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticLineNameStr[]; // ---------------------------------------------------------------------------- // wxStaticLine - a line in a dialog // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxStaticLineBase : public wxControl { public: // constructor wxStaticLineBase() { } // is the line vertical? bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; } // get the default size for the "lesser" dimension of the static line static int GetDefaultSize() { return 2; } // overridden base class virtuals virtual bool AcceptsFocus() const wxOVERRIDE { return false; } protected: // choose the default border for this window virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // set the right size for the right dimension wxSize AdjustSize(const wxSize& size) const { wxSize sizeReal(size); if ( IsVertical() ) { if ( size.x == wxDefaultCoord ) sizeReal.x = GetDefaultSize(); } else { if ( size.y == wxDefaultCoord ) sizeReal.y = GetDefaultSize(); } return sizeReal; } virtual wxSize DoGetBestSize() const wxOVERRIDE { return AdjustSize(wxDefaultSize); } wxDECLARE_NO_COPY_CLASS(wxStaticLineBase); }; // ---------------------------------------------------------------------------- // now include the actual class declaration // ---------------------------------------------------------------------------- #if defined(__WXUNIVERSAL__) #include "wx/univ/statline.h" #elif defined(__WXMSW__) #include "wx/msw/statline.h" #elif defined(__WXGTK20__) #include "wx/gtk/statline.h" #elif defined(__WXGTK__) #include "wx/gtk1/statline.h" #elif defined(__WXMAC__) #include "wx/osx/statline.h" #elif defined(__WXQT__) #include "wx/qt/statline.h" #else // use generic implementation for all other platforms #include "wx/generic/statline.h" #endif #endif // wxUSE_STATLINE #endif // _WX_STATLINE_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/persist.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/persist.h // Purpose: common classes for persistence support // Author: Vadim Zeitlin // Created: 2009-01-18 // Copyright: (c) 2009 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_PERSIST_H_ #define _WX_PERSIST_H_ #include "wx/string.h" #include "wx/hashmap.h" #include "wx/confbase.h" class wxPersistentObject; WX_DECLARE_VOIDPTR_HASH_MAP(wxPersistentObject *, wxPersistentObjectsMap); // ---------------------------------------------------------------------------- // global functions // ---------------------------------------------------------------------------- /* We do _not_ declare this function as doing this would force us to specialize it for the user classes deriving from the standard persistent classes. However we do define overloads of wxCreatePersistentObject() for all the wx classes which means that template wxPersistentObject::Restore() picks up the right overload to use provided that the header defining the correct overload is included before calling it. And a compilation error happens if this is not done. template <class T> wxPersistentObject *wxCreatePersistentObject(T *obj); */ // ---------------------------------------------------------------------------- // wxPersistenceManager: global aspects of persistent windows // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxPersistenceManager { public: // Call this method to specify a non-default persistence manager to use. // This function should usually be called very early to affect creation of // all persistent controls and the object passed to it must have a lifetime // long enough to be still alive when the persistent controls are destroyed // and need it to save their state so typically this would be a global or a // wxApp member. static void Set(wxPersistenceManager& manager); // accessor to the unique persistence manager object static wxPersistenceManager& Get(); // trivial but virtual dtor virtual ~wxPersistenceManager(); // globally disable restoring or saving the persistent properties (both are // enabled by default) void DisableSaving() { m_doSave = false; } void DisableRestoring() { m_doRestore = false; } // register an object with the manager: when using the first overload, // wxCreatePersistentObject() must be specialized for this object class; // with the second one the persistent adapter is created by the caller // // the object shouldn't be already registered with us template <class T> wxPersistentObject *Register(T *obj) { return Register(obj, wxCreatePersistentObject(obj)); } wxPersistentObject *Register(void *obj, wxPersistentObject *po); // check if the object is registered and return the associated // wxPersistentObject if it is or NULL otherwise wxPersistentObject *Find(void *obj) const; // unregister the object, this is called by wxPersistentObject itself so // there is usually no need to do it explicitly // // deletes the associated wxPersistentObject void Unregister(void *obj); // save/restore the state of an object // // these methods do nothing if DisableSaving/Restoring() was called // // Restore() returns true if the object state was really restored void Save(void *obj); bool Restore(void *obj); // combines both Save() and Unregister() calls void SaveAndUnregister(void *obj) { Save(obj); Unregister(obj); } // combines both Register() and Restore() calls template <class T> bool RegisterAndRestore(T *obj) { return Register(obj) && Restore(obj); } bool RegisterAndRestore(void *obj, wxPersistentObject *po) { return Register(obj, po) && Restore(obj); } // methods used by the persistent objects to save and restore the data // // currently these methods simply use wxConfig::Get() but they may be // overridden in the derived class (once we allow creating custom // persistent managers) #define wxPERSIST_DECLARE_SAVE_RESTORE_FOR(Type) \ virtual bool SaveValue(const wxPersistentObject& who, \ const wxString& name, \ Type value); \ \ virtual bool \ RestoreValue(const wxPersistentObject& who, \ const wxString& name, \ Type *value) wxPERSIST_DECLARE_SAVE_RESTORE_FOR(bool); wxPERSIST_DECLARE_SAVE_RESTORE_FOR(int); wxPERSIST_DECLARE_SAVE_RESTORE_FOR(long); wxPERSIST_DECLARE_SAVE_RESTORE_FOR(wxString); #undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR protected: // ctor is private, use Get() wxPersistenceManager() { m_doSave = m_doRestore = true; } // Return the config object to use, by default just the global one but a // different one could be used by the derived class if needed. virtual wxConfigBase *GetConfig() const { return wxConfigBase::Get(); } // Return the path to use for saving the setting with the given name for // the specified object (notice that the name is the name of the setting, // not the name of the object itself which can be retrieved with GetName()). virtual wxString GetKey(const wxPersistentObject& who, const wxString& name) const; private: // map with the registered objects as keys and associated // wxPersistentObjects as values wxPersistentObjectsMap m_persistentObjects; // true if we should restore/save the settings (it doesn't make much sense // to use this class when both of them are false but setting one of them to // false may make sense in some situations) bool m_doSave, m_doRestore; wxDECLARE_NO_COPY_CLASS(wxPersistenceManager); }; // ---------------------------------------------------------------------------- // wxPersistentObject: ABC for anything persistent // ---------------------------------------------------------------------------- class wxPersistentObject { public: // ctor associates us with the object whose options we save/restore wxPersistentObject(void *obj) : m_obj(obj) { } // trivial but virtual dtor virtual ~wxPersistentObject() { } // methods used by wxPersistenceManager // ------------------------------------ // save/restore the corresponding objects settings // // these methods shouldn't be used directly as they don't respect the // global wxPersistenceManager::DisableSaving/Restoring() settings, use // wxPersistenceManager methods with the same name instead virtual void Save() const = 0; virtual bool Restore() = 0; // get the kind of the objects we correspond to, e.g. "Frame" virtual wxString GetKind() const = 0; // get the name of the object we correspond to, e.g. "Main" virtual wxString GetName() const = 0; // return the associated object void *GetObject() const { return m_obj; } protected: // wrappers for wxPersistenceManager methods which don't require passing // "this" as the first parameter all the time template <typename T> bool SaveValue(const wxString& name, T value) const { return wxPersistenceManager::Get().SaveValue(*this, name, value); } template <typename T> bool RestoreValue(const wxString& name, T *value) { return wxPersistenceManager::Get().RestoreValue(*this, name, value); } private: void * const m_obj; wxDECLARE_NO_COPY_CLASS(wxPersistentObject); }; // Helper function calling RegisterAndRestore() on the global persistence // manager object. template <typename T> inline bool wxPersistentRegisterAndRestore(T *obj) { wxPersistentObject * const pers = wxCreatePersistentObject(obj); return wxPersistenceManager::Get().RegisterAndRestore(obj, pers); } // A helper function which also sets the name for the (wxWindow-derived) object // before registering and restoring it. template <typename T> inline bool wxPersistentRegisterAndRestore(T *obj, const wxString& name) { obj->SetName(name); return wxPersistentRegisterAndRestore(obj); } #endif // _WX_PERSIST_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fmappriv.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/fmappriv.h // Purpose: private wxFontMapper stuff, not to be used by the library users // Author: Vadim Zeitlin // Modified by: // Created: 21.06.2003 (extracted from common/fontmap.cpp) // Copyright: (c) 1999-2003 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_FMAPPRIV_H_ #define _WX_FMAPPRIV_H_ // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // a special pseudo encoding which means "don't ask me about this charset // any more" -- we need it to avoid driving the user crazy with asking him // time after time about the same charset which he [presumably] doesn't // have the fonts for enum { wxFONTENCODING_UNKNOWN = -2 }; // the config paths we use #if wxUSE_CONFIG #define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper") #define FONTMAPPER_CHARSET_PATH wxT("Charsets") #define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases") #endif // wxUSE_CONFIG // ---------------------------------------------------------------------------- // wxFontMapperPathChanger: change the config path during our lifetime // ---------------------------------------------------------------------------- #if wxUSE_CONFIG && wxUSE_FILECONFIG class wxFontMapperPathChanger { public: wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path) { m_fontMapper = fontMapper; m_ok = m_fontMapper->ChangePath(path, &m_pathOld); } bool IsOk() const { return m_ok; } ~wxFontMapperPathChanger() { if ( IsOk() ) m_fontMapper->RestorePath(m_pathOld); } private: // the fontmapper object we're working with wxFontMapperBase *m_fontMapper; // the old path to be restored if m_ok wxString m_pathOld; // have we changed the path successfully? bool m_ok; wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger); }; #endif // wxUSE_CONFIG #endif // _WX_FMAPPRIV_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/typeinfo.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/typeinfo.h // Purpose: wxTypeId implementation // Author: Jaakko Salli // Created: 2009-11-19 // Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_TYPEINFO_H_ #define _WX_TYPEINFO_H_ // // This file defines wxTypeId macro that should be used internally in // wxWidgets instead of typeid(), for compatibility with builds that do // not implement C++ RTTI. Also, type defining macros in this file are // intended for internal use only at this time and may change in future // versions. // // The reason why we need this simple RTTI system in addition to the older // wxObject-based one is that the latter does not work in template // classes. // #include "wx/defs.h" #ifndef wxNO_RTTI // // Let's trust that Visual C++ versions 9.0 and later implement C++ // RTTI well enough, so we can use it and work around harmless memory // leaks reported by the static run-time libraries. // #if wxCHECK_VISUALC_VERSION(9) #define wxTRUST_CPP_RTTI 1 #else #define wxTRUST_CPP_RTTI 0 #endif #include <typeinfo> #include <string.h> #define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) #define WX_DECLARE_TYPEINFO_INLINE(CLS) #define WX_DECLARE_TYPEINFO(CLS) #define WX_DEFINE_TYPEINFO(CLS) #define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) #if wxTRUST_CPP_RTTI #define wxTypeId typeid #else /* !wxTRUST_CPP_RTTI */ // // For improved type-safety, let's make the check using class name // comparison. Most modern compilers already do this, but we cannot // rely on all supported compilers to work this well. However, in // cases where we'd know that typeid() would be flawless (as such), // wxTypeId could of course simply be defined as typeid. // class wxTypeIdentifier { public: wxTypeIdentifier(const char* className) { m_className = className; } bool operator==(const wxTypeIdentifier& other) const { return strcmp(m_className, other.m_className) == 0; } bool operator!=(const wxTypeIdentifier& other) const { return !(*this == other); } private: const char* m_className; }; #define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name()) #endif /* wxTRUST_CPP_RTTI/!wxTRUST_CPP_RTTI */ #else // if !wxNO_RTTI #define wxTRUST_CPP_RTTI 0 // // When C++ RTTI is not available, we will have to make the type comparison // using pointer to a dummy static member function. This will fail if // declared type is used across DLL boundaries, although using // WX_DECLARE_TYPEINFO() and WX_DEFINE_TYPEINFO() pair instead of // WX_DECLARE_TYPEINFO_INLINE() should fix this. However, that approach is // usually not possible when type info needs to be declared for a template // class. // typedef void (*wxTypeIdentifier)(); // Use this macro to declare type info with specified static function // IDENTFUNC used as type identifier. Usually you should only use // WX_DECLARE_TYPEINFO() or WX_DECLARE_TYPEINFO_INLINE() however. #define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) \ public: \ virtual wxTypeIdentifier GetWxTypeId() const \ { \ return reinterpret_cast<wxTypeIdentifier> \ (&IDENTFUNC); \ } // Use this macro to declare type info with externally specified // type identifier, defined with WX_DEFINE_TYPEINFO(). #define WX_DECLARE_TYPEINFO(CLS) \ private: \ static CLS sm_wxClassInfo(); \ _WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo) // Use this macro to implement type identifier function required by // WX_DECLARE_TYPEINFO(). // NOTE: CLS is required to have default ctor. If it doesn't // already, you should provide a private dummy one. #define WX_DEFINE_TYPEINFO(CLS) \ CLS CLS::sm_wxClassInfo() { return CLS(); } // Use this macro to declare type info fully inline in class. // NOTE: CLS is required to have default ctor. If it doesn't // already, you should provide a private dummy one. #define WX_DECLARE_TYPEINFO_INLINE(CLS) \ private: \ static CLS sm_wxClassInfo() { return CLS(); } \ _WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo) #define wxTypeId(OBJ) (OBJ).GetWxTypeId() // Because abstract classes cannot be instantiated, we use // this macro to define pure virtual type interface for them. #define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) \ public: \ virtual wxTypeIdentifier GetWxTypeId() const = 0; #endif // wxNO_RTTI/!wxNO_RTTI #endif // _WX_TYPEINFO_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/dvrenderers.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/dvrenderers.h // Purpose: Declare all wxDataViewCtrl classes // Author: Robert Roebling, Vadim Zeitlin // Created: 2009-11-08 (extracted from wx/dataview.h) // Copyright: (c) 2006 Robert Roebling // (c) 2009 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_DVRENDERERS_H_ #define _WX_DVRENDERERS_H_ /* Note about the structure of various headers: they're organized in a more complicated way than usual because of the various dependencies which are different for different ports. In any case the only public header, i.e. the one which can be included directly is wx/dataview.h. It, in turn, includes this one to define all the renderer classes. We define the base wxDataViewRendererBase class first and then include a port-dependent wx/xxx/dvrenderer.h which defines wxDataViewRenderer itself. After this we can define wxDataViewRendererCustomBase (and maybe in the future base classes for other renderers if the need arises, i.e. if there is any non-trivial code or API which it makes sense to keep in common code) and include wx/xxx/dvrenderers.h (notice the plural) which defines all the rest of the renderer classes. */ class WXDLLIMPEXP_FWD_CORE wxDataViewCustomRenderer; // ---------------------------------------------------------------------------- // wxDataViewIconText: helper class used by wxDataViewIconTextRenderer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewIconText : public wxObject { public: wxDataViewIconText( const wxString &text = wxEmptyString, const wxIcon& icon = wxNullIcon ) : m_text(text), m_icon(icon) { } wxDataViewIconText( const wxDataViewIconText &other ) : wxObject(), m_text(other.m_text), m_icon(other.m_icon) { } void SetText( const wxString &text ) { m_text = text; } wxString GetText() const { return m_text; } void SetIcon( const wxIcon &icon ) { m_icon = icon; } const wxIcon &GetIcon() const { return m_icon; } bool IsSameAs(const wxDataViewIconText& other) const { return m_text == other.m_text && m_icon.IsSameAs(other.m_icon); } bool operator==(const wxDataViewIconText& other) const { return IsSameAs(other); } bool operator!=(const wxDataViewIconText& other) const { return !IsSameAs(other); } private: wxString m_text; wxIcon m_icon; wxDECLARE_DYNAMIC_CLASS(wxDataViewIconText); }; DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_CORE) // ---------------------------------------------------------------------------- // wxDataViewCheckIconText: value class used by wxDataViewCheckIconTextRenderer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewCheckIconText : public wxDataViewIconText { public: wxDataViewCheckIconText(const wxString& text = wxString(), const wxIcon& icon = wxNullIcon, wxCheckBoxState checkedState = wxCHK_UNDETERMINED) : wxDataViewIconText(text, icon), m_checkedState(checkedState) { } wxCheckBoxState GetCheckedState() const { return m_checkedState; } void SetCheckedState(wxCheckBoxState state) { m_checkedState = state; } private: wxCheckBoxState m_checkedState; wxDECLARE_DYNAMIC_CLASS(wxDataViewCheckIconText); }; DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_CORE) // ---------------------------------------------------------------------------- // wxDataViewRendererBase // ---------------------------------------------------------------------------- enum wxDataViewCellMode { wxDATAVIEW_CELL_INERT, wxDATAVIEW_CELL_ACTIVATABLE, wxDATAVIEW_CELL_EDITABLE }; enum wxDataViewCellRenderState { wxDATAVIEW_CELL_SELECTED = 1, wxDATAVIEW_CELL_PRELIT = 2, wxDATAVIEW_CELL_INSENSITIVE = 4, wxDATAVIEW_CELL_FOCUSED = 8 }; // helper for fine-tuning rendering of values depending on row's state class WXDLLIMPEXP_CORE wxDataViewValueAdjuster { public: virtual ~wxDataViewValueAdjuster() {} // changes the value to have appearance suitable for highlighted rows virtual wxVariant MakeHighlighted(const wxVariant& value) const { return value; } }; class WXDLLIMPEXP_CORE wxDataViewRendererBase: public wxObject { public: wxDataViewRendererBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int alignment = wxDVR_DEFAULT_ALIGNMENT ); virtual ~wxDataViewRendererBase(); virtual bool Validate( wxVariant& WXUNUSED(value) ) { return true; } void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } wxDataViewColumn* GetOwner() const { return m_owner; } // renderer value and attributes: SetValue() and SetAttr() are called // before a cell is rendered using this renderer virtual bool SetValue(const wxVariant& value) = 0; virtual bool GetValue(wxVariant& value) const = 0; #if wxUSE_ACCESSIBILITY virtual wxString GetAccessibleDescription() const = 0; #endif // wxUSE_ACCESSIBILITY wxString GetVariantType() const { return m_variantType; } // Prepare for rendering the value of the corresponding item in the given // column taken from the provided non-null model. // // Notice that the column must be the same as GetOwner()->GetModelColumn(), // it is only passed to this method because the existing code already has // it and should probably be removed in the future. // // Return true if this cell is non-empty or false otherwise (and also if // the model returned a value of the wrong, i.e. different from our // GetVariantType(), type, in which case a debug error is also logged). bool PrepareForItem(const wxDataViewModel *model, const wxDataViewItem& item, unsigned column); // renderer properties: virtual void SetMode( wxDataViewCellMode mode ) = 0; virtual wxDataViewCellMode GetMode() const = 0; // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but // rather an "int"; that's because for rendering cells it's allowed // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM) virtual void SetAlignment( int align ) = 0; virtual int GetAlignment() const = 0; // enable or disable (if called with wxELLIPSIZE_NONE) replacing parts of // the item text (hence this only makes sense for renderers showing // text...) with ellipsis in order to make it fit the column width virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) = 0; void DisableEllipsize() { EnableEllipsize(wxELLIPSIZE_NONE); } virtual wxEllipsizeMode GetEllipsizeMode() const = 0; // in-place editing virtual bool HasEditorCtrl() const { return false; } virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent), wxRect WXUNUSED(labelRect), const wxVariant& WXUNUSED(value)) { return NULL; } virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor), wxVariant& WXUNUSED(value)) { return false; } virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect ); virtual void CancelEditing(); virtual bool FinishEditing(); wxWindow *GetEditorCtrl() const { return m_editorCtrl; } virtual bool IsCustomRenderer() const { return false; } // Implementation only from now on. // Return the alignment of this renderer if it's specified (i.e. has value // different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of // the column it is used for otherwise. // // Unlike GetAlignment(), this always returns a valid combination of // wxALIGN_XXX flags (although possibly wxALIGN_NOT) and never returns // wxDVR_DEFAULT_ALIGNMENT. int GetEffectiveAlignment() const; // Like GetEffectiveAlignment(), but returns wxDVR_DEFAULT_ALIGNMENT if // the owner isn't set and GetAlignment() is default. int GetEffectiveAlignmentIfKnown() const; // Send wxEVT_DATAVIEW_ITEM_EDITING_STARTED event. void NotifyEditingStarted(const wxDataViewItem& item); // Sets the transformer for fine-tuning rendering of values depending on row's state void SetValueAdjuster(wxDataViewValueAdjuster *transformer) { delete m_valueAdjuster; m_valueAdjuster = transformer; } protected: // These methods are called from PrepareForItem() and should do whatever is // needed for the current platform to ensure that the item is rendered // using the given attributes and enabled/disabled state. virtual void SetAttr(const wxDataViewItemAttr& attr) = 0; virtual void SetEnabled(bool enabled) = 0; // Return whether the currently rendered item is on a highlighted row // (typically selection with dark background). For internal use only. virtual bool IsHighlighted() const = 0; // Helper of PrepareForItem() also used in StartEditing(): returns the // value checking that its type matches our GetVariantType(). wxVariant CheckedGetValue(const wxDataViewModel* model, const wxDataViewItem& item, unsigned column) const; // Validates the given value (if it is non-null) and sends (in any case) // ITEM_EDITING_DONE event and, finally, updates the model with the value // (f it is valid, of course) if the event wasn't vetoed. bool DoHandleEditingDone(wxVariant* value); wxString m_variantType; wxDataViewColumn *m_owner; wxWeakRef<wxWindow> m_editorCtrl; wxDataViewItem m_item; // Item being currently edited, if valid. wxDataViewValueAdjuster *m_valueAdjuster; // internal utility, may be used anywhere the window associated with the // renderer is required wxDataViewCtrl* GetView() const; private: // Called from {Called,Finish}Editing() and dtor to cleanup m_editorCtrl void DestroyEditControl(); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase); }; // include the real wxDataViewRenderer declaration for the native ports #ifdef wxHAS_GENERIC_DATAVIEWCTRL // in the generic implementation there is no real wxDataViewRenderer, all // renderers are custom so it's the same as wxDataViewCustomRenderer and // wxDataViewCustomRendererBase derives from wxDataViewRendererBase directly // // this is a rather ugly hack but unfortunately it just doesn't seem to be // possible to have the same class hierarchy in all ports and avoid // duplicating the entire wxDataViewCustomRendererBase in the generic // wxDataViewRenderer class (well, we could use a mix-in but this would // make classes hierarchy non linear and arguably even more complex) #define wxDataViewCustomRendererRealBase wxDataViewRendererBase #else #if defined(__WXGTK20__) #include "wx/gtk/dvrenderer.h" #elif defined(__WXMAC__) #include "wx/osx/dvrenderer.h" #elif defined(__WXQT__) #include "wx/qt/dvrenderer.h" #else #error "unknown native wxDataViewCtrl implementation" #endif #define wxDataViewCustomRendererRealBase wxDataViewRenderer #endif // ---------------------------------------------------------------------------- // wxDataViewCustomRendererBase // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewCustomRendererBase : public wxDataViewCustomRendererRealBase { public: // Constructor must specify the usual renderer parameters which we simply // pass to the base class wxDataViewCustomRendererBase(const wxString& varianttype = "string", wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT) : wxDataViewCustomRendererRealBase(varianttype, mode, align) { } // Render the item using the current value (returned by GetValue()). virtual bool Render(wxRect cell, wxDC *dc, int state) = 0; // Return the size of the item appropriate to its current value. virtual wxSize GetSize() const = 0; // Define virtual function which are called when a key is pressed on the // item, clicked or the user starts to drag it: by default they all simply // return false indicating that the events are not handled virtual bool ActivateCell(const wxRect& cell, wxDataViewModel *model, const wxDataViewItem & item, unsigned int col, const wxMouseEvent* mouseEvent); // Deprecated, use (and override) ActivateCell() instead wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( virtual bool Activate(wxRect WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), const wxDataViewItem & WXUNUSED(item), unsigned int WXUNUSED(col)), return false; ) // Deprecated, use (and override) ActivateCell() instead wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( virtual bool LeftClick(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), const wxDataViewItem & WXUNUSED(item), unsigned int WXUNUSED(col)), return false; ) virtual bool StartDrag(const wxPoint& WXUNUSED(cursor), const wxRect& WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), const wxDataViewItem & WXUNUSED(item), unsigned int WXUNUSED(col) ) { return false; } // Helper which can be used by Render() implementation in the derived // classes: it will draw the text in the same manner as the standard // renderers do. virtual void RenderText(const wxString& text, int xoffset, wxRect cell, wxDC *dc, int state); // Override the base class virtual method to simply store the attribute so // that it can be accessed using GetAttr() from Render() if needed. virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE { m_attr = attr; } const wxDataViewItemAttr& GetAttr() const { return m_attr; } // Store the enabled state of the item so that it can be accessed from // Render() via GetEnabled() if needed. virtual void SetEnabled(bool enabled) wxOVERRIDE; bool GetEnabled() const { return m_enabled; } // Implementation only from now on // Retrieve the DC to use for drawing. This is implemented in derived // platform-specific classes. virtual wxDC *GetDC() = 0; // To draw background use the background colour in wxDataViewItemAttr virtual void RenderBackground(wxDC* dc, const wxRect& rect); // Prepare DC to use attributes and call Render(). void WXCallRender(wxRect rect, wxDC *dc, int state); virtual bool IsCustomRenderer() const wxOVERRIDE { return true; } protected: // helper for GetSize() implementations, respects attributes wxSize GetTextExtent(const wxString& str) const; private: wxDataViewItemAttr m_attr; bool m_enabled; wxDECLARE_NO_COPY_CLASS(wxDataViewCustomRendererBase); }; // include the declaration of all the other renderers to get the real // wxDataViewCustomRenderer from which we need to inherit below #ifdef wxHAS_GENERIC_DATAVIEWCTRL // because of the different renderer classes hierarchy in the generic // version, as explained above, we can include the header defining // wxDataViewRenderer only here and not before wxDataViewCustomRendererBase // declaration as for the native ports #include "wx/generic/dvrenderer.h" #include "wx/generic/dvrenderers.h" #elif defined(__WXGTK20__) #include "wx/gtk/dvrenderers.h" #elif defined(__WXMAC__) #include "wx/osx/dvrenderers.h" #elif defined(__WXQT__) #include "wx/qt/dvrenderers.h" #else #error "unknown native wxDataViewCtrl implementation" #endif #if wxUSE_SPINCTRL // ---------------------------------------------------------------------------- // wxDataViewSpinRenderer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewSpinRenderer: public wxDataViewCustomRenderer { public: wxDataViewSpinRenderer( int min, int max, wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; virtual wxSize GetSize() const wxOVERRIDE; virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; #if wxUSE_ACCESSIBILITY virtual wxString GetAccessibleDescription() const wxOVERRIDE; #endif // wxUSE_ACCESSIBILITY private: long m_data; long m_min,m_max; }; #endif // wxUSE_SPINCTRL #if defined(wxHAS_GENERIC_DATAVIEWCTRL) // ---------------------------------------------------------------------------- // wxDataViewChoiceRenderer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewChoiceRenderer: public wxDataViewCustomRenderer { public: wxDataViewChoiceRenderer( const wxArrayString &choices, wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; virtual wxSize GetSize() const wxOVERRIDE; virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; #if wxUSE_ACCESSIBILITY virtual wxString GetAccessibleDescription() const wxOVERRIDE; #endif // wxUSE_ACCESSIBILITY wxString GetChoice(size_t index) const { return m_choices[index]; } const wxArrayString& GetChoices() const { return m_choices; } private: wxArrayString m_choices; wxString m_data; }; // ---------------------------------------------------------------------------- // wxDataViewChoiceByIndexRenderer // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer { public: wxDataViewChoiceByIndexRenderer( const wxArrayString &choices, wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; #if wxUSE_ACCESSIBILITY virtual wxString GetAccessibleDescription() const wxOVERRIDE; #endif // wxUSE_ACCESSIBILITY }; #endif // generic version #if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__) // ---------------------------------------------------------------------------- // wxDataViewDateRenderer // ---------------------------------------------------------------------------- #if wxUSE_DATEPICKCTRL class WXDLLIMPEXP_CORE wxDataViewDateRenderer: public wxDataViewCustomRenderer { public: static wxString GetDefaultType() { return wxS("datetime"); } wxDataViewDateRenderer(const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int align = wxDVR_DEFAULT_ALIGNMENT); virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value) wxOVERRIDE; virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value) wxOVERRIDE; virtual bool SetValue(const wxVariant &value) wxOVERRIDE; virtual bool GetValue(wxVariant& value) const wxOVERRIDE; #if wxUSE_ACCESSIBILITY virtual wxString GetAccessibleDescription() const wxOVERRIDE; #endif // wxUSE_ACCESSIBILITY virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; virtual wxSize GetSize() const wxOVERRIDE; private: wxDateTime m_date; }; #else // !wxUSE_DATEPICKCTRL typedef wxDataViewTextRenderer wxDataViewDateRenderer; #endif #endif // generic or GTK+ versions // ---------------------------------------------------------------------------- // wxDataViewCheckIconTextRenderer: 3-state checkbox + text + optional icon // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer : public wxDataViewCustomRenderer { public: static wxString GetDefaultType() { return wxS("wxDataViewCheckIconText"); } explicit wxDataViewCheckIconTextRenderer ( wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int align = wxDVR_DEFAULT_ALIGNMENT ); // This renderer can always display the 3rd ("indeterminate") checkbox // state if the model contains cells with wxCHK_UNDETERMINED value, but it // doesn't allow the user to set it by default. Call this method to allow // this to happen. void Allow3rdStateForUser(bool allow = true); virtual bool SetValue(const wxVariant& value) wxOVERRIDE; virtual bool GetValue(wxVariant& value) const wxOVERRIDE; #if wxUSE_ACCESSIBILITY virtual wxString GetAccessibleDescription() const wxOVERRIDE; #endif // wxUSE_ACCESSIBILITY virtual wxSize GetSize() const wxOVERRIDE; virtual bool Render(wxRect cell, wxDC* dc, int state) wxOVERRIDE; virtual bool ActivateCell(const wxRect& cell, wxDataViewModel *model, const wxDataViewItem & item, unsigned int col, const wxMouseEvent *mouseEvent) wxOVERRIDE; private: wxSize GetCheckSize() const; // Just some arbitrary constants defining margins, in pixels. enum { MARGIN_CHECK_ICON = 3, MARGIN_ICON_TEXT = 4 }; wxDataViewCheckIconText m_value; bool m_allow3rdStateForUser; wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer); }; // this class is obsolete, its functionality was merged in // wxDataViewTextRenderer itself now, don't use it any more #define wxDataViewTextRendererAttr wxDataViewTextRenderer #endif // _WX_DVRENDERERS_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/splash.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/splash.h // Purpose: Base header for wxSplashScreen // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SPLASH_H_BASE_ #define _WX_SPLASH_H_BASE_ #include "wx/generic/splash.h" #endif // _WX_SPLASH_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/cmdproc.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/cmdproc.h // Purpose: undo/redo capable command processing framework // Author: Julian Smart (extracted from docview.h by VZ) // Modified by: // Created: 05.11.00 // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_CMDPROC_H_ #define _WX_CMDPROC_H_ #include "wx/defs.h" #include "wx/object.h" #include "wx/list.h" class WXDLLIMPEXP_FWD_CORE wxMenu; // ---------------------------------------------------------------------------- // wxCommand: a single command capable of performing itself // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxCommand : public wxObject { public: wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString); virtual ~wxCommand(){} // Override this to perform a command virtual bool Do() = 0; // Override this to undo a command virtual bool Undo() = 0; virtual bool CanUndo() const { return m_canUndo; } virtual wxString GetName() const { return m_commandName; } protected: bool m_canUndo; wxString m_commandName; private: wxDECLARE_CLASS(wxCommand); }; // ---------------------------------------------------------------------------- // wxCommandProcessor: wxCommand manager // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxCommandProcessor : public wxObject { public: // if max number of commands is -1, it is unlimited wxCommandProcessor(int maxCommands = -1); virtual ~wxCommandProcessor(); // Pass a command to the processor. The processor calls Do(); if // successful, is appended to the command history unless storeIt is false. virtual bool Submit(wxCommand *command, bool storeIt = true); // just store the command without executing it virtual void Store(wxCommand *command); virtual bool Undo(); virtual bool Redo(); virtual bool CanUndo() const; virtual bool CanRedo() const; // Initialises the current command and menu strings. virtual void Initialize(); // Sets the Undo/Redo menu strings for the current menu. virtual void SetMenuStrings(); // Gets the current Undo menu label. wxString GetUndoMenuLabel() const; // Gets the current Undo menu label. wxString GetRedoMenuLabel() const; #if wxUSE_MENUS // Call this to manage an edit menu. void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; } wxMenu *GetEditMenu() const { return m_commandEditMenu; } #endif // wxUSE_MENUS // command list access wxList& GetCommands() { return m_commands; } const wxList& GetCommands() const { return m_commands; } wxCommand *GetCurrentCommand() const { return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL); } int GetMaxCommands() const { return m_maxNoCommands; } virtual void ClearCommands(); // Has the current project been changed? virtual bool IsDirty() const; // Mark the current command as the one where the last save took place void MarkAsSaved() { m_lastSavedCommand = m_currentCommand; } // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y" const wxString& GetUndoAccelerator() const { return m_undoAccelerator; } const wxString& GetRedoAccelerator() const { return m_redoAccelerator; } void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; } void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; } protected: // for further flexibility, command processor doesn't call wxCommand::Do() // and Undo() directly but uses these functions which can be overridden in // the derived class virtual bool DoCommand(wxCommand& cmd); virtual bool UndoCommand(wxCommand& cmd); int m_maxNoCommands; wxList m_commands; wxList::compatibility_iterator m_currentCommand, m_lastSavedCommand; #if wxUSE_MENUS wxMenu* m_commandEditMenu; #endif // wxUSE_MENUS wxString m_undoAccelerator; wxString m_redoAccelerator; private: wxDECLARE_DYNAMIC_CLASS(wxCommandProcessor); wxDECLARE_NO_COPY_CLASS(wxCommandProcessor); }; #endif // _WX_CMDPROC_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/string.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/string.h // Purpose: wxString class // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 // Copyright: (c) 1998 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// /* Efficient string class [more or less] compatible with MFC CString, wxWidgets version 1 wxString and std::string and some handy functions missing from string.h. */ #ifndef _WX_WXSTRING_H__ #define _WX_WXSTRING_H__ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/defs.h" // everybody should include this #if defined(__WXMAC__) #include <ctype.h> #endif #include <string.h> #include <stdio.h> #include <stdarg.h> #include <limits.h> #include <stdlib.h> #include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc. #include "wx/strvararg.h" #include "wx/buffer.h" // for wxCharBuffer #include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes #include "wx/stringimpl.h" #include "wx/stringops.h" #include "wx/unichar.h" // by default we cache the mapping of the positions in UTF-8 string to the byte // offset as this results in noticeable performance improvements for loops over // strings using indices; comment out this line to disable this // // notice that this optimization is well worth using even in debug builds as it // changes asymptotic complexity of algorithms using indices to iterate over // wxString back to expected linear from quadratic // // also notice that wxTLS_TYPE() (__declspec(thread) in this case) is unsafe to // use in DLL build under pre-Vista Windows so we disable this code for now, if // anybody really needs to use UTF-8 build under Windows with this optimization // it would have to be re-tested and probably corrected // CS: under OSX release builds the string destructor/cache cleanup sometimes // crashes, disable until we find the true reason or a better workaround #if wxUSE_UNICODE_UTF8 && !defined(__WINDOWS__) && !defined(__WXOSX__) #define wxUSE_STRING_POS_CACHE 1 #else #define wxUSE_STRING_POS_CACHE 0 #endif #if wxUSE_STRING_POS_CACHE #include "wx/tls.h" // change this 0 to 1 to enable additional (very expensive) asserts // verifying that string caching logic works as expected #if 0 #define wxSTRING_CACHE_ASSERT(cond) wxASSERT(cond) #else #define wxSTRING_CACHE_ASSERT(cond) #endif #endif // wxUSE_STRING_POS_CACHE class WXDLLIMPEXP_FWD_BASE wxString; // unless this symbol is predefined to disable the compatibility functions, do // use them #ifndef WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER #define WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER 1 #endif namespace wxPrivate { template <typename T> struct wxStringAsBufHelper; } // --------------------------------------------------------------------------- // macros // --------------------------------------------------------------------------- // These macros are not used by wxWidgets itself any longer and are only // preserved for compatibility with the user code that might be still using // them. Do _not_ use them in the new code, just use const_cast<> instead. #define WXSTRINGCAST (wxChar *)(const wxChar *) #define wxCSTRINGCAST (wxChar *)(const wxChar *) #define wxMBSTRINGCAST (char *)(const char *) #define wxWCSTRINGCAST (wchar_t *)(const wchar_t *) // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // --------------------------------------------------------------------------- // global functions complementing standard C string library replacements for // strlen() and portable strcasecmp() //--------------------------------------------------------------------------- #if WXWIN_COMPATIBILITY_2_8 // Use wxXXX() functions from wxcrt.h instead! These functions are for // backwards compatibility only. // checks whether the passed in pointer is NULL and if the string is empty wxDEPRECATED_MSG("use wxIsEmpty() instead") inline bool IsEmpty(const char *p) { return (!p || !*p); } // safe version of strlen() (returns 0 if passed NULL pointer) wxDEPRECATED_MSG("use wxStrlen() instead") inline size_t Strlen(const char *psz) { return psz ? strlen(psz) : 0; } // portable strcasecmp/_stricmp wxDEPRECATED_MSG("use wxStricmp() instead") inline int Stricmp(const char *psz1, const char *psz2) { return wxCRT_StricmpA(psz1, psz2); } #endif // WXWIN_COMPATIBILITY_2_8 // ---------------------------------------------------------------------------- // wxCStrData // ---------------------------------------------------------------------------- // Lightweight object returned by wxString::c_str() and implicitly convertible // to either const char* or const wchar_t*. class wxCStrData { private: // Ctors; for internal use by wxString and wxCStrData only wxCStrData(const wxString *str, size_t offset = 0, bool owned = false) : m_str(str), m_offset(offset), m_owned(owned) {} public: // Ctor constructs the object from char literal; they are needed to make // operator?: compile and they intentionally take char*, not const char* inline wxCStrData(char *buf); inline wxCStrData(wchar_t *buf); inline wxCStrData(const wxCStrData& data); inline ~wxCStrData(); // AsWChar() and AsChar() can't be defined here as they use wxString and so // must come after it and because of this won't be inlined when called from // wxString methods (without a lot of work to extract these wxString methods // from inside the class itself). But we still define them being inline // below to let compiler inline them from elsewhere. And because of this we // must declare them as inline here because otherwise some compilers give // warnings about them, e.g. mingw32 3.4.5 warns about "<symbol> defined // locally after being referenced with dllimport linkage" while IRIX // mipsPro 7.4 warns about "function declared inline after being called". inline const wchar_t* AsWChar() const; operator const wchar_t*() const { return AsWChar(); } inline const char* AsChar() const; const unsigned char* AsUnsignedChar() const { return (const unsigned char *) AsChar(); } operator const char*() const { return AsChar(); } operator const unsigned char*() const { return AsUnsignedChar(); } operator const void*() const { return AsChar(); } // returns buffers that are valid as long as the associated wxString exists const wxScopedCharBuffer AsCharBuf() const { return wxScopedCharBuffer::CreateNonOwned(AsChar()); } const wxScopedWCharBuffer AsWCharBuf() const { return wxScopedWCharBuffer::CreateNonOwned(AsWChar()); } inline wxString AsString() const; // returns the value as C string in internal representation (equivalent // to AsString().wx_str(), but more efficient) const wxStringCharType *AsInternal() const; // allow expressions like "c_str()[0]": inline wxUniChar operator[](size_t n) const; wxUniChar operator[](int n) const { return operator[](size_t(n)); } wxUniChar operator[](long n) const { return operator[](size_t(n)); } #ifndef wxSIZE_T_IS_UINT wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); } #endif // size_t != unsigned int // These operators are needed to emulate the pointer semantics of c_str(): // expressions like "wxChar *p = str.c_str() + 1;" should continue to work // (we need both versions to resolve ambiguities). Note that this means // the 'n' value is interpreted as addition to char*/wchar_t* pointer, it // is *not* number of Unicode characters in wxString. wxCStrData operator+(int n) const { return wxCStrData(m_str, m_offset + n, m_owned); } wxCStrData operator+(long n) const { return wxCStrData(m_str, m_offset + n, m_owned); } wxCStrData operator+(size_t n) const { return wxCStrData(m_str, m_offset + n, m_owned); } // and these for "str.c_str() + (p2 - p1)" (it also works for any integer // expression but it must be ptrdiff_t and not e.g. int to work in this // example): wxCStrData operator-(ptrdiff_t n) const { wxASSERT_MSG( n <= (ptrdiff_t)m_offset, wxT("attempt to construct address before the beginning of the string") ); return wxCStrData(m_str, m_offset - n, m_owned); } // this operator is needed to make expressions like "*c_str()" or // "*(c_str() + 2)" work inline wxUniChar operator*() const; private: // the wxString this object was returned for const wxString *m_str; // Offset into c_str() return value. Note that this is *not* offset in // m_str in Unicode characters. Instead, it is index into the // char*/wchar_t* buffer returned by c_str(). It's interpretation depends // on how is the wxCStrData instance used: if it is eventually cast to // const char*, m_offset will be in bytes form string's start; if it is // cast to const wchar_t*, it will be in wchar_t values. size_t m_offset; // should m_str be deleted, i.e. is it owned by us? bool m_owned; friend class WXDLLIMPEXP_FWD_BASE wxString; }; // ---------------------------------------------------------------------------- // wxString: string class trying to be compatible with std::string, MFC // CString and wxWindows 1.x wxString all at once // --------------------------------------------------------------------------- #if wxUSE_UNICODE_UTF8 // see the comment near wxString::iterator for why we need this class WXDLLIMPEXP_BASE wxStringIteratorNode { public: wxStringIteratorNode() : m_str(NULL), m_citer(NULL), m_iter(NULL), m_prev(NULL), m_next(NULL) {} wxStringIteratorNode(const wxString *str, wxStringImpl::const_iterator *citer) { DoSet(str, citer, NULL); } wxStringIteratorNode(const wxString *str, wxStringImpl::iterator *iter) { DoSet(str, NULL, iter); } ~wxStringIteratorNode() { clear(); } inline void set(const wxString *str, wxStringImpl::const_iterator *citer) { clear(); DoSet(str, citer, NULL); } inline void set(const wxString *str, wxStringImpl::iterator *iter) { clear(); DoSet(str, NULL, iter); } const wxString *m_str; wxStringImpl::const_iterator *m_citer; wxStringImpl::iterator *m_iter; wxStringIteratorNode *m_prev, *m_next; private: inline void clear(); inline void DoSet(const wxString *str, wxStringImpl::const_iterator *citer, wxStringImpl::iterator *iter); // the node belongs to a particular iterator instance, it's not copied // when a copy of the iterator is made wxDECLARE_NO_COPY_CLASS(wxStringIteratorNode); }; #endif // wxUSE_UNICODE_UTF8 class WXDLLIMPEXP_BASE wxString { // NB: special care was taken in arranging the member functions in such order // that all inline functions can be effectively inlined, verify that all // performance critical functions are still inlined if you change order! public: // an 'invalid' value for string index, moved to this place due to a CW bug static const size_t npos; private: // if we hadn't made these operators private, it would be possible to // compile "wxString s; s = 17;" without any warnings as 17 is implicitly // converted to char in C and we do have operator=(char) // // NB: we don't need other versions (short/long and unsigned) as attempt // to assign another numeric type to wxString will now result in // ambiguity between operator=(char) and operator=(int) wxString& operator=(int); // these methods are not implemented - there is _no_ conversion from int to // string, you're doing something wrong if the compiler wants to call it! // // try `s << i' or `s.Printf("%d", i)' instead wxString(int); // buffer for holding temporary substring when using any of the methods // that take (char*,size_t) or (wchar_t*,size_t) arguments: template<typename T> struct SubstrBufFromType { T data; size_t len; SubstrBufFromType(const T& data_, size_t len_) : data(data_), len(len_) { wxASSERT_MSG( len != npos, "must have real length" ); } }; #if wxUSE_UNICODE_UTF8 // even char* -> char* needs conversion, from locale charset to UTF-8 typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC; typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromMB; #elif wxUSE_UNICODE_WCHAR typedef SubstrBufFromType<const wchar_t*> SubstrBufFromWC; typedef SubstrBufFromType<wxScopedWCharBuffer> SubstrBufFromMB; #else typedef SubstrBufFromType<const char*> SubstrBufFromMB; typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC; #endif // Functions implementing primitive operations on string data; wxString // methods and iterators are implemented in terms of it. The differences // between UTF-8 and wchar_t* representations of the string are mostly // contained here. #if wxUSE_UNICODE_UTF8 static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength, const wxMBConv& conv); static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength, const wxMBConv& conv); #elif wxUSE_UNICODE_WCHAR static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength, const wxMBConv& conv); #else static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength, const wxMBConv& conv); #endif #if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR or !wxUSE_UNICODE // returns C string encoded as the implementation expects: #if wxUSE_UNICODE static const wchar_t* ImplStr(const wchar_t* str) { return str ? str : wxT(""); } static const SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) { return SubstrBufFromWC(str, (str && n == npos) ? wxWcslen(str) : n); } static wxScopedWCharBuffer ImplStr(const char* str, const wxMBConv& conv = wxConvLibc) { return ConvertStr(str, npos, conv).data; } static SubstrBufFromMB ImplStr(const char* str, size_t n, const wxMBConv& conv = wxConvLibc) { return ConvertStr(str, n, conv); } #else static const char* ImplStr(const char* str, const wxMBConv& WXUNUSED(conv) = wxConvLibc) { return str ? str : ""; } static const SubstrBufFromMB ImplStr(const char* str, size_t n, const wxMBConv& WXUNUSED(conv) = wxConvLibc) { return SubstrBufFromMB(str, (str && n == npos) ? wxStrlen(str) : n); } static wxScopedCharBuffer ImplStr(const wchar_t* str) { return ConvertStr(str, npos, wxConvLibc).data; } static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) { return ConvertStr(str, n, wxConvLibc); } #endif // translates position index in wxString to/from index in underlying // wxStringImpl: static size_t PosToImpl(size_t pos) { return pos; } static void PosLenToImpl(size_t pos, size_t len, size_t *implPos, size_t *implLen) { *implPos = pos; *implLen = len; } static size_t LenToImpl(size_t len) { return len; } static size_t PosFromImpl(size_t pos) { return pos; } // we don't want to define these as empty inline functions as it could // result in noticeable (and quite unnecessary in non-UTF-8 build) slowdown // in debug build where the inline functions are not effectively inlined #define wxSTRING_INVALIDATE_CACHE() #define wxSTRING_INVALIDATE_CACHED_LENGTH() #define wxSTRING_UPDATE_CACHED_LENGTH(n) #define wxSTRING_SET_CACHED_LENGTH(n) #else // wxUSE_UNICODE_UTF8 static wxScopedCharBuffer ImplStr(const char* str, const wxMBConv& conv = wxConvLibc) { return ConvertStr(str, npos, conv).data; } static SubstrBufFromMB ImplStr(const char* str, size_t n, const wxMBConv& conv = wxConvLibc) { return ConvertStr(str, n, conv); } static wxScopedCharBuffer ImplStr(const wchar_t* str) { return ConvertStr(str, npos, wxMBConvUTF8()).data; } static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) { return ConvertStr(str, n, wxMBConvUTF8()); } #if wxUSE_STRING_POS_CACHE // this is an extremely simple cache used by PosToImpl(): each cache element // contains the string it applies to and the index corresponding to the last // used position in this wxString in its m_impl string // // NB: notice that this struct (and nested Element one) must be a POD or we // wouldn't be able to use a thread-local variable of this type, in // particular it should have no ctor -- we rely on statics being // initialized to 0 instead struct Cache { enum { SIZE = 8 }; struct Element { const wxString *str; // the string to which this element applies size_t pos, // the cached index in this string impl, // the corresponding position in its m_impl len; // cached length or npos if unknown // reset cached index to 0 void ResetPos() { pos = impl = 0; } // reset position and length void Reset() { ResetPos(); len = npos; } }; // cache the indices mapping for the last few string used Element cached[SIZE]; // the last used index unsigned lastUsed; }; #ifndef wxHAS_COMPILER_TLS // we must use an accessor function and not a static variable when the TLS // variables support is implemented in the library (and not by the compiler) // because the global s_cache variable could be not yet initialized when a // ctor of another global object is executed and if that ctor uses any // wxString methods, bad things happen // // however notice that this approach does not work when compiler TLS is used, // at least not with g++ 4.1.2 under amd64 as it apparently compiles code // using this accessor incorrectly when optimizations are enabled (-O2 is // enough) -- luckily we don't need it then neither as static __thread // variables are initialized by 0 anyhow then and so we can use the variable // directly WXEXPORT static Cache& GetCache() { static wxTLS_TYPE(Cache) s_cache; return wxTLS_VALUE(s_cache); } // this helper struct is used to ensure that GetCache() is called during // static initialization time, i.e. before any threads creation, as otherwise // the static s_cache construction inside GetCache() wouldn't be MT-safe friend struct wxStrCacheInitializer; #else // wxHAS_COMPILER_TLS static wxTLS_TYPE(Cache) ms_cache; static Cache& GetCache() { return wxTLS_VALUE(ms_cache); } #endif // !wxHAS_COMPILER_TLS/wxHAS_COMPILER_TLS static Cache::Element *GetCacheBegin() { return GetCache().cached; } static Cache::Element *GetCacheEnd() { return GetCacheBegin() + Cache::SIZE; } static unsigned& LastUsedCacheElement() { return GetCache().lastUsed; } // this is used in debug builds only to provide a convenient function, // callable from a debugger, to show the cache contents friend struct wxStrCacheDumper; // uncomment this to have access to some profiling statistics on program // termination //#define wxPROFILE_STRING_CACHE #ifdef wxPROFILE_STRING_CACHE static struct PosToImplCacheStats { unsigned postot, // total non-trivial calls to PosToImpl poshits, // cache hits from PosToImpl() mishits, // cached position beyond the needed one sumpos, // sum of all positions, used to compute the // average position after dividing by postot sumofs, // sum of all offsets after using the cache, used to // compute the average after dividing by hits lentot, // number of total calls to length() lenhits; // number of cache hits in length() } ms_cacheStats; friend struct wxStrCacheStatsDumper; #define wxCACHE_PROFILE_FIELD_INC(field) ms_cacheStats.field++ #define wxCACHE_PROFILE_FIELD_ADD(field, val) ms_cacheStats.field += (val) #else // !wxPROFILE_STRING_CACHE #define wxCACHE_PROFILE_FIELD_INC(field) #define wxCACHE_PROFILE_FIELD_ADD(field, val) #endif // wxPROFILE_STRING_CACHE/!wxPROFILE_STRING_CACHE // note: it could seem that the functions below shouldn't be inline because // they are big, contain loops and so the compiler shouldn't be able to // inline them anyhow, however moving them into string.cpp does decrease the // code performance by ~5%, at least when using g++ 4.1 so do keep them here // unless tests show that it's not advantageous any more // return the pointer to the cache element for this string or NULL if not // cached Cache::Element *FindCacheElement() const { // profiling seems to show a small but consistent gain if we use this // simple loop instead of starting from the last used element (there are // a lot of misses in this function...) Cache::Element * const cacheBegin = GetCacheBegin(); #ifndef wxHAS_COMPILER_TLS // during destruction tls calls may return NULL, in this case return NULL // immediately without accessing anything else if ( cacheBegin == NULL ) return NULL; #endif Cache::Element * const cacheEnd = GetCacheEnd(); for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ ) { if ( c->str == this ) return c; } return NULL; } // unlike FindCacheElement(), this one always returns a valid pointer to the // cache element for this string, it may have valid last cached position and // its corresponding index in the byte string or not Cache::Element *GetCacheElement() const { Cache::Element * const cacheBegin = GetCacheBegin(); Cache::Element * const cacheEnd = GetCacheEnd(); Cache::Element * const cacheStart = cacheBegin + LastUsedCacheElement(); // check the last used first, this does no (measurable) harm for a miss // but does help for simple loops addressing the same string all the time if ( cacheStart->str == this ) return cacheStart; // notice that we're going to check cacheStart again inside this call but // profiling shows that it's still faster to use a simple loop like // inside FindCacheElement() than manually looping with wrapping starting // from the cache entry after the start one Cache::Element *c = FindCacheElement(); if ( !c ) { // claim the next cache entry for this string c = cacheStart; if ( ++c == cacheEnd ) c = cacheBegin; c->str = this; c->Reset(); // and remember the last used element LastUsedCacheElement() = c - cacheBegin; } return c; } size_t DoPosToImpl(size_t pos) const { wxCACHE_PROFILE_FIELD_INC(postot); // NB: although the case of pos == 1 (and offset from cached position // equal to 1) are common, nothing is gained by writing special code // for handling them, the compiler (at least g++ 4.1 used) seems to // optimize the code well enough on its own wxCACHE_PROFILE_FIELD_ADD(sumpos, pos); Cache::Element * const cache = GetCacheElement(); // cached position can't be 0 so if it is, it means that this entry was // used for length caching only so far, i.e. it doesn't count as a hit // from our point of view if ( cache->pos ) { wxCACHE_PROFILE_FIELD_INC(poshits); } if ( pos == cache->pos ) return cache->impl; // this seems to happen only rarely so just reset the cache in this case // instead of complicating code even further by seeking backwards in this // case if ( cache->pos > pos ) { wxCACHE_PROFILE_FIELD_INC(mishits); cache->ResetPos(); } wxCACHE_PROFILE_FIELD_ADD(sumofs, pos - cache->pos); wxStringImpl::const_iterator i(m_impl.begin() + cache->impl); for ( size_t n = cache->pos; n < pos; n++ ) wxStringOperations::IncIter(i); cache->pos = pos; cache->impl = i - m_impl.begin(); wxSTRING_CACHE_ASSERT( (int)cache->impl == (begin() + pos).impl() - m_impl.begin() ); return cache->impl; } void InvalidateCache() { Cache::Element * const cache = FindCacheElement(); if ( cache ) cache->Reset(); } void InvalidateCachedLength() { Cache::Element * const cache = FindCacheElement(); if ( cache ) cache->len = npos; } void SetCachedLength(size_t len) { // we optimistically cache the length here even if the string wasn't // present in the cache before, this seems to do no harm and the // potential for avoiding length recomputation for long strings looks // interesting GetCacheElement()->len = len; } void UpdateCachedLength(ptrdiff_t delta) { Cache::Element * const cache = FindCacheElement(); if ( cache && cache->len != npos ) { wxSTRING_CACHE_ASSERT( (ptrdiff_t)cache->len + delta >= 0 ); cache->len += delta; } } #define wxSTRING_INVALIDATE_CACHE() InvalidateCache() #define wxSTRING_INVALIDATE_CACHED_LENGTH() InvalidateCachedLength() #define wxSTRING_UPDATE_CACHED_LENGTH(n) UpdateCachedLength(n) #define wxSTRING_SET_CACHED_LENGTH(n) SetCachedLength(n) #else // !wxUSE_STRING_POS_CACHE size_t DoPosToImpl(size_t pos) const { return (begin() + pos).impl() - m_impl.begin(); } #define wxSTRING_INVALIDATE_CACHE() #define wxSTRING_INVALIDATE_CACHED_LENGTH() #define wxSTRING_UPDATE_CACHED_LENGTH(n) #define wxSTRING_SET_CACHED_LENGTH(n) #endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE size_t PosToImpl(size_t pos) const { return pos == 0 || pos == npos ? pos : DoPosToImpl(pos); } void PosLenToImpl(size_t pos, size_t len, size_t *implPos, size_t *implLen) const; size_t LenToImpl(size_t len) const { size_t pos, len2; PosLenToImpl(0, len, &pos, &len2); return len2; } size_t PosFromImpl(size_t pos) const { if ( pos == 0 || pos == npos ) return pos; else return const_iterator(this, m_impl.begin() + pos) - begin(); } #endif // !wxUSE_UNICODE_UTF8/wxUSE_UNICODE_UTF8 public: // standard types typedef wxUniChar value_type; typedef wxUniChar char_type; typedef wxUniCharRef reference; typedef wxChar* pointer; typedef const wxChar* const_pointer; typedef size_t size_type; typedef const wxUniChar const_reference; #if wxUSE_STD_STRING #if wxUSE_UNICODE_UTF8 // random access is not O(1), as required by Random Access Iterator #define WX_STR_ITERATOR_TAG std::bidirectional_iterator_tag #else #define WX_STR_ITERATOR_TAG std::random_access_iterator_tag #endif #define WX_DEFINE_ITERATOR_CATEGORY(cat) typedef cat iterator_category; #else // not defining iterator_category at all in this case is better than defining // it as some dummy type -- at least it results in more intelligible error // messages #define WX_DEFINE_ITERATOR_CATEGORY(cat) #endif #define WX_STR_ITERATOR_IMPL(iterator_name, pointer_type, reference_type) \ private: \ typedef wxStringImpl::iterator_name underlying_iterator; \ public: \ WX_DEFINE_ITERATOR_CATEGORY(WX_STR_ITERATOR_TAG) \ typedef wxUniChar value_type; \ typedef ptrdiff_t difference_type; \ typedef reference_type reference; \ typedef pointer_type pointer; \ \ reference operator[](size_t n) const { return *(*this + n); } \ \ iterator_name& operator++() \ { wxStringOperations::IncIter(m_cur); return *this; } \ iterator_name& operator--() \ { wxStringOperations::DecIter(m_cur); return *this; } \ iterator_name operator++(int) \ { \ iterator_name tmp = *this; \ wxStringOperations::IncIter(m_cur); \ return tmp; \ } \ iterator_name operator--(int) \ { \ iterator_name tmp = *this; \ wxStringOperations::DecIter(m_cur); \ return tmp; \ } \ \ iterator_name& operator+=(ptrdiff_t n) \ { \ m_cur = wxStringOperations::AddToIter(m_cur, n); \ return *this; \ } \ iterator_name& operator-=(ptrdiff_t n) \ { \ m_cur = wxStringOperations::AddToIter(m_cur, -n); \ return *this; \ } \ \ difference_type operator-(const iterator_name& i) const \ { return wxStringOperations::DiffIters(m_cur, i.m_cur); } \ \ bool operator==(const iterator_name& i) const \ { return m_cur == i.m_cur; } \ bool operator!=(const iterator_name& i) const \ { return m_cur != i.m_cur; } \ \ bool operator<(const iterator_name& i) const \ { return m_cur < i.m_cur; } \ bool operator>(const iterator_name& i) const \ { return m_cur > i.m_cur; } \ bool operator<=(const iterator_name& i) const \ { return m_cur <= i.m_cur; } \ bool operator>=(const iterator_name& i) const \ { return m_cur >= i.m_cur; } \ \ private: \ /* for internal wxString use only: */ \ underlying_iterator impl() const { return m_cur; } \ \ friend class wxString; \ friend class wxCStrData; \ \ private: \ underlying_iterator m_cur class WXDLLIMPEXP_FWD_BASE const_iterator; #if wxUSE_UNICODE_UTF8 // NB: In UTF-8 build, (non-const) iterator needs to keep reference // to the underlying wxStringImpl, because UTF-8 is variable-length // encoding and changing the value pointer to by an iterator (using // its operator*) requires calling wxStringImpl::replace() if the old // and new values differ in their encoding's length. // // Furthermore, the replace() call may invalid all iterators for the // string, so we have to keep track of outstanding iterators and update // them if replace() happens. // // This is implemented by maintaining linked list of iterators for every // string and traversing it in wxUniCharRef::operator=(). Head of the // list is stored in wxString. (FIXME-UTF8) class WXDLLIMPEXP_BASE iterator { WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef); public: iterator() {} iterator(const iterator& i) : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} iterator& operator=(const iterator& i) { if (&i != this) { m_cur = i.m_cur; m_node.set(i.str(), &m_cur); } return *this; } reference operator*() { return wxUniCharRef::CreateForString(*str(), m_cur); } iterator operator+(ptrdiff_t n) const { return iterator(str(), wxStringOperations::AddToIter(m_cur, n)); } iterator operator-(ptrdiff_t n) const { return iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); } // Normal iterators need to be comparable with the const_iterators so // declare the comparison operators and implement them below after the // full const_iterator declaration. bool operator==(const const_iterator& i) const; bool operator!=(const const_iterator& i) const; bool operator<(const const_iterator& i) const; bool operator>(const const_iterator& i) const; bool operator<=(const const_iterator& i) const; bool operator>=(const const_iterator& i) const; private: iterator(wxString *wxstr, underlying_iterator ptr) : m_cur(ptr), m_node(wxstr, &m_cur) {} wxString* str() const { return const_cast<wxString*>(m_node.m_str); } wxStringIteratorNode m_node; friend class const_iterator; }; class WXDLLIMPEXP_BASE const_iterator { // NB: reference_type is intentionally value, not reference, the character // may be encoded differently in wxString data: WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar); public: const_iterator() {} const_iterator(const const_iterator& i) : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} const_iterator(const iterator& i) : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} const_iterator& operator=(const const_iterator& i) { if (&i != this) { m_cur = i.m_cur; m_node.set(i.str(), &m_cur); } return *this; } const_iterator& operator=(const iterator& i) { m_cur = i.m_cur; m_node.set(i.str(), &m_cur); return *this; } reference operator*() const { return wxStringOperations::DecodeChar(m_cur); } const_iterator operator+(ptrdiff_t n) const { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); } const_iterator operator-(ptrdiff_t n) const { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); } // Notice that comparison operators taking non-const iterator are not // needed here because of the implicit conversion from non-const iterator // to const ones ensure that the versions for const_iterator declared // inside WX_STR_ITERATOR_IMPL can be used. private: // for internal wxString use only: const_iterator(const wxString *wxstr, underlying_iterator ptr) : m_cur(ptr), m_node(wxstr, &m_cur) {} const wxString* str() const { return m_node.m_str; } wxStringIteratorNode m_node; }; iterator GetIterForNthChar(size_t n) { return iterator(this, m_impl.begin() + PosToImpl(n)); } const_iterator GetIterForNthChar(size_t n) const { return const_iterator(this, m_impl.begin() + PosToImpl(n)); } #else // !wxUSE_UNICODE_UTF8 class WXDLLIMPEXP_BASE iterator { WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef); public: iterator() {} iterator(const iterator& i) : m_cur(i.m_cur) {} reference operator*() { return wxUniCharRef::CreateForString(m_cur); } iterator operator+(ptrdiff_t n) const { return iterator(wxStringOperations::AddToIter(m_cur, n)); } iterator operator-(ptrdiff_t n) const { return iterator(wxStringOperations::AddToIter(m_cur, -n)); } // As in UTF-8 case above, define comparison operators taking // const_iterator too. bool operator==(const const_iterator& i) const; bool operator!=(const const_iterator& i) const; bool operator<(const const_iterator& i) const; bool operator>(const const_iterator& i) const; bool operator<=(const const_iterator& i) const; bool operator>=(const const_iterator& i) const; private: // for internal wxString use only: iterator(underlying_iterator ptr) : m_cur(ptr) {} iterator(wxString *WXUNUSED(str), underlying_iterator ptr) : m_cur(ptr) {} friend class const_iterator; }; class WXDLLIMPEXP_BASE const_iterator { // NB: reference_type is intentionally value, not reference, the character // may be encoded differently in wxString data: WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar); public: const_iterator() {} const_iterator(const const_iterator& i) : m_cur(i.m_cur) {} const_iterator(const iterator& i) : m_cur(i.m_cur) {} const_reference operator*() const { return wxStringOperations::DecodeChar(m_cur); } const_iterator operator+(ptrdiff_t n) const { return const_iterator(wxStringOperations::AddToIter(m_cur, n)); } const_iterator operator-(ptrdiff_t n) const { return const_iterator(wxStringOperations::AddToIter(m_cur, -n)); } // As in UTF-8 case above, we don't need comparison operators taking // iterator because we have an implicit conversion from iterator to // const_iterator so the operators declared by WX_STR_ITERATOR_IMPL will // be used. private: // for internal wxString use only: const_iterator(underlying_iterator ptr) : m_cur(ptr) {} const_iterator(const wxString *WXUNUSED(str), underlying_iterator ptr) : m_cur(ptr) {} }; iterator GetIterForNthChar(size_t n) { return begin() + n; } const_iterator GetIterForNthChar(size_t n) const { return begin() + n; } #endif // wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8 size_t IterToImplPos(wxString::iterator i) const { return wxStringImpl::const_iterator(i.impl()) - m_impl.begin(); } #undef WX_STR_ITERATOR_TAG #undef WX_STR_ITERATOR_IMPL // This method is mostly used by wxWidgets itself and return the offset of // the given iterator in bytes relative to the start of the buffer // representing the current string contents in the current locale encoding. // // It is inefficient as it involves converting part of the string to this // encoding (and also unsafe as it simply returns 0 if the conversion fails) // and so should be avoided if possible, wx itself only uses it to implement // backwards-compatible API. ptrdiff_t IterOffsetInMBStr(const const_iterator& i) const { const wxString str(begin(), i); // This is logically equivalent to strlen(str.mb_str()) but avoids // actually converting the string to multibyte and just computes the // length that it would have after conversion. const size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length()); return ofs == wxCONV_FAILED ? 0 : static_cast<ptrdiff_t>(ofs); } friend class iterator; friend class const_iterator; template <typename T> class reverse_iterator_impl { public: typedef T iterator_type; WX_DEFINE_ITERATOR_CATEGORY(typename T::iterator_category) typedef typename T::value_type value_type; typedef typename T::difference_type difference_type; typedef typename T::reference reference; typedef typename T::pointer *pointer; reverse_iterator_impl() {} reverse_iterator_impl(iterator_type i) : m_cur(i) {} reverse_iterator_impl(const reverse_iterator_impl& ri) : m_cur(ri.m_cur) {} iterator_type base() const { return m_cur; } reference operator*() const { return *(m_cur-1); } reference operator[](size_t n) const { return *(*this + n); } reverse_iterator_impl& operator++() { --m_cur; return *this; } reverse_iterator_impl operator++(int) { reverse_iterator_impl tmp = *this; --m_cur; return tmp; } reverse_iterator_impl& operator--() { ++m_cur; return *this; } reverse_iterator_impl operator--(int) { reverse_iterator_impl tmp = *this; ++m_cur; return tmp; } // NB: explicit <T> in the functions below is to keep BCC 5.5 happy reverse_iterator_impl operator+(ptrdiff_t n) const { return reverse_iterator_impl<T>(m_cur - n); } reverse_iterator_impl operator-(ptrdiff_t n) const { return reverse_iterator_impl<T>(m_cur + n); } reverse_iterator_impl operator+=(ptrdiff_t n) { m_cur -= n; return *this; } reverse_iterator_impl operator-=(ptrdiff_t n) { m_cur += n; return *this; } difference_type operator-(const reverse_iterator_impl& i) const { return i.m_cur - m_cur; } bool operator==(const reverse_iterator_impl& ri) const { return m_cur == ri.m_cur; } bool operator!=(const reverse_iterator_impl& ri) const { return !(*this == ri); } bool operator<(const reverse_iterator_impl& i) const { return m_cur > i.m_cur; } bool operator>(const reverse_iterator_impl& i) const { return m_cur < i.m_cur; } bool operator<=(const reverse_iterator_impl& i) const { return m_cur >= i.m_cur; } bool operator>=(const reverse_iterator_impl& i) const { return m_cur <= i.m_cur; } private: iterator_type m_cur; }; typedef reverse_iterator_impl<iterator> reverse_iterator; typedef reverse_iterator_impl<const_iterator> const_reverse_iterator; private: // used to transform an expression built using c_str() (and hence of type // wxCStrData) to an iterator into the string static const_iterator CreateConstIterator(const wxCStrData& data) { return const_iterator(data.m_str, (data.m_str->begin() + data.m_offset).impl()); } // in UTF-8 STL build, creation from std::string requires conversion under // non-UTF8 locales, so we can't have and use wxString(wxStringImpl) ctor; // instead we define dummy type that lets us have wxString ctor for creation // from wxStringImpl that couldn't be used by user code (in all other builds, // "standard" ctors can be used): #if wxUSE_UNICODE_UTF8 && wxUSE_STL_BASED_WXSTRING struct CtorFromStringImplTag {}; wxString(CtorFromStringImplTag* WXUNUSED(dummy), const wxStringImpl& src) : m_impl(src) {} static wxString FromImpl(const wxStringImpl& src) { return wxString((CtorFromStringImplTag*)NULL, src); } #else #if !wxUSE_STL_BASED_WXSTRING wxString(const wxStringImpl& src) : m_impl(src) { } // else: already defined as wxString(wxStdString) below #endif static wxString FromImpl(const wxStringImpl& src) { return wxString(src); } #endif public: // constructors and destructor // ctor for an empty string wxString() {} // copy ctor wxString(const wxString& stringSrc) : m_impl(stringSrc.m_impl) { } // string containing nRepeat copies of ch wxString(wxUniChar ch, size_t nRepeat = 1 ) { assign(nRepeat, ch); } wxString(size_t nRepeat, wxUniChar ch) { assign(nRepeat, ch); } wxString(wxUniCharRef ch, size_t nRepeat = 1) { assign(nRepeat, ch); } wxString(size_t nRepeat, wxUniCharRef ch) { assign(nRepeat, ch); } wxString(char ch, size_t nRepeat = 1) { assign(nRepeat, ch); } wxString(size_t nRepeat, char ch) { assign(nRepeat, ch); } wxString(wchar_t ch, size_t nRepeat = 1) { assign(nRepeat, ch); } wxString(size_t nRepeat, wchar_t ch) { assign(nRepeat, ch); } // ctors from char* strings: wxString(const char *psz) : m_impl(ImplStr(psz)) {} wxString(const char *psz, const wxMBConv& conv) : m_impl(ImplStr(psz, conv)) {} wxString(const char *psz, size_t nLength) { assign(psz, nLength); } wxString(const char *psz, const wxMBConv& conv, size_t nLength) { SubstrBufFromMB str(ImplStr(psz, nLength, conv)); m_impl.assign(str.data, str.len); } // and unsigned char*: wxString(const unsigned char *psz) : m_impl(ImplStr((const char*)psz)) {} wxString(const unsigned char *psz, const wxMBConv& conv) : m_impl(ImplStr((const char*)psz, conv)) {} wxString(const unsigned char *psz, size_t nLength) { assign((const char*)psz, nLength); } wxString(const unsigned char *psz, const wxMBConv& conv, size_t nLength) { SubstrBufFromMB str(ImplStr((const char*)psz, nLength, conv)); m_impl.assign(str.data, str.len); } // ctors from wchar_t* strings: wxString(const wchar_t *pwz) : m_impl(ImplStr(pwz)) {} wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv)) : m_impl(ImplStr(pwz)) {} wxString(const wchar_t *pwz, size_t nLength) { assign(pwz, nLength); } wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv), size_t nLength) { assign(pwz, nLength); } wxString(const wxScopedCharBuffer& buf) { assign(buf.data(), buf.length()); } wxString(const wxScopedWCharBuffer& buf) { assign(buf.data(), buf.length()); } wxString(const wxScopedCharBuffer& buf, const wxMBConv& conv) { assign(buf, conv); } // NB: this version uses m_impl.c_str() to force making a copy of the // string, so that "wxString(str.c_str())" idiom for passing strings // between threads works wxString(const wxCStrData& cstr) : m_impl(cstr.AsString().m_impl.c_str()) { } // as we provide both ctors with this signature for both char and unsigned // char string, we need to provide one for wxCStrData to resolve ambiguity wxString(const wxCStrData& cstr, size_t nLength) : m_impl(cstr.AsString().Mid(0, nLength).m_impl) {} // and because wxString is convertible to wxCStrData and const wxChar * // we also need to provide this one wxString(const wxString& str, size_t nLength) { assign(str, nLength); } #if wxUSE_STRING_POS_CACHE ~wxString() { // we need to invalidate our cache entry as another string could be // recreated at the same address (unlikely, but still possible, with the // heap-allocated strings but perfectly common with stack-allocated ones) InvalidateCache(); } #endif // wxUSE_STRING_POS_CACHE // even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is // very convenient to allow implicit conversions from std::string to wxString // and vice verse as this allows to use the same strings in non-GUI and GUI // code, however we don't want to unconditionally add this ctor as it would // make wx lib dependent on libstdc++ on some Linux versions which is bad, so // instead we ask the client code to define this wxUSE_STD_STRING symbol if // they need it #if wxUSE_STD_STRING #if wxUSE_UNICODE_WCHAR wxString(const wxStdWideString& str) : m_impl(str) {} #else // UTF-8 or ANSI wxString(const wxStdWideString& str) { assign(str.c_str(), str.length()); } #endif #if !wxUSE_UNICODE // ANSI build // FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too wxString(const std::string& str) : m_impl(str) {} #else // Unicode wxString(const std::string& str) { assign(str.c_str(), str.length()); } #endif #endif // wxUSE_STD_STRING // Also always provide explicit conversions to std::[w]string in any case, // see below for the implicit ones. #if wxUSE_STD_STRING // We can avoid a copy if we already use this string type internally, // otherwise we create a copy on the fly: #if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING #define wxStringToStdWstringRetType const wxStdWideString& const wxStdWideString& ToStdWstring() const { return m_impl; } #else // wxStringImpl is either not std::string or needs conversion #define wxStringToStdWstringRetType wxStdWideString wxStdWideString ToStdWstring() const { #if wxUSE_UNICODE_WCHAR wxScopedWCharBuffer buf = wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); #else // !wxUSE_UNICODE_WCHAR wxScopedWCharBuffer buf(wc_str()); #endif return wxStdWideString(buf.data(), buf.length()); } #endif #if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING // wxStringImpl is std::string in the encoding we want #define wxStringToStdStringRetType const std::string& const std::string& ToStdString() const { return m_impl; } std::string ToStdString(const wxMBConv& WXUNUSED(conv)) const { // No conversions are done when not using Unicode as everything is // supposed to be in 7 bit ASCII anyhow, this method is provided just // for compatibility with the Unicode build. return ToStdString(); } #else // wxStringImpl is either not std::string or needs conversion #define wxStringToStdStringRetType std::string std::string ToStdString(const wxMBConv& conv = wxConvLibc) const { wxScopedCharBuffer buf(mb_str(conv)); return std::string(buf.data(), buf.length()); } #endif #if wxUSE_STD_STRING_CONV_IN_WXSTRING // Implicit conversions to std::[w]string are not provided by default as // they conflict with the implicit conversions to "const char/wchar_t *" // which we use for backwards compatibility but do provide them if // explicitly requested. #if wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV) operator wxStringToStdStringRetType() const { return ToStdString(); } #endif // wxUSE_UNSAFE_WXSTRING_CONV operator wxStringToStdWstringRetType() const { return ToStdWstring(); } #endif // wxUSE_STD_STRING_CONV_IN_WXSTRING #undef wxStringToStdStringRetType #undef wxStringToStdWstringRetType #endif // wxUSE_STD_STRING wxString Clone() const { // make a deep copy of the string, i.e. the returned string will have // ref count = 1 with refcounted implementation return wxString::FromImpl(wxStringImpl(m_impl.c_str(), m_impl.length())); } // first valid index position const_iterator begin() const { return const_iterator(this, m_impl.begin()); } iterator begin() { return iterator(this, m_impl.begin()); } const_iterator cbegin() const { return const_iterator(this, m_impl.begin()); } // position one after the last valid one const_iterator end() const { return const_iterator(this, m_impl.end()); } iterator end() { return iterator(this, m_impl.end()); } const_iterator cend() const { return const_iterator(this, m_impl.end()); } // first element of the reversed string const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } reverse_iterator rbegin() { return reverse_iterator(end()); } const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } // one beyond the end of the reversed string const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } // std::string methods: #if wxUSE_UNICODE_UTF8 size_t length() const { #if wxUSE_STRING_POS_CACHE wxCACHE_PROFILE_FIELD_INC(lentot); Cache::Element * const cache = GetCacheElement(); if ( cache->len == npos ) { // it's probably not worth trying to be clever and using cache->pos // here as it's probably 0 anyhow -- you usually call length() before // starting to index the string cache->len = end() - begin(); } else { wxCACHE_PROFILE_FIELD_INC(lenhits); wxSTRING_CACHE_ASSERT( (int)cache->len == end() - begin() ); } return cache->len; #else // !wxUSE_STRING_POS_CACHE return end() - begin(); #endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE } #else size_t length() const { return m_impl.length(); } #endif size_type size() const { return length(); } size_type max_size() const { return npos; } bool empty() const { return m_impl.empty(); } // NB: these methods don't have a well-defined meaning in UTF-8 case size_type capacity() const { return m_impl.capacity(); } void reserve(size_t sz) { m_impl.reserve(sz); } void resize(size_t nSize, wxUniChar ch = wxT('\0')) { const size_t len = length(); if ( nSize == len) return; #if wxUSE_UNICODE_UTF8 if ( nSize < len ) { wxSTRING_INVALIDATE_CACHE(); // we can't use wxStringImpl::resize() for truncating the string as it // counts in bytes, not characters erase(nSize); return; } // we also can't use (presumably more efficient) resize() if we have to // append characters taking more than one byte if ( !ch.IsAscii() ) { append(nSize - len, ch); } else // can use (presumably faster) resize() version #endif // wxUSE_UNICODE_UTF8 { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl.resize(nSize, (wxStringCharType)ch); } } wxString substr(size_t nStart = 0, size_t nLen = npos) const { size_t pos, len; PosLenToImpl(nStart, nLen, &pos, &len); return FromImpl(m_impl.substr(pos, len)); } // generic attributes & operations // as standard strlen() size_t Len() const { return length(); } // string contains any characters? bool IsEmpty() const { return empty(); } // empty string is "false", so !str will return true bool operator!() const { return empty(); } // truncate the string to given length wxString& Truncate(size_t uiLen); // empty string contents void Empty() { clear(); } // empty the string and free memory void Clear() { clear(); } // contents test // Is an ascii value bool IsAscii() const; // Is a number bool IsNumber() const; // Is a word bool IsWord() const; // data access (all indexes are 0 based) // read access wxUniChar at(size_t n) const { return wxStringOperations::DecodeChar(m_impl.begin() + PosToImpl(n)); } wxUniChar GetChar(size_t n) const { return at(n); } // read/write access wxUniCharRef at(size_t n) { return *GetIterForNthChar(n); } wxUniCharRef GetWritableChar(size_t n) { return at(n); } // write access void SetChar(size_t n, wxUniChar ch) { at(n) = ch; } // get last character wxUniChar Last() const { wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); return *rbegin(); } // get writable last character wxUniCharRef Last() { wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); return *rbegin(); } /* Note that we we must define all of the overloads below to avoid ambiguity when using str[0]. */ wxUniChar operator[](int n) const { return at(n); } wxUniChar operator[](long n) const { return at(n); } wxUniChar operator[](size_t n) const { return at(n); } #ifndef wxSIZE_T_IS_UINT wxUniChar operator[](unsigned int n) const { return at(n); } #endif // size_t != unsigned int // operator versions of GetWriteableChar() wxUniCharRef operator[](int n) { return at(n); } wxUniCharRef operator[](long n) { return at(n); } wxUniCharRef operator[](size_t n) { return at(n); } #ifndef wxSIZE_T_IS_UINT wxUniCharRef operator[](unsigned int n) { return at(n); } #endif // size_t != unsigned int /* Overview of wxString conversions, implicit and explicit: - wxString has a std::[w]string-like c_str() method, however it does not return a C-style string directly but instead returns wxCStrData helper object which is convertible to either "char *" narrow string or "wchar_t *" wide string. Usually the correct conversion will be applied by the compiler automatically but if this doesn't happen you need to explicitly choose one using wxCStrData::AsChar() or AsWChar() methods or another wxString conversion function. - One of the places where the conversion does *NOT* happen correctly is when c_str() is passed to a vararg function such as printf() so you must *NOT* use c_str() with them. Either use wxPrintf() (all wx functions do handle c_str() correctly, even if they appear to be vararg (but they're not, really)) or add an explicit AsChar() or, if compatibility with previous wxWidgets versions is important, add a cast to "const char *". - In non-STL mode only, wxString is also implicitly convertible to wxCStrData. The same warning as above applies. - c_str() is polymorphic as it can be converted to either narrow or wide string. If you explicitly need one or the other, choose to use mb_str() (for narrow) or wc_str() (for wide) instead. Notice that these functions can return either the pointer to string directly (if this is what the string uses internally) or a temporary buffer containing the string and convertible to it. Again, conversion will usually be done automatically by the compiler but beware of the vararg functions: you need an explicit cast when using them. - There are also non-const versions of mb_str() and wc_str() called char_str() and wchar_str(). They are only meant to be used with non-const-correct functions and they always return buffers. - Finally wx_str() returns whatever string representation is used by wxString internally. It may be either a narrow or wide string depending on wxWidgets build mode but it will always be a raw pointer (and not a buffer). */ // explicit conversion to wxCStrData wxCStrData c_str() const { return wxCStrData(this); } wxCStrData data() const { return c_str(); } // implicit conversion to wxCStrData operator wxCStrData() const { return c_str(); } // the first two operators conflict with operators for conversion to // std::string and they must be disabled if those conversions are enabled; // the next one only makes sense if conversions to char* are also defined // and not defining it in STL build also helps us to get more clear error // messages for the code which relies on implicit conversion to char* in // STL build #if !wxUSE_STD_STRING_CONV_IN_WXSTRING operator const wchar_t*() const { return c_str(); } #if wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV) operator const char*() const { return c_str(); } // implicit conversion to untyped pointer for compatibility with previous // wxWidgets versions: this is the same as conversion to const char * so it // may fail! operator const void*() const { return c_str(); } #endif // wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV) #endif // !wxUSE_STD_STRING_CONV_IN_WXSTRING // identical to c_str(), for MFC compatibility const wxCStrData GetData() const { return c_str(); } // explicit conversion to C string in internal representation (char*, // wchar_t*, UTF-8-encoded char*, depending on the build): const wxStringCharType *wx_str() const { return m_impl.c_str(); } // conversion to *non-const* multibyte or widestring buffer; modifying // returned buffer won't affect the string, these methods are only useful // for passing values to const-incorrect functions wxWritableCharBuffer char_str(const wxMBConv& conv = wxConvLibc) const { return mb_str(conv); } wxWritableWCharBuffer wchar_str() const { return wc_str(); } // conversion to the buffer of the given type T (= char or wchar_t) and // also optionally return the buffer length // // this is mostly/only useful for the template functions template <typename T> wxCharTypeBuffer<T> tchar_str(size_t *len = NULL) const { #if wxUSE_UNICODE // we need a helper dispatcher depending on type return wxPrivate::wxStringAsBufHelper<T>::Get(*this, len); #else // ANSI // T can only be char in ANSI build if ( len ) *len = length(); return wxCharTypeBuffer<T>::CreateNonOwned(wx_str(), length()); #endif // Unicode build kind } // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for // converting numbers or strings which are certain not to contain special // chars (typically system functions, X atoms, environment variables etc.) // // the behaviour of these functions with the strings containing anything // else than 7 bit ASCII characters is undefined, use at your own risk. #if wxUSE_UNICODE static wxString FromAscii(const char *ascii, size_t len); static wxString FromAscii(const char *ascii); static wxString FromAscii(char ascii); const wxScopedCharBuffer ToAscii(char replaceWith = '_') const; #else // ANSI static wxString FromAscii(const char *ascii) { return wxString( ascii ); } static wxString FromAscii(const char *ascii, size_t len) { return wxString( ascii, len ); } static wxString FromAscii(char ascii) { return wxString( ascii ); } const char *ToAscii(char WXUNUSED(replaceWith) = '_') const { return c_str(); } #endif // Unicode/!Unicode // also provide unsigned char overloads as signed/unsigned doesn't matter // for 7 bit ASCII characters static wxString FromAscii(const unsigned char *ascii) { return FromAscii((const char *)ascii); } static wxString FromAscii(const unsigned char *ascii, size_t len) { return FromAscii((const char *)ascii, len); } // conversion to/from UTF-8: #if wxUSE_UNICODE_UTF8 static wxString FromUTF8Unchecked(const char *utf8) { if ( !utf8 ) return wxEmptyString; wxASSERT( wxStringOperations::IsValidUtf8String(utf8) ); return FromImpl(wxStringImpl(utf8)); } static wxString FromUTF8Unchecked(const char *utf8, size_t len) { if ( !utf8 ) return wxEmptyString; if ( len == npos ) return FromUTF8Unchecked(utf8); wxASSERT( wxStringOperations::IsValidUtf8String(utf8, len) ); return FromImpl(wxStringImpl(utf8, len)); } static wxString FromUTF8(const char *utf8) { if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8) ) return wxString(); return FromImpl(wxStringImpl(utf8)); } static wxString FromUTF8(const char *utf8, size_t len) { if ( len == npos ) return FromUTF8(utf8); if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8, len) ) return wxString(); return FromImpl(wxStringImpl(utf8, len)); } #if wxUSE_STD_STRING static wxString FromUTF8Unchecked(const std::string& utf8) { wxASSERT( wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) ); /* Note that, under wxUSE_UNICODE_UTF8 and wxUSE_STD_STRING, wxStringImpl can be initialized with a std::string whether wxUSE_STL_BASED_WXSTRING is 1 or not. */ return FromImpl(utf8); } static wxString FromUTF8(const std::string& utf8) { if ( utf8.empty() || !wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) ) return wxString(); return FromImpl(utf8); } #endif const wxScopedCharBuffer utf8_str() const { return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); } // this function exists in UTF-8 build only and returns the length of the // internal UTF-8 representation size_t utf8_length() const { return m_impl.length(); } #elif wxUSE_UNICODE_WCHAR static wxString FromUTF8(const char *utf8, size_t len = npos) { return wxString(utf8, wxMBConvUTF8(), len); } static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos) { const wxString s(utf8, wxMBConvUTF8(), len); wxASSERT_MSG( !utf8 || !*utf8 || !s.empty(), "string must be valid UTF-8" ); return s; } #if wxUSE_STD_STRING static wxString FromUTF8(const std::string& utf8) { return FromUTF8(utf8.c_str(), utf8.length()); } static wxString FromUTF8Unchecked(const std::string& utf8) { return FromUTF8Unchecked(utf8.c_str(), utf8.length()); } #endif const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); } #else // ANSI static wxString FromUTF8(const char *utf8) { return wxString(wxMBConvUTF8().cMB2WC(utf8)); } static wxString FromUTF8(const char *utf8, size_t len) { size_t wlen; wxScopedWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); return wxString(buf.data(), wlen); } static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos) { size_t wlen; wxScopedWCharBuffer buf ( wxMBConvUTF8().cMB2WC ( utf8, len == npos ? wxNO_LEN : len, &wlen ) ); wxASSERT_MSG( !utf8 || !*utf8 || wlen, "string must be valid UTF-8" ); return wxString(buf.data(), wlen); } #if wxUSE_STD_STRING static wxString FromUTF8(const std::string& utf8) { return FromUTF8(utf8.c_str(), utf8.length()); } static wxString FromUTF8Unchecked(const std::string& utf8) { return FromUTF8Unchecked(utf8.c_str(), utf8.length()); } #endif const wxScopedCharBuffer utf8_str() const { return wxMBConvUTF8().cWC2MB(wc_str()); } #endif const wxScopedCharBuffer ToUTF8() const { return utf8_str(); } // functions for storing binary data in wxString: #if wxUSE_UNICODE static wxString From8BitData(const char *data, size_t len) { return wxString(data, wxConvISO8859_1, len); } // version for NUL-terminated data: static wxString From8BitData(const char *data) { return wxString(data, wxConvISO8859_1); } const wxScopedCharBuffer To8BitData() const { return mb_str(wxConvISO8859_1); } #else // ANSI static wxString From8BitData(const char *data, size_t len) { return wxString(data, len); } // version for NUL-terminated data: static wxString From8BitData(const char *data) { return wxString(data); } const wxScopedCharBuffer To8BitData() const { return wxScopedCharBuffer::CreateNonOwned(wx_str(), length()); } #endif // Unicode/ANSI // conversions with (possible) format conversions: have to return a // buffer with temporary data // // the functions defined (in either Unicode or ANSI) mode are mb_str() to // return an ANSI (multibyte) string, wc_str() to return a wide string and // fn_str() to return a string which should be used with the OS APIs // accepting the file names. The return value is always the same, but the // type differs because a function may either return pointer to the buffer // directly or have to use intermediate buffer for translation. #if wxUSE_UNICODE // this is an optimization: even though using mb_str(wxConvLibc) does the // same thing (i.e. returns pointer to internal representation as locale is // always an UTF-8 one) in wxUSE_UTF8_LOCALE_ONLY case, we can avoid the // extra checks and the temporary buffer construction by providing a // separate mb_str() overload #if wxUSE_UTF8_LOCALE_ONLY const char* mb_str() const { return wx_str(); } const wxScopedCharBuffer mb_str(const wxMBConv& conv) const { return AsCharBuf(conv); } #else // !wxUSE_UTF8_LOCALE_ONLY const wxScopedCharBuffer mb_str(const wxMBConv& conv = wxConvLibc) const { return AsCharBuf(conv); } #endif // wxUSE_UTF8_LOCALE_ONLY/!wxUSE_UTF8_LOCALE_ONLY const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } #if wxUSE_UNICODE_WCHAR const wchar_t* wc_str() const { return wx_str(); } #elif wxUSE_UNICODE_UTF8 const wxScopedWCharBuffer wc_str() const { return AsWCharBuf(wxMBConvStrictUTF8()); } #endif // for compatibility with !wxUSE_UNICODE version const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const { return wc_str(); } #if wxMBFILES const wxScopedCharBuffer fn_str() const { return mb_str(wxConvFile); } #else // !wxMBFILES const wxWX2WCbuf fn_str() const { return wc_str(); } #endif // wxMBFILES/!wxMBFILES #else // ANSI const char* mb_str() const { return wx_str(); } // for compatibility with wxUSE_UNICODE version const char* mb_str(const wxMBConv& WXUNUSED(conv)) const { return wx_str(); } const wxWX2MBbuf mbc_str() const { return mb_str(); } const wxScopedWCharBuffer wc_str(const wxMBConv& conv = wxConvLibc) const { return AsWCharBuf(conv); } const wxScopedCharBuffer fn_str() const { return wxConvFile.cWC2WX( wc_str( wxConvLibc ) ); } #endif // Unicode/ANSI #if wxUSE_UNICODE_UTF8 const wxScopedWCharBuffer t_str() const { return wc_str(); } #elif wxUSE_UNICODE_WCHAR const wchar_t* t_str() const { return wx_str(); } #else const char* t_str() const { return wx_str(); } #endif // overloaded assignment // from another wxString wxString& operator=(const wxString& stringSrc) { if ( this != &stringSrc ) { wxSTRING_INVALIDATE_CACHE(); m_impl = stringSrc.m_impl; } return *this; } wxString& operator=(const wxCStrData& cstr) { return *this = cstr.AsString(); } // from a character wxString& operator=(wxUniChar ch) { wxSTRING_INVALIDATE_CACHE(); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl = (wxStringCharType)ch; else m_impl = wxStringOperations::EncodeChar(ch); return *this; } wxString& operator=(wxUniCharRef ch) { return operator=((wxUniChar)ch); } wxString& operator=(char ch) { return operator=(wxUniChar(ch)); } wxString& operator=(unsigned char ch) { return operator=(wxUniChar(ch)); } wxString& operator=(wchar_t ch) { return operator=(wxUniChar(ch)); } // from a C string - STL probably will crash on NULL, // so we need to compensate in that case #if wxUSE_STL_BASED_WXSTRING wxString& operator=(const char *psz) { wxSTRING_INVALIDATE_CACHE(); if ( psz ) m_impl = ImplStr(psz); else clear(); return *this; } wxString& operator=(const wchar_t *pwz) { wxSTRING_INVALIDATE_CACHE(); if ( pwz ) m_impl = ImplStr(pwz); else clear(); return *this; } #else // !wxUSE_STL_BASED_WXSTRING wxString& operator=(const char *psz) { wxSTRING_INVALIDATE_CACHE(); m_impl = ImplStr(psz); return *this; } wxString& operator=(const wchar_t *pwz) { wxSTRING_INVALIDATE_CACHE(); m_impl = ImplStr(pwz); return *this; } #endif // wxUSE_STL_BASED_WXSTRING/!wxUSE_STL_BASED_WXSTRING wxString& operator=(const unsigned char *psz) { return operator=((const char*)psz); } // from wxScopedWCharBuffer wxString& operator=(const wxScopedWCharBuffer& s) { return assign(s); } // from wxScopedCharBuffer wxString& operator=(const wxScopedCharBuffer& s) { return assign(s); } // string concatenation // in place concatenation /* Concatenate and return the result. Note that the left to right associativity of << allows to write things like "str << str1 << str2 << ..." (unlike with +=) */ // string += string wxString& operator<<(const wxString& s) { #if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 wxASSERT_MSG( s.IsValid(), wxT("did you forget to call UngetWriteBuf()?") ); #endif append(s); return *this; } // string += C string wxString& operator<<(const char *psz) { append(psz); return *this; } wxString& operator<<(const wchar_t *pwz) { append(pwz); return *this; } wxString& operator<<(const wxCStrData& psz) { append(psz.AsString()); return *this; } // string += char wxString& operator<<(wxUniChar ch) { append(1, ch); return *this; } wxString& operator<<(wxUniCharRef ch) { append(1, ch); return *this; } wxString& operator<<(char ch) { append(1, ch); return *this; } wxString& operator<<(unsigned char ch) { append(1, ch); return *this; } wxString& operator<<(wchar_t ch) { append(1, ch); return *this; } // string += buffer (i.e. from wxGetString) wxString& operator<<(const wxScopedWCharBuffer& s) { return append(s); } wxString& operator<<(const wxScopedCharBuffer& s) { return append(s); } // string += C string wxString& Append(const wxString& s) { // test for empty() to share the string if possible if ( empty() ) *this = s; else append(s); return *this; } wxString& Append(const char* psz) { append(psz); return *this; } wxString& Append(const wchar_t* pwz) { append(pwz); return *this; } wxString& Append(const wxCStrData& psz) { append(psz); return *this; } wxString& Append(const wxScopedCharBuffer& psz) { append(psz); return *this; } wxString& Append(const wxScopedWCharBuffer& psz) { append(psz); return *this; } wxString& Append(const char* psz, size_t nLen) { append(psz, nLen); return *this; } wxString& Append(const wchar_t* pwz, size_t nLen) { append(pwz, nLen); return *this; } wxString& Append(const wxCStrData& psz, size_t nLen) { append(psz, nLen); return *this; } wxString& Append(const wxScopedCharBuffer& psz, size_t nLen) { append(psz, nLen); return *this; } wxString& Append(const wxScopedWCharBuffer& psz, size_t nLen) { append(psz, nLen); return *this; } // append count copies of given character wxString& Append(wxUniChar ch, size_t count = 1u) { append(count, ch); return *this; } wxString& Append(wxUniCharRef ch, size_t count = 1u) { append(count, ch); return *this; } wxString& Append(char ch, size_t count = 1u) { append(count, ch); return *this; } wxString& Append(unsigned char ch, size_t count = 1u) { append(count, ch); return *this; } wxString& Append(wchar_t ch, size_t count = 1u) { append(count, ch); return *this; } // prepend a string, return the string itself wxString& Prepend(const wxString& str) { *this = str + *this; return *this; } // non-destructive concatenation // two strings friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); // string with a single char friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch); // char with a string friend wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string); // string with C string friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz); friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz); // C string with string friend wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string); friend wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string); // stream-like functions // insert an int into string wxString& operator<<(int i) { return (*this) << Format(wxT("%d"), i); } // insert an unsigned int into string wxString& operator<<(unsigned int ui) { return (*this) << Format(wxT("%u"), ui); } // insert a long into string wxString& operator<<(long l) { return (*this) << Format(wxT("%ld"), l); } // insert an unsigned long into string wxString& operator<<(unsigned long ul) { return (*this) << Format(wxT("%lu"), ul); } #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG // insert a long long if they exist and aren't longs wxString& operator<<(wxLongLong_t ll) { return (*this) << Format("%" wxLongLongFmtSpec "d", ll); } // insert an unsigned long long wxString& operator<<(wxULongLong_t ull) { return (*this) << Format("%" wxLongLongFmtSpec "u" , ull); } #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG // insert a float into string wxString& operator<<(float f) { return (*this) << Format(wxT("%f"), f); } // insert a double into string wxString& operator<<(double d) { return (*this) << Format(wxT("%g"), d); } // string comparison // case-sensitive comparison (returns a value < 0, = 0 or > 0) int Cmp(const char *psz) const { return compare(psz); } int Cmp(const wchar_t *pwz) const { return compare(pwz); } int Cmp(const wxString& s) const { return compare(s); } int Cmp(const wxCStrData& s) const { return compare(s); } int Cmp(const wxScopedCharBuffer& s) const { return compare(s); } int Cmp(const wxScopedWCharBuffer& s) const { return compare(s); } // same as Cmp() but not case-sensitive int CmpNoCase(const wxString& s) const; // test for the string equality, either considering case or not // (if compareWithCase then the case matters) bool IsSameAs(const wxString& str, bool compareWithCase = true) const { #if !wxUSE_UNICODE_UTF8 // in UTF-8 build, length() is O(n) and doing this would be _slower_ if ( length() != str.length() ) return false; #endif return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } bool IsSameAs(const char *str, bool compareWithCase = true) const { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } bool IsSameAs(const wchar_t *str, bool compareWithCase = true) const { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } bool IsSameAs(const wxCStrData& str, bool compareWithCase = true) const { return IsSameAs(str.AsString(), compareWithCase); } bool IsSameAs(const wxScopedCharBuffer& str, bool compareWithCase = true) const { return IsSameAs(str.data(), compareWithCase); } bool IsSameAs(const wxScopedWCharBuffer& str, bool compareWithCase = true) const { return IsSameAs(str.data(), compareWithCase); } // comparison with a single character: returns true if equal bool IsSameAs(wxUniChar c, bool compareWithCase = true) const; // FIXME-UTF8: remove these overloads bool IsSameAs(wxUniCharRef c, bool compareWithCase = true) const { return IsSameAs(wxUniChar(c), compareWithCase); } bool IsSameAs(char c, bool compareWithCase = true) const { return IsSameAs(wxUniChar(c), compareWithCase); } bool IsSameAs(unsigned char c, bool compareWithCase = true) const { return IsSameAs(wxUniChar(c), compareWithCase); } bool IsSameAs(wchar_t c, bool compareWithCase = true) const { return IsSameAs(wxUniChar(c), compareWithCase); } bool IsSameAs(int c, bool compareWithCase = true) const { return IsSameAs(wxUniChar(c), compareWithCase); } // simple sub-string extraction // return substring starting at nFirst of length nCount (or till the end // if nCount = default value) wxString Mid(size_t nFirst, size_t nCount = npos) const; // operator version of Mid() wxString operator()(size_t start, size_t len) const { return Mid(start, len); } // check if the string starts with the given prefix and return the rest // of the string in the provided pointer if it is not NULL; otherwise // return false bool StartsWith(const wxString& prefix, wxString *rest = NULL) const; // check if the string ends with the given suffix and return the // beginning of the string before the suffix in the provided pointer if // it is not NULL; otherwise return false bool EndsWith(const wxString& suffix, wxString *rest = NULL) const; // get first nCount characters wxString Left(size_t nCount) const; // get last nCount characters wxString Right(size_t nCount) const; // get all characters before the first occurrence of ch // (returns the whole string if ch not found) and also put everything // following the first occurrence of ch into rest if it's non-NULL wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const; // get all characters before the last occurrence of ch // (returns empty string if ch not found) and also put everything // following the last occurrence of ch into rest if it's non-NULL wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const; // get all characters after the first occurrence of ch // (returns empty string if ch not found) wxString AfterFirst(wxUniChar ch) const; // get all characters after the last occurrence of ch // (returns the whole string if ch not found) wxString AfterLast(wxUniChar ch) const; // for compatibility only, use more explicitly named functions above wxString Before(wxUniChar ch) const { return BeforeLast(ch); } wxString After(wxUniChar ch) const { return AfterFirst(ch); } // case conversion // convert to upper case in place, return the string itself wxString& MakeUpper(); // convert to upper case, return the copy of the string wxString Upper() const { return wxString(*this).MakeUpper(); } // convert to lower case in place, return the string itself wxString& MakeLower(); // convert to lower case, return the copy of the string wxString Lower() const { return wxString(*this).MakeLower(); } // convert the first character to the upper case and the rest to the // lower one, return the modified string itself wxString& MakeCapitalized(); // convert the first character to the upper case and the rest to the // lower one, return the copy of the string wxString Capitalize() const { return wxString(*this).MakeCapitalized(); } // trimming/padding whitespace (either side) and truncating // remove spaces from left or from right (default) side wxString& Trim(bool bFromRight = true); // add nCount copies chPad in the beginning or at the end (default) wxString& Pad(size_t nCount, wxUniChar chPad = wxT(' '), bool bFromRight = true); // searching and replacing // searching (return starting index, or -1 if not found) int Find(wxUniChar ch, bool bFromEnd = false) const; // like strchr/strrchr int Find(wxUniCharRef ch, bool bFromEnd = false) const { return Find(wxUniChar(ch), bFromEnd); } int Find(char ch, bool bFromEnd = false) const { return Find(wxUniChar(ch), bFromEnd); } int Find(unsigned char ch, bool bFromEnd = false) const { return Find(wxUniChar(ch), bFromEnd); } int Find(wchar_t ch, bool bFromEnd = false) const { return Find(wxUniChar(ch), bFromEnd); } // searching (return starting index, or -1 if not found) int Find(const wxString& sub) const // like strstr { const size_type idx = find(sub); return (idx == npos) ? wxNOT_FOUND : (int)idx; } int Find(const char *sub) const // like strstr { const size_type idx = find(sub); return (idx == npos) ? wxNOT_FOUND : (int)idx; } int Find(const wchar_t *sub) const // like strstr { const size_type idx = find(sub); return (idx == npos) ? wxNOT_FOUND : (int)idx; } int Find(const wxCStrData& sub) const { return Find(sub.AsString()); } int Find(const wxScopedCharBuffer& sub) const { return Find(sub.data()); } int Find(const wxScopedWCharBuffer& sub) const { return Find(sub.data()); } // replace first (or all of bReplaceAll) occurrences of substring with // another string, returns the number of replacements made size_t Replace(const wxString& strOld, const wxString& strNew, bool bReplaceAll = true); // check if the string contents matches a mask containing '*' and '?' bool Matches(const wxString& mask) const; // conversion to numbers: all functions return true only if the whole // string is a number and put the value of this number into the pointer // provided, the base is the numeric base in which the conversion should be // done and must be comprised between 2 and 36 or be 0 in which case the // standard C rules apply (leading '0' => octal, "0x" => hex) // convert to a signed integer bool ToLong(long *val, int base = 10) const; // convert to an unsigned integer bool ToULong(unsigned long *val, int base = 10) const; // convert to wxLongLong #if defined(wxLongLong_t) bool ToLongLong(wxLongLong_t *val, int base = 10) const; // convert to wxULongLong bool ToULongLong(wxULongLong_t *val, int base = 10) const; #endif // wxLongLong_t // convert to a double bool ToDouble(double *val) const; // conversions to numbers using C locale // convert to a signed integer bool ToCLong(long *val, int base = 10) const; // convert to an unsigned integer bool ToCULong(unsigned long *val, int base = 10) const; // convert to a double bool ToCDouble(double *val) const; // create a string representing the given floating point number with the // default (like %g) or fixed (if precision >=0) precision // in the current locale static wxString FromDouble(double val, int precision = -1); // in C locale static wxString FromCDouble(double val, int precision = -1); // formatted input/output // as sprintf(), returns the number of characters written or < 0 on error // (take 'this' into account in attribute parameter count) // int Printf(const wxString& format, ...); WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&), DoPrintfWchar, DoPrintfUtf8) // as vprintf(), returns the number of characters written or < 0 on error int PrintfV(const wxString& format, va_list argptr); // returns the string containing the result of Printf() to it // static wxString Format(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_1; WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&), DoFormatWchar, DoFormatUtf8) // the same as above, but takes a va_list static wxString FormatV(const wxString& format, va_list argptr); // raw access to string memory // ensure that string has space for at least nLen characters // only works if the data of this string is not shared bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; } // minimize the string's memory // only works if the data of this string is not shared bool Shrink(); #if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 // These are deprecated, use wxStringBuffer or wxStringBufferLength instead // // get writable buffer of at least nLen bytes. Unget() *must* be called // a.s.a.p. to put string back in a reasonable state! wxDEPRECATED( wxStringCharType *GetWriteBuf(size_t nLen) ); // call this immediately after GetWriteBuf() has been used wxDEPRECATED( void UngetWriteBuf() ); wxDEPRECATED( void UngetWriteBuf(size_t nLen) ); #endif // WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && wxUSE_UNICODE_UTF8 // wxWidgets version 1 compatibility functions // use Mid() wxString SubString(size_t from, size_t to) const { return Mid(from, (to - from + 1)); } // values for second parameter of CompareTo function enum caseCompare {exact, ignoreCase}; // values for first parameter of Strip function enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; // use Printf() // (take 'this' into account in attribute parameter count) // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2; WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&), DoPrintfWchar, DoPrintfUtf8) // use Cmp() int CompareTo(const wxChar* psz, caseCompare cmp = exact) const { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); } // use length() size_t Length() const { return length(); } // Count the number of characters int Freq(wxUniChar ch) const; // use MakeLower void LowerCase() { MakeLower(); } // use MakeUpper void UpperCase() { MakeUpper(); } // use Trim except that it doesn't change this string wxString Strip(stripType w = trailing) const; // use Find (more general variants not yet supported) size_t Index(const wxChar* psz) const { return Find(psz); } size_t Index(wxUniChar ch) const { return Find(ch); } // use Truncate wxString& Remove(size_t pos) { return Truncate(pos); } wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); } wxString& Remove(size_t nStart, size_t nLen) { return (wxString&)erase( nStart, nLen ); } // use Find() int First( wxUniChar ch ) const { return Find(ch); } int First( wxUniCharRef ch ) const { return Find(ch); } int First( char ch ) const { return Find(ch); } int First( unsigned char ch ) const { return Find(ch); } int First( wchar_t ch ) const { return Find(ch); } int First( const wxString& str ) const { return Find(str); } int Last( wxUniChar ch ) const { return Find(ch, true); } bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; } // use empty() bool IsNull() const { return empty(); } // std::string compatibility functions // take nLen chars starting at nPos wxString(const wxString& str, size_t nPos, size_t nLen) { assign(str, nPos, nLen); } // take all characters from first to last wxString(const_iterator first, const_iterator last) : m_impl(first.impl(), last.impl()) { } #if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER // the 2 overloads below are for compatibility with the existing code using // pointers instead of iterators wxString(const char *first, const char *last) { SubstrBufFromMB str(ImplStr(first, last - first)); m_impl.assign(str.data, str.len); } wxString(const wchar_t *first, const wchar_t *last) { SubstrBufFromWC str(ImplStr(first, last - first)); m_impl.assign(str.data, str.len); } // and this one is needed to compile code adding offsets to c_str() result wxString(const wxCStrData& first, const wxCStrData& last) : m_impl(CreateConstIterator(first).impl(), CreateConstIterator(last).impl()) { wxASSERT_MSG( first.m_str == last.m_str, wxT("pointers must be into the same string") ); } #endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER // lib.string.modifiers // append elements str[pos], ..., str[pos+n] wxString& append(const wxString& str, size_t pos, size_t n) { wxSTRING_UPDATE_CACHED_LENGTH(n); size_t from, len; str.PosLenToImpl(pos, n, &from, &len); m_impl.append(str.m_impl, from, len); return *this; } // append a string wxString& append(const wxString& str) { wxSTRING_UPDATE_CACHED_LENGTH(str.length()); m_impl.append(str.m_impl); return *this; } // append first n (or all if n == npos) characters of sz wxString& append(const char *sz) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl.append(ImplStr(sz)); return *this; } wxString& append(const wchar_t *sz) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl.append(ImplStr(sz)); return *this; } wxString& append(const char *sz, size_t n) { wxSTRING_INVALIDATE_CACHED_LENGTH(); SubstrBufFromMB str(ImplStr(sz, n)); m_impl.append(str.data, str.len); return *this; } wxString& append(const wchar_t *sz, size_t n) { wxSTRING_UPDATE_CACHED_LENGTH(n); SubstrBufFromWC str(ImplStr(sz, n)); m_impl.append(str.data, str.len); return *this; } wxString& append(const wxCStrData& str) { return append(str.AsString()); } wxString& append(const wxScopedCharBuffer& str) { return append(str.data(), str.length()); } wxString& append(const wxScopedWCharBuffer& str) { return append(str.data(), str.length()); } wxString& append(const wxCStrData& str, size_t n) { return append(str.AsString(), 0, n); } wxString& append(const wxScopedCharBuffer& str, size_t n) { return append(str.data(), n); } wxString& append(const wxScopedWCharBuffer& str, size_t n) { return append(str.data(), n); } // append n copies of ch wxString& append(size_t n, wxUniChar ch) { if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) { wxSTRING_UPDATE_CACHED_LENGTH(n); m_impl.append(n, (wxStringCharType)ch); } else { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl.append(wxStringOperations::EncodeNChars(n, ch)); } return *this; } wxString& append(size_t n, wxUniCharRef ch) { return append(n, wxUniChar(ch)); } wxString& append(size_t n, char ch) { return append(n, wxUniChar(ch)); } wxString& append(size_t n, unsigned char ch) { return append(n, wxUniChar(ch)); } wxString& append(size_t n, wchar_t ch) { return append(n, wxUniChar(ch)); } // append from first to last wxString& append(const_iterator first, const_iterator last) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl.append(first.impl(), last.impl()); return *this; } #if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER wxString& append(const char *first, const char *last) { return append(first, last - first); } wxString& append(const wchar_t *first, const wchar_t *last) { return append(first, last - first); } wxString& append(const wxCStrData& first, const wxCStrData& last) { return append(CreateConstIterator(first), CreateConstIterator(last)); } #endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER // same as `this_string = str' wxString& assign(const wxString& str) { wxSTRING_SET_CACHED_LENGTH(str.length()); m_impl = str.m_impl; return *this; } // This is a non-standard-compliant overload taking the first "len" // characters of the source string. wxString& assign(const wxString& str, size_t len) { #if wxUSE_STRING_POS_CACHE // It is legal to pass len > str.length() to wxStringImpl::assign() but // by restricting it here we save some work for that function so it's not // really less efficient and, at the same time, ensure that we don't // cache invalid length. const size_t lenSrc = str.length(); if ( len > lenSrc ) len = lenSrc; wxSTRING_SET_CACHED_LENGTH(len); #endif // wxUSE_STRING_POS_CACHE m_impl.assign(str.m_impl, 0, str.LenToImpl(len)); return *this; } // same as ` = str[pos..pos + n] wxString& assign(const wxString& str, size_t pos, size_t n) { size_t from, len; str.PosLenToImpl(pos, n, &from, &len); m_impl.assign(str.m_impl, from, len); // it's important to call this after PosLenToImpl() above in case str is // the same string as this one wxSTRING_SET_CACHED_LENGTH(n); return *this; } // same as `= first n (or all if n == npos) characters of sz' wxString& assign(const char *sz) { wxSTRING_INVALIDATE_CACHE(); m_impl.assign(ImplStr(sz)); return *this; } wxString& assign(const wchar_t *sz) { wxSTRING_INVALIDATE_CACHE(); m_impl.assign(ImplStr(sz)); return *this; } wxString& assign(const char *sz, size_t n) { wxSTRING_INVALIDATE_CACHE(); SubstrBufFromMB str(ImplStr(sz, n)); m_impl.assign(str.data, str.len); return *this; } wxString& assign(const wchar_t *sz, size_t n) { wxSTRING_SET_CACHED_LENGTH(n); SubstrBufFromWC str(ImplStr(sz, n)); m_impl.assign(str.data, str.len); return *this; } wxString& assign(const wxCStrData& str) { return assign(str.AsString()); } wxString& assign(const wxScopedCharBuffer& str) { return assign(str.data(), str.length()); } wxString& assign(const wxScopedCharBuffer& buf, const wxMBConv& conv) { SubstrBufFromMB str(ImplStr(buf.data(), buf.length(), conv)); m_impl.assign(str.data, str.len); return *this; } wxString& assign(const wxScopedWCharBuffer& str) { return assign(str.data(), str.length()); } wxString& assign(const wxCStrData& str, size_t len) { return assign(str.AsString(), len); } wxString& assign(const wxScopedCharBuffer& str, size_t len) { return assign(str.data(), len); } wxString& assign(const wxScopedWCharBuffer& str, size_t len) { return assign(str.data(), len); } // same as `= n copies of ch' wxString& assign(size_t n, wxUniChar ch) { wxSTRING_SET_CACHED_LENGTH(n); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl.assign(n, (wxStringCharType)ch); else m_impl.assign(wxStringOperations::EncodeNChars(n, ch)); return *this; } wxString& assign(size_t n, wxUniCharRef ch) { return assign(n, wxUniChar(ch)); } wxString& assign(size_t n, char ch) { return assign(n, wxUniChar(ch)); } wxString& assign(size_t n, unsigned char ch) { return assign(n, wxUniChar(ch)); } wxString& assign(size_t n, wchar_t ch) { return assign(n, wxUniChar(ch)); } // assign from first to last wxString& assign(const_iterator first, const_iterator last) { wxSTRING_INVALIDATE_CACHE(); m_impl.assign(first.impl(), last.impl()); return *this; } #if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER wxString& assign(const char *first, const char *last) { return assign(first, last - first); } wxString& assign(const wchar_t *first, const wchar_t *last) { return assign(first, last - first); } wxString& assign(const wxCStrData& first, const wxCStrData& last) { return assign(CreateConstIterator(first), CreateConstIterator(last)); } #endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER // string comparison int compare(const wxString& str) const; int compare(const char* sz) const; int compare(const wchar_t* sz) const; int compare(const wxCStrData& str) const { return compare(str.AsString()); } int compare(const wxScopedCharBuffer& str) const { return compare(str.data()); } int compare(const wxScopedWCharBuffer& str) const { return compare(str.data()); } // comparison with a substring int compare(size_t nStart, size_t nLen, const wxString& str) const; // comparison of 2 substrings int compare(size_t nStart, size_t nLen, const wxString& str, size_t nStart2, size_t nLen2) const; // substring comparison with first nCount characters of sz int compare(size_t nStart, size_t nLen, const char* sz, size_t nCount = npos) const; int compare(size_t nStart, size_t nLen, const wchar_t* sz, size_t nCount = npos) const; // insert another string wxString& insert(size_t nPos, const wxString& str) { insert(GetIterForNthChar(nPos), str.begin(), str.end()); return *this; } // insert n chars of str starting at nStart (in str) wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n) { wxSTRING_UPDATE_CACHED_LENGTH(n); size_t from, len; str.PosLenToImpl(nStart, n, &from, &len); m_impl.insert(PosToImpl(nPos), str.m_impl, from, len); return *this; } // insert first n (or all if n == npos) characters of sz wxString& insert(size_t nPos, const char *sz) { wxSTRING_INVALIDATE_CACHE(); m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this; } wxString& insert(size_t nPos, const wchar_t *sz) { wxSTRING_INVALIDATE_CACHE(); m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this; } wxString& insert(size_t nPos, const char *sz, size_t n) { wxSTRING_UPDATE_CACHED_LENGTH(n); SubstrBufFromMB str(ImplStr(sz, n)); m_impl.insert(PosToImpl(nPos), str.data, str.len); return *this; } wxString& insert(size_t nPos, const wchar_t *sz, size_t n) { wxSTRING_UPDATE_CACHED_LENGTH(n); SubstrBufFromWC str(ImplStr(sz, n)); m_impl.insert(PosToImpl(nPos), str.data, str.len); return *this; } // insert n copies of ch wxString& insert(size_t nPos, size_t n, wxUniChar ch) { wxSTRING_UPDATE_CACHED_LENGTH(n); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl.insert(PosToImpl(nPos), n, (wxStringCharType)ch); else m_impl.insert(PosToImpl(nPos), wxStringOperations::EncodeNChars(n, ch)); return *this; } iterator insert(iterator it, wxUniChar ch) { wxSTRING_UPDATE_CACHED_LENGTH(1); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) return iterator(this, m_impl.insert(it.impl(), (wxStringCharType)ch)); else { size_t pos = IterToImplPos(it); m_impl.insert(pos, wxStringOperations::EncodeChar(ch)); return iterator(this, m_impl.begin() + pos); } } void insert(iterator it, const_iterator first, const_iterator last) { wxSTRING_INVALIDATE_CACHE(); m_impl.insert(it.impl(), first.impl(), last.impl()); } #if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER void insert(iterator it, const char *first, const char *last) { insert(it - begin(), first, last - first); } void insert(iterator it, const wchar_t *first, const wchar_t *last) { insert(it - begin(), first, last - first); } void insert(iterator it, const wxCStrData& first, const wxCStrData& last) { insert(it, CreateConstIterator(first), CreateConstIterator(last)); } #endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER void insert(iterator it, size_type n, wxUniChar ch) { wxSTRING_UPDATE_CACHED_LENGTH(n); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl.insert(it.impl(), n, (wxStringCharType)ch); else m_impl.insert(IterToImplPos(it), wxStringOperations::EncodeNChars(n, ch)); } // delete characters from nStart to nStart + nLen wxString& erase(size_type pos = 0, size_type n = npos) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(pos, n, &from, &len); m_impl.erase(from, len); return *this; } // delete characters from first up to last iterator erase(iterator first, iterator last) { wxSTRING_INVALIDATE_CACHE(); return iterator(this, m_impl.erase(first.impl(), last.impl())); } iterator erase(iterator first) { wxSTRING_UPDATE_CACHED_LENGTH(-1); return iterator(this, m_impl.erase(first.impl())); } void clear() { wxSTRING_SET_CACHED_LENGTH(0); m_impl.clear(); } // replaces the substring of length nLen starting at nStart wxString& replace(size_t nStart, size_t nLen, const char* sz) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); m_impl.replace(from, len, ImplStr(sz)); return *this; } wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); m_impl.replace(from, len, ImplStr(sz)); return *this; } // replaces the substring of length nLen starting at nStart wxString& replace(size_t nStart, size_t nLen, const wxString& str) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); m_impl.replace(from, len, str.m_impl); return *this; } // replaces the substring with nCount copies of ch wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxUniChar ch) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl.replace(from, len, nCount, (wxStringCharType)ch); else m_impl.replace(from, len, wxStringOperations::EncodeNChars(nCount, ch)); return *this; } // replaces a substring with another substring wxString& replace(size_t nStart, size_t nLen, const wxString& str, size_t nStart2, size_t nLen2) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); size_t from2, len2; str.PosLenToImpl(nStart2, nLen2, &from2, &len2); m_impl.replace(from, len, str.m_impl, from2, len2); return *this; } // replaces the substring with first nCount chars of sz wxString& replace(size_t nStart, size_t nLen, const char* sz, size_t nCount) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); SubstrBufFromMB str(ImplStr(sz, nCount)); m_impl.replace(from, len, str.data, str.len); return *this; } wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz, size_t nCount) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); SubstrBufFromWC str(ImplStr(sz, nCount)); m_impl.replace(from, len, str.data, str.len); return *this; } wxString& replace(size_t nStart, size_t nLen, const wxString& s, size_t nCount) { wxSTRING_INVALIDATE_CACHE(); size_t from, len; PosLenToImpl(nStart, nLen, &from, &len); m_impl.replace(from, len, s.m_impl.c_str(), s.LenToImpl(nCount)); return *this; } wxString& replace(iterator first, iterator last, const char* s) { wxSTRING_INVALIDATE_CACHE(); m_impl.replace(first.impl(), last.impl(), ImplStr(s)); return *this; } wxString& replace(iterator first, iterator last, const wchar_t* s) { wxSTRING_INVALIDATE_CACHE(); m_impl.replace(first.impl(), last.impl(), ImplStr(s)); return *this; } wxString& replace(iterator first, iterator last, const char* s, size_type n) { wxSTRING_INVALIDATE_CACHE(); SubstrBufFromMB str(ImplStr(s, n)); m_impl.replace(first.impl(), last.impl(), str.data, str.len); return *this; } wxString& replace(iterator first, iterator last, const wchar_t* s, size_type n) { wxSTRING_INVALIDATE_CACHE(); SubstrBufFromWC str(ImplStr(s, n)); m_impl.replace(first.impl(), last.impl(), str.data, str.len); return *this; } wxString& replace(iterator first, iterator last, const wxString& s) { wxSTRING_INVALIDATE_CACHE(); m_impl.replace(first.impl(), last.impl(), s.m_impl); return *this; } wxString& replace(iterator first, iterator last, size_type n, wxUniChar ch) { wxSTRING_INVALIDATE_CACHE(); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl.replace(first.impl(), last.impl(), n, (wxStringCharType)ch); else m_impl.replace(first.impl(), last.impl(), wxStringOperations::EncodeNChars(n, ch)); return *this; } wxString& replace(iterator first, iterator last, const_iterator first1, const_iterator last1) { wxSTRING_INVALIDATE_CACHE(); m_impl.replace(first.impl(), last.impl(), first1.impl(), last1.impl()); return *this; } wxString& replace(iterator first, iterator last, const char *first1, const char *last1) { replace(first, last, first1, last1 - first1); return *this; } wxString& replace(iterator first, iterator last, const wchar_t *first1, const wchar_t *last1) { replace(first, last, first1, last1 - first1); return *this; } // swap two strings void swap(wxString& str) { #if wxUSE_STRING_POS_CACHE // we modify not only this string but also the other one directly so we // need to invalidate cache for both of them (we could also try to // exchange their cache entries but it seems unlikely to be worth it) InvalidateCache(); str.InvalidateCache(); #endif // wxUSE_STRING_POS_CACHE m_impl.swap(str.m_impl); } // find a substring size_t find(const wxString& str, size_t nStart = 0) const { return PosFromImpl(m_impl.find(str.m_impl, PosToImpl(nStart))); } // find first n characters of sz size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const { SubstrBufFromMB str(ImplStr(sz, n)); return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len)); } size_t find(const wchar_t* sz, size_t nStart = 0, size_t n = npos) const { SubstrBufFromWC str(ImplStr(sz, n)); return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len)); } size_t find(const wxScopedCharBuffer& s, size_t nStart = 0, size_t n = npos) const { return find(s.data(), nStart, n); } size_t find(const wxScopedWCharBuffer& s, size_t nStart = 0, size_t n = npos) const { return find(s.data(), nStart, n); } size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const { return find(s.AsWChar(), nStart, n); } // find the first occurrence of character ch after nStart size_t find(wxUniChar ch, size_t nStart = 0) const { if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) return PosFromImpl(m_impl.find((wxStringCharType)ch, PosToImpl(nStart))); else return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch), PosToImpl(nStart))); } size_t find(wxUniCharRef ch, size_t nStart = 0) const { return find(wxUniChar(ch), nStart); } size_t find(char ch, size_t nStart = 0) const { return find(wxUniChar(ch), nStart); } size_t find(unsigned char ch, size_t nStart = 0) const { return find(wxUniChar(ch), nStart); } size_t find(wchar_t ch, size_t nStart = 0) const { return find(wxUniChar(ch), nStart); } // rfind() family is exactly like find() but works right to left // as find, but from the end size_t rfind(const wxString& str, size_t nStart = npos) const { return PosFromImpl(m_impl.rfind(str.m_impl, PosToImpl(nStart))); } // as find, but from the end size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const { SubstrBufFromMB str(ImplStr(sz, n)); return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len)); } size_t rfind(const wchar_t* sz, size_t nStart = npos, size_t n = npos) const { SubstrBufFromWC str(ImplStr(sz, n)); return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len)); } size_t rfind(const wxScopedCharBuffer& s, size_t nStart = npos, size_t n = npos) const { return rfind(s.data(), nStart, n); } size_t rfind(const wxScopedWCharBuffer& s, size_t nStart = npos, size_t n = npos) const { return rfind(s.data(), nStart, n); } size_t rfind(const wxCStrData& s, size_t nStart = npos, size_t n = npos) const { return rfind(s.AsWChar(), nStart, n); } // as find, but from the end size_t rfind(wxUniChar ch, size_t nStart = npos) const { if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) return PosFromImpl(m_impl.rfind((wxStringCharType)ch, PosToImpl(nStart))); else return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch), PosToImpl(nStart))); } size_t rfind(wxUniCharRef ch, size_t nStart = npos) const { return rfind(wxUniChar(ch), nStart); } size_t rfind(char ch, size_t nStart = npos) const { return rfind(wxUniChar(ch), nStart); } size_t rfind(unsigned char ch, size_t nStart = npos) const { return rfind(wxUniChar(ch), nStart); } size_t rfind(wchar_t ch, size_t nStart = npos) const { return rfind(wxUniChar(ch), nStart); } // find first/last occurrence of any character (not) in the set: #if wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 // FIXME-UTF8: this is not entirely correct, because it doesn't work if // sizeof(wchar_t)==2 and surrogates are present in the string; // should we care? Probably not. size_t find_first_of(const wxString& str, size_t nStart = 0) const { return m_impl.find_first_of(str.m_impl, nStart); } size_t find_first_of(const char* sz, size_t nStart = 0) const { return m_impl.find_first_of(ImplStr(sz), nStart); } size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const { return m_impl.find_first_of(ImplStr(sz), nStart); } size_t find_first_of(const char* sz, size_t nStart, size_t n) const { return m_impl.find_first_of(ImplStr(sz), nStart, n); } size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const { return m_impl.find_first_of(ImplStr(sz), nStart, n); } size_t find_first_of(wxUniChar c, size_t nStart = 0) const { return m_impl.find_first_of((wxChar)c, nStart); } size_t find_last_of(const wxString& str, size_t nStart = npos) const { return m_impl.find_last_of(str.m_impl, nStart); } size_t find_last_of(const char* sz, size_t nStart = npos) const { return m_impl.find_last_of(ImplStr(sz), nStart); } size_t find_last_of(const wchar_t* sz, size_t nStart = npos) const { return m_impl.find_last_of(ImplStr(sz), nStart); } size_t find_last_of(const char* sz, size_t nStart, size_t n) const { return m_impl.find_last_of(ImplStr(sz), nStart, n); } size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const { return m_impl.find_last_of(ImplStr(sz), nStart, n); } size_t find_last_of(wxUniChar c, size_t nStart = npos) const { return m_impl.find_last_of((wxChar)c, nStart); } size_t find_first_not_of(const wxString& str, size_t nStart = 0) const { return m_impl.find_first_not_of(str.m_impl, nStart); } size_t find_first_not_of(const char* sz, size_t nStart = 0) const { return m_impl.find_first_not_of(ImplStr(sz), nStart); } size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const { return m_impl.find_first_not_of(ImplStr(sz), nStart); } size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); } size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); } size_t find_first_not_of(wxUniChar c, size_t nStart = 0) const { return m_impl.find_first_not_of((wxChar)c, nStart); } size_t find_last_not_of(const wxString& str, size_t nStart = npos) const { return m_impl.find_last_not_of(str.m_impl, nStart); } size_t find_last_not_of(const char* sz, size_t nStart = npos) const { return m_impl.find_last_not_of(ImplStr(sz), nStart); } size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const { return m_impl.find_last_not_of(ImplStr(sz), nStart); } size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); } size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); } size_t find_last_not_of(wxUniChar c, size_t nStart = npos) const { return m_impl.find_last_not_of((wxChar)c, nStart); } #else // we can't use std::string implementation in UTF-8 build, because the // character sets would be interpreted wrongly: // as strpbrk() but starts at nStart, returns npos if not found size_t find_first_of(const wxString& str, size_t nStart = 0) const #if wxUSE_UNICODE // FIXME-UTF8: temporary { return find_first_of(str.wc_str(), nStart); } #else { return find_first_of(str.mb_str(), nStart); } #endif // same as above size_t find_first_of(const char* sz, size_t nStart = 0) const; size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const; size_t find_first_of(const char* sz, size_t nStart, size_t n) const; size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const; // same as find(char, size_t) size_t find_first_of(wxUniChar c, size_t nStart = 0) const { return find(c, nStart); } // find the last (starting from nStart) char from str in this string size_t find_last_of (const wxString& str, size_t nStart = npos) const #if wxUSE_UNICODE // FIXME-UTF8: temporary { return find_last_of(str.wc_str(), nStart); } #else { return find_last_of(str.mb_str(), nStart); } #endif // same as above size_t find_last_of (const char* sz, size_t nStart = npos) const; size_t find_last_of (const wchar_t* sz, size_t nStart = npos) const; size_t find_last_of(const char* sz, size_t nStart, size_t n) const; size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const; // same as above size_t find_last_of(wxUniChar c, size_t nStart = npos) const { return rfind(c, nStart); } // find first/last occurrence of any character not in the set // as strspn() (starting from nStart), returns npos on failure size_t find_first_not_of(const wxString& str, size_t nStart = 0) const #if wxUSE_UNICODE // FIXME-UTF8: temporary { return find_first_not_of(str.wc_str(), nStart); } #else { return find_first_not_of(str.mb_str(), nStart); } #endif // same as above size_t find_first_not_of(const char* sz, size_t nStart = 0) const; size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const; size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const; size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const; // same as above size_t find_first_not_of(wxUniChar ch, size_t nStart = 0) const; // as strcspn() size_t find_last_not_of(const wxString& str, size_t nStart = npos) const #if wxUSE_UNICODE // FIXME-UTF8: temporary { return find_last_not_of(str.wc_str(), nStart); } #else { return find_last_not_of(str.mb_str(), nStart); } #endif // same as above size_t find_last_not_of(const char* sz, size_t nStart = npos) const; size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const; size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const; size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const; // same as above size_t find_last_not_of(wxUniChar ch, size_t nStart = npos) const; #endif // wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 or not // provide char/wchar_t/wxUniCharRef overloads for char-finding functions // above to resolve ambiguities: size_t find_first_of(wxUniCharRef ch, size_t nStart = 0) const { return find_first_of(wxUniChar(ch), nStart); } size_t find_first_of(char ch, size_t nStart = 0) const { return find_first_of(wxUniChar(ch), nStart); } size_t find_first_of(unsigned char ch, size_t nStart = 0) const { return find_first_of(wxUniChar(ch), nStart); } size_t find_first_of(wchar_t ch, size_t nStart = 0) const { return find_first_of(wxUniChar(ch), nStart); } size_t find_last_of(wxUniCharRef ch, size_t nStart = npos) const { return find_last_of(wxUniChar(ch), nStart); } size_t find_last_of(char ch, size_t nStart = npos) const { return find_last_of(wxUniChar(ch), nStart); } size_t find_last_of(unsigned char ch, size_t nStart = npos) const { return find_last_of(wxUniChar(ch), nStart); } size_t find_last_of(wchar_t ch, size_t nStart = npos) const { return find_last_of(wxUniChar(ch), nStart); } size_t find_first_not_of(wxUniCharRef ch, size_t nStart = 0) const { return find_first_not_of(wxUniChar(ch), nStart); } size_t find_first_not_of(char ch, size_t nStart = 0) const { return find_first_not_of(wxUniChar(ch), nStart); } size_t find_first_not_of(unsigned char ch, size_t nStart = 0) const { return find_first_not_of(wxUniChar(ch), nStart); } size_t find_first_not_of(wchar_t ch, size_t nStart = 0) const { return find_first_not_of(wxUniChar(ch), nStart); } size_t find_last_not_of(wxUniCharRef ch, size_t nStart = npos) const { return find_last_not_of(wxUniChar(ch), nStart); } size_t find_last_not_of(char ch, size_t nStart = npos) const { return find_last_not_of(wxUniChar(ch), nStart); } size_t find_last_not_of(unsigned char ch, size_t nStart = npos) const { return find_last_not_of(wxUniChar(ch), nStart); } size_t find_last_not_of(wchar_t ch, size_t nStart = npos) const { return find_last_not_of(wxUniChar(ch), nStart); } // and additional overloads for the versions taking strings: size_t find_first_of(const wxCStrData& sz, size_t nStart = 0) const { return find_first_of(sz.AsString(), nStart); } size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const { return find_first_of(sz.data(), nStart); } size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const { return find_first_of(sz.data(), nStart); } size_t find_first_of(const wxCStrData& sz, size_t nStart, size_t n) const { return find_first_of(sz.AsWChar(), nStart, n); } size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const { return find_first_of(sz.data(), nStart, n); } size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const { return find_first_of(sz.data(), nStart, n); } size_t find_last_of(const wxCStrData& sz, size_t nStart = 0) const { return find_last_of(sz.AsString(), nStart); } size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const { return find_last_of(sz.data(), nStart); } size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const { return find_last_of(sz.data(), nStart); } size_t find_last_of(const wxCStrData& sz, size_t nStart, size_t n) const { return find_last_of(sz.AsWChar(), nStart, n); } size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const { return find_last_of(sz.data(), nStart, n); } size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const { return find_last_of(sz.data(), nStart, n); } size_t find_first_not_of(const wxCStrData& sz, size_t nStart = 0) const { return find_first_not_of(sz.AsString(), nStart); } size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const { return find_first_not_of(sz.data(), nStart); } size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const { return find_first_not_of(sz.data(), nStart); } size_t find_first_not_of(const wxCStrData& sz, size_t nStart, size_t n) const { return find_first_not_of(sz.AsWChar(), nStart, n); } size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const { return find_first_not_of(sz.data(), nStart, n); } size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const { return find_first_not_of(sz.data(), nStart, n); } size_t find_last_not_of(const wxCStrData& sz, size_t nStart = 0) const { return find_last_not_of(sz.AsString(), nStart); } size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const { return find_last_not_of(sz.data(), nStart); } size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const { return find_last_not_of(sz.data(), nStart); } size_t find_last_not_of(const wxCStrData& sz, size_t nStart, size_t n) const { return find_last_not_of(sz.AsWChar(), nStart, n); } size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const { return find_last_not_of(sz.data(), nStart, n); } size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const { return find_last_not_of(sz.data(), nStart, n); } // string += string wxString& operator+=(const wxString& s) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl += s.m_impl; return *this; } // string += C string wxString& operator+=(const char *psz) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl += ImplStr(psz); return *this; } wxString& operator+=(const wchar_t *pwz) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl += ImplStr(pwz); return *this; } wxString& operator+=(const wxCStrData& s) { wxSTRING_INVALIDATE_CACHED_LENGTH(); m_impl += s.AsString().m_impl; return *this; } wxString& operator+=(const wxScopedCharBuffer& s) { return append(s); } wxString& operator+=(const wxScopedWCharBuffer& s) { return append(s); } // string += char wxString& operator+=(wxUniChar ch) { wxSTRING_UPDATE_CACHED_LENGTH(1); if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) m_impl += (wxStringCharType)ch; else m_impl += wxStringOperations::EncodeChar(ch); return *this; } wxString& operator+=(wxUniCharRef ch) { return *this += wxUniChar(ch); } wxString& operator+=(int ch) { return *this += wxUniChar(ch); } wxString& operator+=(char ch) { return *this += wxUniChar(ch); } wxString& operator+=(unsigned char ch) { return *this += wxUniChar(ch); } wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); } private: #if !wxUSE_STL_BASED_WXSTRING // helpers for wxStringBuffer and wxStringBufferLength wxStringCharType *DoGetWriteBuf(size_t nLen) { return m_impl.DoGetWriteBuf(nLen); } void DoUngetWriteBuf() { wxSTRING_INVALIDATE_CACHE(); m_impl.DoUngetWriteBuf(); } void DoUngetWriteBuf(size_t nLen) { wxSTRING_INVALIDATE_CACHE(); m_impl.DoUngetWriteBuf(nLen); } #endif // !wxUSE_STL_BASED_WXSTRING #if !wxUSE_UTF8_LOCALE_ONLY int DoPrintfWchar(const wxChar *format, ...); static wxString DoFormatWchar(const wxChar *format, ...); #endif #if wxUSE_UNICODE_UTF8 int DoPrintfUtf8(const char *format, ...); static wxString DoFormatUtf8(const char *format, ...); #endif #if !wxUSE_STL_BASED_WXSTRING // check string's data validity bool IsValid() const { return m_impl.GetStringData()->IsValid(); } #endif private: wxStringImpl m_impl; // buffers for compatibility conversion from (char*)c_str() and // (wchar_t*)c_str(): the pointers returned by these functions should remain // valid until the string itself is modified for compatibility with the // existing code and consistency with std::string::c_str() so returning a // temporary buffer won't do and we need to cache the conversion results // TODO-UTF8: benchmark various approaches to keeping compatibility buffers template<typename T> struct ConvertedBuffer { // notice that there is no need to initialize m_len here as it's unused // as long as m_str is NULL ConvertedBuffer() : m_str(NULL) {} ~ConvertedBuffer() { free(m_str); } bool Extend(size_t len) { // add extra 1 for the trailing NUL void * const str = realloc(m_str, sizeof(T)*(len + 1)); if ( !str ) return false; m_str = static_cast<T *>(str); m_len = len; return true; } const wxScopedCharTypeBuffer<T> AsScopedBuffer() const { return wxScopedCharTypeBuffer<T>::CreateNonOwned(m_str, m_len); } T *m_str; // pointer to the string data size_t m_len; // length, not size, i.e. in chars and without last NUL }; #if wxUSE_UNICODE // common mb_str() and wxCStrData::AsChar() helper: performs the conversion // and returns either m_convertedToChar.m_str (in which case its m_len is // also updated) or NULL if it failed // // there is an important exception: in wxUSE_UNICODE_UTF8 build if conv is a // UTF-8 one, we return m_impl.c_str() directly, without doing any conversion // as optimization and so the caller needs to check for this before using // m_convertedToChar // // NB: AsChar() returns char* in any build, unlike mb_str() const char *AsChar(const wxMBConv& conv) const; // mb_str() implementation helper wxScopedCharBuffer AsCharBuf(const wxMBConv& conv) const { #if wxUSE_UNICODE_UTF8 // avoid conversion if we can if ( conv.IsUTF8() ) { return wxScopedCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); } #endif // wxUSE_UNICODE_UTF8 // call this solely in order to fill in m_convertedToChar as AsChar() // updates it as a side effect: this is a bit ugly but it's a completely // internal function so the users of this class shouldn't care or know // about it and doing it like this, i.e. having a separate AsChar(), // allows us to avoid the creation and destruction of a temporary buffer // when using wxCStrData without duplicating any code if ( !AsChar(conv) ) { // although it would be probably more correct to return NULL buffer // from here if the conversion fails, a lot of existing code doesn't // expect mb_str() (or wc_str()) to ever return NULL so return an // empty string otherwise to avoid crashes in it // // also, some existing code does check for the conversion success and // so asserting here would be bad too -- even if it does mean that // silently losing data is possible for badly written code return wxScopedCharBuffer::CreateNonOwned("", 0); } return m_convertedToChar.AsScopedBuffer(); } ConvertedBuffer<char> m_convertedToChar; #endif // !wxUSE_UNICODE #if !wxUSE_UNICODE_WCHAR // common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI // builds: converts the string contents into m_convertedToWChar and returns // NULL if the conversion failed (this can only happen in ANSI build) // // NB: AsWChar() returns wchar_t* in any build, unlike wc_str() const wchar_t *AsWChar(const wxMBConv& conv) const; // wc_str() implementation helper wxScopedWCharBuffer AsWCharBuf(const wxMBConv& conv) const { if ( !AsWChar(conv) ) return wxScopedWCharBuffer::CreateNonOwned(L"", 0); return m_convertedToWChar.AsScopedBuffer(); } ConvertedBuffer<wchar_t> m_convertedToWChar; #endif // !wxUSE_UNICODE_WCHAR #if wxUSE_UNICODE_UTF8 // FIXME-UTF8: (try to) move this elsewhere (TLS) or solve differently // assigning to character pointer to by wxString::iterator may // change the underlying wxStringImpl iterator, so we have to // keep track of all iterators and update them as necessary: struct wxStringIteratorNodeHead { wxStringIteratorNodeHead() : ptr(NULL) {} wxStringIteratorNode *ptr; // copying is disallowed as it would result in more than one pointer into // the same linked list wxDECLARE_NO_COPY_CLASS(wxStringIteratorNodeHead); }; wxStringIteratorNodeHead m_iterators; friend class WXDLLIMPEXP_FWD_BASE wxStringIteratorNode; friend class WXDLLIMPEXP_FWD_BASE wxUniCharRef; #endif // wxUSE_UNICODE_UTF8 friend class WXDLLIMPEXP_FWD_BASE wxCStrData; friend class wxStringInternalBuffer; friend class wxStringInternalBufferLength; }; // string iterator operators that satisfy STL Random Access Iterator // requirements: inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i) { return i + n; } inline wxString::const_iterator operator+(ptrdiff_t n, wxString::const_iterator i) { return i + n; } inline wxString::reverse_iterator operator+(ptrdiff_t n, wxString::reverse_iterator i) { return i + n; } inline wxString::const_reverse_iterator operator+(ptrdiff_t n, wxString::const_reverse_iterator i) { return i + n; } // notice that even though for many compilers the friend declarations above are // enough, from the point of view of C++ standard we must have the declarations // here as friend ones are not injected in the enclosing namespace and without // them the code fails to compile with conforming compilers such as xlC or g++4 wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz); wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz); wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string); wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string); wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch); wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string); inline wxString operator+(const wxString& string, wxUniCharRef ch) { return string + (wxUniChar)ch; } inline wxString operator+(const wxString& string, char ch) { return string + wxUniChar(ch); } inline wxString operator+(const wxString& string, wchar_t ch) { return string + wxUniChar(ch); } inline wxString operator+(wxUniCharRef ch, const wxString& string) { return (wxUniChar)ch + string; } inline wxString operator+(char ch, const wxString& string) { return wxUniChar(ch) + string; } inline wxString operator+(wchar_t ch, const wxString& string) { return wxUniChar(ch) + string; } #define wxGetEmptyString() wxString() // ---------------------------------------------------------------------------- // helper functions which couldn't be defined inline // ---------------------------------------------------------------------------- namespace wxPrivate { #if wxUSE_UNICODE_WCHAR template <> struct wxStringAsBufHelper<char> { static wxScopedCharBuffer Get(const wxString& s, size_t *len) { wxScopedCharBuffer buf(s.mb_str()); if ( len ) *len = buf ? strlen(buf) : 0; return buf; } }; template <> struct wxStringAsBufHelper<wchar_t> { static wxScopedWCharBuffer Get(const wxString& s, size_t *len) { const size_t length = s.length(); if ( len ) *len = length; return wxScopedWCharBuffer::CreateNonOwned(s.wx_str(), length); } }; #elif wxUSE_UNICODE_UTF8 template <> struct wxStringAsBufHelper<char> { static wxScopedCharBuffer Get(const wxString& s, size_t *len) { const size_t length = s.utf8_length(); if ( len ) *len = length; return wxScopedCharBuffer::CreateNonOwned(s.wx_str(), length); } }; template <> struct wxStringAsBufHelper<wchar_t> { static wxScopedWCharBuffer Get(const wxString& s, size_t *len) { wxScopedWCharBuffer wbuf(s.wc_str()); if ( len ) *len = wxWcslen(wbuf); return wbuf; } }; #endif // Unicode build kind } // namespace wxPrivate // ---------------------------------------------------------------------------- // wxStringBuffer: a tiny class allowing to get a writable pointer into string // ---------------------------------------------------------------------------- #if !wxUSE_STL_BASED_WXSTRING // string buffer for direct access to string data in their native // representation: class wxStringInternalBuffer { public: typedef wxStringCharType CharType; wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) : m_str(str), m_buf(NULL) { m_buf = m_str.DoGetWriteBuf(lenWanted); } ~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); } operator wxStringCharType*() const { return m_buf; } private: wxString& m_str; wxStringCharType *m_buf; wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); }; class wxStringInternalBufferLength { public: typedef wxStringCharType CharType; wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) { m_buf = m_str.DoGetWriteBuf(lenWanted); wxASSERT(m_buf != NULL); } ~wxStringInternalBufferLength() { wxASSERT(m_lenSet); m_str.DoUngetWriteBuf(m_len); } operator wxStringCharType*() const { return m_buf; } void SetLength(size_t length) { m_len = length; m_lenSet = true; } private: wxString& m_str; wxStringCharType *m_buf; size_t m_len; bool m_lenSet; wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength); }; #endif // !wxUSE_STL_BASED_WXSTRING template<typename T> class wxStringTypeBufferBase { public: typedef T CharType; wxStringTypeBufferBase(wxString& str, size_t lenWanted = 1024) : m_str(str), m_buf(lenWanted) { // for compatibility with old wxStringBuffer which provided direct // access to wxString internal buffer, initialize ourselves with the // string initial contents size_t len; const wxCharTypeBuffer<CharType> buf(str.tchar_str<CharType>(&len)); if ( buf ) { if ( len > lenWanted ) { // in this case there is not enough space for terminating NUL, // ensure that we still put it there m_buf.data()[lenWanted] = 0; len = lenWanted - 1; } memcpy(m_buf.data(), buf, (len + 1)*sizeof(CharType)); } //else: conversion failed, this can happen when trying to get Unicode // string contents into a char string } operator CharType*() { return m_buf.data(); } protected: wxString& m_str; wxCharTypeBuffer<CharType> m_buf; }; template<typename T> class wxStringTypeBufferLengthBase : public wxStringTypeBufferBase<T> { public: wxStringTypeBufferLengthBase(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferBase<T>(str, lenWanted), m_len(0), m_lenSet(false) { } ~wxStringTypeBufferLengthBase() { wxASSERT_MSG( this->m_lenSet, "forgot to call SetLength()" ); } void SetLength(size_t length) { m_len = length; m_lenSet = true; } protected: size_t m_len; bool m_lenSet; }; template<typename T> class wxStringTypeBuffer : public wxStringTypeBufferBase<T> { public: wxStringTypeBuffer(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferBase<T>(str, lenWanted) { } ~wxStringTypeBuffer() { this->m_str.assign(this->m_buf.data()); } wxDECLARE_NO_COPY_CLASS(wxStringTypeBuffer); }; template<typename T> class wxStringTypeBufferLength : public wxStringTypeBufferLengthBase<T> { public: wxStringTypeBufferLength(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferLengthBase<T>(str, lenWanted) { } ~wxStringTypeBufferLength() { this->m_str.assign(this->m_buf.data(), this->m_len); } wxDECLARE_NO_COPY_CLASS(wxStringTypeBufferLength); }; #if wxUSE_STL_BASED_WXSTRING class wxStringInternalBuffer : public wxStringTypeBufferBase<wxStringCharType> { public: wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferBase<wxStringCharType>(str, lenWanted) {} ~wxStringInternalBuffer() { m_str.m_impl.assign(m_buf.data()); } wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); }; class wxStringInternalBufferLength : public wxStringTypeBufferLengthBase<wxStringCharType> { public: wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferLengthBase<wxStringCharType>(str, lenWanted) {} ~wxStringInternalBufferLength() { m_str.m_impl.assign(m_buf.data(), m_len); } wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength); }; #endif // wxUSE_STL_BASED_WXSTRING #if wxUSE_STL_BASED_WXSTRING || wxUSE_UNICODE_UTF8 typedef wxStringTypeBuffer<wxChar> wxStringBuffer; typedef wxStringTypeBufferLength<wxChar> wxStringBufferLength; #else // if !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 typedef wxStringInternalBuffer wxStringBuffer; typedef wxStringInternalBufferLength wxStringBufferLength; #endif // !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 #if wxUSE_UNICODE_UTF8 typedef wxStringInternalBuffer wxUTF8StringBuffer; typedef wxStringInternalBufferLength wxUTF8StringBufferLength; #elif wxUSE_UNICODE_WCHAR // Note about inlined dtors in the classes below: this is done not for // performance reasons but just to avoid linking errors in the MSVC DLL build // under Windows: if a class has non-inline methods it must be declared as // being DLL-exported but, due to an extremely interesting feature of MSVC 7 // and later, any template class which is used as a base of a DLL-exported // class is implicitly made DLL-exported too, as explained at the bottom of // http://msdn.microsoft.com/en-us/library/twa2aw10.aspx (just to confirm: yes, // _inheriting_ from a class can change whether it is being exported from DLL) // // But this results in link errors because the base template class is not DLL- // exported, whether it is declared with WXDLLIMPEXP_BASE or not, because it // does have only inline functions. So the simplest fix is to just make all the // functions of these classes inline too. class wxUTF8StringBuffer : public wxStringTypeBufferBase<char> { public: wxUTF8StringBuffer(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferBase<char>(str, lenWanted) {} ~wxUTF8StringBuffer() { wxMBConvStrictUTF8 conv; size_t wlen = conv.ToWChar(NULL, 0, m_buf); wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); wxStringInternalBuffer wbuf(m_str, wlen); conv.ToWChar(wbuf, wlen, m_buf); } wxDECLARE_NO_COPY_CLASS(wxUTF8StringBuffer); }; class wxUTF8StringBufferLength : public wxStringTypeBufferLengthBase<char> { public: wxUTF8StringBufferLength(wxString& str, size_t lenWanted = 1024) : wxStringTypeBufferLengthBase<char>(str, lenWanted) {} ~wxUTF8StringBufferLength() { wxCHECK_RET(m_lenSet, "length not set"); wxMBConvStrictUTF8 conv; size_t wlen = conv.ToWChar(NULL, 0, m_buf, m_len); wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); wxStringInternalBufferLength wbuf(m_str, wlen); conv.ToWChar(wbuf, wlen, m_buf, m_len); wbuf.SetLength(wlen); } wxDECLARE_NO_COPY_CLASS(wxUTF8StringBufferLength); }; #endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR // --------------------------------------------------------------------------- // wxString comparison functions: operator versions are always case sensitive // --------------------------------------------------------------------------- // comparison with C-style narrow and wide strings. #define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p) wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxString&, wxCMP_WXCHAR_STRING) wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_WXCHAR_STRING) #undef wxCMP_WXCHAR_STRING inline bool operator==(const wxString& s1, const wxString& s2) { return s1.IsSameAs(s2); } inline bool operator!=(const wxString& s1, const wxString& s2) { return !s1.IsSameAs(s2); } inline bool operator< (const wxString& s1, const wxString& s2) { return s1.Cmp(s2) < 0; } inline bool operator> (const wxString& s1, const wxString& s2) { return s1.Cmp(s2) > 0; } inline bool operator<=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) <= 0; } inline bool operator>=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) >= 0; } inline bool operator==(const wxString& s1, const wxCStrData& s2) { return s1 == s2.AsString(); } inline bool operator==(const wxCStrData& s1, const wxString& s2) { return s1.AsString() == s2; } inline bool operator!=(const wxString& s1, const wxCStrData& s2) { return s1 != s2.AsString(); } inline bool operator!=(const wxCStrData& s1, const wxString& s2) { return s1.AsString() != s2; } inline bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2) { return (s1.Cmp((const wchar_t *)s2) == 0); } inline bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const wchar_t *)s1) == 0); } inline bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2) { return (s1.Cmp((const wchar_t *)s2) != 0); } inline bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const wchar_t *)s1) != 0); } inline bool operator==(const wxString& s1, const wxScopedCharBuffer& s2) { return (s1.Cmp((const char *)s2) == 0); } inline bool operator==(const wxScopedCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const char *)s1) == 0); } inline bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2) { return (s1.Cmp((const char *)s2) != 0); } inline bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const char *)s1) != 0); } inline wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf) { return string + (const wchar_t *)buf; } inline wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string) { return (const wchar_t *)buf + string; } inline wxString operator+(const wxString& string, const wxScopedCharBuffer& buf) { return string + (const char *)buf; } inline wxString operator+(const wxScopedCharBuffer& buf, const wxString& string) { return (const char *)buf + string; } // comparison with char inline bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); } inline bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); } inline bool operator==(char c, const wxString& s) { return s.IsSameAs(c); } inline bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); } inline bool operator==(int c, const wxString& s) { return s.IsSameAs(c); } inline bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); } inline bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); } inline bool operator==(const wxString& s, char c) { return s.IsSameAs(c); } inline bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); } inline bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); } inline bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); } inline bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); } inline bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); } inline bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); } inline bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); } inline bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); } inline bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); } inline bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); } // wxString iterators comparisons inline bool wxString::iterator::operator==(const const_iterator& i) const { return i == *this; } inline bool wxString::iterator::operator!=(const const_iterator& i) const { return i != *this; } inline bool wxString::iterator::operator<(const const_iterator& i) const { return i > *this; } inline bool wxString::iterator::operator>(const const_iterator& i) const { return i < *this; } inline bool wxString::iterator::operator<=(const const_iterator& i) const { return i >= *this; } inline bool wxString::iterator::operator>=(const const_iterator& i) const { return i <= *this; } // we also need to provide the operators for comparison with wxCStrData to // resolve ambiguity between operator(const wxChar *,const wxString &) and // operator(const wxChar *, const wxChar *) for "p == s.c_str()" // // notice that these are (shallow) pointer comparisons, not (deep) string ones #define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar() #define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar() wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA) wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA) #undef wxCMP_CHAR_CSTRDATA #undef wxCMP_WCHAR_CSTRDATA // ---------------------------------------------------------------------------- // Implement hashing using C++11 std::hash<>. // ---------------------------------------------------------------------------- // Check for both compiler and standard library support for C++11: normally the // former implies the latter but under Mac OS X < 10.7 C++11 compiler can (and // even has to be) used with non-C++11 standard library, so explicitly exclude // this case. #if (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10)) \ && ( (!defined __GLIBCXX__) || (__GLIBCXX__ > 20070719) ) // Don't do this if ToStdWstring() is not available. We could work around it // but, presumably, if using std::wstring is undesirable, then so is using // std::hash<> anyhow. #if wxUSE_STD_STRING #include <functional> namespace std { template<> struct hash<wxString> { size_t operator()(const wxString& s) const { return std::hash<std::wstring>()(s.ToStdWstring()); } }; } // namespace std #endif // wxUSE_STD_STRING #endif // C++11 // Specialize std::iter_swap in C++11 to make std::reverse() work with wxString // iterators: unlike in C++98, where iter_swap() is required to deal with the // iterator::reference being different from "iterator::value_type&", in C++11 // iter_swap() just calls swap() by default and this doesn't work for us as // wxUniCharRef is not the same as "wxUniChar&". // // Unfortunately currently iter_swap() can't be specialized when using libc++, // see https://llvm.org/bugs/show_bug.cgi?id=28559 #if (__cplusplus >= 201103L) && !defined(_LIBCPP_VERSION) namespace std { template <> inline void iter_swap<wxString::iterator>(wxString::iterator i1, wxString::iterator i2) { // We don't check for i1 == i2, this won't happen in normal use, so // don't pessimize the common code to account for it. wxUniChar tmp = *i1; *i1 = *i2; *i2 = tmp; } } // namespace std #endif // C++11 // --------------------------------------------------------------------------- // Implementation only from here until the end of file // --------------------------------------------------------------------------- #if wxUSE_STD_IOSTREAM #include "wx/iosfwrap.h" WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxCStrData&); WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuffer&); #ifndef __BORLANDC__ WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&); #endif #if wxUSE_UNICODE && defined(HAVE_WOSTREAM) WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxString&); WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxCStrData&); WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxScopedWCharBuffer&); #endif // wxUSE_UNICODE && defined(HAVE_WOSTREAM) #endif // wxUSE_STD_IOSTREAM // --------------------------------------------------------------------------- // wxCStrData implementation // --------------------------------------------------------------------------- inline wxCStrData::wxCStrData(char *buf) : m_str(new wxString(buf)), m_offset(0), m_owned(true) {} inline wxCStrData::wxCStrData(wchar_t *buf) : m_str(new wxString(buf)), m_offset(0), m_owned(true) {} inline wxCStrData::wxCStrData(const wxCStrData& data) : m_str(data.m_owned ? new wxString(*data.m_str) : data.m_str), m_offset(data.m_offset), m_owned(data.m_owned) { } inline wxCStrData::~wxCStrData() { if ( m_owned ) delete const_cast<wxString*>(m_str); // cast to silence warnings } // AsChar() and AsWChar() implementations simply forward to wxString methods inline const wchar_t* wxCStrData::AsWChar() const { const wchar_t * const p = #if wxUSE_UNICODE_WCHAR m_str->wc_str(); #elif wxUSE_UNICODE_UTF8 m_str->AsWChar(wxMBConvStrictUTF8()); #else m_str->AsWChar(wxConvLibc); #endif // in Unicode build the string always has a valid Unicode representation // and even if a conversion is needed (as in UTF8 case) it can't fail // // but in ANSI build the string contents might be not convertible to // Unicode using the current locale encoding so we do need to check for // errors #if !wxUSE_UNICODE if ( !p ) { // if conversion fails, return empty string and not NULL to avoid // crashes in code written with either wxWidgets 2 wxString or // std::string behaviour in mind: neither of them ever returns NULL // from its c_str() and so we shouldn't neither // // notice that the same is done in AsChar() below and // wxString::wc_str() and mb_str() for the same reasons return L""; } #endif // !wxUSE_UNICODE return p + m_offset; } inline const char* wxCStrData::AsChar() const { #if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY const char * const p = m_str->AsChar(wxConvLibc); if ( !p ) return ""; #else // !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY const char * const p = m_str->mb_str(); #endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY return p + m_offset; } inline wxString wxCStrData::AsString() const { if ( m_offset == 0 ) return *m_str; else return m_str->Mid(m_offset); } inline const wxStringCharType *wxCStrData::AsInternal() const { #if wxUSE_UNICODE_UTF8 return wxStringOperations::AddToIter(m_str->wx_str(), m_offset); #else return m_str->wx_str() + m_offset; #endif } inline wxUniChar wxCStrData::operator*() const { if ( m_str->empty() ) return wxUniChar(wxT('\0')); else return (*m_str)[m_offset]; } inline wxUniChar wxCStrData::operator[](size_t n) const { // NB: we intentionally use operator[] and not at() here because the former // works for the terminating NUL while the latter does not return (*m_str)[m_offset + n]; } // ---------------------------------------------------------------------------- // more wxCStrData operators // ---------------------------------------------------------------------------- // we need to define those to allow "size_t pos = p - s.c_str()" where p is // some pointer into the string inline size_t operator-(const char *p, const wxCStrData& cs) { return p - cs.AsChar(); } inline size_t operator-(const wchar_t *p, const wxCStrData& cs) { return p - cs.AsWChar(); } // ---------------------------------------------------------------------------- // implementation of wx[W]CharBuffer inline methods using wxCStrData // ---------------------------------------------------------------------------- // FIXME-UTF8: move this to buffer.h inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr) : wxCharTypeBufferBase(cstr.AsCharBuf()) { } inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr) : wxCharTypeBufferBase(cstr.AsWCharBuf()) { } #if wxUSE_UNICODE_UTF8 // ---------------------------------------------------------------------------- // implementation of wxStringIteratorNode inline methods // ---------------------------------------------------------------------------- void wxStringIteratorNode::DoSet(const wxString *str, wxStringImpl::const_iterator *citer, wxStringImpl::iterator *iter) { m_prev = NULL; m_iter = iter; m_citer = citer; m_str = str; if ( str ) { m_next = str->m_iterators.ptr; const_cast<wxString*>(m_str)->m_iterators.ptr = this; if ( m_next ) m_next->m_prev = this; } else { m_next = NULL; } } void wxStringIteratorNode::clear() { if ( m_next ) m_next->m_prev = m_prev; if ( m_prev ) m_prev->m_next = m_next; else if ( m_str ) // first in the list const_cast<wxString*>(m_str)->m_iterators.ptr = m_next; m_next = m_prev = NULL; m_citer = NULL; m_iter = NULL; m_str = NULL; } #endif // wxUSE_UNICODE_UTF8 #if WXWIN_COMPATIBILITY_2_8 // lot of code out there doesn't explicitly include wx/crt.h, but uses // CRT wrappers that are now declared in wx/wxcrt.h and wx/wxcrtvararg.h, // so let's include this header now that wxString is defined and it's safe // to do it: #include "wx/crt.h" #endif // ---------------------------------------------------------------------------- // Checks on wxString characters // ---------------------------------------------------------------------------- template<bool (T)(const wxUniChar& c)> inline bool wxStringCheck(const wxString& val) { for ( wxString::const_iterator i = val.begin(); i != val.end(); ++i ) if (T(*i) == 0) return false; return true; } #endif // _WX_WXSTRING_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/sashwin.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/sashwin.h // Purpose: Base header for wxSashWindow // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SASHWIN_H_BASE_ #define _WX_SASHWIN_H_BASE_ #include "wx/generic/sashwin.h" #endif // _WX_SASHWIN_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/help.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/help.h // Purpose: wxHelpController base header // Author: wxWidgets Team // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_HELP_H_BASE_ #define _WX_HELP_H_BASE_ #include "wx/defs.h" #if wxUSE_HELP #include "wx/helpbase.h" #if defined(__WXMSW__) #include "wx/msw/helpchm.h" #define wxHelpController wxCHMHelpController #else // !MSW #if wxUSE_WXHTML_HELP #include "wx/html/helpctrl.h" #define wxHelpController wxHtmlHelpController #else #include "wx/generic/helpext.h" #define wxHelpController wxExtHelpController #endif #endif // MSW/!MSW #endif // wxUSE_HELP #endif // _WX_HELP_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/archive.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/archive.h // Purpose: Streams for archive formats // Author: Mike Wetherell // Copyright: (c) 2004 Mike Wetherell // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ARCHIVE_H__ #define _WX_ARCHIVE_H__ #include "wx/defs.h" #if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS #include "wx/stream.h" #include "wx/filename.h" ///////////////////////////////////////////////////////////////////////////// // wxArchiveNotifier class WXDLLIMPEXP_BASE wxArchiveNotifier { public: virtual ~wxArchiveNotifier() { } virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0; }; ///////////////////////////////////////////////////////////////////////////// // wxArchiveEntry // // Holds an entry's meta data, such as filename and timestamp. class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject { public: virtual ~wxArchiveEntry() { } virtual wxDateTime GetDateTime() const = 0; virtual wxFileOffset GetSize() const = 0; virtual wxFileOffset GetOffset() const = 0; virtual bool IsDir() const = 0; virtual bool IsReadOnly() const = 0; virtual wxString GetInternalName() const = 0; virtual wxPathFormat GetInternalFormat() const = 0; virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0; virtual void SetDateTime(const wxDateTime& dt) = 0; virtual void SetSize(wxFileOffset size) = 0; virtual void SetIsDir(bool isDir = true) = 0; virtual void SetIsReadOnly(bool isReadOnly = true) = 0; virtual void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE) = 0; wxArchiveEntry *Clone() const { return DoClone(); } void SetNotifier(wxArchiveNotifier& notifier); virtual void UnsetNotifier() { m_notifier = NULL; } protected: wxArchiveEntry() : m_notifier(NULL) { } wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { } virtual void SetOffset(wxFileOffset offset) = 0; virtual wxArchiveEntry* DoClone() const = 0; wxArchiveNotifier *GetNotifier() const { return m_notifier; } wxArchiveEntry& operator=(const wxArchiveEntry& entry); private: wxArchiveNotifier *m_notifier; wxDECLARE_ABSTRACT_CLASS(wxArchiveEntry); }; ///////////////////////////////////////////////////////////////////////////// // wxArchiveInputStream // // GetNextEntry() returns an wxArchiveEntry object containing the meta-data // for the next entry in the archive (and gives away ownership). Reading from // the wxArchiveInputStream then returns the entry's data. Eof() becomes true // after an attempt has been made to read past the end of the entry's data. // // When there are no more entries, GetNextEntry() returns NULL and sets Eof(). class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream { public: typedef wxArchiveEntry entry_type; virtual ~wxArchiveInputStream() { } virtual bool OpenEntry(wxArchiveEntry& entry) = 0; virtual bool CloseEntry() = 0; wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); } virtual char Peek() wxOVERRIDE { return wxInputStream::Peek(); } protected: wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv); wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv); virtual wxArchiveEntry *DoGetNextEntry() = 0; wxMBConv& GetConv() const { return m_conv; } private: wxMBConv& m_conv; }; ///////////////////////////////////////////////////////////////////////////// // wxArchiveOutputStream // // PutNextEntry is used to create a new entry in the output archive, then // the entry's data is written to the wxArchiveOutputStream. // // Only one entry can be open for output at a time; another call to // PutNextEntry closes the current entry and begins the next. // // The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership // of the entry object. class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream { public: virtual ~wxArchiveOutputStream() { } virtual bool PutNextEntry(wxArchiveEntry *entry) = 0; virtual bool PutNextEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now(), wxFileOffset size = wxInvalidOffset) = 0; virtual bool PutNextDirEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now()) = 0; virtual bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream) = 0; virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0; virtual bool CloseEntry() = 0; protected: wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv); wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv); wxMBConv& GetConv() const { return m_conv; } private: wxMBConv& m_conv; }; ///////////////////////////////////////////////////////////////////////////// // wxArchiveIterator // // An input iterator that can be used to transfer an archive's catalog to // a container. #if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR #include <iterator> #include <utility> template <class X, class Y> inline void _wxSetArchiveIteratorValue( X& val, Y entry, void *WXUNUSED(d)) { val = X(entry); } template <class X, class Y, class Z> inline void _wxSetArchiveIteratorValue( std::pair<X, Y>& val, Z entry, Z WXUNUSED(d)) { val = std::make_pair(X(entry->GetInternalName()), Y(entry)); } template <class Arc, class T = typename Arc::entry_type*> class wxArchiveIterator { public: typedef std::input_iterator_tag iterator_category; typedef T value_type; typedef ptrdiff_t difference_type; typedef T* pointer; typedef T& reference; wxArchiveIterator() : m_rep(NULL) { } wxArchiveIterator(Arc& arc) { typename Arc::entry_type* entry = arc.GetNextEntry(); m_rep = entry ? new Rep(arc, entry) : NULL; } wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) { if (m_rep) m_rep->AddRef(); } ~wxArchiveIterator() { if (m_rep) m_rep->UnRef(); } const T& operator *() const { return m_rep->GetValue(); } const T* operator ->() const { return &**this; } wxArchiveIterator& operator =(const wxArchiveIterator& it) { if (it.m_rep) it.m_rep.AddRef(); if (m_rep) this->m_rep.UnRef(); m_rep = it.m_rep; return *this; } wxArchiveIterator& operator ++() { m_rep = m_rep->Next(); return *this; } wxArchiveIterator operator ++(int) { wxArchiveIterator it(*this); ++(*this); return it; } bool operator ==(const wxArchiveIterator& j) const { return m_rep == j.m_rep; } bool operator !=(const wxArchiveIterator& j) const { return !(*this == j); } private: class Rep { Arc& m_arc; typename Arc::entry_type* m_entry; T m_value; int m_ref; public: Rep(Arc& arc, typename Arc::entry_type* entry) : m_arc(arc), m_entry(entry), m_value(), m_ref(1) { } ~Rep() { delete m_entry; } void AddRef() { m_ref++; } void UnRef() { if (--m_ref == 0) delete this; } Rep *Next() { typename Arc::entry_type* entry = m_arc.GetNextEntry(); if (!entry) { UnRef(); return NULL; } if (m_ref > 1) { m_ref--; return new Rep(m_arc, entry); } delete m_entry; m_entry = entry; m_value = T(); return this; } const T& GetValue() { if (m_entry) { _wxSetArchiveIteratorValue(m_value, m_entry, m_entry); m_entry = NULL; } return m_value; } } *m_rep; }; typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter; typedef wxArchiveIterator<wxArchiveInputStream, std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter; #endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR ///////////////////////////////////////////////////////////////////////////// // wxArchiveClassFactory // // A wxArchiveClassFactory instance for a particular archive type allows // the creation of the other classes that may be needed. void WXDLLIMPEXP_BASE wxUseArchiveClasses(); class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase { public: typedef wxArchiveEntry entry_type; typedef wxArchiveInputStream instream_type; typedef wxArchiveOutputStream outstream_type; typedef wxArchiveNotifier notifier_type; #if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR typedef wxArchiveIter iter_type; typedef wxArchivePairIter pairiter_type; #endif virtual ~wxArchiveClassFactory() { } wxArchiveEntry *NewEntry() const { return DoNewEntry(); } wxArchiveInputStream *NewStream(wxInputStream& stream) const { return DoNewStream(stream); } wxArchiveOutputStream *NewStream(wxOutputStream& stream) const { return DoNewStream(stream); } wxArchiveInputStream *NewStream(wxInputStream *stream) const { return DoNewStream(stream); } wxArchiveOutputStream *NewStream(wxOutputStream *stream) const { return DoNewStream(stream); } virtual wxString GetInternalName( const wxString& name, wxPathFormat format = wxPATH_NATIVE) const = 0; // FIXME-UTF8: remove these from this file, they are used for ANSI // build only void SetConv(wxMBConv& conv) { m_pConv = &conv; } wxMBConv& GetConv() const { if (m_pConv) return *m_pConv; else return wxConvLocal; } static const wxArchiveClassFactory *Find(const wxString& protocol, wxStreamProtocolType type = wxSTREAM_PROTOCOL); static const wxArchiveClassFactory *GetFirst(); const wxArchiveClassFactory *GetNext() const { return m_next; } void PushFront() { Remove(); m_next = sm_first; sm_first = this; } void Remove(); protected: // old compilers don't support covarient returns, so 'Do' methods are // used to simulate them virtual wxArchiveEntry *DoNewEntry() const = 0; virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0; virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0; virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0; virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0; wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { } wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f)) { return *this; } private: wxMBConv *m_pConv; static wxArchiveClassFactory *sm_first; wxArchiveClassFactory *m_next; wxDECLARE_ABSTRACT_CLASS(wxArchiveClassFactory); }; #endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS #endif // _WX_ARCHIVE_H__
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/print.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/print.h // Purpose: Base header for printer classes // Author: Julian Smart // Modified by: // Created: // Copyright: (c) Julian Smart // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_PRINT_H_BASE_ #define _WX_PRINT_H_BASE_ #include "wx/defs.h" #if wxUSE_PRINTING_ARCHITECTURE #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/printwin.h" #elif defined(__WXMAC__) #include "wx/osx/printmac.h" #elif defined(__WXQT__) #include "wx/qt/printqt.h" #else #include "wx/generic/printps.h" #endif #endif // wxUSE_PRINTING_ARCHITECTURE #endif // _WX_PRINT_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/compiler.h
/* * Name: wx/compiler.h * Purpose: Compiler-specific macro definitions. * Author: Vadim Zeitlin * Created: 2013-07-13 (extracted from wx/platform.h) * Copyright: (c) 1997-2013 Vadim Zeitlin <[email protected]> * Licence: wxWindows licence */ /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ #ifndef _WX_COMPILER_H_ #define _WX_COMPILER_H_ /* Compiler detection and related helpers. */ /* Notice that Intel compiler can be used as Microsoft Visual C++ add-on and so we should define both __INTELC__ and __VISUALC__ for it. */ #ifdef __INTEL_COMPILER # define __INTELC__ #endif #if defined(_MSC_VER) /* define another standard symbol for Microsoft Visual C++: the standard one (_MSC_VER) is also defined by some other compilers. */ # define __VISUALC__ _MSC_VER /* define special symbols for different VC version instead of writing tests for magic numbers such as 1200, 1300 &c repeatedly */ #if __VISUALC__ < 1300 # error "This Visual C++ version is not supported any longer (at least MSVC 2003 required)." #elif __VISUALC__ < 1400 # define __VISUALC7__ #elif __VISUALC__ < 1500 # define __VISUALC8__ #elif __VISUALC__ < 1600 # define __VISUALC9__ #elif __VISUALC__ < 1700 # define __VISUALC10__ #elif __VISUALC__ < 1800 # define __VISUALC11__ #elif __VISUALC__ < 1900 # define __VISUALC12__ #elif __VISUALC__ < 2000 /* There is no __VISUALC13__! */ # define __VISUALC14__ #else /* Don't forget to update include/msvc/wx/setup.h as well when adding support for a newer MSVC version here. */ # pragma message("Please update wx/compiler.h to recognize this VC++ version") #endif #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) # define __BORLANDC__ #elif defined(__SUNPRO_CC) # ifndef __SUNCC__ # define __SUNCC__ __SUNPRO_CC # endif /* Sun CC */ #endif /* compiler */ /* Macros for checking compiler version. */ /* This macro can be used to test the gcc version and can be used like this: # if wxCHECK_GCC_VERSION(3, 1) ... we have gcc 3.1 or later ... # else ... no gcc at all or gcc < 3.1 ... # endif */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) #define wxCHECK_GCC_VERSION( major, minor ) \ ( ( __GNUC__ > (major) ) \ || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) #else #define wxCHECK_GCC_VERSION( major, minor ) 0 #endif /* This macro can be used to test the Visual C++ version. */ #ifndef __VISUALC__ # define wxVISUALC_VERSION(major) 0 # define wxCHECK_VISUALC_VERSION(major) 0 #else /* Things used to be simple with the _MSC_VER value and the version number increasing in lock step, but _MSC_VER value of 1900 is VC14 and not the non existing (presumably for the superstitious reasons) VC13, so we now need to account for this with an extra offset. */ # define wxVISUALC_VERSION(major) ( (6 - (major >= 14 ? 1 : 0) + major) * 100 ) # define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) ) #endif /** This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler. */ #ifdef __SUNCC__ /* __SUNCC__ is 0xVRP where V is major version, R release and P patch level */ #define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4))) #else #define wxCHECK_SUNCC_VERSION(maj, min) (0) #endif /* wxCHECK_MINGW32_VERSION() is defined in wx/msw/gccpriv.h which is included later, see comments there. */ #endif // _WX_COMPILER_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/wxchar.h
////////////////////////////////////////////////////////////////////////////// // Name: wx/wxchar.h // Purpose: Declarations common to wx char/wchar_t usage (wide chars) // Author: Joel Farley, Ove Kåven // Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee // Created: 1998/06/12 // Copyright: (c) 1998-2006 wxWidgets dev team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_WXCHAR_H_ #define _WX_WXCHAR_H_ // This header used to define CRT functions wrappers in wxWidgets 2.8. This is // now done in (headers included by) wx/crt.h, so include it for compatibility: #include "wx/crt.h" #endif /* _WX_WXCHAR_H_ */
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ptr_scpd.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/ptr_scpd.h // Purpose: compatibility wrapper for wxScoped{Ptr,Array} // Author: Vadim Zeitlin // Created: 2009-02-03 // Copyright: (c) 2009 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // do not include this file in any new code, include either wx/scopedptr.h or // wx/scopedarray.h (or both) instead #include "wx/scopedarray.h" #include "wx/scopedptr.h"
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/containr.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/containr.h // Purpose: wxControlContainer and wxNavigationEnabled declarations // Author: Vadim Zeitlin // Modified by: // Created: 06.08.01 // Copyright: (c) 2001, 2011 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_CONTAINR_H_ #define _WX_CONTAINR_H_ #include "wx/defs.h" #ifndef wxHAS_NATIVE_TAB_TRAVERSAL // We need wxEVT_XXX declarations in this case. #include "wx/event.h" #endif class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxWindowBase; /* This header declares wxControlContainer class however it's not a real container of controls but rather just a helper used to implement TAB navigation among the window children. You should rarely need to use it directly, derive from the documented public wxNavigationEnabled<> class to implement TAB navigation in a custom composite window. */ // ---------------------------------------------------------------------------- // wxControlContainerBase: common part used in both native and generic cases // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxControlContainerBase { public: // default ctor, SetContainerWindow() must be called later wxControlContainerBase() { m_winParent = NULL; // By default, we accept focus ourselves. m_acceptsFocusSelf = true; // But we don't have any children accepting it yet. m_acceptsFocusChildren = false; m_inSetFocus = false; m_winLastFocused = NULL; } virtual ~wxControlContainerBase() {} void SetContainerWindow(wxWindow *winParent) { wxASSERT_MSG( !m_winParent, wxT("shouldn't be called twice") ); m_winParent = winParent; } // This can be called by the window to indicate that it never wants to have // the focus for itself. void DisableSelfFocus() { m_acceptsFocusSelf = false; UpdateParentCanFocus(); } // This can be called to undo the effect of a previous DisableSelfFocus() // (otherwise calling it is not necessary as the window does accept focus // by default). void EnableSelfFocus() { m_acceptsFocusSelf = true; UpdateParentCanFocus(); } // should be called from SetFocus(), returns false if we did nothing with // the focus and the default processing should take place bool DoSetFocus(); // returns whether we should accept focus ourselves or not bool AcceptsFocus() const; // Returns whether we or one of our children accepts focus. bool AcceptsFocusRecursively() const { return AcceptsFocus() || (m_acceptsFocusChildren && HasAnyChildrenAcceptingFocus()); } // We accept focus from keyboard if we accept it at all. bool AcceptsFocusFromKeyboard() const { return AcceptsFocusRecursively(); } // Call this when the number of children of the window changes. // // Returns true if we have any focusable children, false otherwise. bool UpdateCanFocusChildren(); #ifdef __WXMSW__ // This is not strictly related to navigation, but all windows containing // more than one children controls need to return from this method if any // of their parents has an inheritable background, so do this automatically // for all of them (another alternative could be to do it in wxWindow // itself but this would be potentially more backwards incompatible and // could conceivably break some custom windows). bool HasTransparentBackground() const; #endif // __WXMSW__ protected: // set the focus to the child which had it the last time virtual bool SetFocusToChild(); // return true if we have any children accepting focus bool HasAnyFocusableChildren() const; // return true if we have any children that do accept focus right now bool HasAnyChildrenAcceptingFocus() const; // the parent window we manage the children for wxWindow *m_winParent; // the child which had the focus last time this panel was activated wxWindow *m_winLastFocused; private: // Update the window status to reflect whether it is getting focus or not. void UpdateParentCanFocus(); // Indicates whether the associated window can ever have focus itself. // // Usually this is the case, e.g. a wxPanel can be used either as a // container for its children or just as a normal window which can be // focused. But sometimes, e.g. for wxStaticBox, we can never have focus // ourselves and can only get it if we have any focusable children. bool m_acceptsFocusSelf; // Cached value remembering whether we have any children accepting focus. bool m_acceptsFocusChildren; // a guard against infinite recursion bool m_inSetFocus; }; #ifdef wxHAS_NATIVE_TAB_TRAVERSAL // ---------------------------------------------------------------------------- // wxControlContainer for native TAB navigation // ---------------------------------------------------------------------------- // this must be a real class as we forward-declare it elsewhere class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase { protected: // set the focus to the child which had it the last time virtual bool SetFocusToChild() wxOVERRIDE; }; #else // !wxHAS_NATIVE_TAB_TRAVERSAL // ---------------------------------------------------------------------------- // wxControlContainer for TAB navigation implemented in wx itself // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase { public: // default ctor, SetContainerWindow() must be called later wxControlContainer(); // the methods to be called from the window event handlers void HandleOnNavigationKey(wxNavigationKeyEvent& event); void HandleOnFocus(wxFocusEvent& event); void HandleOnWindowDestroy(wxWindowBase *child); // called from OnChildFocus() handler, i.e. when one of our (grand) // children gets the focus void SetLastFocus(wxWindow *win); protected: wxDECLARE_NO_COPY_CLASS(wxControlContainer); }; #endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL // this function is for wxWidgets internal use only extern WXDLLIMPEXP_CORE bool wxSetFocusToChild(wxWindow *win, wxWindow **child); // ---------------------------------------------------------------------------- // wxNavigationEnabled: Derive from this class to support keyboard navigation // among window children in a wxWindow-derived class. The details of this class // don't matter, you just need to derive from it to make navigation work. // ---------------------------------------------------------------------------- // The template parameter W must be a wxWindow-derived class. template <class W> class wxNavigationEnabled : public W { public: typedef W BaseWindowClass; wxNavigationEnabled() { m_container.SetContainerWindow(this); #ifndef wxHAS_NATIVE_TAB_TRAVERSAL BaseWindowClass::Bind(wxEVT_NAVIGATION_KEY, &wxNavigationEnabled::OnNavigationKey, this); BaseWindowClass::Bind(wxEVT_SET_FOCUS, &wxNavigationEnabled::OnFocus, this); BaseWindowClass::Bind(wxEVT_CHILD_FOCUS, &wxNavigationEnabled::OnChildFocus, this); #endif // !wxHAS_NATIVE_TAB_TRAVERSAL } WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const wxOVERRIDE { return m_container.AcceptsFocus(); } WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const wxOVERRIDE { return m_container.AcceptsFocusRecursively(); } WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return m_container.AcceptsFocusFromKeyboard(); } WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child) wxOVERRIDE { BaseWindowClass::AddChild(child); if ( m_container.UpdateCanFocusChildren() ) { // Under MSW we must have wxTAB_TRAVERSAL style for TAB navigation // to work. if ( !BaseWindowClass::HasFlag(wxTAB_TRAVERSAL) ) BaseWindowClass::ToggleWindowStyle(wxTAB_TRAVERSAL); } } WXDLLIMPEXP_INLINE_CORE virtual void RemoveChild(wxWindowBase *child) wxOVERRIDE { #ifndef wxHAS_NATIVE_TAB_TRAVERSAL m_container.HandleOnWindowDestroy(child); #endif // !wxHAS_NATIVE_TAB_TRAVERSAL BaseWindowClass::RemoveChild(child); // We could reset wxTAB_TRAVERSAL here but it doesn't seem to do any // harm to keep it. m_container.UpdateCanFocusChildren(); } WXDLLIMPEXP_INLINE_CORE virtual void SetFocus() wxOVERRIDE { if ( !m_container.DoSetFocus() ) BaseWindowClass::SetFocus(); } void SetFocusIgnoringChildren() { BaseWindowClass::SetFocus(); } #ifdef __WXMSW__ WXDLLIMPEXP_INLINE_CORE virtual bool HasTransparentBackground() wxOVERRIDE { return m_container.HasTransparentBackground(); } #endif // __WXMSW__ protected: #ifndef wxHAS_NATIVE_TAB_TRAVERSAL void OnNavigationKey(wxNavigationKeyEvent& event) { m_container.HandleOnNavigationKey(event); } void OnFocus(wxFocusEvent& event) { m_container.HandleOnFocus(event); } void OnChildFocus(wxChildFocusEvent& event) { m_container.SetLastFocus(event.GetWindow()); event.Skip(); } #endif // !wxHAS_NATIVE_TAB_TRAVERSAL wxControlContainer m_container; wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxNavigationEnabled, W); }; // ---------------------------------------------------------------------------- // Compatibility macros from now on, do NOT use them and preferably do not even // look at them. // ---------------------------------------------------------------------------- #if WXWIN_COMPATIBILITY_2_8 // common part of WX_DECLARE_CONTROL_CONTAINER in the native and generic cases, // it should be used in the wxWindow-derived class declaration #define WX_DECLARE_CONTROL_CONTAINER_BASE() \ public: \ virtual bool AcceptsFocus() const; \ virtual bool AcceptsFocusRecursively() const; \ virtual bool AcceptsFocusFromKeyboard() const; \ virtual void AddChild(wxWindowBase *child); \ virtual void RemoveChild(wxWindowBase *child); \ virtual void SetFocus(); \ void SetFocusIgnoringChildren(); \ \ protected: \ wxControlContainer m_container // this macro must be used in the derived class ctor #define WX_INIT_CONTROL_CONTAINER() \ m_container.SetContainerWindow(this) // common part of WX_DELEGATE_TO_CONTROL_CONTAINER in the native and generic // cases, must be used in the wxWindow-derived class implementation #define WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \ void classname::AddChild(wxWindowBase *child) \ { \ basename::AddChild(child); \ \ m_container.UpdateCanFocusChildren(); \ } \ \ bool classname::AcceptsFocusRecursively() const \ { \ return m_container.AcceptsFocusRecursively(); \ } \ \ void classname::SetFocus() \ { \ if ( !m_container.DoSetFocus() ) \ basename::SetFocus(); \ } \ \ bool classname::AcceptsFocus() const \ { \ return m_container.AcceptsFocus(); \ } \ \ bool classname::AcceptsFocusFromKeyboard() const \ { \ return m_container.AcceptsFocusFromKeyboard(); \ } #ifdef wxHAS_NATIVE_TAB_TRAVERSAL #define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) #define WX_DECLARE_CONTROL_CONTAINER WX_DECLARE_CONTROL_CONTAINER_BASE #define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \ \ void classname::RemoveChild(wxWindowBase *child) \ { \ basename::RemoveChild(child); \ \ m_container.UpdateCanFocusChildren(); \ } \ \ void classname::SetFocusIgnoringChildren() \ { \ basename::SetFocus(); \ } #else // !wxHAS_NATIVE_TAB_TRAVERSAL // declare the methods to be forwarded #define WX_DECLARE_CONTROL_CONTAINER() \ WX_DECLARE_CONTROL_CONTAINER_BASE(); \ \ public: \ void OnNavigationKey(wxNavigationKeyEvent& event); \ void OnFocus(wxFocusEvent& event); \ virtual void OnChildFocus(wxChildFocusEvent& event) // implement the event table entries for wxControlContainer #define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \ EVT_SET_FOCUS(classname::OnFocus) \ EVT_CHILD_FOCUS(classname::OnChildFocus) \ EVT_NAVIGATION_KEY(classname::OnNavigationKey) // implement the methods forwarding to the wxControlContainer #define WX_DELEGATE_TO_CONTROL_CONTAINER(classname, basename) \ WX_DELEGATE_TO_CONTROL_CONTAINER_BASE(classname, basename) \ \ void classname::RemoveChild(wxWindowBase *child) \ { \ m_container.HandleOnWindowDestroy(child); \ \ basename::RemoveChild(child); \ \ m_container.UpdateCanFocusChildren(); \ } \ \ void classname::OnNavigationKey( wxNavigationKeyEvent& event ) \ { \ m_container.HandleOnNavigationKey(event); \ } \ \ void classname::SetFocusIgnoringChildren() \ { \ basename::SetFocus(); \ } \ \ void classname::OnChildFocus(wxChildFocusEvent& event) \ { \ m_container.SetLastFocus(event.GetWindow()); \ event.Skip(); \ } \ \ void classname::OnFocus(wxFocusEvent& event) \ { \ m_container.HandleOnFocus(event); \ } #endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL #endif // WXWIN_COMPATIBILITY_2_8 #endif // _WX_CONTAINR_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/datetime.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/datetime.h // Purpose: declarations of time/date related classes (wxDateTime, // wxTimeSpan) // Author: Vadim Zeitlin // Modified by: // Created: 10.02.99 // Copyright: (c) 1998 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DATETIME_H #define _WX_DATETIME_H #include "wx/defs.h" #if wxUSE_DATETIME #include <time.h> #include <limits.h> // for INT_MIN #include "wx/longlong.h" #include "wx/anystr.h" class WXDLLIMPEXP_FWD_BASE wxDateTime; class WXDLLIMPEXP_FWD_BASE wxTimeSpan; class WXDLLIMPEXP_FWD_BASE wxDateSpan; #ifdef __WINDOWS__ struct _SYSTEMTIME; #endif #include "wx/dynarray.h" // not all c-runtimes are based on 1/1/1970 being (time_t) 0 // set this to the corresponding value in seconds 1/1/1970 has on your // systems c-runtime #define WX_TIME_BASE_OFFSET 0 /* * TODO * * + 1. Time zones with minutes (make TimeZone a class) * ? 2. getdate() function like under Solaris * + 3. text conversion for wxDateSpan * + 4. pluggable modules for the workdays calculations * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts */ /* The three (main) classes declared in this header represent: 1. An absolute moment in the time (wxDateTime) 2. A difference between two moments in the time, positive or negative (wxTimeSpan) 3. A logical difference between two dates expressed in years/months/weeks/days (wxDateSpan) The following arithmetic operations are permitted (all others are not): addition -------- wxDateTime + wxTimeSpan = wxDateTime wxDateTime + wxDateSpan = wxDateTime wxTimeSpan + wxTimeSpan = wxTimeSpan wxDateSpan + wxDateSpan = wxDateSpan subtraction ------------ wxDateTime - wxDateTime = wxTimeSpan wxDateTime - wxTimeSpan = wxDateTime wxDateTime - wxDateSpan = wxDateTime wxTimeSpan - wxTimeSpan = wxTimeSpan wxDateSpan - wxDateSpan = wxDateSpan multiplication -------------- wxTimeSpan * number = wxTimeSpan number * wxTimeSpan = wxTimeSpan wxDateSpan * number = wxDateSpan number * wxDateSpan = wxDateSpan unitary minus ------------- -wxTimeSpan = wxTimeSpan -wxDateSpan = wxDateSpan For each binary operation OP (+, -, *) we have the following operatorOP=() as a method and the method with a symbolic name OPER (Add, Subtract, Multiply) as a synonym for it and another const method with the same name which returns the changed copy of the object and operatorOP() as a global function which is implemented in terms of the const version of OPEN. For the unary - we have operator-() as a method, Neg() as synonym for it and Negate() which returns the copy of the object with the changed sign. */ // an invalid/default date time object which may be used as the default // argument for arguments of type wxDateTime; it is also returned by all // functions returning wxDateTime on failure (this is why it is also called // wxInvalidDateTime) class WXDLLIMPEXP_FWD_BASE wxDateTime; extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultDateTimeFormat[]; extern WXDLLIMPEXP_DATA_BASE(const char) wxDefaultTimeSpanFormat[]; extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; #define wxInvalidDateTime wxDefaultDateTime // ---------------------------------------------------------------------------- // conditional compilation // ---------------------------------------------------------------------------- // if configure detected strftime(), we have it too #ifdef HAVE_STRFTIME #define wxHAS_STRFTIME // suppose everyone else has strftime #else #define wxHAS_STRFTIME #endif // ---------------------------------------------------------------------------- // wxDateTime represents an absolute moment in the time // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxDateTime { public: // types // ------------------------------------------------------------------------ // a small unsigned integer type for storing things like minutes, // seconds &c. It should be at least short (i.e. not char) to contain // the number of milliseconds - it may also be 'int' because there is // no size penalty associated with it in our code, we don't store any // data in this format typedef unsigned short wxDateTime_t; // constants // ------------------------------------------------------------------------ // the timezones enum TZ { // the time in the current time zone Local, // zones from GMT (= Greenwich Mean Time): they're guaranteed to be // consequent numbers, so writing something like `GMT0 + offset' is // safe if abs(offset) <= 12 // underscore stands for minus GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7, GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1, GMT0, GMT1, GMT2, GMT3, GMT4, GMT5, GMT6, GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13, // Note that GMT12 and GMT_12 are not the same: there is a difference // of exactly one day between them // some symbolic names for TZ // Europe WET = GMT0, // Western Europe Time WEST = GMT1, // Western Europe Summer Time CET = GMT1, // Central Europe Time CEST = GMT2, // Central Europe Summer Time EET = GMT2, // Eastern Europe Time EEST = GMT3, // Eastern Europe Summer Time MSK = GMT3, // Moscow Time MSD = GMT4, // Moscow Summer Time // US and Canada AST = GMT_4, // Atlantic Standard Time ADT = GMT_3, // Atlantic Daylight Time EST = GMT_5, // Eastern Standard Time EDT = GMT_4, // Eastern Daylight Saving Time CST = GMT_6, // Central Standard Time CDT = GMT_5, // Central Daylight Saving Time MST = GMT_7, // Mountain Standard Time MDT = GMT_6, // Mountain Daylight Saving Time PST = GMT_8, // Pacific Standard Time PDT = GMT_7, // Pacific Daylight Saving Time HST = GMT_10, // Hawaiian Standard Time AKST = GMT_9, // Alaska Standard Time AKDT = GMT_8, // Alaska Daylight Saving Time // Australia A_WST = GMT8, // Western Standard Time A_CST = GMT13 + 1, // Central Standard Time (+9.5) A_EST = GMT10, // Eastern Standard Time A_ESST = GMT11, // Eastern Summer Time // New Zealand NZST = GMT12, // Standard Time NZDT = GMT13, // Daylight Saving Time // TODO add more symbolic timezone names here // Universal Coordinated Time = the new and politically correct name // for GMT UTC = GMT0 }; // the calendar systems we know about: notice that it's valid (for // this classes purpose anyhow) to work with any of these calendars // even with the dates before the historical appearance of the // calendar enum Calendar { Gregorian, // current calendar Julian // calendar in use since -45 until the 1582 (or later) // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?) }; // the country parameter is used so far for calculating the start and // the end of DST period and for deciding whether the date is a work // day or not // // TODO move this to intl.h enum Country { Country_Unknown, // no special information for this country Country_Default, // set the default country with SetCountry() method // or use the default country with any other // TODO add more countries (for this we must know about DST and/or // holidays for this country) // Western European countries: we assume that they all follow the same // DST rules (true or false?) Country_WesternEurope_Start, Country_EEC = Country_WesternEurope_Start, France, Germany, UK, Country_WesternEurope_End = UK, Russia, USA }; // symbolic names for the months enum Month { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month }; // symbolic names for the weekdays enum WeekDay { Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay }; // invalid value for the year enum Year { Inv_Year = SHRT_MIN // should hold in wxDateTime_t }; // flags for GetWeekDayName and GetMonthName enum NameFlags { Name_Full = 0x01, // return full name Name_Abbr = 0x02 // return abbreviated name }; // flags for GetWeekOfYear and GetWeekOfMonth enum WeekFlags { Default_First, // Sunday_First for US, Monday_First for the rest Monday_First, // week starts with a Monday Sunday_First // week starts with a Sunday }; // Currently we assume that DST is always shifted by 1 hour, this seems to // be always true in practice. If this ever needs to change, search for all // places using DST_OFFSET and update them. enum { DST_OFFSET = 3600 }; // helper classes // ------------------------------------------------------------------------ // a class representing a time zone: basically, this is just an offset // (in seconds) from GMT class WXDLLIMPEXP_BASE TimeZone { public: TimeZone(TZ tz); // create time zone object with the given offset TimeZone(long offset = 0) { m_offset = offset; } static TimeZone Make(long offset) { TimeZone tz; tz.m_offset = offset; return tz; } bool IsLocal() const { return m_offset == -1; } long GetOffset() const; private: // offset for this timezone from GMT in seconds long m_offset; }; // standard struct tm is limited to the years from 1900 (because // tm_year field is the offset from 1900), so we use our own struct // instead to represent broken down time // // NB: this struct should always be kept normalized (i.e. mon should // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays() // instead of modifying the member fields directly! struct WXDLLIMPEXP_BASE Tm { wxDateTime_t msec, sec, min, hour, mday, // Day of the month in 1..31 range. yday; // Day of the year in 0..365 range. Month mon; int year; // default ctor inits the object to an invalid value Tm(); // ctor from struct tm and the timezone Tm(const struct tm& tm, const TimeZone& tz); // check that the given date/time is valid (in Gregorian calendar) bool IsValid() const; // get the week day WeekDay GetWeekDay() // not const because wday may be changed { if ( wday == Inv_WeekDay ) ComputeWeekDay(); return (WeekDay)wday; } // add the given number of months to the date keeping it normalized void AddMonths(int monDiff); // add the given number of months to the date keeping it normalized void AddDays(int dayDiff); private: // compute the weekday from other fields void ComputeWeekDay(); // the timezone we correspond to TimeZone m_tz; // This value can only be accessed via GetWeekDay() and not directly // because it's not always computed when creating this object and may // need to be calculated on demand. wxDateTime_t wday; }; // static methods // ------------------------------------------------------------------------ // set the current country static void SetCountry(Country country); // get the current country static Country GetCountry(); // return true if the country is a West European one (in practice, // this means that the same DST rules as for EEC apply) static bool IsWestEuropeanCountry(Country country = Country_Default); // return the current year static int GetCurrentYear(Calendar cal = Gregorian); // convert the year as returned by wxDateTime::GetYear() to a year // suitable for BC/AD notation. The difference is that BC year 1 // corresponds to the year 0 (while BC year 0 didn't exist) and AD // year N is just year N. static int ConvertYearToBC(int year); // return the current month static Month GetCurrentMonth(Calendar cal = Gregorian); // returns true if the given year is a leap year in the given calendar static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian); // acquires the first day of week based on locale and/or OS settings static bool GetFirstWeekDay(WeekDay *firstDay); // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC) static int GetCentury(int year); // returns the number of days in this year (356 or 355 for Gregorian // calendar usually :-) static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian); // get the number of the days in the given month (default value for // the year means the current one) static wxDateTime_t GetNumberOfDays(Month month, int year = Inv_Year, Calendar cal = Gregorian); // get the full (default) or abbreviated month name in the current // locale, returns empty string on error static wxString GetMonthName(Month month, NameFlags flags = Name_Full); // get the standard English full (default) or abbreviated month name static wxString GetEnglishMonthName(Month month, NameFlags flags = Name_Full); // get the full (default) or abbreviated weekday name in the current // locale, returns empty string on error static wxString GetWeekDayName(WeekDay weekday, NameFlags flags = Name_Full); // get the standard English full (default) or abbreviated weekday name static wxString GetEnglishWeekDayName(WeekDay weekday, NameFlags flags = Name_Full); // get the AM and PM strings in the current locale (may be empty) static void GetAmPmStrings(wxString *am, wxString *pm); // return true if the given country uses DST for this year static bool IsDSTApplicable(int year = Inv_Year, Country country = Country_Default); // get the beginning of DST for this year, will return invalid object // if no DST applicable in this year. The default value of the // parameter means to take the current year. static wxDateTime GetBeginDST(int year = Inv_Year, Country country = Country_Default); // get the end of DST for this year, will return invalid object // if no DST applicable in this year. The default value of the // parameter means to take the current year. static wxDateTime GetEndDST(int year = Inv_Year, Country country = Country_Default); // return the wxDateTime object for the current time static inline wxDateTime Now(); // return the wxDateTime object for the current time with millisecond // precision (if available on this platform) static wxDateTime UNow(); // return the wxDateTime object for today midnight: i.e. as Now() but // with time set to 0 static inline wxDateTime Today(); // constructors: you should test whether the constructor succeeded with // IsValid() function. The values Inv_Month and Inv_Year for the // parameters mean take current month and/or year values. // ------------------------------------------------------------------------ // default ctor does not initialize the object, use Set()! wxDateTime() { m_time = wxINT64_MIN; } // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) inline wxDateTime(time_t timet); // from broken down time/date (only for standard Unix range) inline wxDateTime(const struct tm& tm); // from broken down time/date (any range) inline wxDateTime(const Tm& tm); // from JDN (beware of rounding errors) inline wxDateTime(double jdn); // from separate values for each component, date set to today inline wxDateTime(wxDateTime_t hour, wxDateTime_t minute = 0, wxDateTime_t second = 0, wxDateTime_t millisec = 0); // from separate values for each component with explicit date inline wxDateTime(wxDateTime_t day, // day of the month Month month, int year = Inv_Year, // 1999, not 99 please! wxDateTime_t hour = 0, wxDateTime_t minute = 0, wxDateTime_t second = 0, wxDateTime_t millisec = 0); #ifdef __WINDOWS__ wxDateTime(const struct _SYSTEMTIME& st) { SetFromMSWSysTime(st); } #endif // default copy ctor ok // no dtor // assignment operators and Set() functions: all non const methods return // the reference to this object. IsValid() should be used to test whether // the function succeeded. // ------------------------------------------------------------------------ // set to the current time inline wxDateTime& SetToCurrent(); // set to given time_t value inline wxDateTime& Set(time_t timet); // set to given broken down time/date wxDateTime& Set(const struct tm& tm); // set to given broken down time/date inline wxDateTime& Set(const Tm& tm); // set to given JDN (beware of rounding errors) wxDateTime& Set(double jdn); // set to given time, date = today wxDateTime& Set(wxDateTime_t hour, wxDateTime_t minute = 0, wxDateTime_t second = 0, wxDateTime_t millisec = 0); // from separate values for each component with explicit date // (defaults for month and year are the current values) wxDateTime& Set(wxDateTime_t day, Month month, int year = Inv_Year, // 1999, not 99 please! wxDateTime_t hour = 0, wxDateTime_t minute = 0, wxDateTime_t second = 0, wxDateTime_t millisec = 0); // resets time to 00:00:00, doesn't change the date wxDateTime& ResetTime(); // get the date part of this object only, i.e. the object which has the // same date as this one but time of 00:00:00 wxDateTime GetDateOnly() const; // the following functions don't change the values of the other // fields, i.e. SetMinute() won't change either hour or seconds value // set the year wxDateTime& SetYear(int year); // set the month wxDateTime& SetMonth(Month month); // set the day of the month wxDateTime& SetDay(wxDateTime_t day); // set hour wxDateTime& SetHour(wxDateTime_t hour); // set minute wxDateTime& SetMinute(wxDateTime_t minute); // set second wxDateTime& SetSecond(wxDateTime_t second); // set millisecond wxDateTime& SetMillisecond(wxDateTime_t millisecond); // assignment operator from time_t wxDateTime& operator=(time_t timet) { return Set(timet); } // assignment operator from broken down time/date wxDateTime& operator=(const struct tm& tm) { return Set(tm); } // assignment operator from broken down time/date wxDateTime& operator=(const Tm& tm) { return Set(tm); } // default assignment operator is ok // calendar calculations (functions which set the date only leave the time // unchanged, e.g. don't explicitly zero it): SetXXX() functions modify the // object itself, GetXXX() ones return a new object. // ------------------------------------------------------------------------ // set to the given week day in the same week as this one wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, WeekFlags flags = Monday_First); inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday, WeekFlags flags = Monday_First) const; // set to the next week day following this one wxDateTime& SetToNextWeekDay(WeekDay weekday); inline wxDateTime GetNextWeekDay(WeekDay weekday) const; // set to the previous week day before this one wxDateTime& SetToPrevWeekDay(WeekDay weekday); inline wxDateTime GetPrevWeekDay(WeekDay weekday) const; // set to Nth occurrence of given weekday in the given month of the // given year (time is set to 0), return true on success and false on // failure. n may be positive (1..5) or negative to count from the end // of the month (see helper function SetToLastWeekDay()) bool SetToWeekDay(WeekDay weekday, int n = 1, Month month = Inv_Month, int year = Inv_Year); inline wxDateTime GetWeekDay(WeekDay weekday, int n = 1, Month month = Inv_Month, int year = Inv_Year) const; // sets to the last weekday in the given month, year inline bool SetToLastWeekDay(WeekDay weekday, Month month = Inv_Month, int year = Inv_Year); inline wxDateTime GetLastWeekDay(WeekDay weekday, Month month = Inv_Month, int year = Inv_Year); // returns the date corresponding to the given week day of the given // week (in ISO notation) of the specified year static wxDateTime SetToWeekOfYear(int year, wxDateTime_t numWeek, WeekDay weekday = Mon); // sets the date to the last day of the given (or current) month or the // given (or current) year wxDateTime& SetToLastMonthDay(Month month = Inv_Month, int year = Inv_Year); inline wxDateTime GetLastMonthDay(Month month = Inv_Month, int year = Inv_Year) const; // sets to the given year day (1..365 or 366) wxDateTime& SetToYearDay(wxDateTime_t yday); inline wxDateTime GetYearDay(wxDateTime_t yday) const; // The definitions below were taken verbatim from // // http://www.capecod.net/~pbaum/date/date0.htm // // (Peter Baum's home page) // // definition: The Julian Day Number, Julian Day, or JD of a // particular instant of time is the number of days and fractions of a // day since 12 hours Universal Time (Greenwich mean noon) on January // 1 of the year -4712, where the year is given in the Julian // proleptic calendar. The idea of using this reference date was // originally proposed by Joseph Scalizer in 1582 to count years but // it was modified by 19th century astronomers to count days. One // could have equivalently defined the reference time to be noon of // November 24, -4713 if were understood that Gregorian calendar rules // were applied. Julian days are Julian Day Numbers and are not to be // confused with Julian dates. // // definition: The Rata Die number is a date specified as the number // of days relative to a base date of December 31 of the year 0. Thus // January 1 of the year 1 is Rata Die day 1. // get the Julian Day number (the fractional part specifies the time of // the day, related to noon - beware of rounding errors!) double GetJulianDayNumber() const; double GetJDN() const { return GetJulianDayNumber(); } // get the Modified Julian Day number: it is equal to JDN - 2400000.5 // and so integral MJDs correspond to the midnights (and not noons). // MJD 0 is Nov 17, 1858 double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; } double GetMJD() const { return GetModifiedJulianDayNumber(); } // get the Rata Die number double GetRataDie() const; // TODO algorithms for calculating some important dates, such as // religious holidays (Easter...) or moon/solar eclipses? Some // algorithms can be found in the calendar FAQ // Timezone stuff: a wxDateTime object constructed using given // day/month/year/hour/min/sec values is interpreted as this moment in // local time. Using the functions below, it may be converted to another // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()). // // These functions try to handle DST internally, but there is no magical // way to know all rules for it in all countries in the world, so if the // program can handle it itself (or doesn't want to handle it at all for // whatever reason), the DST handling can be disabled with noDST. // ------------------------------------------------------------------------ // transform to any given timezone inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const; wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false); // interpret current value as being in another timezone and transform // it to local one inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const; wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false); // transform to/from GMT/UTC wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); } wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); } wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); } wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); } wxDateTime FromUTC(bool noDST = false) const { return FromTimezone(UTC, noDST); } wxDateTime& MakeFromUTC(bool noDST = false) { return MakeFromTimezone(UTC, noDST); } // is daylight savings time in effect at this moment according to the // rules of the specified country? // // Return value is > 0 if DST is in effect, 0 if it is not and -1 if // the information is not available (this is compatible with ANSI C) int IsDST(Country country = Country_Default) const; // accessors: many of them take the timezone parameter which indicates the // timezone for which to make the calculations and the default value means // to do it for the current timezone of this machine (even if the function // only operates with the date it's necessary because a date may wrap as // result of timezone shift) // ------------------------------------------------------------------------ // is the date valid? inline bool IsValid() const { return m_time != wxLongLong(wxINT64_MIN); } // get the broken down date/time representation in the given timezone // // If you wish to get several time components (day, month and year), // consider getting the whole Tm strcuture first and retrieving the // value from it - this is much more efficient Tm GetTm(const TimeZone& tz = Local) const; // get the number of seconds since the Unix epoch - returns (time_t)-1 // if the value is out of range inline time_t GetTicks() const; // get the century, same as GetCentury(GetYear()) int GetCentury(const TimeZone& tz = Local) const { return GetCentury(GetYear(tz)); } // get the year (returns Inv_Year if date is invalid) int GetYear(const TimeZone& tz = Local) const { return GetTm(tz).year; } // get the month (Inv_Month if date is invalid) Month GetMonth(const TimeZone& tz = Local) const { return (Month)GetTm(tz).mon; } // get the month day (in 1..31 range, 0 if date is invalid) wxDateTime_t GetDay(const TimeZone& tz = Local) const { return GetTm(tz).mday; } // get the day of the week (Inv_WeekDay if date is invalid) WeekDay GetWeekDay(const TimeZone& tz = Local) const { return GetTm(tz).GetWeekDay(); } // get the hour of the day wxDateTime_t GetHour(const TimeZone& tz = Local) const { return GetTm(tz).hour; } // get the minute wxDateTime_t GetMinute(const TimeZone& tz = Local) const { return GetTm(tz).min; } // get the second wxDateTime_t GetSecond(const TimeZone& tz = Local) const { return GetTm(tz).sec; } // get milliseconds wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const { return GetTm(tz).msec; } // get the day since the year start (1..366, 0 if date is invalid) wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const; // get the week number since the year start (1..52 or 53, 0 if date is // invalid) wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First, const TimeZone& tz = Local) const; // get the year to which the number returned from GetWeekOfYear() // belongs int GetWeekBasedYear(const TimeZone& tz = Local) const; // get the week number since the month start (1..5, 0 if date is // invalid) wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First, const TimeZone& tz = Local) const; // is this date a work day? This depends on a country, of course, // because the holidays are different in different countries bool IsWorkDay(Country country = Country_Default) const; // dos date and time format // ------------------------------------------------------------------------ // set from the DOS packed format wxDateTime& SetFromDOS(unsigned long ddt); // pack the date in DOS format unsigned long GetAsDOS() const; // SYSTEMTIME format // ------------------------------------------------------------------------ #ifdef __WINDOWS__ // convert SYSTEMTIME to wxDateTime wxDateTime& SetFromMSWSysTime(const struct _SYSTEMTIME& st); // convert wxDateTime to SYSTEMTIME void GetAsMSWSysTime(struct _SYSTEMTIME* st) const; // same as above but only take date part into account, time is always zero wxDateTime& SetFromMSWSysDate(const struct _SYSTEMTIME& st); void GetAsMSWSysDate(struct _SYSTEMTIME* st) const; #endif // __WINDOWS__ // comparison (see also functions below for operator versions) // ------------------------------------------------------------------------ // returns true if the two moments are strictly identical inline bool IsEqualTo(const wxDateTime& datetime) const; // returns true if the date is strictly earlier than the given one inline bool IsEarlierThan(const wxDateTime& datetime) const; // returns true if the date is strictly later than the given one inline bool IsLaterThan(const wxDateTime& datetime) const; // returns true if the date is strictly in the given range inline bool IsStrictlyBetween(const wxDateTime& t1, const wxDateTime& t2) const; // returns true if the date is in the given range inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const; // do these two objects refer to the same date? inline bool IsSameDate(const wxDateTime& dt) const; // do these two objects have the same time? inline bool IsSameTime(const wxDateTime& dt) const; // are these two objects equal up to given timespan? inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const; inline bool operator<(const wxDateTime& dt) const { return GetValue() < dt.GetValue(); } inline bool operator<=(const wxDateTime& dt) const { return GetValue() <= dt.GetValue(); } inline bool operator>(const wxDateTime& dt) const { return GetValue() > dt.GetValue(); } inline bool operator>=(const wxDateTime& dt) const { return GetValue() >= dt.GetValue(); } inline bool operator==(const wxDateTime& dt) const { // Intentionally do not call GetValue() here, in order that // invalid wxDateTimes may be compared for equality return m_time == dt.m_time; } inline bool operator!=(const wxDateTime& dt) const { // As above, don't use GetValue() here. return m_time != dt.m_time; } // arithmetics with dates (see also below for more operators) // ------------------------------------------------------------------------ // return the sum of the date with a time span (positive or negative) inline wxDateTime Add(const wxTimeSpan& diff) const; // add a time span (positive or negative) inline wxDateTime& Add(const wxTimeSpan& diff); // add a time span (positive or negative) inline wxDateTime& operator+=(const wxTimeSpan& diff); inline wxDateTime operator+(const wxTimeSpan& ts) const { wxDateTime dt(*this); dt.Add(ts); return dt; } // return the difference of the date with a time span inline wxDateTime Subtract(const wxTimeSpan& diff) const; // subtract a time span (positive or negative) inline wxDateTime& Subtract(const wxTimeSpan& diff); // subtract a time span (positive or negative) inline wxDateTime& operator-=(const wxTimeSpan& diff); inline wxDateTime operator-(const wxTimeSpan& ts) const { wxDateTime dt(*this); dt.Subtract(ts); return dt; } // return the sum of the date with a date span inline wxDateTime Add(const wxDateSpan& diff) const; // add a date span (positive or negative) wxDateTime& Add(const wxDateSpan& diff); // add a date span (positive or negative) inline wxDateTime& operator+=(const wxDateSpan& diff); inline wxDateTime operator+(const wxDateSpan& ds) const { wxDateTime dt(*this); dt.Add(ds); return dt; } // return the difference of the date with a date span inline wxDateTime Subtract(const wxDateSpan& diff) const; // subtract a date span (positive or negative) inline wxDateTime& Subtract(const wxDateSpan& diff); // subtract a date span (positive or negative) inline wxDateTime& operator-=(const wxDateSpan& diff); inline wxDateTime operator-(const wxDateSpan& ds) const { wxDateTime dt(*this); dt.Subtract(ds); return dt; } // return the difference between two dates inline wxTimeSpan Subtract(const wxDateTime& dt) const; inline wxTimeSpan operator-(const wxDateTime& dt2) const; wxDateSpan DiffAsDateSpan(const wxDateTime& dt) const; // conversion to/from text // ------------------------------------------------------------------------ // all conversions functions return true to indicate whether parsing // succeeded or failed and fill in the provided end iterator, which must // not be NULL, with the location of the character where the parsing // stopped (this will be end() of the passed string if everything was // parsed) // parse a string in RFC 822 format (found e.g. in mail headers and // having the form "Wed, 10 Feb 1999 19:07:07 +0100") bool ParseRfc822Date(const wxString& date, wxString::const_iterator *end); // parse a date/time in the given format (see strptime(3)), fill in // the missing (in the string) fields with the values of dateDef (by // default, they will not change if they had valid values or will // default to Today() otherwise) bool ParseFormat(const wxString& date, const wxString& format, const wxDateTime& dateDef, wxString::const_iterator *end); bool ParseFormat(const wxString& date, const wxString& format, wxString::const_iterator *end) { return ParseFormat(date, format, wxDefaultDateTime, end); } bool ParseFormat(const wxString& date, wxString::const_iterator *end) { return ParseFormat(date, wxDefaultDateTimeFormat, wxDefaultDateTime, end); } // parse a string containing date, time or both in ISO 8601 format // // notice that these functions are new in wx 3.0 and so we don't // provide compatibility overloads for them bool ParseISODate(const wxString& date) { wxString::const_iterator end; return ParseFormat(date, wxS("%Y-%m-%d"), &end) && end == date.end(); } bool ParseISOTime(const wxString& time) { wxString::const_iterator end; return ParseFormat(time, wxS("%H:%M:%S"), &end) && end == time.end(); } bool ParseISOCombined(const wxString& datetime, char sep = 'T') { wxString::const_iterator end; const wxString fmt = wxS("%Y-%m-%d") + wxString(sep) + wxS("%H:%M:%S"); return ParseFormat(datetime, fmt, &end) && end == datetime.end(); } // parse a string containing the date/time in "free" format, this // function will try to make an educated guess at the string contents bool ParseDateTime(const wxString& datetime, wxString::const_iterator *end); // parse a string containing the date only in "free" format (less // flexible than ParseDateTime) bool ParseDate(const wxString& date, wxString::const_iterator *end); // parse a string containing the time only in "free" format bool ParseTime(const wxString& time, wxString::const_iterator *end); // this function accepts strftime()-like format string (default // argument corresponds to the preferred date and time representation // for the current locale) and returns the string containing the // resulting text representation wxString Format(const wxString& format = wxDefaultDateTimeFormat, const TimeZone& tz = Local) const; // preferred date representation for the current locale wxString FormatDate() const { return Format(wxS("%x")); } // preferred time representation for the current locale wxString FormatTime() const { return Format(wxS("%X")); } // returns the string representing the date in ISO 8601 format // (YYYY-MM-DD) wxString FormatISODate() const { return Format(wxS("%Y-%m-%d")); } // returns the string representing the time in ISO 8601 format // (HH:MM:SS) wxString FormatISOTime() const { return Format(wxS("%H:%M:%S")); } // return the combined date time representation in ISO 8601 format; the // separator character should be 'T' according to the standard but it // can also be useful to set it to ' ' wxString FormatISOCombined(char sep = 'T') const { return FormatISODate() + sep + FormatISOTime(); } // backwards compatible versions of the parsing functions: they return an // object representing the next character following the date specification // (i.e. the one where the scan had to stop) or a special NULL-like object // on failure // // they're not deprecated because a lot of existing code uses them and // there is no particular harm in keeping them but you should still prefer // the versions above in the new code wxAnyStrPtr ParseRfc822Date(const wxString& date) { wxString::const_iterator end; return ParseRfc822Date(date, &end) ? wxAnyStrPtr(date, end) : wxAnyStrPtr(); } wxAnyStrPtr ParseFormat(const wxString& date, const wxString& format = wxDefaultDateTimeFormat, const wxDateTime& dateDef = wxDefaultDateTime) { wxString::const_iterator end; return ParseFormat(date, format, dateDef, &end) ? wxAnyStrPtr(date, end) : wxAnyStrPtr(); } wxAnyStrPtr ParseDateTime(const wxString& datetime) { wxString::const_iterator end; return ParseDateTime(datetime, &end) ? wxAnyStrPtr(datetime, end) : wxAnyStrPtr(); } wxAnyStrPtr ParseDate(const wxString& date) { wxString::const_iterator end; return ParseDate(date, &end) ? wxAnyStrPtr(date, end) : wxAnyStrPtr(); } wxAnyStrPtr ParseTime(const wxString& time) { wxString::const_iterator end; return ParseTime(time, &end) ? wxAnyStrPtr(time, end) : wxAnyStrPtr(); } // In addition to wxAnyStrPtr versions above we also must provide the // overloads for C strings as we must return a pointer into the original // string and not inside a temporary wxString which would have been created // if the overloads above were used. // // And then we also have to provide the overloads for wxCStrData, as usual. // Unfortunately those ones can't return anything as we don't have any // sufficiently long-lived wxAnyStrPtr to return from them: any temporary // strings it would point to would be destroyed when this function returns // making it impossible to dereference the return value. So we just don't // return anything from here which at least allows to keep compatibility // with the code not testing the return value. Other uses of this method // need to be converted to use one of the new bool-returning overloads // above. void ParseRfc822Date(const wxCStrData& date) { ParseRfc822Date(wxString(date)); } const char* ParseRfc822Date(const char* date); const wchar_t* ParseRfc822Date(const wchar_t* date); void ParseFormat(const wxCStrData& date, const wxString& format = wxDefaultDateTimeFormat, const wxDateTime& dateDef = wxDefaultDateTime) { ParseFormat(wxString(date), format, dateDef); } const char* ParseFormat(const char* date, const wxString& format = wxDefaultDateTimeFormat, const wxDateTime& dateDef = wxDefaultDateTime); const wchar_t* ParseFormat(const wchar_t* date, const wxString& format = wxDefaultDateTimeFormat, const wxDateTime& dateDef = wxDefaultDateTime); void ParseDateTime(const wxCStrData& datetime) { ParseDateTime(wxString(datetime)); } const char* ParseDateTime(const char* datetime); const wchar_t* ParseDateTime(const wchar_t* datetime); void ParseDate(const wxCStrData& date) { ParseDate(wxString(date)); } const char* ParseDate(const char* date); const wchar_t* ParseDate(const wchar_t* date); void ParseTime(const wxCStrData& time) { ParseTime(wxString(time)); } const char* ParseTime(const char* time); const wchar_t* ParseTime(const wchar_t* time); // implementation // ------------------------------------------------------------------------ // construct from internal representation wxDateTime(const wxLongLong& time) { m_time = time; } // get the internal representation inline wxLongLong GetValue() const; // a helper function to get the current time_t static time_t GetTimeNow() { return time(NULL); } // another one to get the current time broken down static struct tm *GetTmNow() { static struct tm l_CurrentTime; return GetTmNow(&l_CurrentTime); } // get current time using thread-safe function static struct tm *GetTmNow(struct tm *tmstruct); private: // the current country - as it's the same for all program objects (unless // it runs on a _really_ big cluster system :-), this is a static member: // see SetCountry() and GetCountry() static Country ms_country; // this constant is used to transform a time_t value to the internal // representation, as time_t is in seconds and we use milliseconds it's // fixed to 1000 static const long TIME_T_FACTOR; // returns true if we fall in range in which we can use standard ANSI C // functions inline bool IsInStdRange() const; // assign the preferred first day of a week to flags, if necessary void UseEffectiveWeekDayFlags(WeekFlags &flags) const; // the internal representation of the time is the amount of milliseconds // elapsed since the origin which is set by convention to the UNIX/C epoch // value: the midnight of January 1, 1970 (UTC) wxLongLong m_time; }; // ---------------------------------------------------------------------------- // This class contains a difference between 2 wxDateTime values, so it makes // sense to add it to wxDateTime and it is the result of subtraction of 2 // objects of that class. See also wxDateSpan. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxTimeSpan { public: // constructors // ------------------------------------------------------------------------ // return the timespan for the given number of milliseconds static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); } static wxTimeSpan Millisecond() { return Milliseconds(1); } // return the timespan for the given number of seconds static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); } static wxTimeSpan Second() { return Seconds(1); } // return the timespan for the given number of minutes static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); } static wxTimeSpan Minute() { return Minutes(1); } // return the timespan for the given number of hours static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); } static wxTimeSpan Hour() { return Hours(1); } // return the timespan for the given number of days static wxTimeSpan Days(long days) { return Hours(24 * days); } static wxTimeSpan Day() { return Days(1); } // return the timespan for the given number of weeks static wxTimeSpan Weeks(long days) { return Days(7 * days); } static wxTimeSpan Week() { return Weeks(1); } // default ctor constructs the 0 time span wxTimeSpan() { } // from separate values for each component, date set to 0 (hours are // not restricted to 0..24 range, neither are minutes, seconds or // milliseconds) inline wxTimeSpan(long hours, long minutes = 0, wxLongLong seconds = 0, wxLongLong milliseconds = 0); // default copy ctor is ok // no dtor // arithmetics with time spans (see also below for more operators) // ------------------------------------------------------------------------ // return the sum of two timespans inline wxTimeSpan Add(const wxTimeSpan& diff) const; // add two timespans together inline wxTimeSpan& Add(const wxTimeSpan& diff); // add two timespans together wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); } inline wxTimeSpan operator+(const wxTimeSpan& ts) const { return wxTimeSpan(GetValue() + ts.GetValue()); } // return the difference of two timespans inline wxTimeSpan Subtract(const wxTimeSpan& diff) const; // subtract another timespan inline wxTimeSpan& Subtract(const wxTimeSpan& diff); // subtract another timespan wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); } inline wxTimeSpan operator-(const wxTimeSpan& ts) const { return wxTimeSpan(GetValue() - ts.GetValue()); } // multiply timespan by a scalar inline wxTimeSpan Multiply(int n) const; // multiply timespan by a scalar inline wxTimeSpan& Multiply(int n); // multiply timespan by a scalar wxTimeSpan& operator*=(int n) { return Multiply(n); } inline wxTimeSpan operator*(int n) const { return wxTimeSpan(*this).Multiply(n); } // return this timespan with opposite sign wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); } // negate the value of the timespan wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; } // negate the value of the timespan wxTimeSpan& operator-() { return Neg(); } // return the absolute value of the timespan: does _not_ modify the // object inline wxTimeSpan Abs() const; // there is intentionally no division because we don't want to // introduce rounding errors in time calculations // comparison (see also operator versions below) // ------------------------------------------------------------------------ // is the timespan null? bool IsNull() const { return m_diff == 0l; } // returns true if the timespan is null bool operator!() const { return !IsNull(); } // is the timespan positive? bool IsPositive() const { return m_diff > 0l; } // is the timespan negative? bool IsNegative() const { return m_diff < 0l; } // are two timespans equal? inline bool IsEqualTo(const wxTimeSpan& ts) const; // compare two timestamps: works with the absolute values, i.e. -2 // hours is longer than 1 hour. Also, it will return false if the // timespans are equal in absolute value. inline bool IsLongerThan(const wxTimeSpan& ts) const; // compare two timestamps: works with the absolute values, i.e. 1 // hour is shorter than -2 hours. Also, it will return false if the // timespans are equal in absolute value. bool IsShorterThan(const wxTimeSpan& t) const; inline bool operator<(const wxTimeSpan &ts) const { return GetValue() < ts.GetValue(); } inline bool operator<=(const wxTimeSpan &ts) const { return GetValue() <= ts.GetValue(); } inline bool operator>(const wxTimeSpan &ts) const { return GetValue() > ts.GetValue(); } inline bool operator>=(const wxTimeSpan &ts) const { return GetValue() >= ts.GetValue(); } inline bool operator==(const wxTimeSpan &ts) const { return GetValue() == ts.GetValue(); } inline bool operator!=(const wxTimeSpan &ts) const { return GetValue() != ts.GetValue(); } // breaking into days, hours, minutes and seconds // ------------------------------------------------------------------------ // get the max number of weeks in this timespan inline int GetWeeks() const; // get the max number of days in this timespan inline int GetDays() const; // get the max number of hours in this timespan inline int GetHours() const; // get the max number of minutes in this timespan inline int GetMinutes() const; // get the max number of seconds in this timespan inline wxLongLong GetSeconds() const; // get the number of milliseconds in this timespan wxLongLong GetMilliseconds() const { return m_diff; } // conversion to text // ------------------------------------------------------------------------ // this function accepts strftime()-like format string (default // argument corresponds to the preferred date and time representation // for the current locale) and returns the string containing the // resulting text representation. Notice that only some of format // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, // minutes and seconds make sense, but not "PM/AM" string for example. wxString Format(const wxString& format = wxDefaultTimeSpanFormat) const; // implementation // ------------------------------------------------------------------------ // construct from internal representation wxTimeSpan(const wxLongLong& diff) { m_diff = diff; } // get the internal representation wxLongLong GetValue() const { return m_diff; } private: // the (signed) time span in milliseconds wxLongLong m_diff; }; // ---------------------------------------------------------------------------- // This class is a "logical time span" and is useful for implementing program // logic for such things as "add one month to the date" which, in general, // doesn't mean to add 60*60*24*31 seconds to it, but to take the same date // the next month (to understand that this is indeed different consider adding // one month to Feb, 15 - we want to get Mar, 15, of course). // // When adding a month to the date, all lesser components (days, hours, ...) // won't be changed unless the resulting date would be invalid: for example, // Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31. // // Because of this feature, adding and subtracting back again the same // wxDateSpan will *not*, in general give back the original date: Feb 28 - 1 // month will be Jan 28, not Jan 31! // // wxDateSpan can be either positive or negative. They may be // multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1 // month and 1 day) is 2 months and 2 days. They can be added together and // with wxDateTime or wxTimeSpan, but the type of result is different for each // case. // // Beware about weeks: if you specify both weeks and days, the total number of // days added will be 7*weeks + days! See also GetTotalDays() function. // // Equality operators are defined for wxDateSpans. Two datespans are equal if // they both give the same target date when added to *every* source date. // Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because // they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is // equal to wxDateSpan::Weeks(2) // // Finally, notice that for adding hours, minutes &c you don't need this // class: wxTimeSpan will do the job because there are no subtleties // associated with those. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxDateSpan { public: // constructors // ------------------------------------------------------------------------ // this many years/months/weeks/days wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0) { m_years = years; m_months = months; m_weeks = weeks; m_days = days; } // get an object for the given number of days static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); } static wxDateSpan Day() { return Days(1); } // get an object for the given number of weeks static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); } static wxDateSpan Week() { return Weeks(1); } // get an object for the given number of months static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); } static wxDateSpan Month() { return Months(1); } // get an object for the given number of years static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); } static wxDateSpan Year() { return Years(1); } // default copy ctor is ok // no dtor // accessors (all SetXXX() return the (modified) wxDateSpan object) // ------------------------------------------------------------------------ // set number of years wxDateSpan& SetYears(int n) { m_years = n; return *this; } // set number of months wxDateSpan& SetMonths(int n) { m_months = n; return *this; } // set number of weeks wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; } // set number of days wxDateSpan& SetDays(int n) { m_days = n; return *this; } // get number of years int GetYears() const { return m_years; } // get number of months int GetMonths() const { return m_months; } // returns 12*GetYears() + GetMonths() int GetTotalMonths() const { return 12*m_years + m_months; } // get number of weeks int GetWeeks() const { return m_weeks; } // get number of days int GetDays() const { return m_days; } // returns 7*GetWeeks() + GetDays() int GetTotalDays() const { return 7*m_weeks + m_days; } // arithmetics with date spans (see also below for more operators) // ------------------------------------------------------------------------ // return sum of two date spans inline wxDateSpan Add(const wxDateSpan& other) const; // add another wxDateSpan to us inline wxDateSpan& Add(const wxDateSpan& other); // add another wxDateSpan to us inline wxDateSpan& operator+=(const wxDateSpan& other); inline wxDateSpan operator+(const wxDateSpan& ds) const { return wxDateSpan(GetYears() + ds.GetYears(), GetMonths() + ds.GetMonths(), GetWeeks() + ds.GetWeeks(), GetDays() + ds.GetDays()); } // return difference of two date spans inline wxDateSpan Subtract(const wxDateSpan& other) const; // subtract another wxDateSpan from us inline wxDateSpan& Subtract(const wxDateSpan& other); // subtract another wxDateSpan from us inline wxDateSpan& operator-=(const wxDateSpan& other); inline wxDateSpan operator-(const wxDateSpan& ds) const { return wxDateSpan(GetYears() - ds.GetYears(), GetMonths() - ds.GetMonths(), GetWeeks() - ds.GetWeeks(), GetDays() - ds.GetDays()); } // return a copy of this time span with changed sign inline wxDateSpan Negate() const; // inverse the sign of this timespan inline wxDateSpan& Neg(); // inverse the sign of this timespan wxDateSpan& operator-() { return Neg(); } // return the date span proportional to this one with given factor inline wxDateSpan Multiply(int factor) const; // multiply all components by a (signed) number inline wxDateSpan& Multiply(int factor); // multiply all components by a (signed) number inline wxDateSpan& operator*=(int factor) { return Multiply(factor); } inline wxDateSpan operator*(int n) const { return wxDateSpan(*this).Multiply(n); } // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 inline bool operator==(const wxDateSpan& ds) const { return GetYears() == ds.GetYears() && GetMonths() == ds.GetMonths() && GetTotalDays() == ds.GetTotalDays(); } inline bool operator!=(const wxDateSpan& ds) const { return !(*this == ds); } private: int m_years, m_months, m_weeks, m_days; }; // ---------------------------------------------------------------------------- // wxDateTimeArray: array of dates. // ---------------------------------------------------------------------------- WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE); // ---------------------------------------------------------------------------- // wxDateTimeHolidayAuthority: an object of this class will decide whether a // given date is a holiday and is used by all functions working with "work // days". // // NB: the base class is an ABC, derived classes must implement the pure // virtual methods to work with the holidays they correspond to. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority; WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *, wxHolidayAuthoritiesArray, class WXDLLIMPEXP_BASE); class wxDateTimeHolidaysModule; class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority { friend class wxDateTimeHolidaysModule; public: // returns true if the given date is a holiday static bool IsHoliday(const wxDateTime& dt); // fills the provided array with all holidays in the given range, returns // the number of them static size_t GetHolidaysInRange(const wxDateTime& dtStart, const wxDateTime& dtEnd, wxDateTimeArray& holidays); // clear the list of holiday authorities static void ClearAllAuthorities(); // add a new holiday authority (the pointer will be deleted by // wxDateTimeHolidayAuthority) static void AddAuthority(wxDateTimeHolidayAuthority *auth); // the base class must have a virtual dtor virtual ~wxDateTimeHolidayAuthority(); protected: // this function is called to determine whether a given day is a holiday virtual bool DoIsHoliday(const wxDateTime& dt) const = 0; // this function should fill the array with all holidays between the two // given dates - it is implemented in the base class, but in a very // inefficient way (it just iterates over all days and uses IsHoliday() for // each of them), so it must be overridden in the derived class where the // base class version may be explicitly used if needed // // returns the number of holidays in the given range and fills holidays // array virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, const wxDateTime& dtEnd, wxDateTimeArray& holidays) const = 0; private: // all holiday authorities static wxHolidayAuthoritiesArray ms_authorities; }; // the holidays for this class are all Saturdays and Sundays class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority { protected: virtual bool DoIsHoliday(const wxDateTime& dt) const wxOVERRIDE; virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, const wxDateTime& dtEnd, wxDateTimeArray& holidays) const wxOVERRIDE; }; // ============================================================================ // inline functions implementation // ============================================================================ // ---------------------------------------------------------------------------- // private macros // ---------------------------------------------------------------------------- #define MILLISECONDS_PER_DAY 86400000l // some broken compilers (HP-UX CC) refuse to compile the "normal" version, but // using a temp variable always might prevent other compilers from optimising // it away - hence use of this ugly macro #ifndef __HPUX__ #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op #else #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt #endif // ---------------------------------------------------------------------------- // wxDateTime construction // ---------------------------------------------------------------------------- inline bool wxDateTime::IsInStdRange() const { // currently we don't know what is the real type of time_t so prefer to err // on the safe side and limit it to 32 bit values which is safe everywhere return m_time >= 0l && (m_time / TIME_T_FACTOR) < wxINT32_MAX; } /* static */ inline wxDateTime wxDateTime::Now() { struct tm tmstruct; return wxDateTime(*GetTmNow(&tmstruct)); } /* static */ inline wxDateTime wxDateTime::Today() { wxDateTime dt(Now()); dt.ResetTime(); return dt; } inline wxDateTime& wxDateTime::Set(time_t timet) { if ( timet == (time_t)-1 ) { m_time = wxInvalidDateTime.m_time; } else { // assign first to avoid long multiplication overflow! m_time = timet - WX_TIME_BASE_OFFSET; m_time *= TIME_T_FACTOR; } return *this; } inline wxDateTime& wxDateTime::SetToCurrent() { *this = Now(); return *this; } inline wxDateTime::wxDateTime(time_t timet) { Set(timet); } inline wxDateTime::wxDateTime(const struct tm& tm) { Set(tm); } inline wxDateTime::wxDateTime(const Tm& tm) { Set(tm); } inline wxDateTime::wxDateTime(double jdn) { Set(jdn); } inline wxDateTime& wxDateTime::Set(const Tm& tm) { wxASSERT_MSG( tm.IsValid(), wxT("invalid broken down date/time") ); return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec, tm.msec); } inline wxDateTime::wxDateTime(wxDateTime_t hour, wxDateTime_t minute, wxDateTime_t second, wxDateTime_t millisec) { Set(hour, minute, second, millisec); } inline wxDateTime::wxDateTime(wxDateTime_t day, Month month, int year, wxDateTime_t hour, wxDateTime_t minute, wxDateTime_t second, wxDateTime_t millisec) { Set(day, month, year, hour, minute, second, millisec); } // ---------------------------------------------------------------------------- // wxDateTime accessors // ---------------------------------------------------------------------------- inline wxLongLong wxDateTime::GetValue() const { wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); return m_time; } inline time_t wxDateTime::GetTicks() const { wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); if ( !IsInStdRange() ) { return (time_t)-1; } return (time_t)((m_time / (long)TIME_T_FACTOR).ToLong()) + WX_TIME_BASE_OFFSET; } inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, Month month, int year) { return SetToWeekDay(weekday, -1, month, year); } inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday, WeekFlags WXUNUSED(flags)) const { MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); } inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const { MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); } inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const { MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); } inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, int n, Month month, int year) const { wxDateTime dt(*this); return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; } inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, Month month, int year) { wxDateTime dt(*this); return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; } inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const { MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); } inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const { MODIFY_AND_RETURN( SetToYearDay(yday) ); } // ---------------------------------------------------------------------------- // wxDateTime comparison // ---------------------------------------------------------------------------- inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const { return *this == datetime; } inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const { return *this < datetime; } inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const { return *this > datetime; } inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, const wxDateTime& t2) const { // no need for assert, will be checked by the functions we call return IsLaterThan(t1) && IsEarlierThan(t2); } inline bool wxDateTime::IsBetween(const wxDateTime& t1, const wxDateTime& t2) const { // no need for assert, will be checked by the functions we call return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); } inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const { Tm tm1 = GetTm(), tm2 = dt.GetTm(); return tm1.year == tm2.year && tm1.mon == tm2.mon && tm1.mday == tm2.mday; } inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const { // notice that we can't do something like this: // // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY // // because we have also to deal with (possibly) different DST settings! Tm tm1 = GetTm(), tm2 = dt.GetTm(); return tm1.hour == tm2.hour && tm1.min == tm2.min && tm1.sec == tm2.sec && tm1.msec == tm2.msec; } inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const { return IsBetween(dt.Subtract(ts), dt.Add(ts)); } // ---------------------------------------------------------------------------- // wxDateTime arithmetics // ---------------------------------------------------------------------------- inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const { wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); return wxDateTime(m_time + diff.GetValue()); } inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) { wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); m_time += diff.GetValue(); return *this; } inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) { return Add(diff); } inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const { wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); return wxDateTime(m_time - diff.GetValue()); } inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) { wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); m_time -= diff.GetValue(); return *this; } inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) { return Subtract(diff); } inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const { wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); return wxTimeSpan(GetValue() - datetime.GetValue()); } inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const { return this->Subtract(dt2); } inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const { return wxDateTime(*this).Add(diff); } inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) { return Add(diff.Negate()); } inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const { return wxDateTime(*this).Subtract(diff); } inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) { return Subtract(diff); } inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) { return Add(diff); } // ---------------------------------------------------------------------------- // wxDateTime and timezones // ---------------------------------------------------------------------------- inline wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const { MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); } inline wxDateTime wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const { MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) ); } // ---------------------------------------------------------------------------- // wxTimeSpan construction // ---------------------------------------------------------------------------- inline wxTimeSpan::wxTimeSpan(long hours, long minutes, wxLongLong seconds, wxLongLong milliseconds) { // assign first to avoid precision loss m_diff = hours; m_diff *= 60l; m_diff += minutes; m_diff *= 60l; m_diff += seconds; m_diff *= 1000l; m_diff += milliseconds; } // ---------------------------------------------------------------------------- // wxTimeSpan accessors // ---------------------------------------------------------------------------- inline wxLongLong wxTimeSpan::GetSeconds() const { return m_diff / 1000l; } inline int wxTimeSpan::GetMinutes() const { // For compatibility, this method (and the other accessors) return int, // even though GetLo() actually returns unsigned long with greater range. return static_cast<int>((GetSeconds() / 60l).GetLo()); } inline int wxTimeSpan::GetHours() const { return GetMinutes() / 60; } inline int wxTimeSpan::GetDays() const { return GetHours() / 24; } inline int wxTimeSpan::GetWeeks() const { return GetDays() / 7; } // ---------------------------------------------------------------------------- // wxTimeSpan arithmetics // ---------------------------------------------------------------------------- inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const { return wxTimeSpan(m_diff + diff.GetValue()); } inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) { m_diff += diff.GetValue(); return *this; } inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const { return wxTimeSpan(m_diff - diff.GetValue()); } inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) { m_diff -= diff.GetValue(); return *this; } inline wxTimeSpan& wxTimeSpan::Multiply(int n) { m_diff *= (long)n; return *this; } inline wxTimeSpan wxTimeSpan::Multiply(int n) const { return wxTimeSpan(m_diff * (long)n); } inline wxTimeSpan wxTimeSpan::Abs() const { return wxTimeSpan(GetValue().Abs()); } inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const { return GetValue() == ts.GetValue(); } inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const { return GetValue().Abs() > ts.GetValue().Abs(); } inline bool wxTimeSpan::IsShorterThan(const wxTimeSpan& ts) const { return GetValue().Abs() < ts.GetValue().Abs(); } // ---------------------------------------------------------------------------- // wxDateSpan // ---------------------------------------------------------------------------- inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) { m_years += other.m_years; m_months += other.m_months; m_weeks += other.m_weeks; m_days += other.m_days; return *this; } inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) { return *this += other; } inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const { wxDateSpan ds(*this); ds.Add(other); return ds; } inline wxDateSpan& wxDateSpan::Multiply(int factor) { m_years *= factor; m_months *= factor; m_weeks *= factor; m_days *= factor; return *this; } inline wxDateSpan wxDateSpan::Multiply(int factor) const { wxDateSpan ds(*this); ds.Multiply(factor); return ds; } inline wxDateSpan wxDateSpan::Negate() const { return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); } inline wxDateSpan& wxDateSpan::Neg() { m_years = -m_years; m_months = -m_months; m_weeks = -m_weeks; m_days = -m_days; return *this; } inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) { return *this += other.Negate(); } inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) { return *this -= other; } inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const { wxDateSpan ds(*this); ds.Subtract(other); return ds; } #undef MILLISECONDS_PER_DAY #undef MODIFY_AND_RETURN // ============================================================================ // binary operators // ============================================================================ // ---------------------------------------------------------------------------- // wxTimeSpan operators // ---------------------------------------------------------------------------- wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts); // ---------------------------------------------------------------------------- // wxDateSpan // ---------------------------------------------------------------------------- wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds); // ============================================================================ // other helper functions // ============================================================================ // ---------------------------------------------------------------------------- // iteration helpers: can be used to write a for loop over enum variable like // this: // for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) // ---------------------------------------------------------------------------- WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m); WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m); WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd); WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd); #endif // wxUSE_DATETIME #endif // _WX_DATETIME_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/itemattr.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/itemattr.h // Purpose: wxItemAttr class declaration // Author: Vadim Zeitlin // Created: 2016-04-16 (extracted from wx/listctrl.h) // Copyright: (c) 2016 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_ITEMATTR_H_ #define _WX_ITEMATTR_H_ // ---------------------------------------------------------------------------- // wxItemAttr: a structure containing the visual attributes of an item // ---------------------------------------------------------------------------- class wxItemAttr { public: // ctors wxItemAttr() { } wxItemAttr(const wxColour& colText, const wxColour& colBack, const wxFont& font) : m_colText(colText), m_colBack(colBack), m_font(font) { } // default copy ctor, assignment operator and dtor are ok bool operator==(const wxItemAttr& other) const { return m_colText == other.m_colText && m_colBack == other.m_colBack && m_font == other.m_font; } bool operator!=(const wxItemAttr& other) const { return !(*this == other); } // setters void SetTextColour(const wxColour& colText) { m_colText = colText; } void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } void SetFont(const wxFont& font) { m_font = font; } // accessors bool HasTextColour() const { return m_colText.IsOk(); } bool HasBackgroundColour() const { return m_colBack.IsOk(); } bool HasFont() const { return m_font.IsOk(); } bool HasColours() const { return HasTextColour() || HasBackgroundColour(); } bool IsDefault() const { return !HasColours() && !HasFont(); } const wxColour& GetTextColour() const { return m_colText; } const wxColour& GetBackgroundColour() const { return m_colBack; } const wxFont& GetFont() const { return m_font; } // this is almost like assignment operator except it doesn't overwrite the // fields unset in the source attribute void AssignFrom(const wxItemAttr& source) { if ( source.HasTextColour() ) SetTextColour(source.GetTextColour()); if ( source.HasBackgroundColour() ) SetBackgroundColour(source.GetBackgroundColour()); if ( source.HasFont() ) SetFont(source.GetFont()); } private: wxColour m_colText, m_colBack; wxFont m_font; }; #endif // _WX_ITEMATTR_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fontpicker.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/fontpicker.h // Purpose: wxFontPickerCtrl base header // Author: Francesco Montorsi // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FONTPICKER_H_BASE_ #define _WX_FONTPICKER_H_BASE_ #include "wx/defs.h" #if wxUSE_FONTPICKERCTRL #include "wx/pickerbase.h" class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent; extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerWidgetNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerCtrlNameStr[]; // ---------------------------------------------------------------------------- // wxFontPickerWidgetBase: a generic abstract interface which must be // implemented by controls used by wxFontPickerCtrl // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFontPickerWidgetBase { public: wxFontPickerWidgetBase() : m_selectedFont(*wxNORMAL_FONT) { } virtual ~wxFontPickerWidgetBase() {} wxFont GetSelectedFont() const { return m_selectedFont; } virtual void SetSelectedFont(const wxFont &f) { m_selectedFont = f; UpdateFont(); } virtual wxColour GetSelectedColour() const = 0; virtual void SetSelectedColour(const wxColour &colour) = 0; protected: virtual void UpdateFont() = 0; // the current font (may be invalid if none) // NOTE: don't call this m_font as wxWindow::m_font already exists wxFont m_selectedFont; }; // Styles which must be supported by all controls implementing wxFontPickerWidgetBase // NB: these styles must be defined to carefully-chosen values to // avoid conflicts with wxButton's styles // keeps the label of the button updated with the fontface name + font size // E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, // updates the wxFontButtonGeneric's label (overwriting any previous label) // with the "Times New Roman, 10" text (only fontface + fontsize is displayed // to avoid extralong labels). #define wxFNTP_FONTDESC_AS_LABEL 0x0008 // uses the currently selected font to draw the label of the button #define wxFNTP_USEFONT_FOR_LABEL 0x0010 #define wxFONTBTN_DEFAULT_STYLE \ (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) // native version currently only exists in wxGTK2 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/fontpicker.h" #define wxFontPickerWidget wxFontButton #else #include "wx/generic/fontpickerg.h" #define wxFontPickerWidget wxGenericFontButton #endif // ---------------------------------------------------------------------------- // wxFontPickerCtrl specific flags // ---------------------------------------------------------------------------- #define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) #define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL) // not a style but rather the default value of the minimum/maximum pointsize allowed #define wxFNTP_MINPOINT_SIZE 0 #define wxFNTP_MAXPOINT_SIZE 100 // ---------------------------------------------------------------------------- // wxFontPickerCtrl: platform-independent class which embeds the // platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is // used, a textctrl next to it. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase { public: wxFontPickerCtrl() : m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) { } virtual ~wxFontPickerCtrl() {} wxFontPickerCtrl(wxWindow *parent, wxWindowID id, const wxFont& initial = wxNullFont, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFNTP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFontPickerCtrlNameStr) : m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) { Create(parent, id, initial, pos, size, style, validator, name); } bool Create(wxWindow *parent, wxWindowID id, const wxFont& initial = wxNullFont, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFNTP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFontPickerCtrlNameStr); public: // public API // get the font chosen wxFont GetSelectedFont() const { return GetPickerWidget()->GetSelectedFont(); } // sets currently displayed font void SetSelectedFont(const wxFont& f); // returns the selected color wxColour GetSelectedColour() const { return GetPickerWidget()->GetSelectedColour(); } // sets the currently selected color void SetSelectedColour(const wxColour& colour) { GetPickerWidget()->SetSelectedColour(colour); } // set/get the min point size void SetMinPointSize(unsigned int min); unsigned int GetMinPointSize() const { return m_nMinPointSize; } // set/get the max point size void SetMaxPointSize(unsigned int max); unsigned int GetMaxPointSize() const { return m_nMaxPointSize; } public: // internal functions void UpdatePickerFromTextCtrl() wxOVERRIDE; void UpdateTextCtrlFromPicker() wxOVERRIDE; // event handler for our picker void OnFontChange(wxFontPickerEvent &); // used to convert wxString <-> wxFont virtual wxString Font2String(const wxFont &font); virtual wxFont String2Font(const wxString &font); protected: // extracts the style for our picker from wxFontPickerCtrl's style long GetPickerStyle(long style) const wxOVERRIDE { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); } // the minimum pointsize allowed to the user unsigned int m_nMinPointSize; // the maximum pointsize allowed to the user unsigned int m_nMaxPointSize; private: wxFontPickerWidget* GetPickerWidget() const { return static_cast<wxFontPickerWidget*>(m_picker); } wxDECLARE_DYNAMIC_CLASS(wxFontPickerCtrl); }; // ---------------------------------------------------------------------------- // wxFontPickerEvent: used by wxFontPickerCtrl only // ---------------------------------------------------------------------------- wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FONTPICKER_CHANGED, wxFontPickerEvent ); class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent { public: wxFontPickerEvent() {} wxFontPickerEvent(wxObject *generator, int id, const wxFont &f) : wxCommandEvent(wxEVT_FONTPICKER_CHANGED, id), m_font(f) { SetEventObject(generator); } wxFont GetFont() const { return m_font; } void SetFont(const wxFont &c) { m_font = c; } // default copy ctor, assignment operator and dtor are ok virtual wxEvent *Clone() const wxOVERRIDE { return new wxFontPickerEvent(*this); } private: wxFont m_font; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent); }; // ---------------------------------------------------------------------------- // event types and macros // ---------------------------------------------------------------------------- typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&); #define wxFontPickerEventHandler(func) \ wxEVENT_HANDLER_CAST(wxFontPickerEventFunction, func) #define EVT_FONTPICKER_CHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn)) // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_FONTPICKER_CHANGED wxEVT_FONTPICKER_CHANGED #endif // wxUSE_FONTPICKERCTRL #endif // _WX_FONTPICKER_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/gbsizer.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/gbsizer.h // Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, // with items at specified cells, and with the option of row // and/or column spanning // // Author: Robin Dunn // Created: 03-Nov-2003 // Copyright: (c) Robin Dunn // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WXGBSIZER_H__ #define __WXGBSIZER_H__ #include "wx/sizer.h" //--------------------------------------------------------------------------- // Classes to represent a position in the grid and a size of an item in the // grid, IOW, the number of rows and columns it occupies. I chose to use these // instead of wxPoint and wxSize because they are (x,y) and usually pixel // oriented while grids and tables are usually thought of as (row,col) so some // confusion would definitely result in using wxPoint... // // NOTE: This should probably be refactored to a common RowCol data type which // is used for this and also for wxGridCellCoords. //--------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxGBPosition { public: wxGBPosition() : m_row(0), m_col(0) {} wxGBPosition(int row, int col) : m_row(row), m_col(col) {} // default copy ctor and assignment operator are okay. int GetRow() const { return m_row; } int GetCol() const { return m_col; } void SetRow(int row) { m_row = row; } void SetCol(int col) { m_col = col; } bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; } bool operator!=(const wxGBPosition& p) const { return !(*this == p); } private: int m_row; int m_col; }; class WXDLLIMPEXP_CORE wxGBSpan { public: wxGBSpan() { Init(); } wxGBSpan(int rowspan, int colspan) { // Initialize the members to valid values as not doing it may result in // infinite loop in wxGBSizer code if the user passed 0 for any of // them, see #12934. Init(); SetRowspan(rowspan); SetColspan(colspan); } // default copy ctor and assignment operator are okay. // Factor constructor creating an invalid wxGBSpan: this is mostly supposed // to be used as return value for functions returning wxGBSpan in case of // errors. static wxGBSpan Invalid() { return wxGBSpan(NULL); } int GetRowspan() const { return m_rowspan; } int GetColspan() const { return m_colspan; } void SetRowspan(int rowspan) { wxCHECK_RET( rowspan > 0, "Row span should be strictly positive" ); m_rowspan = rowspan; } void SetColspan(int colspan) { wxCHECK_RET( colspan > 0, "Column span should be strictly positive" ); m_colspan = colspan; } bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } bool operator!=(const wxGBSpan& o) const { return !(*this == o); } private: // This private ctor is used by Invalid() only. wxGBSpan(struct InvalidCtorTag*) { m_rowspan = m_colspan = -1; } void Init() { m_rowspan = m_colspan = 1; } int m_rowspan; int m_colspan; }; extern WXDLLIMPEXP_DATA_CORE(const wxGBSpan) wxDefaultSpan; //--------------------------------------------------------------------------- // wxGBSizerItem //--------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; class WXDLLIMPEXP_CORE wxGBSizerItem : public wxSizerItem { public: // spacer wxGBSizerItem( int width, int height, const wxGBPosition& pos, const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, wxObject* userData=NULL); // window wxGBSizerItem( wxWindow *window, const wxGBPosition& pos, const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, wxObject* userData=NULL ); // subsizer wxGBSizerItem( wxSizer *sizer, const wxGBPosition& pos, const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, wxObject* userData=NULL ); // default ctor wxGBSizerItem(); // Get the grid position of the item wxGBPosition GetPos() const { return m_pos; } void GetPos(int& row, int& col) const; // Get the row and column spanning of the item wxGBSpan GetSpan() const { return m_span; } void GetSpan(int& rowspan, int& colspan) const; // If the item is already a member of a sizer then first ensure that there // is no other item that would intersect with this one at the new // position, then set the new position. Returns true if the change is // successful and after the next Layout the item will be moved. bool SetPos( const wxGBPosition& pos ); // If the item is already a member of a sizer then first ensure that there // is no other item that would intersect with this one with its new // spanning size, then set the new spanning. Returns true if the change // is successful and after the next Layout the item will be resized. bool SetSpan( const wxGBSpan& span ); // Returns true if this item and the other item intersect bool Intersects(const wxGBSizerItem& other); // Returns true if the given pos/span would intersect with this item. bool Intersects(const wxGBPosition& pos, const wxGBSpan& span); // Get the row and column of the endpoint of this item void GetEndPos(int& row, int& col); wxGridBagSizer* GetGBSizer() const { return m_gbsizer; } void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; } protected: wxGBPosition m_pos; wxGBSpan m_span; wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects private: wxDECLARE_DYNAMIC_CLASS(wxGBSizerItem); wxDECLARE_NO_COPY_CLASS(wxGBSizerItem); }; //--------------------------------------------------------------------------- // wxGridBagSizer //--------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxGridBagSizer : public wxFlexGridSizer { public: wxGridBagSizer(int vgap = 0, int hgap = 0 ); // The Add methods return true if the item was successfully placed at the // given position, false if something was already there. wxSizerItem* Add( wxWindow *window, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, int flag = 0, int border = 0, wxObject* userData = NULL ); wxSizerItem* Add( wxSizer *sizer, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, int flag = 0, int border = 0, wxObject* userData = NULL ); wxSizerItem* Add( int width, int height, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, int flag = 0, int border = 0, wxObject* userData = NULL ); wxSizerItem* Add( wxGBSizerItem *item ); // Get/Set the size used for cells in the grid with no item. wxSize GetEmptyCellSize() const { return m_emptyCellSize; } void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; } // Get the size of the specified cell, including hgap and vgap. Only // valid after a Layout. wxSize GetCellSize(int row, int col) const; // Get the grid position of the specified item (non-recursive) wxGBPosition GetItemPosition(wxWindow *window); wxGBPosition GetItemPosition(wxSizer *sizer); wxGBPosition GetItemPosition(size_t index); // Set the grid position of the specified item. Returns true on success. // If the move is not allowed (because an item is already there) then // false is returned. (non-recursive) bool SetItemPosition(wxWindow *window, const wxGBPosition& pos); bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos); bool SetItemPosition(size_t index, const wxGBPosition& pos); // Get the row/col spanning of the specified item (non-recursive) wxGBSpan GetItemSpan(wxWindow *window); wxGBSpan GetItemSpan(wxSizer *sizer); wxGBSpan GetItemSpan(size_t index); // Set the row/col spanning of the specified item. Returns true on // success. If the move is not allowed (because an item is already there) // then false is returned. (non-recursive) bool SetItemSpan(wxWindow *window, const wxGBSpan& span); bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); bool SetItemSpan(size_t index, const wxGBSpan& span); // Find the sizer item for the given window or subsizer, returns NULL if // not found. (non-recursive) wxGBSizerItem* FindItem(wxWindow* window); wxGBSizerItem* FindItem(wxSizer* sizer); // Return the sizer item for the given grid cell, or NULL if there is no // item at that position. (non-recursive) wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); // Return the sizer item located at the point given in pt, or NULL if // there is no item at that point. The (x,y) coordinates in pt correspond // to the client coordinates of the window using the sizer for // layout. (non-recursive) wxGBSizerItem* FindItemAtPoint(const wxPoint& pt); // Return the sizer item that has a matching user data (it only compares // pointer values) or NULL if not found. (non-recursive) wxGBSizerItem* FindItemWithData(const wxObject* userData); // These are what make the sizer do size calculations and layout virtual void RecalcSizes() wxOVERRIDE; virtual wxSize CalcMin() wxOVERRIDE; // Look at all items and see if any intersect (or would overlap) the given // item. Returns true if so, false if there would be no overlap. If an // excludeItem is given then it will not be checked for intersection, for // example it may be the item we are checking the position of. bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); // The Add base class virtuals should not be used with this class, but // we'll try to make them automatically select a location for the item // anyway. virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); // The Insert and Prepend base class virtuals that are not appropriate for // this class and should not be used. Their implementation in this class // simply fails. virtual wxSizerItem* Add( wxSizerItem *item ); virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ) wxOVERRIDE; virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Prepend( wxSizerItem *item ); protected: wxGBPosition FindEmptyCell(); void AdjustForOverflow(); wxSize m_emptyCellSize; private: wxDECLARE_CLASS(wxGridBagSizer); wxDECLARE_NO_COPY_CLASS(wxGridBagSizer); }; //--------------------------------------------------------------------------- #endif
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/settings.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/settings.h // Purpose: wxSystemSettings class // Author: Julian Smart // Modified by: // Created: 01/02/97 // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SETTINGS_H_BASE_ #define _WX_SETTINGS_H_BASE_ #include "wx/colour.h" #include "wx/font.h" class WXDLLIMPEXP_FWD_CORE wxWindow; // possible values for wxSystemSettings::GetFont() parameter // // NB: wxMSW assumes that they have the same values as the parameters of // Windows GetStockObject() API, don't change the values! enum wxSystemFont { wxSYS_OEM_FIXED_FONT = 10, wxSYS_ANSI_FIXED_FONT, wxSYS_ANSI_VAR_FONT, wxSYS_SYSTEM_FONT, wxSYS_DEVICE_DEFAULT_FONT, // don't use: this is here just to make the values of enum elements // coincide with the corresponding MSW constants wxSYS_DEFAULT_PALETTE, // don't use: MSDN says that this is a stock object provided only // for compatibility with 16-bit Windows versions earlier than 3.0! wxSYS_SYSTEM_FIXED_FONT, wxSYS_DEFAULT_GUI_FONT, // this was just a temporary aberration, do not use it any more wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT }; // possible values for wxSystemSettings::GetColour() parameter // // NB: wxMSW assumes that they have the same values as the parameters of // Windows GetSysColor() API, don't change the values! enum wxSystemColour { wxSYS_COLOUR_SCROLLBAR, wxSYS_COLOUR_DESKTOP, wxSYS_COLOUR_ACTIVECAPTION, wxSYS_COLOUR_INACTIVECAPTION, wxSYS_COLOUR_MENU, wxSYS_COLOUR_WINDOW, wxSYS_COLOUR_WINDOWFRAME, wxSYS_COLOUR_MENUTEXT, wxSYS_COLOUR_WINDOWTEXT, wxSYS_COLOUR_CAPTIONTEXT, wxSYS_COLOUR_ACTIVEBORDER, wxSYS_COLOUR_INACTIVEBORDER, wxSYS_COLOUR_APPWORKSPACE, wxSYS_COLOUR_HIGHLIGHT, wxSYS_COLOUR_HIGHLIGHTTEXT, wxSYS_COLOUR_BTNFACE, wxSYS_COLOUR_BTNSHADOW, wxSYS_COLOUR_GRAYTEXT, wxSYS_COLOUR_BTNTEXT, wxSYS_COLOUR_INACTIVECAPTIONTEXT, wxSYS_COLOUR_BTNHIGHLIGHT, wxSYS_COLOUR_3DDKSHADOW, wxSYS_COLOUR_3DLIGHT, wxSYS_COLOUR_INFOTEXT, wxSYS_COLOUR_INFOBK, wxSYS_COLOUR_LISTBOX, wxSYS_COLOUR_HOTLIGHT, wxSYS_COLOUR_GRADIENTACTIVECAPTION, wxSYS_COLOUR_GRADIENTINACTIVECAPTION, wxSYS_COLOUR_MENUHILIGHT, wxSYS_COLOUR_MENUBAR, wxSYS_COLOUR_LISTBOXTEXT, wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, wxSYS_COLOUR_MAX, // synonyms wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP, wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE }; // possible values for wxSystemSettings::GetMetric() index parameter // // NB: update the conversion table in msw/settings.cpp if you change the values // of the elements of this enum enum wxSystemMetric { wxSYS_MOUSE_BUTTONS = 1, wxSYS_BORDER_X, wxSYS_BORDER_Y, wxSYS_CURSOR_X, wxSYS_CURSOR_Y, wxSYS_DCLICK_X, wxSYS_DCLICK_Y, wxSYS_DRAG_X, wxSYS_DRAG_Y, wxSYS_EDGE_X, wxSYS_EDGE_Y, wxSYS_HSCROLL_ARROW_X, wxSYS_HSCROLL_ARROW_Y, wxSYS_HTHUMB_X, wxSYS_ICON_X, wxSYS_ICON_Y, wxSYS_ICONSPACING_X, wxSYS_ICONSPACING_Y, wxSYS_WINDOWMIN_X, wxSYS_WINDOWMIN_Y, wxSYS_SCREEN_X, wxSYS_SCREEN_Y, wxSYS_FRAMESIZE_X, wxSYS_FRAMESIZE_Y, wxSYS_SMALLICON_X, wxSYS_SMALLICON_Y, wxSYS_HSCROLL_Y, wxSYS_VSCROLL_X, wxSYS_VSCROLL_ARROW_X, wxSYS_VSCROLL_ARROW_Y, wxSYS_VTHUMB_Y, wxSYS_CAPTION_Y, wxSYS_MENU_Y, wxSYS_NETWORK_PRESENT, wxSYS_PENWINDOWS_PRESENT, wxSYS_SHOW_SOUNDS, wxSYS_SWAP_BUTTONS, wxSYS_DCLICK_MSEC, wxSYS_CARET_ON_MSEC, wxSYS_CARET_OFF_MSEC, wxSYS_CARET_TIMEOUT_MSEC }; // possible values for wxSystemSettings::HasFeature() parameter enum wxSystemFeature { wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1, wxSYS_CAN_ICONIZE_FRAME, wxSYS_TABLET_PRESENT }; // values for different screen designs enum wxSystemScreenType { wxSYS_SCREEN_NONE = 0, // not yet defined wxSYS_SCREEN_TINY, // < wxSYS_SCREEN_PDA, // >= 320x240 wxSYS_SCREEN_SMALL, // >= 640x480 wxSYS_SCREEN_DESKTOP // >= 800x600 }; // ---------------------------------------------------------------------------- // wxSystemSettingsNative: defines the API for wxSystemSettings class // ---------------------------------------------------------------------------- // this is a namespace rather than a class: it has only non virtual static // functions // // also note that the methods are implemented in the platform-specific source // files (i.e. this is not a real base class as we can't override its virtual // functions because it doesn't have any) class WXDLLIMPEXP_CORE wxSystemSettingsNative { public: // get a standard system colour static wxColour GetColour(wxSystemColour index); // get a standard system font static wxFont GetFont(wxSystemFont index); // get a system-dependent metric static int GetMetric(wxSystemMetric index, wxWindow * win = NULL); // return true if the port has certain feature static bool HasFeature(wxSystemFeature index); }; // ---------------------------------------------------------------------------- // include the declaration of the real platform-dependent class // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxSystemSettings : public wxSystemSettingsNative { public: #ifdef __WXUNIVERSAL__ // in wxUniversal we want to use the theme standard colours instead of the // system ones, otherwise wxSystemSettings is just the same as // wxSystemSettingsNative static wxColour GetColour(wxSystemColour index); // some metrics are toolkit-dependent and provided by wxUniv, some are // lowlevel static int GetMetric(wxSystemMetric index, wxWindow *win = NULL); #endif // __WXUNIVERSAL__ // Get system screen design (desktop, pda, ..) used for // laying out various dialogs. static wxSystemScreenType GetScreenType(); // Override default. static void SetScreenType( wxSystemScreenType screen ); // Value static wxSystemScreenType ms_screen; }; #endif // _WX_SETTINGS_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/frame.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/frame.h // Purpose: wxFrame class interface // Author: Vadim Zeitlin // Modified by: // Created: 15.11.99 // Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FRAME_H_BASE_ #define _WX_FRAME_H_BASE_ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/toplevel.h" // the base class #include "wx/statusbr.h" // the default names for various classs extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxMenuBar; class WXDLLIMPEXP_FWD_CORE wxMenuItem; class WXDLLIMPEXP_FWD_CORE wxStatusBar; class WXDLLIMPEXP_FWD_CORE wxToolBar; // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // wxFrame-specific (i.e. not for wxDialog) styles // // Also see the bit summary table in wx/toplevel.h. #define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) #define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu #define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent // ---------------------------------------------------------------------------- // wxFrame is a top-level window with optional menubar, statusbar and toolbar // // For each of *bars, a frame may have several of them, but only one is // managed by the frame, i.e. resized/moved when the frame is and whose size // is accounted for in client size calculations - all others should be taken // care of manually. The CreateXXXBar() functions create this, main, XXXBar, // but the actual creation is done in OnCreateXXXBar() functions which may be // overridden to create custom objects instead of standard ones when // CreateXXXBar() is called. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFrameBase : public wxTopLevelWindow { public: // construction wxFrameBase(); virtual ~wxFrameBase(); wxFrame *New(wxWindow *parent, wxWindowID winid, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); // frame state // ----------- // get the origin of the client area (which may be different from (0, 0) // if the frame has a toolbar) in client coordinates virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; // menu bar functions // ------------------ #if wxUSE_MENUS virtual void SetMenuBar(wxMenuBar *menubar); virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } // find the item by id in the frame menu bar: this is an internal function // and exists mainly in order to be overridden in the MDI parent frame // which also looks at its active child menu bar virtual wxMenuItem *FindItemInMenuBar(int menuId) const; // generate menu command corresponding to the given menu item // // returns true if processed bool ProcessCommand(wxMenuItem *item); // generate menu command corresponding to the given menu command id // // returns true if processed bool ProcessCommand(int winid); #else bool ProcessCommand(int WXUNUSED(winid)) { return false; } #endif // wxUSE_MENUS // status bar functions // -------------------- #if wxUSE_STATUSBAR // create the main status bar by calling OnCreateStatusBar() virtual wxStatusBar* CreateStatusBar(int number = 1, long style = wxSTB_DEFAULT_STYLE, wxWindowID winid = 0, const wxString& name = wxStatusLineNameStr); // return a new status bar virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID winid, const wxString& name); // get the main status bar virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } // sets the main status bar virtual void SetStatusBar(wxStatusBar *statBar); // forward these to status bar virtual void SetStatusText(const wxString &text, int number = 0); virtual void SetStatusWidths(int n, const int widths_field[]); void PushStatusText(const wxString &text, int number = 0); void PopStatusText(int number = 0); // set the status bar pane the help will be shown in void SetStatusBarPane(int n) { m_statusBarPane = n; } int GetStatusBarPane() const { return m_statusBarPane; } #endif // wxUSE_STATUSBAR // toolbar functions // ----------------- #if wxUSE_TOOLBAR // create main toolbar bycalling OnCreateToolBar() virtual wxToolBar* CreateToolBar(long style = -1, wxWindowID winid = wxID_ANY, const wxString& name = wxToolBarNameStr); // return a new toolbar virtual wxToolBar *OnCreateToolBar(long style, wxWindowID winid, const wxString& name ); // get/set the main toolbar virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } virtual void SetToolBar(wxToolBar *toolbar); #endif // wxUSE_TOOLBAR // implementation only from now on // ------------------------------- // event handlers #if wxUSE_MENUS void OnMenuOpen(wxMenuEvent& event); #if wxUSE_STATUSBAR void OnMenuClose(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event); #endif // wxUSE_STATUSBAR // send wxUpdateUIEvents for all menu items in the menubar, // or just for menu if non-NULL virtual void DoMenuUpdates(wxMenu* menu = NULL); #endif // wxUSE_MENUS // do the UI update processing for this window virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE; // Implement internal behaviour (menu updating on some platforms) virtual void OnInternalIdle() wxOVERRIDE; #if wxUSE_MENUS || wxUSE_TOOLBAR // show help text for the currently selected menu or toolbar item // (typically in the status bar) or hide it and restore the status bar text // originally shown before the menu was opened if show == false virtual void DoGiveHelp(const wxString& text, bool show); #endif virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE { return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child); } protected: // the frame main menu/status/tool bars // ------------------------------------ // this (non virtual!) function should be called from dtor to delete the // main menubar, statusbar and toolbar (if any) void DeleteAllBars(); // test whether this window makes part of the frame virtual bool IsOneOfBars(const wxWindow *win) const wxOVERRIDE; #if wxUSE_MENUS // override to update menu bar position when the frame size changes virtual void PositionMenuBar() { } // override to do something special when the menu bar is being removed // from the frame virtual void DetachMenuBar(); // override to do something special when the menu bar is attached to the // frame virtual void AttachMenuBar(wxMenuBar *menubar); // Return true if we should update the menu item state from idle event // handler or false if we should delay it until the menu is opened. static bool ShouldUpdateMenuFromIdle(); wxMenuBar *m_frameMenuBar; #endif // wxUSE_MENUS #if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR) // the saved status bar text overwritten by DoGiveHelp() wxString m_oldStatusText; // the last help string we have shown in the status bar wxString m_lastHelpShown; #endif #if wxUSE_STATUSBAR // override to update status bar position (or anything else) when // something changes virtual void PositionStatusBar() { } // show the help string for the given menu item using DoGiveHelp() if the // given item does have a help string (as determined by FindInMenuBar()), // return false if there is no help for such item bool ShowMenuHelp(int helpid); wxStatusBar *m_frameStatusBar; #endif // wxUSE_STATUSBAR int m_statusBarPane; #if wxUSE_TOOLBAR // override to update status bar position (or anything else) when // something changes virtual void PositionToolBar() { } wxToolBar *m_frameToolBar; #endif // wxUSE_TOOLBAR #if wxUSE_MENUS wxDECLARE_EVENT_TABLE(); #endif // wxUSE_MENUS wxDECLARE_NO_COPY_CLASS(wxFrameBase); }; // include the real class declaration #if defined(__WXUNIVERSAL__) #include "wx/univ/frame.h" #else // !__WXUNIVERSAL__ #if defined(__WXMSW__) #include "wx/msw/frame.h" #elif defined(__WXGTK20__) #include "wx/gtk/frame.h" #elif defined(__WXGTK__) #include "wx/gtk1/frame.h" #elif defined(__WXMOTIF__) #include "wx/motif/frame.h" #elif defined(__WXMAC__) #include "wx/osx/frame.h" #elif defined(__WXQT__) #include "wx/qt/frame.h" #endif #endif #endif // _WX_FRAME_H_BASE_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/animdecod.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/animdecod.h // Purpose: wxAnimationDecoder // Author: Francesco Montorsi // Copyright: (c) 2006 Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ANIMDECOD_H #define _WX_ANIMDECOD_H #include "wx/defs.h" #if wxUSE_STREAMS #include "wx/colour.h" #include "wx/gdicmn.h" #include "wx/log.h" #include "wx/stream.h" class WXDLLIMPEXP_FWD_CORE wxImage; /* Differences between a wxAnimationDecoder and a wxImageHandler: 1) wxImageHandlers always load an input stream directly into a given wxImage object converting from the format-specific data representation to the wxImage native format (RGB24). wxAnimationDecoders always load an input stream using some optimized format to store it which is format-depedent. This allows to store a (possibly big) animation using a format which is a good compromise between required memory and time required to blit it on the screen. 2) wxAnimationDecoders contain the animation data in some internal variable. That's why they derive from wxObjectRefData: they are data which can be shared. 3) wxAnimationDecoders can be used by a wxImageHandler to retrieve a frame in wxImage format; the viceversa cannot be done. 4) wxAnimationDecoders are decoders only, thus they do not support save features. 5) wxAnimationDecoders are directly used by wxAnimation (generic implementation) as wxObjectRefData while they need to be 'wrapped' by a wxImageHandler for wxImage uses. */ // -------------------------------------------------------------------------- // Constants // -------------------------------------------------------------------------- // NB: the values of these enum items are not casual but coincide with the // GIF disposal codes. Do not change them !! enum wxAnimationDisposal { // No disposal specified. The decoder is not required to take any action. wxANIM_UNSPECIFIED = -1, // Do not dispose. The graphic is to be left in place. wxANIM_DONOTREMOVE = 0, // Restore to background color. The area used by the graphic must be // restored to the background color. wxANIM_TOBACKGROUND = 1, // Restore to previous. The decoder is required to restore the area // overwritten by the graphic with what was there prior to rendering the graphic. wxANIM_TOPREVIOUS = 2 }; enum wxAnimationType { wxANIMATION_TYPE_INVALID, wxANIMATION_TYPE_GIF, wxANIMATION_TYPE_ANI, wxANIMATION_TYPE_ANY }; // -------------------------------------------------------------------------- // wxAnimationDecoder class // -------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxAnimationDecoder : public wxObjectRefData { public: wxAnimationDecoder() { m_nFrames = 0; } virtual bool Load( wxInputStream& stream ) = 0; bool CanRead( wxInputStream& stream ) const { // NOTE: this code is the same of wxImageHandler::CallDoCanRead if ( !stream.IsSeekable() ) return false; // can't test unseekable stream wxFileOffset posOld = stream.TellI(); bool ok = DoCanRead(stream); // restore the old position to be able to test other formats and so on if ( stream.SeekI(posOld) == wxInvalidOffset ) { wxLogDebug(wxT("Failed to rewind the stream in wxAnimationDecoder!")); // reading would fail anyhow as we're not at the right position return false; } return ok; } virtual wxAnimationDecoder *Clone() const = 0; virtual wxAnimationType GetType() const = 0; // convert given frame to wxImage virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0; // frame specific data getters // not all frames may be of the same size; e.g. GIF allows to // specify that between two frames only a smaller portion of the // entire animation has changed. virtual wxSize GetFrameSize(unsigned int frame) const = 0; // the position of this frame in case it's not as big as m_szAnimation // or wxPoint(0,0) otherwise. virtual wxPoint GetFramePosition(unsigned int frame) const = 0; // what should be done after displaying this frame. virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0; // the number of milliseconds this frame should be displayed. // if returns -1 then the frame must be displayed forever. virtual long GetDelay(unsigned int frame) const = 0; // the transparent colour for this frame if any or wxNullColour. virtual wxColour GetTransparentColour(unsigned int frame) const = 0; // get global data wxSize GetAnimationSize() const { return m_szAnimation; } wxColour GetBackgroundColour() const { return m_background; } unsigned int GetFrameCount() const { return m_nFrames; } protected: // checks the signature of the data in the given stream and returns true if it // appears to be a valid animation format recognized by the animation decoder; // this function should modify the stream current position without taking care // of restoring it since CanRead() will do it. virtual bool DoCanRead(wxInputStream& stream) const = 0; wxSize m_szAnimation; unsigned int m_nFrames; // this is the colour to use for the wxANIM_TOBACKGROUND disposal. // if not specified by the animation, it's set to wxNullColour wxColour m_background; }; #endif // wxUSE_STREAMS #endif // _WX_ANIMDECOD_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/encinfo.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/encinfo.h // Purpose: declares wxNativeEncodingInfo struct // Author: Vadim Zeitlin // Modified by: // Created: 19.09.2003 (extracted from wx/fontenc.h) // Copyright: (c) 2003 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_ENCINFO_H_ #define _WX_ENCINFO_H_ #include "wx/string.h" // ---------------------------------------------------------------------------- // wxNativeEncodingInfo contains all encoding parameters for this platform // ---------------------------------------------------------------------------- // This private structure specifies all the parameters needed to create a font // with the given encoding on this platform. // // Under X, it contains the last 2 elements of the font specifications // (registry and encoding). // // Under Windows, it contains a number which is one of predefined XXX_CHARSET // values (https://msdn.microsoft.com/en-us/library/cc250412.aspx). // // Under all platforms it also contains a facename string which should be // used, if not empty, to create fonts in this encoding (this is the only way // to create a font of non-standard encoding (like KOI8) under Windows - the // facename specifies the encoding then) struct WXDLLIMPEXP_CORE wxNativeEncodingInfo { wxString facename; // may be empty meaning "any" wxFontEncoding encoding; // so that we know what this struct represents #if defined(__WXMSW__) || \ defined(__WXMAC__) || \ defined(__WXQT__) wxNativeEncodingInfo() : facename() , encoding(wxFONTENCODING_SYSTEM) , charset(0) /* ANSI_CHARSET */ { } int charset; #elif defined(_WX_X_FONTLIKE) wxString xregistry, xencoding; #elif defined(wxHAS_UTF8_FONTS) // ports using UTF-8 for text don't need encoding information for fonts #else #error "Unsupported toolkit" #endif // this struct is saved in config by wxFontMapper, so it should know to // serialise itself (implemented in platform-specific code) bool FromString(const wxString& s); wxString ToString() const; }; #endif // _WX_ENCINFO_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/thrimpl.cpp
///////////////////////////////////////////////////////////////////////////// // Name: wx/thrimpl.cpp // Purpose: common part of wxThread Implementations // Author: Vadim Zeitlin // Modified by: // Created: 04.06.02 (extracted from src/*/thread.cpp files) // Copyright: (c) Vadim Zeitlin (2002) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // this file is supposed to be included only by the various thread.cpp // ---------------------------------------------------------------------------- // wxMutex // ---------------------------------------------------------------------------- wxMutex::wxMutex(wxMutexType mutexType) { m_internal = new wxMutexInternal(mutexType); if ( !m_internal->IsOk() ) { delete m_internal; m_internal = NULL; } } wxMutex::~wxMutex() { delete m_internal; } bool wxMutex::IsOk() const { return m_internal != NULL; } wxMutexError wxMutex::Lock() { wxCHECK_MSG( m_internal, wxMUTEX_INVALID, wxT("wxMutex::Lock(): not initialized") ); return m_internal->Lock(); } wxMutexError wxMutex::LockTimeout(unsigned long ms) { wxCHECK_MSG( m_internal, wxMUTEX_INVALID, wxT("wxMutex::Lock(): not initialized") ); return m_internal->Lock(ms); } wxMutexError wxMutex::TryLock() { wxCHECK_MSG( m_internal, wxMUTEX_INVALID, wxT("wxMutex::TryLock(): not initialized") ); return m_internal->TryLock(); } wxMutexError wxMutex::Unlock() { wxCHECK_MSG( m_internal, wxMUTEX_INVALID, wxT("wxMutex::Unlock(): not initialized") ); return m_internal->Unlock(); } // -------------------------------------------------------------------------- // wxConditionInternal // -------------------------------------------------------------------------- // Win32 doesn't have explicit support for the POSIX condition // variables and its events/event semaphores have quite different semantics, // so we reimplement the conditions from scratch using the mutexes and // semaphores #if defined(__WINDOWS__) class wxConditionInternal { public: wxConditionInternal(wxMutex& mutex); bool IsOk() const { return m_mutex.IsOk() && m_semaphore.IsOk(); } wxCondError Wait(); wxCondError WaitTimeout(unsigned long milliseconds); wxCondError Signal(); wxCondError Broadcast(); private: // the number of threads currently waiting for this condition LONG m_numWaiters; // the critical section protecting m_numWaiters wxCriticalSection m_csWaiters; wxMutex& m_mutex; wxSemaphore m_semaphore; wxDECLARE_NO_COPY_CLASS(wxConditionInternal); }; wxConditionInternal::wxConditionInternal(wxMutex& mutex) : m_mutex(mutex) { // another thread can't access it until we return from ctor, so no need to // protect access to m_numWaiters here m_numWaiters = 0; } wxCondError wxConditionInternal::Wait() { // increment the number of waiters { wxCriticalSectionLocker lock(m_csWaiters); m_numWaiters++; } m_mutex.Unlock(); // after unlocking the mutex other threads may Signal() us, but it is ok // now as we had already incremented m_numWaiters so Signal() will post the // semaphore and decrement m_numWaiters back even if it is called before we // start to Wait() const wxSemaError err = m_semaphore.Wait(); m_mutex.Lock(); if ( err == wxSEMA_NO_ERROR ) { // m_numWaiters was decremented by Signal() return wxCOND_NO_ERROR; } // but in case of an error we need to do it manually { wxCriticalSectionLocker lock(m_csWaiters); m_numWaiters--; } return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; } wxCondError wxConditionInternal::WaitTimeout(unsigned long milliseconds) { { wxCriticalSectionLocker lock(m_csWaiters); m_numWaiters++; } m_mutex.Unlock(); wxSemaError err = m_semaphore.WaitTimeout(milliseconds); m_mutex.Lock(); if ( err == wxSEMA_NO_ERROR ) return wxCOND_NO_ERROR; if ( err == wxSEMA_TIMEOUT ) { // a potential race condition exists here: it happens when a waiting // thread times out but doesn't have time to decrement m_numWaiters yet // before Signal() is called in another thread // // to handle this particular case, check the semaphore again after // acquiring m_csWaiters lock -- this will catch the signals missed // during this window wxCriticalSectionLocker lock(m_csWaiters); err = m_semaphore.WaitTimeout(0); if ( err == wxSEMA_NO_ERROR ) return wxCOND_NO_ERROR; // we need to decrement m_numWaiters ourselves as it wasn't done by // Signal() m_numWaiters--; return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; } // undo m_numWaiters++ above in case of an error { wxCriticalSectionLocker lock(m_csWaiters); m_numWaiters--; } return wxCOND_MISC_ERROR; } wxCondError wxConditionInternal::Signal() { wxCriticalSectionLocker lock(m_csWaiters); if ( m_numWaiters > 0 ) { // increment the semaphore by 1 if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) return wxCOND_MISC_ERROR; m_numWaiters--; } return wxCOND_NO_ERROR; } wxCondError wxConditionInternal::Broadcast() { wxCriticalSectionLocker lock(m_csWaiters); while ( m_numWaiters > 0 ) { if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) return wxCOND_MISC_ERROR; m_numWaiters--; } return wxCOND_NO_ERROR; } #endif // __WINDOWS__ // ---------------------------------------------------------------------------- // wxCondition // ---------------------------------------------------------------------------- wxCondition::wxCondition(wxMutex& mutex) { m_internal = new wxConditionInternal(mutex); if ( !m_internal->IsOk() ) { delete m_internal; m_internal = NULL; } } wxCondition::~wxCondition() { delete m_internal; } bool wxCondition::IsOk() const { return m_internal != NULL; } wxCondError wxCondition::Wait() { wxCHECK_MSG( m_internal, wxCOND_INVALID, wxT("wxCondition::Wait(): not initialized") ); return m_internal->Wait(); } wxCondError wxCondition::WaitTimeout(unsigned long milliseconds) { wxCHECK_MSG( m_internal, wxCOND_INVALID, wxT("wxCondition::Wait(): not initialized") ); return m_internal->WaitTimeout(milliseconds); } wxCondError wxCondition::Signal() { wxCHECK_MSG( m_internal, wxCOND_INVALID, wxT("wxCondition::Signal(): not initialized") ); return m_internal->Signal(); } wxCondError wxCondition::Broadcast() { wxCHECK_MSG( m_internal, wxCOND_INVALID, wxT("wxCondition::Broadcast(): not initialized") ); return m_internal->Broadcast(); } // -------------------------------------------------------------------------- // wxSemaphore // -------------------------------------------------------------------------- wxSemaphore::wxSemaphore(int initialcount, int maxcount) { m_internal = new wxSemaphoreInternal( initialcount, maxcount ); if ( !m_internal->IsOk() ) { delete m_internal; m_internal = NULL; } } wxSemaphore::~wxSemaphore() { delete m_internal; } bool wxSemaphore::IsOk() const { return m_internal != NULL; } wxSemaError wxSemaphore::Wait() { wxCHECK_MSG( m_internal, wxSEMA_INVALID, wxT("wxSemaphore::Wait(): not initialized") ); return m_internal->Wait(); } wxSemaError wxSemaphore::TryWait() { wxCHECK_MSG( m_internal, wxSEMA_INVALID, wxT("wxSemaphore::TryWait(): not initialized") ); return m_internal->TryWait(); } wxSemaError wxSemaphore::WaitTimeout(unsigned long milliseconds) { wxCHECK_MSG( m_internal, wxSEMA_INVALID, wxT("wxSemaphore::WaitTimeout(): not initialized") ); return m_internal->WaitTimeout(milliseconds); } wxSemaError wxSemaphore::Post() { wxCHECK_MSG( m_internal, wxSEMA_INVALID, wxT("wxSemaphore::Post(): not initialized") ); return m_internal->Post(); } // ---------------------------------------------------------------------------- // wxThread // ---------------------------------------------------------------------------- #include "wx/utils.h" #include "wx/private/threadinfo.h" #include "wx/scopeguard.h" void wxThread::Sleep(unsigned long milliseconds) { wxMilliSleep(milliseconds); } void *wxThread::CallEntry() { wxON_BLOCK_EXIT0(wxThreadSpecificInfo::ThreadCleanUp); return Entry(); }
cpp
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/strconv.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/strconv.h // Purpose: conversion routines for char sets any Unicode // Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 29/01/98 // Copyright: (c) 1998 Ove Kaaven, Robert Roebling // (c) 1998-2006 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_STRCONV_H_ #define _WX_STRCONV_H_ #include "wx/defs.h" #include "wx/chartype.h" #include "wx/buffer.h" #include <stdlib.h> class WXDLLIMPEXP_FWD_BASE wxString; // the error value returned by wxMBConv methods #define wxCONV_FAILED ((size_t)-1) // ---------------------------------------------------------------------------- // wxMBConv (abstract base class for conversions) // ---------------------------------------------------------------------------- // When deriving a new class from wxMBConv you must reimplement ToWChar() and // FromWChar() methods which are not pure virtual only for historical reasons, // don't let the fact that the existing classes implement MB2WC/WC2MB() instead // confuse you. // // You also have to implement Clone() to allow copying the conversions // polymorphically. // // And you might need to override GetMBNulLen() as well. class WXDLLIMPEXP_BASE wxMBConv { public: // The functions doing actual conversion from/to narrow to/from wide // character strings. // // On success, the return value is the length (i.e. the number of // characters, not bytes) of the converted string including any trailing // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if // there is not enough space for everything, including the trailing NUL // character(s), in the output buffer, wxCONV_FAILED is returned. // // In the special case when dst is NULL (the value of dstLen is ignored // then) the return value is the length of the needed buffer but nothing // happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and // including the trailing NUL(s), is converted, otherwise exactly srcLen // bytes are. // // Typical usage: // // size_t dstLen = conv.ToWChar(NULL, 0, src); // if ( dstLen == wxCONV_FAILED ) // ... handle error ... // wchar_t *wbuf = new wchar_t[dstLen]; // conv.ToWChar(wbuf, dstLen, src); // ... work with wbuf ... // delete [] wbuf; // virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const; // Convenience functions for translating NUL-terminated strings: return // the buffer containing the converted string or empty buffer if the // conversion failed. wxWCharBuffer cMB2WC(const char *in) const { return DoConvertMB2WC(in, wxNO_LEN); } wxCharBuffer cWC2MB(const wchar_t *in) const { return DoConvertWC2MB(in, wxNO_LEN); } wxWCharBuffer cMB2WC(const wxScopedCharBuffer& in) const { return DoConvertMB2WC(in, in.length()); } wxCharBuffer cWC2MB(const wxScopedWCharBuffer& in) const { return DoConvertWC2MB(in, in.length()); } // Convenience functions for converting strings which may contain embedded // NULs and don't have to be NUL-terminated. // // inLen is the length of the buffer including trailing NUL if any or // wxNO_LEN if the input is NUL-terminated. // // outLen receives, if not NULL, the length of the converted string or 0 if // the conversion failed (returning 0 and not -1 in this case makes it // difficult to distinguish between failed conversion and empty input but // this is done for backwards compatibility). Notice that the rules for // whether outLen accounts or not for the last NUL are the same as for // To/FromWChar() above: if inLen is specified, outLen is exactly the // number of characters converted, whether the last one of them was NUL or // not. But if inLen == wxNO_LEN then outLen doesn't account for the last // NUL even though it is present. wxWCharBuffer cMB2WC(const char *in, size_t inLen, size_t *outLen) const; wxCharBuffer cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const; // convenience functions for converting MB or WC to/from wxWin default #if wxUSE_UNICODE wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); } const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; } const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; } #else // ANSI const char* cMB2WX(const char *psz) const { return psz; } const char* cWX2MB(const char *psz) const { return psz; } wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); } wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); } #endif // Unicode/ANSI // this function is used in the implementation of cMB2WC() to distinguish // between the following cases: // // a) var width encoding with strings terminated by a single NUL // (usual multibyte encodings): return 1 in this case // b) fixed width encoding with 2 bytes/char and so terminated by // 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case // c) fixed width encoding with 4 bytes/char and so terminated by // 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case // // anything else is not supported currently and -1 should be returned virtual size_t GetMBNulLen() const { return 1; } // return the maximal value currently returned by GetMBNulLen() for any // encoding static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; } // return true if the converter's charset is UTF-8, i.e. char* strings // decoded using this object can be directly copied to wxString's internal // storage without converting to WC and than back to UTF-8 MB string virtual bool IsUTF8() const { return false; } // The old conversion functions. The existing classes currently mostly // implement these ones but we're in transition to using To/FromWChar() // instead and any new classes should implement just the new functions. // For now, however, we provide default implementation of To/FromWChar() in // this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all // the conversions at once. // // On success, the return value is the length (i.e. the number of // characters, not bytes) not counting the trailing NUL(s) of the converted // string. On failure, (size_t)-1 is returned. In the special case when // outputBuf is NULL the return value is the same one but nothing is // written to the buffer. // // Note that outLen is the length of the output buffer, not the length of // the input (which is always supposed to be terminated by one or more // NULs, as appropriate for the encoding)! virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const; virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const; // make a heap-allocated copy of this object virtual wxMBConv *Clone() const = 0; // virtual dtor for any base class virtual ~wxMBConv() { } private: // Common part of single argument cWC2MB() and cMB2WC() overloads above. wxCharBuffer DoConvertWC2MB(const wchar_t* pwz, size_t srcLen) const; wxWCharBuffer DoConvertMB2WC(const char* psz, size_t srcLen) const; }; // ---------------------------------------------------------------------------- // wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for // conversion (hence it depends on the current locale) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv { public: virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const wxOVERRIDE; virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvLibc; } virtual bool IsUTF8() const wxOVERRIDE { return wxLocaleIsUtf8; } }; #ifdef __UNIX__ // ---------------------------------------------------------------------------- // wxConvBrokenFileNames is made for Unix in Unicode mode when // files are accidentally written in an encoding which is not // the system encoding. Typically, the system encoding will be // UTF8 but there might be files stored in ISO8859-1 on disk. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv { public: wxConvBrokenFileNames(const wxString& charset); wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) : wxMBConv(), m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) { } virtual ~wxConvBrokenFileNames() { delete m_conv; } virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const wxOVERRIDE { return m_conv->MB2WC(out, in, outLen); } virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const wxOVERRIDE { return m_conv->WC2MB(out, in, outLen); } virtual size_t GetMBNulLen() const wxOVERRIDE { // cast needed to call a private function return m_conv->GetMBNulLen(); } virtual bool IsUTF8() const wxOVERRIDE { return m_conv->IsUTF8(); } virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvBrokenFileNames(*this); } private: // the conversion object we forward to wxMBConv *m_conv; wxDECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames); }; #endif // __UNIX__ // ---------------------------------------------------------------------------- // wxMBConvUTF7 (for conversion using UTF7 encoding) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv { public: wxMBConvUTF7() { } // compiler-generated copy ctor, assignment operator and dtor are ok // (assuming it's ok to copy the shift state -- not really sure about it) virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF7; } private: // UTF-7 decoder/encoder may be in direct mode or in shifted mode after a // '+' (and until the '-' or any other non-base64 character) struct StateMode { enum Mode { Direct, // pass through state Shifted // after a '+' (and before '-') }; }; // the current decoder state: this is only used by ToWChar() if srcLen // parameter is not wxNO_LEN, when working on the entire NUL-terminated // strings we neither update nor use the state class DecoderState : private StateMode { private: // current state: this one is private as we want to enforce the use of // ToDirect/ToShifted() methods below Mode mode; public: // the initial state is direct DecoderState() { mode = Direct; } // switch to/from shifted mode void ToDirect() { mode = Direct; } void ToShifted() { mode = Shifted; accum = bit = 0; isLSB = false; } bool IsDirect() const { return mode == Direct; } bool IsShifted() const { return mode == Shifted; } // these variables are only used in shifted mode unsigned int accum; // accumulator of the bit we've already got unsigned int bit; // the number of bits consumed mod 8 unsigned char msb; // the high byte of UTF-16 word bool isLSB; // whether we're decoding LSB or MSB of UTF-16 word }; DecoderState m_stateDecoder; // encoder state is simpler as we always receive entire Unicode characters // on input class EncoderState : private StateMode { private: Mode mode; public: EncoderState() { mode = Direct; } void ToDirect() { mode = Direct; } void ToShifted() { mode = Shifted; accum = bit = 0; } bool IsDirect() const { return mode == Direct; } bool IsShifted() const { return mode == Shifted; } unsigned int accum; unsigned int bit; }; EncoderState m_stateEncoder; }; // ---------------------------------------------------------------------------- // wxMBConvUTF8 (for conversion using UTF8 encoding) // ---------------------------------------------------------------------------- // this is the real UTF-8 conversion class, it has to be called "strict UTF-8" // for compatibility reasons: the wxMBConvUTF8 class below also supports lossy // conversions if it is created with non default options class WXDLLIMPEXP_BASE wxMBConvStrictUTF8 : public wxMBConv { public: // compiler-generated default ctor and other methods are ok virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvStrictUTF8(); } // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't // take the shortcut in that case virtual bool IsUTF8() const wxOVERRIDE { return true; } }; class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8 { public: enum { MAP_INVALID_UTF8_NOT = 0, MAP_INVALID_UTF8_TO_PUA = 1, MAP_INVALID_UTF8_TO_OCTAL = 2 }; wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF8(m_options); } // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't // take the shortcut in that case virtual bool IsUTF8() const wxOVERRIDE { return m_options == MAP_INVALID_UTF8_NOT; } private: int m_options; }; // ---------------------------------------------------------------------------- // wxMBConvUTF16Base: for both LE and BE variants // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv { public: enum { BYTES_PER_CHAR = 2 }; virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; } protected: // return the length of the buffer using srcLen if it's not wxNO_LEN and // computing the length ourselves if it is; also checks that the length is // even if specified as we need an entire number of UTF-16 characters and // returns wxNO_LEN which indicates error if it is odd static size_t GetLength(const char *src, size_t srcLen); }; // ---------------------------------------------------------------------------- // wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16LE; } }; // ---------------------------------------------------------------------------- // wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16BE; } }; // ---------------------------------------------------------------------------- // wxMBConvUTF32Base: base class for both LE and BE variants // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv { public: enum { BYTES_PER_CHAR = 4 }; virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; } protected: // this is similar to wxMBConvUTF16Base method with the same name except // that, of course, it verifies that length is divisible by 4 if given and // not by 2 static size_t GetLength(const char *src, size_t srcLen); }; // ---------------------------------------------------------------------------- // wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32LE; } }; // ---------------------------------------------------------------------------- // wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding) // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32BE; } }; // ---------------------------------------------------------------------------- // wxCSConv (for conversion based on loadable char sets) // ---------------------------------------------------------------------------- #include "wx/fontenc.h" class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv { public: // we can be created either from charset name or from an encoding constant // but we can't have both at once wxCSConv(const wxString& charset); wxCSConv(wxFontEncoding encoding); wxCSConv(const wxCSConv& conv); virtual ~wxCSConv(); wxCSConv& operator=(const wxCSConv& conv); virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t GetMBNulLen() const wxOVERRIDE; virtual bool IsUTF8() const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxCSConv(*this); } void Clear(); // return true if the conversion could be initialized successfully bool IsOk() const; private: // common part of all ctors void Init(); // Creates the conversion to use, called from all ctors to initialize // m_convReal. wxMBConv *DoCreate() const; // Set the name (may be only called when m_name == NULL), makes copy of // the charset string. void SetName(const char *charset); // Set m_encoding field respecting the rules below, i.e. making sure it has // a valid value if m_name == NULL (thus this should be always called after // SetName()). // // Input encoding may be valid or not. void SetEncoding(wxFontEncoding encoding); // The encoding we use is specified by the two fields below: // // 1. If m_name != NULL, m_encoding corresponds to it if it's one of // encodings we know about (i.e. member of wxFontEncoding) or is // wxFONTENCODING_SYSTEM otherwise. // // 2. If m_name == NULL, m_encoding is always valid, i.e. not one of // wxFONTENCODING_{SYSTEM,DEFAULT,MAX}. char *m_name; wxFontEncoding m_encoding; // The conversion object for our encoding or NULL if we failed to create it // in which case we fall back to hard-coded ISO8859-1 conversion. wxMBConv *m_convReal; }; // ---------------------------------------------------------------------------- // wxWhateverWorksConv: use whatever encoding works for the input // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxWhateverWorksConv : public wxMBConv { public: wxWhateverWorksConv() { } // Try to interpret the string as UTF-8, if it fails fall back to the // current locale encoding (wxConvLibc) and if this fails as well, // interpret it as wxConvISO8859_1 (which is used because it never fails // and this conversion is used when we really, really must produce // something on output). virtual size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; // Try to encode the string using the current locale encoding (wxConvLibc) // and fall back to UTF-8 (which never fails) if it doesn't work. Note that // we never use wxConvISO8859_1 here as we prefer to fall back on UTF-8 // even for the strings containing only code points representable in 8869-1. virtual size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual wxMBConv *Clone() const wxOVERRIDE { return new wxWhateverWorksConv(); } }; // ---------------------------------------------------------------------------- // declare predefined conversion objects // ---------------------------------------------------------------------------- // Note: this macro is an implementation detail (see the comment in // strconv.cpp). The wxGet_XXX() and wxGet_XXXPtr() functions shouldn't be // used by user code and neither should XXXPtr, use the wxConvXXX macro // instead. #define WX_DECLARE_GLOBAL_CONV(klass, name) \ extern WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr; \ extern WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr(); \ inline klass& wxGet_##name() \ { \ if ( !name##Ptr ) \ name##Ptr = wxGet_##name##Ptr(); \ return *name##Ptr; \ } // conversion to be used with all standard functions affected by locale, e.g. // strtol(), strftime(), ... WX_DECLARE_GLOBAL_CONV(wxMBConv, wxConvLibc) #define wxConvLibc wxGet_wxConvLibc() // conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1) #define wxConvISO8859_1 wxGet_wxConvISO8859_1() WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8) #define wxConvUTF8 wxGet_wxConvUTF8() WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7) #define wxConvUTF7 wxGet_wxConvUTF7() // conversion used when we may not afford to lose data when outputting Unicode // strings (should be avoid in the other direction as it can misinterpret the // input encoding) WX_DECLARE_GLOBAL_CONV(wxWhateverWorksConv, wxConvWhateverWorks) #define wxConvWhateverWorks wxGet_wxConvWhateverWorks() // conversion used for the file names on the systems where they're not Unicode // (basically anything except Windows) // // this is used by all file functions, can be changed by the application // // by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used // under Windows normally) extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName; // backwards compatible define #define wxConvFile (*wxConvFileName) // the current conversion object, may be set to any conversion, is used by // default in a couple of places inside wx (initially same as wxConvLibc) extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; // the conversion corresponding to the current locale WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal) #define wxConvLocal wxGet_wxConvLocal() // the conversion corresponding to the encoding of the standard UI elements // // by default this is the same as wxConvLocal but may be changed if the program // needs to use a fixed encoding extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; #undef WX_DECLARE_GLOBAL_CONV // ---------------------------------------------------------------------------- // endianness-dependent conversions // ---------------------------------------------------------------------------- #ifdef WORDS_BIGENDIAN typedef wxMBConvUTF16BE wxMBConvUTF16; typedef wxMBConvUTF32BE wxMBConvUTF32; #else typedef wxMBConvUTF16LE wxMBConvUTF16; typedef wxMBConvUTF32LE wxMBConvUTF32; #endif // ---------------------------------------------------------------------------- // filename conversion macros // ---------------------------------------------------------------------------- // filenames are multibyte on Unix and widechar on Windows #if wxMBFILES && wxUSE_UNICODE #define wxFNCONV(name) wxConvFileName->cWX2MB(name) #define wxFNSTRINGCAST wxMBSTRINGCAST #else #if defined(__WXOSX__) && wxMBFILES #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) #else #define wxFNCONV(name) name #endif #define wxFNSTRINGCAST WXSTRINGCAST #endif // ---------------------------------------------------------------------------- // macros for the most common conversions // ---------------------------------------------------------------------------- #if wxUSE_UNICODE #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s) #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s) // these functions should be used when the conversions really, really have // to succeed (usually because we pass their results to a standard C // function which would crash if we passed NULL to it), so these functions // always return a valid pointer if their argument is non-NULL inline wxWCharBuffer wxSafeConvertMB2WX(const char *s) { return wxConvWhateverWorks.cMB2WC(s); } inline wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) { return wxConvWhateverWorks.cWC2MB(ws); } #else // ANSI // no conversions to do #define wxConvertWX2MB(s) (s) #define wxConvertMB2WX(s) (s) #define wxSafeConvertMB2WX(s) (s) #define wxSafeConvertWX2MB(s) (s) #endif // Unicode/ANSI #endif // _WX_STRCONV_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/buffer.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/buffer.h // Purpose: auto buffer classes: buffers which automatically free memory // Author: Vadim Zeitlin // Modified by: // Created: 12.04.99 // Copyright: (c) 1998 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_BUFFER_H #define _WX_BUFFER_H #include "wx/defs.h" #include "wx/wxcrtbase.h" #include <stdlib.h> // malloc() and free() class WXDLLIMPEXP_FWD_BASE wxCStrData; // ---------------------------------------------------------------------------- // Special classes for (wide) character strings: they use malloc/free instead // of new/delete // ---------------------------------------------------------------------------- // helpers used by wxCharTypeBuffer namespace wxPrivate { struct UntypedBufferData { enum Kind { Owned, NonOwned }; UntypedBufferData(void *str, size_t len, Kind kind = Owned) : m_str(str), m_length(len), m_ref(1), m_owned(kind == Owned) {} ~UntypedBufferData() { if ( m_owned ) free(m_str); } void *m_str; size_t m_length; // "short" to have sizeof(Data)=12 on 32bit archs unsigned short m_ref; bool m_owned; }; // NB: this is defined in string.cpp and not the (non-existent) buffer.cpp WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData(); } // namespace wxPrivate // Reference-counted character buffer for storing string data. The buffer // is only valid for as long as the "parent" object that provided the data // is valid; see wxCharTypeBuffer<T> for persistent variant. template <typename T> class wxScopedCharTypeBuffer { public: typedef T CharType; wxScopedCharTypeBuffer() { m_data = GetNullData(); } // Creates "non-owned" buffer, i.e. 'str' is not owned by the buffer // and doesn't get freed by dtor. Used e.g. to point to wxString's internal // storage. static const wxScopedCharTypeBuffer CreateNonOwned(const CharType *str, size_t len = wxNO_LEN) { if ( len == wxNO_LEN ) len = wxStrlen(str); wxScopedCharTypeBuffer buf; if ( str ) buf.m_data = new Data(const_cast<CharType*>(str), len, Data::NonOwned); return buf; } // Creates "owned" buffer, i.e. takes over ownership of 'str' and frees it // in dtor (if ref.count reaches 0). static const wxScopedCharTypeBuffer CreateOwned(CharType *str, size_t len = wxNO_LEN ) { if ( len == wxNO_LEN ) len = wxStrlen(str); wxScopedCharTypeBuffer buf; if ( str ) buf.m_data = new Data(str, len); return buf; } wxScopedCharTypeBuffer(const wxScopedCharTypeBuffer& src) { m_data = src.m_data; IncRef(); } wxScopedCharTypeBuffer& operator=(const wxScopedCharTypeBuffer& src) { if ( &src == this ) return *this; DecRef(); m_data = src.m_data; IncRef(); return *this; } ~wxScopedCharTypeBuffer() { DecRef(); } // NB: this method is only const for backward compatibility. It used to // be needed for auto_ptr-like semantics of the copy ctor, but now // that ref-counting is used, it's not really needed. CharType *release() const { if ( m_data == GetNullData() ) return NULL; wxASSERT_MSG( m_data->m_owned, wxT("can't release non-owned buffer") ); wxASSERT_MSG( m_data->m_ref == 1, wxT("can't release shared buffer") ); CharType * const p = m_data->Get(); wxScopedCharTypeBuffer *self = const_cast<wxScopedCharTypeBuffer*>(this); self->m_data->Set(NULL, 0); self->DecRef(); return p; } void reset() { DecRef(); } CharType *data() { return m_data->Get(); } const CharType *data() const { return m_data->Get(); } operator const CharType *() const { return data(); } CharType operator[](size_t n) const { return data()[n]; } size_t length() const { return m_data->m_length; } protected: // reference-counted data struct Data : public wxPrivate::UntypedBufferData { Data(CharType *str, size_t len, Kind kind = Owned) : wxPrivate::UntypedBufferData(str, len, kind) { } CharType *Get() const { return static_cast<CharType *>(m_str); } void Set(CharType *str, size_t len) { m_str = str; m_length = len; } }; // placeholder for NULL string, to simplify this code static Data *GetNullData() { return static_cast<Data *>(wxPrivate::GetUntypedNullData()); } void IncRef() { if ( m_data == GetNullData() ) // exception, not ref-counted return; m_data->m_ref++; } void DecRef() { if ( m_data == GetNullData() ) // exception, not ref-counted return; if ( --m_data->m_ref == 0 ) delete m_data; m_data = GetNullData(); } // sets this object to a be copy of 'other'; if 'src' is non-owned, // a deep copy is made and 'this' will contain new instance of the data void MakeOwnedCopyOf(const wxScopedCharTypeBuffer& src) { this->DecRef(); if ( src.m_data == this->GetNullData() ) { this->m_data = this->GetNullData(); } else if ( src.m_data->m_owned ) { this->m_data = src.m_data; this->IncRef(); } else { // if the scoped buffer had non-owned data, we have to make // a copy here, because src.m_data->m_str is valid only for as long // as 'src' exists this->m_data = new Data ( StrCopy(src.data(), src.length()), src.length() ); } } static CharType *StrCopy(const CharType *src, size_t len) { CharType *dst = (CharType*)malloc(sizeof(CharType) * (len + 1)); if ( dst ) memcpy(dst, src, sizeof(CharType) * (len + 1)); return dst; } protected: Data *m_data; }; typedef wxScopedCharTypeBuffer<char> wxScopedCharBuffer; typedef wxScopedCharTypeBuffer<wchar_t> wxScopedWCharBuffer; // this buffer class always stores data in "owned" (persistent) manner template <typename T> class wxCharTypeBuffer : public wxScopedCharTypeBuffer<T> { protected: typedef typename wxScopedCharTypeBuffer<T>::Data Data; public: typedef T CharType; wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN) { if ( str ) { if ( len == wxNO_LEN ) len = wxStrlen(str); this->m_data = new Data(this->StrCopy(str, len), len); } else { this->m_data = this->GetNullData(); } } wxCharTypeBuffer(size_t len) { CharType* const str = (CharType *)malloc((len + 1)*sizeof(CharType)); if ( str ) { str[len] = (CharType)0; // There is a potential memory leak here if new throws because it // fails to allocate Data, we ought to use new(nothrow) here, but // this might fail to compile under some platforms so until this // can be fully tested, just live with this (rather unlikely, as // Data is a small object) potential leak. this->m_data = new Data(str, len); } else { this->m_data = this->GetNullData(); } } wxCharTypeBuffer(const wxCharTypeBuffer& src) : wxScopedCharTypeBuffer<T>(src) {} wxCharTypeBuffer& operator=(const CharType *str) { this->DecRef(); if ( str ) this->m_data = new Data(wxStrdup(str), wxStrlen(str)); return *this; } wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src) { wxScopedCharTypeBuffer<T>::operator=(src); return *this; } wxCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src) { this->MakeOwnedCopyOf(src); } wxCharTypeBuffer& operator=(const wxScopedCharTypeBuffer<T>& src) { MakeOwnedCopyOf(src); return *this; } bool extend(size_t len) { wxASSERT_MSG( this->m_data->m_owned, "cannot extend non-owned buffer" ); wxASSERT_MSG( this->m_data->m_ref == 1, "can't extend shared buffer" ); CharType *str = (CharType *)realloc(this->data(), (len + 1) * sizeof(CharType)); if ( !str ) return false; // For consistency with the ctor taking just the length, NUL-terminate // the buffer. str[len] = (CharType)0; if ( this->m_data == this->GetNullData() ) { this->m_data = new Data(str, len); } else { this->m_data->Set(str, len); this->m_data->m_owned = true; } return true; } void shrink(size_t len) { wxASSERT_MSG( this->m_data->m_owned, "cannot shrink non-owned buffer" ); wxASSERT_MSG( this->m_data->m_ref == 1, "can't shrink shared buffer" ); wxASSERT( len <= this->length() ); this->m_data->m_length = len; this->data()[len] = 0; } }; class wxCharBuffer : public wxCharTypeBuffer<char> { public: typedef wxCharTypeBuffer<char> wxCharTypeBufferBase; typedef wxScopedCharTypeBuffer<char> wxScopedCharTypeBufferBase; wxCharBuffer(const wxCharTypeBufferBase& buf) : wxCharTypeBufferBase(buf) {} wxCharBuffer(const wxScopedCharTypeBufferBase& buf) : wxCharTypeBufferBase(buf) {} wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} wxCharBuffer(const wxCStrData& cstr); }; class wxWCharBuffer : public wxCharTypeBuffer<wchar_t> { public: typedef wxCharTypeBuffer<wchar_t> wxCharTypeBufferBase; typedef wxScopedCharTypeBuffer<wchar_t> wxScopedCharTypeBufferBase; wxWCharBuffer(const wxCharTypeBufferBase& buf) : wxCharTypeBufferBase(buf) {} wxWCharBuffer(const wxScopedCharTypeBufferBase& buf) : wxCharTypeBufferBase(buf) {} wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} wxWCharBuffer(const wxCStrData& cstr); }; // wxCharTypeBuffer<T> implicitly convertible to T* template <typename T> class wxWritableCharTypeBuffer : public wxCharTypeBuffer<T> { public: typedef typename wxScopedCharTypeBuffer<T>::CharType CharType; wxWritableCharTypeBuffer(const wxScopedCharTypeBuffer<T>& src) : wxCharTypeBuffer<T>(src) {} // FIXME-UTF8: this won't be needed after converting mb_str()/wc_str() to // always return a buffer // + we should derive this class from wxScopedCharTypeBuffer // then wxWritableCharTypeBuffer(const CharType *str = NULL) : wxCharTypeBuffer<T>(str) {} operator CharType*() { return this->data(); } }; typedef wxWritableCharTypeBuffer<char> wxWritableCharBuffer; typedef wxWritableCharTypeBuffer<wchar_t> wxWritableWCharBuffer; #if wxUSE_UNICODE #define wxWxCharBuffer wxWCharBuffer #define wxMB2WXbuf wxWCharBuffer #define wxWX2MBbuf wxCharBuffer #if wxUSE_UNICODE_WCHAR #define wxWC2WXbuf wxChar* #define wxWX2WCbuf wxChar* #elif wxUSE_UNICODE_UTF8 #define wxWC2WXbuf wxWCharBuffer #define wxWX2WCbuf wxWCharBuffer #endif #else // ANSI #define wxWxCharBuffer wxCharBuffer #define wxMB2WXbuf wxChar* #define wxWX2MBbuf wxChar* #define wxWC2WXbuf wxCharBuffer #define wxWX2WCbuf wxWCharBuffer #endif // Unicode/ANSI // ---------------------------------------------------------------------------- // A class for holding growable data buffers (not necessarily strings) // ---------------------------------------------------------------------------- // This class manages the actual data buffer pointer and is ref-counted. class wxMemoryBufferData { public: // the initial size and also the size added by ResizeIfNeeded() enum { DefBufSize = 1024 }; friend class wxMemoryBuffer; // everything is private as it can only be used by wxMemoryBuffer private: wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize) : m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0) { } ~wxMemoryBufferData() { free(m_data); } void ResizeIfNeeded(size_t newSize) { if (newSize > m_size) { void* const data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); if ( !data ) { // It's better to crash immediately dereferencing a null // pointer in the function calling us than overflowing the // buffer which couldn't be made big enough. free(release()); return; } m_data = data; m_size = newSize + wxMemoryBufferData::DefBufSize; } } void IncRef() { m_ref += 1; } void DecRef() { m_ref -= 1; if (m_ref == 0) // are there no more references? delete this; } void *release() { if ( m_data == NULL ) return NULL; wxASSERT_MSG( m_ref == 1, "can't release shared buffer" ); void *p = m_data; m_data = NULL; m_len = m_size = 0; return p; } // the buffer containing the data void *m_data; // the size of the buffer size_t m_size; // the amount of data currently in the buffer size_t m_len; // the reference count size_t m_ref; wxDECLARE_NO_COPY_CLASS(wxMemoryBufferData); }; class wxMemoryBuffer { public: // ctor and dtor wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize) { m_bufdata = new wxMemoryBufferData(size); m_bufdata->IncRef(); } ~wxMemoryBuffer() { m_bufdata->DecRef(); } // copy and assignment wxMemoryBuffer(const wxMemoryBuffer& src) : m_bufdata(src.m_bufdata) { m_bufdata->IncRef(); } wxMemoryBuffer& operator=(const wxMemoryBuffer& src) { if (&src != this) { m_bufdata->DecRef(); m_bufdata = src.m_bufdata; m_bufdata->IncRef(); } return *this; } // Accessors void *GetData() const { return m_bufdata->m_data; } size_t GetBufSize() const { return m_bufdata->m_size; } size_t GetDataLen() const { return m_bufdata->m_len; } bool IsEmpty() const { return GetDataLen() == 0; } void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); } void SetDataLen(size_t len) { wxASSERT(len <= m_bufdata->m_size); m_bufdata->m_len = len; } void Clear() { SetDataLen(0); } // Ensure the buffer is big enough and return a pointer to it void *GetWriteBuf(size_t sizeNeeded) { m_bufdata->ResizeIfNeeded(sizeNeeded); return m_bufdata->m_data; } // Update the length after the write void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); } // Like the above, but appends to the buffer void *GetAppendBuf(size_t sizeNeeded) { m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded); return (char*)m_bufdata->m_data + m_bufdata->m_len; } // Update the length after the append void UngetAppendBuf(size_t sizeUsed) { SetDataLen(m_bufdata->m_len + sizeUsed); } // Other ways to append to the buffer void AppendByte(char data) { wxCHECK_RET( m_bufdata->m_data, wxT("invalid wxMemoryBuffer") ); m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1); *(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data; m_bufdata->m_len += 1; } void AppendData(const void *data, size_t len) { memcpy(GetAppendBuf(len), data, len); UngetAppendBuf(len); } operator const char *() const { return (const char*)GetData(); } // gives up ownership of data, returns the pointer; after this call, // data isn't freed by the buffer and its content is resent to empty void *release() { return m_bufdata->release(); } private: wxMemoryBufferData* m_bufdata; }; // ---------------------------------------------------------------------------- // template class for any kind of data // ---------------------------------------------------------------------------- // TODO #endif // _WX_BUFFER_H
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/vms_x_fix.h
/*************************************************************************** * * * Author : Jouk Jansen ([email protected]) * * * * Last revision : 7 October 2005 * * * * Repair definitions of Runtime library functions when compiling with * * /name=(as_is) on OpenVMS * * * ***************************************************************************/ #ifndef VMS_X_FIX #define VMS_X_FIX #define decw$_select DECW$_SELECT #define DtSaverGetWindows DTSAVERGETWINDOWS #define MrmFetchWidget MRMFETCHWIDGET #define MrmInitialize MRMINITIALIZE #define MrmOpenHierarchy MRMOPENHIERARCHY #define MrmRegisterNames MRMREGISTERNAMES #define XAddExtension XADDEXTENSION #define XAddHosts XADDHOSTS #define XAllocClassHint XALLOCCLASSHINT #define XAllocColor XALLOCCOLOR #define XAllocColorCells XALLOCCOLORCELLS #define XAllocIconSize XALLOCICONSIZE #define XAllocNamedColor XALLOCNAMEDCOLOR #define XAllocSizeHints XALLOCSIZEHINTS #define XAllocStandardColormap XALLOCSTANDARDCOLORMAP #define XAllocWMHints XALLOCWMHINTS #define XAllowEvents XALLOWEVENTS #define XAutoRepeatOff XAUTOREPEATOFF #define XAutoRepeatOn XAUTOREPEATON #define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET #define XBell XBELL #define XBitmapPad XBITMAPPAD #define XBlackPixel XBLACKPIXEL #define XBlackPixelOfScreen XBLACKPIXELOFSCREEN #define XCellsOfScreen XCELLSOFSCREEN #define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB #define XChangeGC XCHANGEGC #define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL #define XChangePointerControl XCHANGEPOINTERCONTROL #define XChangeProperty XCHANGEPROPERTY #define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES #define XCheckIfEvent XCHECKIFEVENT #define XCheckMaskEvent XCHECKMASKEVENT #define XCheckTypedEvent XCHECKTYPEDEVENT #define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT #define XCheckWindowEvent XCHECKWINDOWEVENT #define XClearArea XCLEARAREA #define XClearWindow XCLEARWINDOW #define XClipBox XCLIPBOX #define XCloseDisplay XCLOSEDISPLAY #define XCloseIM XCLOSEIM #define XConfigureWindow XCONFIGUREWINDOW #define XConvertSelection XCONVERTSELECTION #define XCopyArea XCOPYAREA #define XCopyColormapAndFree XCOPYCOLORMAPANDFREE #define XCopyGC XCOPYGC #define XCopyPlane XCOPYPLANE #define XCreateBitmapFromData XCREATEBITMAPFROMDATA #define XCreateColormap XCREATECOLORMAP #define XCreateFontCursor XCREATEFONTCURSOR #define XCreateFontSet XCREATEFONTSET #define XCreateGC XCREATEGC #define XCreateGlyphCursor XCREATEGLYPHCURSOR #define XCreateIC XCREATEIC #define XCreateImage XCREATEIMAGE #define XCreatePixmap XCREATEPIXMAP #define XCreatePixmapCursor XCREATEPIXMAPCURSOR #define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA #define XCreateRegion XCREATEREGION #define XCreateSimpleWindow XCREATESIMPLEWINDOW #define XCreateWindow XCREATEWINDOW #define XDefaultColormap XDEFAULTCOLORMAP #define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN #define XDefaultDepth XDEFAULTDEPTH #define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN #define XDefaultGC XDEFAULTGC #define XDefaultRootWindow XDEFAULTROOTWINDOW #define XDefaultScreen XDEFAULTSCREEN #define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY #define XDefaultVisual XDEFAULTVISUAL #define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN #define XDefineCursor XDEFINECURSOR #define XDeleteContext XDELETECONTEXT #define XDeleteProperty XDELETEPROPERTY #define XDestroyIC XDESTROYIC #define XDestroyRegion XDESTROYREGION #define XDestroySubwindows XDESTROYSUBWINDOWS #define XDestroyWindow XDESTROYWINDOW #define XDisableAccessControl XDISABLEACCESSCONTROL #define XDisplayCells XDISPLAYCELLS #define XDisplayHeight XDISPLAYHEIGHT #define XDisplayKeycodes XDISPLAYKEYCODES #define XDisplayName XDISPLAYNAME #define XDisplayOfIM XDISPLAYOFIM #define XDisplayOfScreen XDISPLAYOFSCREEN #define XDisplayString XDISPLAYSTRING #define XDisplayWidth XDISPLAYWIDTH #define XDoesBackingStore XDOESBACKINGSTORE #define XDrawArc XDRAWARC #define XDrawArcs XDRAWARCS #define XDrawImageString XDRAWIMAGESTRING #define XDrawImageString16 XDRAWIMAGESTRING16 #define XDrawLine XDRAWLINE #define XDrawLines XDRAWLINES #define XDrawPoint XDRAWPOINT #define XDrawPoints XDRAWPOINTS #define XDrawRectangle XDRAWRECTANGLE #define XDrawRectangles XDRAWRECTANGLES #define XDrawSegments XDRAWSEGMENTS #define XDrawString XDRAWSTRING #define XDrawString16 XDRAWSTRING16 #define XDrawText XDRAWTEXT #define XDrawText16 XDRAWTEXT16 #define XESetCloseDisplay XESETCLOSEDISPLAY #define XEmptyRegion XEMPTYREGION #define XEnableAccessControl XENABLEACCESSCONTROL #define XEqualRegion XEQUALREGION #define XEventsQueued XEVENTSQUEUED #define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE #define XExtentsOfFontSet XEXTENTSOFFONTSET #define XFetchBuffer XFETCHBUFFER #define XFetchBytes XFETCHBYTES #define XFetchName XFETCHNAME #define XFillArc XFILLARC #define XFillArcs XFILLARCS #define XFillPolygon XFILLPOLYGON #define XFillRectangle XFILLRECTANGLE #define XFillRectangles XFILLRECTANGLES #define XFilterEvent XFILTEREVENT #define XFindContext XFINDCONTEXT #define XFlush XFLUSH #define XFontsOfFontSet XFONTSOFFONTSET #define XForceScreenSaver XFORCESCREENSAVER #define XFree XFREE #define XFreeColormap XFREECOLORMAP #define XFreeColors XFREECOLORS #define XFreeCursor XFREECURSOR #define XFreeDeviceList XFREEDEVICELIST #define XFreeDeviceState XFREEDEVICESTATE #define XFreeFont XFREEFONT #define XFreeFontInfo XFREEFONTINFO #define XFreeFontNames XFREEFONTNAMES #define XFreeFontSet XFREEFONTSET #define XFreeGC XFREEGC #define XFreeModifiermap XFREEMODIFIERMAP #define XFreePixmap XFREEPIXMAP #define XFreeStringList XFREESTRINGLIST #define XGContextFromGC XGCONTEXTFROMGC #define XGeometry XGEOMETRY #define XGetAtomName XGETATOMNAME #define XGetCommand XGETCOMMAND #define XGetDefault XGETDEFAULT #define XGetErrorDatabaseText XGETERRORDATABASETEXT #define XGetErrorText XGETERRORTEXT #define XGetExtensionVersion XGETEXTENSIONVERSION #define XGetFontProperty XGETFONTPROPERTY #define XGetGCValues XGETGCVALUES #define XGetGeometry XGETGEOMETRY #define XGetICValues XGETICVALUES #define XGetIMValues XGETIMVALUES #define XGetIconName XGETICONNAME #define XGetIconSizes XGETICONSIZES #define XGetImage XGETIMAGE #define XGetInputFocus XGETINPUTFOCUS #define XGetKeyboardControl XGETKEYBOARDCONTROL #define XGetKeyboardMapping XGETKEYBOARDMAPPING #define XGetModifierMapping XGETMODIFIERMAPPING #define XGetMotionEvents XGETMOTIONEVENTS #define XGetNormalHints XGETNORMALHINTS #define XGetPointerMapping XGETPOINTERMAPPING #define XGetRGBColormaps XGETRGBCOLORMAPS #define XGetScreenSaver XGETSCREENSAVER #define XGetSelectionOwner XGETSELECTIONOWNER #define XGetStandardColormap XGETSTANDARDCOLORMAP #define XGetSubImage XGETSUBIMAGE #define XGetTextProperty XGETTEXTPROPERTY #define XGetVisualInfo XGETVISUALINFO #define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS #define XGetWMHints XGETWMHINTS #define XGetWMIconName XGETWMICONNAME #define XGetWMName XGETWMNAME #define XGetWMNormalHints XGETWMNORMALHINTS #define XGetWindowAttributes XGETWINDOWATTRIBUTES #define XGetWindowProperty XGETWINDOWPROPERTY #define XGrabButton XGRABBUTTON #define XGrabKeyboard XGRABKEYBOARD #define XGrabPointer XGRABPOINTER #define XGrabServer XGRABSERVER #define XHeightMMOfScreen XHEIGHTMMOFSCREEN #define XHeightOfScreen XHEIGHTOFSCREEN #define XIconifyWindow XICONIFYWINDOW #define XIfEvent XIFEVENT #define XInitExtension XINITEXTENSION #define XInitImage XINITIMAGE #define XInstallColormap XINSTALLCOLORMAP #define XInternAtom XINTERNATOM #define XInternAtoms XINTERNATOMS #define XIntersectRegion XINTERSECTREGION #define XKeycodeToKeysym XKEYCODETOKEYSYM #define XKeysymToKeycode XKEYSYMTOKEYCODE #define XKeysymToString XKEYSYMTOSTRING #define XKillClient XKILLCLIENT #define XListDepths XLISTDEPTHS #define XListFonts XLISTFONTS #define XListFontsWithInfo XLISTFONTSWITHINFO #define XListHosts XLISTHOSTS #define XListInputDevices XLISTINPUTDEVICES #define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS #define XListPixmapFormats XLISTPIXMAPFORMATS #define XListProperties XLISTPROPERTIES #define XLoadFont XLOADFONT #define XLoadQueryFont XLOADQUERYFONT #define XLookupColor XLOOKUPCOLOR #define XLookupKeysym XLOOKUPKEYSYM #define XLookupString XLOOKUPSTRING #define XLowerWindow XLOWERWINDOW #define XMapRaised XMAPRAISED #define XMapSubwindows XMAPSUBWINDOWS #define XMapWindow XMAPWINDOW #define XMatchVisualInfo XMATCHVISUALINFO #define XMaxRequestSize XMAXREQUESTSIZE #define XMissingExtension XMISSINGEXTENSION #define XMoveResizeWindow XMOVERESIZEWINDOW #define XMoveWindow XMOVEWINDOW #define XNextEvent XNEXTEVENT #define XNextRequest XNEXTREQUEST #define XNoOp XNOOP #define XOffsetRegion XOFFSETREGION #define XOpenDevice XOPENDEVICE #define XOpenDisplay XOPENDISPLAY #define XOpenIM XOPENIM #define XParseColor XPARSECOLOR #define XParseGeometry XPARSEGEOMETRY #define XPeekEvent XPEEKEVENT #define XPeekIfEvent XPEEKIFEVENT #define XPending XPENDING #define XPointInRegion XPOINTINREGION #define XPolygonRegion XPOLYGONREGION #define XPutBackEvent XPUTBACKEVENT #define XPutImage XPUTIMAGE #define XQLength XQLENGTH #define XQueryBestCursor XQUERYBESTCURSOR #define XQueryBestStipple XQUERYBESTSTIPPLE #define XQueryColor XQUERYCOLOR #define XQueryColors XQUERYCOLORS #define XQueryDeviceState XQUERYDEVICESTATE #define XQueryExtension XQUERYEXTENSION #define XQueryFont XQUERYFONT #define XQueryKeymap XQUERYKEYMAP #define XQueryPointer XQUERYPOINTER #define XQueryTree XQUERYTREE #define XRaiseWindow XRAISEWINDOW #define XReadBitmapFile XREADBITMAPFILE #define XRecolorCursor XRECOLORCURSOR #define XReconfigureWMWindow XRECONFIGUREWMWINDOW #define XRectInRegion XRECTINREGION #define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING #define XRemoveHosts XREMOVEHOSTS #define XReparentWindow XREPARENTWINDOW #define XResetScreenSaver XRESETSCREENSAVER #define XResizeWindow XRESIZEWINDOW #define XResourceManagerString XRESOURCEMANAGERSTRING #define XRestackWindows XRESTACKWINDOWS #define XRotateBuffers XROTATEBUFFERS #define XRootWindow XROOTWINDOW #define XRootWindowOfScreen XROOTWINDOWOFSCREEN #define XSaveContext XSAVECONTEXT #define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN #define XScreenOfDisplay XSCREENOFDISPLAY #define XSelectAsyncEvent XSELECTASYNCEVENT #define XSelectAsyncInput XSELECTASYNCINPUT #define XSelectExtensionEvent XSELECTEXTENSIONEVENT #define XSelectInput XSELECTINPUT #define XSendEvent XSENDEVENT #define XServerVendor XSERVERVENDOR #define XSetArcMode XSETARCMODE #define XSetBackground XSETBACKGROUND #define XSetClassHint XSETCLASSHINT #define XSetClipMask XSETCLIPMASK #define XSetClipOrigin XSETCLIPORIGIN #define XSetClipRectangles XSETCLIPRECTANGLES #define XSetCloseDownMode XSETCLOSEDOWNMODE #define XSetCommand XSETCOMMAND #define XSetDashes XSETDASHES #define XSetErrorHandler XSETERRORHANDLER #define XSetFillRule XSETFILLRULE #define XSetFillStyle XSETFILLSTYLE #define XSetFont XSETFONT #define XSetForeground XSETFOREGROUND #define XSetFunction XSETFUNCTION #define XSetGraphicsExposures XSETGRAPHICSEXPOSURES #define XSetICFocus XSETICFOCUS #define XSetICValues XSETICVALUES #define XSetIOErrorHandler XSETIOERRORHANDLER #define XSetIconName XSETICONNAME #define XSetInputFocus XSETINPUTFOCUS #define XSetLineAttributes XSETLINEATTRIBUTES #define XSetLocaleModifiers XSETLOCALEMODIFIERS #define XSetNormalHints XSETNORMALHINTS #define XSetPlaneMask XSETPLANEMASK #define XSetRegion XSETREGION #define XSetRGBColormaps XSETRGBCOLORMAPS #define XSetScreenSaver XSETSCREENSAVER #define XSetSelectionOwner XSETSELECTIONOWNER #define XSetStandardProperties XSETSTANDARDPROPERTIES #define XSetState XSETSTATE #define XSetStipple XSETSTIPPLE #define XSetSubwindowMode XSETSUBWINDOWMODE #define XSetTSOrigin XSETTSORIGIN #define XSetTextProperty XSETTEXTPROPERTY #define XSetTile XSETTILE #define XSetTransientForHint XSETTRANSIENTFORHINT #define XSetWMClientMachine XSETWMCLIENTMACHINE #define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS #define XSetWMHints XSETWMHINTS #define XSetWMIconName XSETWMICONNAME #define XSetWMName XSETWMNAME #define XSetWMNormalHints XSETWMNORMALHINTS #define XSetWMProperties XSETWMPROPERTIES #define XSetWMProtocols XSETWMPROTOCOLS #define XSetWMSizeHints XSETWMSIZEHINTS #define XSetWindowBackground XSETWINDOWBACKGROUND #define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP #define XSetWindowBorder XSETWINDOWBORDER #define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP #define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH #define XSetWindowColormap XSETWINDOWCOLORMAP #define XShapeCombineMask XSHAPECOMBINEMASK #define XShapeCombineRectangles XSHAPECOMBINERECTANGLES #define XShapeGetRectangles XSHAPEGETRECTANGLES #define XShapeQueryExtension XSHAPEQUERYEXTENSION #define XShmAttach XSHMATTACH #define XShmCreateImage XSHMCREATEIMAGE #define XShmCreatePixmap XSHMCREATEPIXMAP #define XShmDetach XSHMDETACH #define XShmGetEventBase XSHMGETEVENTBASE #define XShmPutImage XSHMPUTIMAGE #define XShmQueryExtension XSHMQUERYEXTENSION #define XShmQueryVersion XSHMQUERYVERSION #define XShrinkRegion XSHRINKREGION #define XStoreBuffer XSTOREBUFFER #define XStoreBytes XSTOREBYTES #define XStoreColor XSTORECOLOR #define XStoreColors XSTORECOLORS #define XStoreName XSTORENAME #define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY #define XStringToKeysym XSTRINGTOKEYSYM #define XSubtractRegion XSUBTRACTREGION #define XSupportsLocale XSUPPORTSLOCALE #define XSync XSYNC #define XSynchronize XSYNCHRONIZE #define XTextExtents XTEXTEXTENTS #define XTextExtents16 XTEXTEXTENTS16 #define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST #define XTextWidth XTEXTWIDTH #define XTextWidth16 XTEXTWIDTH16 #define XTranslateCoordinates XTRANSLATECOORDINATES #define XUndefineCursor XUNDEFINECURSOR #define XUngrabButton XUNGRABBUTTON #define XUngrabKeyboard XUNGRABKEYBOARD #define XUngrabPointer XUNGRABPOINTER #define XUngrabServer XUNGRABSERVER #define XUninstallColormap XUNINSTALLCOLORMAP #define XUnionRectWithRegion XUNIONRECTWITHREGION #define XUnionRegion XUNIONREGION #define XUniqueContext XUNIQUECONTEXT #define XUnmapWindow XUNMAPWINDOW #define XUnsetICFocus XUNSETICFOCUS #define XVaCreateNestedList XVACREATENESTEDLIST #define XVisualIDFromVisual XVISUALIDFROMVISUAL #define XWMGeometry XWMGEOMETRY #define XWarpPointer XWARPPOINTER #define XWhitePixel XWHITEPIXEL #define XWhitePixelOfScreen XWHITEPIXELOFSCREEN #define XWidthMMOfScreen XWIDTHMMOFSCREEN #define XWidthOfScreen XWIDTHOFSCREEN #define XWindowEvent XWINDOWEVENT #define XWithdrawWindow XWITHDRAWWINDOW #define XXorRegion XXORREGION #define XcmsQueryColor XCMSQUERYCOLOR #define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME #define XdbeFreeVisualInfo XDBEFREEVISUALINFO #define XdbeGetVisualInfo XDBEGETVISUALINFO #define XdbeQueryExtension XDBEQUERYEXTENSION #define XdbeSwapBuffers XDBESWAPBUFFERS #define XextAddDisplay XEXTADDDISPLAY #define XextFindDisplay XEXTFINDDISPLAY #define XextRemoveDisplay XEXTREMOVEDISPLAY #define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT #define XmActivateProtocol XMACTIVATEPROTOCOL #define XmAddProtocolCallback XMADDPROTOCOLCALLBACK #define XmAddProtocols XMADDPROTOCOLS #define XmChangeColor XMCHANGECOLOR #define XmClipboardCopy XMCLIPBOARDCOPY #define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME #define XmClipboardEndCopy XMCLIPBOARDENDCOPY #define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE #define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT #define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT #define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH #define XmClipboardLock XMCLIPBOARDLOCK #define XmClipboardRetrieve XMCLIPBOARDRETRIEVE #define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY #define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE #define XmClipboardUnlock XMCLIPBOARDUNLOCK #define XmCommandError XMCOMMANDERROR #define XmCommandGetChild XMCOMMANDGETCHILD #define XmCommandSetValue XMCOMMANDSETVALUE #define XmCreateArrowButton XMCREATEARROWBUTTON #define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET #define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG #define XmCreateCascadeButton XMCREATECASCADEBUTTON #define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET #define XmCreateDialogShell XMCREATEDIALOGSHELL #define XmCreateDragIcon XMCREATEDRAGICON #define XmCreateDrawingArea XMCREATEDRAWINGAREA #define XmCreateDrawnButton XMCREATEDRAWNBUTTON #define XmCreateErrorDialog XMCREATEERRORDIALOG #define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX #define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG #define XmCreateForm XMCREATEFORM #define XmCreateFormDialog XMCREATEFORMDIALOG #define XmCreateFrame XMCREATEFRAME #define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG #define XmCreateLabel XMCREATELABEL #define XmCreateLabelGadget XMCREATELABELGADGET #define XmCreateList XMCREATELIST #define XmCreateMainWindow XMCREATEMAINWINDOW #define XmCreateMenuBar XMCREATEMENUBAR #define XmCreateMessageBox XMCREATEMESSAGEBOX #define XmCreateMessageDialog XMCREATEMESSAGEDIALOG #define XmCreateOptionMenu XMCREATEOPTIONMENU #define XmCreatePanedWindow XMCREATEPANEDWINDOW #define XmCreatePopupMenu XMCREATEPOPUPMENU #define XmCreatePromptDialog XMCREATEPROMPTDIALOG #define XmCreatePulldownMenu XMCREATEPULLDOWNMENU #define XmCreatePushButton XMCREATEPUSHBUTTON #define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET #define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG #define XmCreateRadioBox XMCREATERADIOBOX #define XmCreateRowColumn XMCREATEROWCOLUMN #define XmCreateScale XMCREATESCALE #define XmCreateScrollBar XMCREATESCROLLBAR #define XmCreateScrolledList XMCREATESCROLLEDLIST #define XmCreateScrolledText XMCREATESCROLLEDTEXT #define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW #define XmCreateSelectionDialog XMCREATESELECTIONDIALOG #define XmCreateSeparator XMCREATESEPARATOR #define XmCreateSeparatorGadget XMCREATESEPARATORGADGET #define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG #define XmCreateText XMCREATETEXT #define XmCreateTextField XMCREATETEXTFIELD #define XmCreateToggleButton XMCREATETOGGLEBUTTON #define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET #define XmCreateWarningDialog XMCREATEWARNINGDIALOG #define XmCvtCTToXmString XMCVTCTTOXMSTRING #define XmDestroyPixmap XMDESTROYPIXMAP #define XmDragStart XMDRAGSTART #define XmDropSiteRegister XMDROPSITEREGISTER #define XmDropSiteUnregister XMDROPSITEUNREGISTER #define XmDropSiteUpdate XMDROPSITEUPDATE #define XmDropTransferStart XMDROPTRANSFERSTART #define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD #define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH #define XmFontListAppendEntry XMFONTLISTAPPENDENTRY #define XmFontListCopy XMFONTLISTCOPY #define XmFontListCreate XMFONTLISTCREATE #define XmFontListEntryCreate XMFONTLISTENTRYCREATE #define XmFontListEntryFree XMFONTLISTENTRYFREE #define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT #define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG #define XmFontListEntryLoad XMFONTLISTENTRYLOAD #define XmFontListFree XMFONTLISTFREE #define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT #define XmFontListGetNextFont XMFONTLISTGETNEXTFONT #define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT #define XmFontListNextEntry XMFONTLISTNEXTENTRY #define XmGetColors XMGETCOLORS #define XmGetColorCalculation XMGETCOLORCALCULATION #define XmGetFocusWidget XMGETFOCUSWIDGET #define XmGetMenuCursor XMGETMENUCURSOR #define XmGetPixmap XMGETPIXMAP #define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH #define XmGetTearOffControl XMGETTEAROFFCONTROL #define XmGetXmDisplay XMGETXMDISPLAY #define XmImMbLookupString XMIMMBLOOKUPSTRING #define XmImRegister XMIMREGISTER #define XmImSetFocusValues XMIMSETFOCUSVALUES #define XmImSetValues XMIMSETVALUES #define XmImUnregister XMIMUNREGISTER #define XmImUnsetFocus XMIMUNSETFOCUS #define XmInstallImage XMINSTALLIMAGE #define XmInternAtom XMINTERNATOM #define XmIsMotifWMRunning XMISMOTIFWMRUNNING #define XmListAddItem XMLISTADDITEM #define XmListAddItemUnselected XMLISTADDITEMUNSELECTED #define XmListAddItems XMLISTADDITEMS #define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED #define XmListDeleteAllItems XMLISTDELETEALLITEMS #define XmListDeleteItem XMLISTDELETEITEM #define XmListDeleteItemsPos XMLISTDELETEITEMSPOS #define XmListDeletePos XMLISTDELETEPOS #define XmListDeselectAllItems XMLISTDESELECTALLITEMS #define XmListDeselectPos XMLISTDESELECTPOS #define XmListGetKbdItemPos XMLISTGETKBDITEMPOS #define XmListGetMatchPos XMLISTGETMATCHPOS #define XmListGetSelectedPos XMLISTGETSELECTEDPOS #define XmListItemExists XMLISTITEMEXISTS #define XmListItemPos XMLISTITEMPOS #define XmListPosSelected XMLISTPOSSELECTED #define XmListReplaceItems XMLISTREPLACEITEMS #define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS #define XmListSelectItem XMLISTSELECTITEM #define XmListSelectPos XMLISTSELECTPOS #define XmListSetBottomPos XMLISTSETBOTTOMPOS #define XmListSetItem XMLISTSETITEM #define XmListSetKbdItemPos XMLISTSETKBDITEMPOS #define XmListSetPos XMLISTSETPOS #define XmMainWindowSetAreas XMMAINWINDOWSETAREAS #define XmMenuPosition XMMENUPOSITION #define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD #define XmOptionButtonGadget XMOPTIONBUTTONGADGET #define XmOptionLabelGadget XMOPTIONLABELGADGET #define XmProcessTraversal XMPROCESSTRAVERSAL #define XmQmotif XMQMOTIF #define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK #define XmRemoveProtocols XMREMOVEPROTOCOLS #define XmRemoveTabGroup XMREMOVETABGROUP #define XmRepTypeGetId XMREPTYPEGETID #define XmRepTypeGetRecord XMREPTYPEGETRECORD #define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON #define XmRepTypeRegister XMREPTYPEREGISTER #define XmRepTypeValidValue XMREPTYPEVALIDVALUE #define XmScrollBarGetValues XMSCROLLBARGETVALUES #define XmScrollBarSetValues XMSCROLLBARSETVALUES #define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS #define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD #define XmSetColorCalculation XMSETCOLORCALCULATION #define XmStringByteCompare XMSTRINGBYTECOMPARE #define XmStringCompare XMSTRINGCOMPARE #define XmStringConcat XMSTRINGCONCAT #define XmStringCopy XMSTRINGCOPY #define XmStringCreate XMSTRINGCREATE #define XmStringCreateLocalized XMSTRINGCREATELOCALIZED #define XmStringCreateLtoR XMSTRINGCREATELTOR #define XmStringCreateSimple XMSTRINGCREATESIMPLE #define XmStringDraw XMSTRINGDRAW #define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE #define XmStringExtent XMSTRINGEXTENT #define XmStringFree XMSTRINGFREE #define XmStringFreeContext XMSTRINGFREECONTEXT #define XmStringGetLtoR XMSTRINGGETLTOR #define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT #define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT #define XmStringInitContext XMSTRINGINITCONTEXT #define XmStringLength XMSTRINGLENGTH #define XmStringLtoRCreate XMSTRINGLTORCREATE #define XmStringNConcat XMSTRINGNCONCAT #define XmStringSegmentCreate XMSTRINGSEGMENTCREATE #define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE #define XmStringWidth XMSTRINGWIDTH #define XmTextClearSelection XMTEXTCLEARSELECTION #define XmTextCopy XMTEXTCOPY #define XmTextCut XMTEXTCUT #define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION #define XmTextFieldCopy XMTEXTFIELDCOPY #define XmTextFieldCut XMTEXTFIELDCUT #define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE #define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION #define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION #define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH #define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION #define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION #define XmTextFieldGetString XMTEXTFIELDGETSTRING #define XmTextFieldInsert XMTEXTFIELDINSERT #define XmTextFieldPaste XMTEXTFIELDPASTE #define XmTextFieldRemove XMTEXTFIELDREMOVE #define XmTextFieldReplace XMTEXTFIELDREPLACE #define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE #define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT #define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION #define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH #define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION #define XmTextFieldSetString XMTEXTFIELDSETSTRING #define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION #define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION #define XmTextGetEditable XMTEXTGETEDITABLE #define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION #define XmTextGetLastPosition XMTEXTGETLASTPOSITION #define XmTextGetMaxLength XMTEXTGETMAXLENGTH #define XmTextGetSelection XMTEXTGETSELECTION #define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION #define XmTextGetString XMTEXTGETSTRING #define XmTextInsert XMTEXTINSERT #define XmTextPaste XMTEXTPASTE #define XmTextPosToXY XMTEXTPOSTOXY #define XmTextRemove XMTEXTREMOVE #define XmTextReplace XMTEXTREPLACE #define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION #define XmTextSetEditable XMTEXTSETEDITABLE #define XmTextSetHighlight XMTEXTSETHIGHLIGHT #define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION #define XmTextSetSelection XMTEXTSETSELECTION #define XmTextSetString XMTEXTSETSTRING #define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER #define XmTextShowPosition XMTEXTSHOWPOSITION #define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE #define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE #define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE #define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE #define XmUninstallImage XMUNINSTALLIMAGE #define XmUpdateDisplay XMUPDATEDISPLAY #define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX #define XmbDrawString XMBDRAWSTRING #define XmbLookupString XMBLOOKUPSTRING #define XmbResetIC XMBRESETIC #define XmbSetWMProperties XMBSETWMPROPERTIES #define XmbTextEscapement XMBTEXTESCAPEMENT #define XmbTextExtents XMBTEXTEXTENTS #define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY #define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST #define XmbufCreateBuffers XMBUFCREATEBUFFERS #define XmbufDestroyBuffers XMBUFDESTROYBUFFERS #define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS #define XmbufQueryExtension XMBUFQUERYEXTENSION #define Xmemory_free XMEMORY_FREE #define Xmemory_malloc XMEMORY_MALLOC #define XmuClientWindow XMUCLIENTWINDOW #define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION #define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP #define XmuInternAtom XMUINTERNATOM #define XmuInternStrings XMUINTERNSTRINGS #define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP #define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE #define XrmCombineDatabase XRMCOMBINEDATABASE #define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE #define XrmDestroyDatabase XRMDESTROYDATABASE #define XrmGetDatabase XRMGETDATABASE #define XrmGetFileDatabase XRMGETFILEDATABASE #define XrmGetResource XRMGETRESOURCE #define XrmGetStringDatabase XRMGETSTRINGDATABASE #define XrmInitialize XRMINITIALIZE #define XrmMergeDatabases XRMMERGEDATABASES #define XrmParseCommand XRMPARSECOMMAND #define XrmPermStringToQuark XRMPERMSTRINGTOQUARK #define XrmPutFileDatabase XRMPUTFILEDATABASE #define XrmPutLineResource XRMPUTLINERESOURCE #define XrmPutStringResource XRMPUTSTRINGRESOURCE #define XrmQGetResource XRMQGETRESOURCE #define XrmQPutStringResource XRMQPUTSTRINGRESOURCE #define XrmQuarkToString XRMQUARKTOSTRING #define XrmSetDatabase XRMSETDATABASE #define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST #define XrmStringToQuark XRMSTRINGTOQUARK #define XtAddCallback XTADDCALLBACK #define XtAddCallbacks XTADDCALLBACKS #define XtAddConverter XTADDCONVERTER #define XtAddEventHandler XTADDEVENTHANDLER #define XtAddExposureToRegion XTADDEXPOSURETOREGION #define XtAddGrab XTADDGRAB #define XtAddRawEventHandler XTADDRAWEVENTHANDLER #define XtAllocateGC XTALLOCATEGC #define XtAppAddActions XTAPPADDACTIONS #define XtAppAddInput XTAPPADDINPUT #define XtAppAddTimeOut XTAPPADDTIMEOUT #define XtAppAddWorkProc XTAPPADDWORKPROC #define XtAppCreateShell XTAPPCREATESHELL #define XtAppError XTAPPERROR #define XtAppErrorMsg XTAPPERRORMSG #define XtAppInitialize XTAPPINITIALIZE #define XtAppMainLoop XTAPPMAINLOOP #define XtAppNextEvent XTAPPNEXTEVENT #define XtAppPeekEvent XTAPPPEEKEVENT #define XtAppPending XTAPPPENDING #define XtAppProcessEvent XTAPPPROCESSEVENT #define XtAppSetErrorHandler XTAPPSETERRORHANDLER #define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES #define XtAppSetTypeConverter XTAPPSETTYPECONVERTER #define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER #define XtAppWarningMsg XTAPPWARNINGMSG #define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER #define XtAppWarning XTAPPWARNING #define XtAugmentTranslations XTAUGMENTTRANSLATIONS #define XtCallActionProc XTCALLACTIONPROC #define XtCallCallbackList XTCALLCALLBACKLIST #define XtCallCallbacks XTCALLCALLBACKS #define XtCallConverter XTCALLCONVERTER #define XtCalloc XTCALLOC #ifndef NOXTDISPLAY #define XtClass XTCLASS #endif #define XtCloseDisplay XTCLOSEDISPLAY #define XtConfigureWidget XTCONFIGUREWIDGET #define XtConvert XTCONVERT #define XtConvertAndStore XTCONVERTANDSTORE #define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT #define XtCreateManagedWidget XTCREATEMANAGEDWIDGET #define XtCreatePopupShell XTCREATEPOPUPSHELL #define XtCreateWidget XTCREATEWIDGET #define XtCreateWindow XTCREATEWINDOW #define XtCvtStringToFont XTCVTSTRINGTOFONT #define XtDatabase XTDATABASE #define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT #define XtDestroyWidget XTDESTROYWIDGET #define XtDisownSelection XTDISOWNSELECTION #define XtDispatchEvent XTDISPATCHEVENT #ifndef NOXTDISPLAY #define XtDisplay XTDISPLAY #endif #define XtDisplayOfObject XTDISPLAYOFOBJECT #define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING #define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT #define XtError XTERROR #define XtErrorMsg XTERRORMSG #define XtFree XTFREE #define XtGetActionKeysym XTGETACTIONKEYSYM #define XtGetActionList XTGETACTIONLIST #define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS #define XtGetApplicationResources XTGETAPPLICATIONRESOURCES #define XtGetClassExtension XTGETCLASSEXTENSION #define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST #define XtGetGC XTGETGC #define XtGetMultiClickTime XTGETMULTICLICKTIME #define XtGetResourceList XTGETRESOURCELIST #define XtGetSelectionValue XTGETSELECTIONVALUE #define XtGetSelectionValues XTGETSELECTIONVALUES #define XtGetSubresources XTGETSUBRESOURCES #define XtGetValues XTGETVALUES #define XtGrabButton XTGRABBUTTON #define XtGrabKeyboard XTGRABKEYBOARD #define XtGrabPointer XTGRABPOINTER #define XtHasCallbacks XTHASCALLBACKS #define XtInitialize XTINITIALIZE #define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS #define XtInsertEventHandler XTINSERTEVENTHANDLER #define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER #define XtInstallAccelerators XTINSTALLACCELERATORS #define XtIsManaged XTISMANAGED #define XtIsObject XTISOBJECT #ifndef NOXTDISPLAY #define XtIsRealized XTISREALIZED #endif #define XtIsSensitive XTISSENSITIVE #define XtIsSubclass XTISSUBCLASS #define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED #define XtMainLoop XTMAINLOOP #define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST #define XtMakeResizeRequest XTMAKERESIZEREQUEST #define XtMalloc XTMALLOC #define XtManageChild XTMANAGECHILD #define XtManageChildren XTMANAGECHILDREN #define XtMergeArgLists XTMERGEARGLISTS #define XtMoveWidget XTMOVEWIDGET #define XtName XTNAME #define XtNameToWidget XTNAMETOWIDGET #define XtOpenApplication XTOPENAPPLICATION #define XtOpenDisplay XTOPENDISPLAY #define XtOverrideTranslations XTOVERRIDETRANSLATIONS #define XtOwnSelection XTOWNSELECTION #ifndef NOXTDISPLAY #define XtParent XTPARENT #endif #define XtParseAcceleratorTable XTPARSEACCELERATORTABLE #define XtParseTranslationTable XTPARSETRANSLATIONTABLE #define XtPopdown XTPOPDOWN #define XtPopup XTPOPUP #define XtPopupSpringLoaded XTPOPUPSPRINGLOADED #define XtQueryGeometry XTQUERYGEOMETRY #define XtRealizeWidget XTREALIZEWIDGET #define XtRealloc XTREALLOC #define XtRegisterDrawable _XTREGISTERWINDOW #define XtRegisterGrabAction XTREGISTERGRABACTION #define XtReleaseGC XTRELEASEGC #define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS #define XtRemoveCallback XTREMOVECALLBACK #define XtRemoveEventHandler XTREMOVEEVENTHANDLER #define XtRemoveGrab XTREMOVEGRAB #define XtRemoveInput XTREMOVEINPUT #define XtRemoveTimeOut XTREMOVETIMEOUT #define XtRemoveWorkProc XTREMOVEWORKPROC #define XtResizeWidget XTRESIZEWIDGET #define XtResolvePathname XTRESOLVEPATHNAME #ifndef NOXTDISPLAY #define XtScreen XTSCREEN #endif #define XtScreenDatabase XTSCREENDATABASE #define XtScreenOfObject XTSCREENOFOBJECT #define XtSessionReturnToken XTSESSIONRETURNTOKEN #define XtSetErrorHandler XTSETERRORHANDLER #define XtSetKeyboardFocus XTSETKEYBOARDFOCUS #define XtSetLanguageProc XTSETLANGUAGEPROC #define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED #define XtSetSensitive XTSETSENSITIVE #define XtSetTypeConverter XTSETTYPECONVERTER #define XtSetValues XTSETVALUES #define XtShellStrings XTSHELLSTRINGS #define XtStringConversionWarning XTSTRINGCONVERSIONWARNING #define XtStrings XTSTRINGS #define XtToolkitInitialize XTTOOLKITINITIALIZE #define XtTranslateCoords XTTRANSLATECOORDS #define XtTranslateKeycode XTTRANSLATEKEYCODE #define XtUngrabButton XTUNGRABBUTTON #define XtUngrabKeyboard XTUNGRABKEYBOARD #define XtUngrabPointer XTUNGRABPOINTER #define XtUnmanageChild XTUNMANAGECHILD #define XtUnmanageChildren XTUNMANAGECHILDREN #define XtUnrealizeWidget XTUNREALIZEWIDGET #define XtUnregisterDrawable _XTUNREGISTERWINDOW #define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET #define XtVaCreatePopupShell XTVACREATEPOPUPSHELL #define XtVaCreateWidget XTVACREATEWIDGET #define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES #define XtVaGetValues XTVAGETVALUES #define XtVaSetValues XTVASETVALUES #define XtWarning XTWARNING #define XtWarningMsg XTWARNINGMSG #define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT #ifndef NOXTDISPLAY #define XtWindow XTWINDOW #endif #define XtWindowOfObject XTWINDOWOFOBJECT #define XtWindowToWidget XTWINDOWTOWIDGET #define XwcDrawImageString XWCDRAWIMAGESTRING #define XwcDrawString XWCDRAWSTRING #define XwcFreeStringList XWCFREESTRINGLIST #define XwcTextEscapement XWCTEXTESCAPEMENT #define XwcTextExtents XWCTEXTEXTENTS #define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY #define XwcLookupString XWCLOOKUPSTRING #define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST #define _XAllocTemp _XALLOCTEMP #define _XDeqAsyncHandler _XDEQASYNCHANDLER #define _XEatData _XEATDATA #define _XFlush _XFLUSH #define _XFreeTemp _XFREETEMP #define _XGetAsyncReply _XGETASYNCREPLY #define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS #define _XRead _XREAD #define _XReadPad _XREADPAD #define _XRegisterFilterByType _XREGISTERFILTERBYTYPE #define _XReply _XREPLY #define _XSend _XSEND #define _XUnregisterFilter _XUNREGISTERFILTER #define _XVIDtoVisual _XVIDTOVISUAL #define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT #define _XmClearBorder _XMCLEARBORDER #define _XmConfigureObject _XMCONFIGUREOBJECT #define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK #define _XmDrawArrow _XMDRAWARROW #define _XmDrawShadows _XMDRAWSHADOWS #define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT #define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS #define _XmFromVerticalPixels _XMFROMVERTICALPIXELS #define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR #define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST #define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON #define _XmGetWidgetExtData _XMGETWIDGETEXTDATA #define _XmGrabKeyboard _XMGRABKEYBOARD #define _XmGrabPointer _XMGRABPOINTER #define _XmInheritClass _XMINHERITCLASS #define _XmInputForGadget _XMINPUTFORGADGET #define _XmInputInGadget _XMINPUTINGADGET #define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST #define _XmMenuPopDown _XMMENUPOPDOWN #define _XmMoveObject _XMMOVEOBJECT #define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED #define _XmOSBuildFileList _XMOSBUILDFILELIST #define _XmOSFileCompare _XMOSFILECOMPARE #define _XmOSFindPatternPart _XMOSFINDPATTERNPART #define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC #define _XmPostPopupMenu _XMPOSTPOPUPMENU #define _XmPrimitiveEnter _XMPRIMITIVEENTER #define _XmPrimitiveLeave _XMPRIMITIVELEAVE #define _XmRedisplayGadgets _XMREDISPLAYGADGETS #define _XmShellIsExclusive _XMSHELLISEXCLUSIVE #define _XmStringDraw _XMSTRINGDRAW #define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT #define _XmStrings _XMSTRINGS #define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS #define _XmToVerticalPixels _XMTOVERTICALPIXELS #define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT #define _Xm_fastPtr _XM_FASTPTR #define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG #define _XtCopyFromArg _XTCOPYFROMARG #define _XtCountVaList _XTCOUNTVALIST #define _XtInherit _XTINHERIT #define _XtInheritTranslations _XTINHERITTRANSLATIONS #define _XtIsSubclassOf _XTISSUBCLASSOF #define _XtVaToArgList _XTVATOARGLIST #define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS #define cli$dcl_parse CLI$DCL_PARSE #define cli$get_value CLI$GET_VALUE #define cli$present CLI$PRESENT #define compositeClassRec COMPOSITECLASSREC #define compositeWidgetClass COMPOSITEWIDGETCLASS #define constraintClassRec CONSTRAINTCLASSREC #define constraintWidgetClass CONSTRAINTWIDGETCLASS #define coreWidgetClass COREWIDGETCLASS #define exe$getspi EXE$GETSPI #define lbr$close LBR$CLOSE #define lbr$get_header LBR$GET_HEADER #define lbr$get_index LBR$GET_INDEX #define lbr$get_record LBR$GET_RECORD #define lbr$ini_control LBR$INI_CONTROL #define lbr$lookup_key LBR$LOOKUP_KEY #define lbr$open LBR$OPEN #define lbr$output_help LBR$OUTPUT_HELP #define lib$add_times LIB$ADD_TIMES #define lib$addx LIB$ADDX #define lib$create_dir LIB$CREATE_DIR #define lib$create_vm_zone LIB$CREATE_VM_ZONE #define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME #define lib$cvt_htb LIB$CVT_HTB #define lib$cvt_vectim LIB$CVT_VECTIM #define lib$day LIB$DAY #define lib$day_of_week LIB$DAY_OF_WEEK #define lib$delete_symbol LIB$DELETE_SYMBOL #define lib$delete_vm_zone LIB$DELETE_VM_ZONE #define lib$disable_ctrl LIB$DISABLE_CTRL #define lib$ediv LIB$EDIV #define lib$emul LIB$EMUL #define lib$enable_ctrl LIB$ENABLE_CTRL #define lib$find_vm_zone LIB$FIND_VM_ZONE #define lib$format_date_time LIB$FORMAT_DATE_TIME #define lib$free_timer LIB$FREE_TIMER #define lib$free_vm LIB$FREE_VM #define lib$get_ef LIB$GET_EF #define lib$get_foreign LIB$GET_FOREIGN #define lib$get_input LIB$GET_INPUT #define lib$get_users_language LIB$GET_USERS_LANGUAGE #define lib$get_vm LIB$GET_VM #define lib$get_symbol LIB$GET_SYMBOL #define lib$getdvi LIB$GETDVI #define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT #define lib$init_timer LIB$INIT_TIMER #define lib$find_file LIB$FIND_FILE #define lib$find_file_end LIB$FIND_FILE_END #define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL #define lib$mult_delta_time LIB$MULT_DELTA_TIME #define lib$put_output LIB$PUT_OUTPUT #define lib$rename_file LIB$RENAME_FILE #define lib$reset_vm_zone LIB$RESET_VM_ZONE #define lib$set_symbol LIB$SET_SYMBOL #define lib$sfree1_dd LIB$SFREE1_DD #define lib$show_vm LIB$SHOW_VM #define lib$show_vm_zone LIB$SHOW_VM_ZONE #define lib$spawn LIB$SPAWN #define lib$stat_timer LIB$STAT_TIMER #define lib$subx LIB$SUBX #define lib$sub_times LIB$SUB_TIMES #define lib$wait LIB$WAIT #define mail$send_add_address MAIL$SEND_ADD_ADDRESS #define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE #define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART #define mail$send_begin MAIL$SEND_BEGIN #define mail$send_end MAIL$SEND_END #define mail$send_message MAIL$SEND_MESSAGE #define ncs$convert NCS$CONVERT #define ncs$get_cf NCS$GET_CF #define objectClass OBJECTCLASS #define objectClassRec OBJECTCLASSREC #define overrideShellClassRec OVERRIDESHELLCLASSREC #define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS #define pthread_attr_create PTHREAD_ATTR_CREATE #define pthread_attr_delete PTHREAD_ATTR_DELETE #define pthread_attr_destroy PTHREAD_ATTR_DESTROY #define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP #define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP #define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED #define pthread_attr_getprio PTHREAD_ATTR_GETPRIO #define pthread_attr_getsched PTHREAD_ATTR_GETSCHED #define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM #define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY #define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE #define pthread_attr_init PTHREAD_ATTR_INIT #define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE #define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP #define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED #define pthread_attr_setprio PTHREAD_ATTR_SETPRIO #define pthread_attr_setsched PTHREAD_ATTR_SETSCHED #define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM #define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY #ifndef pthread_attr_setscope # define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE #endif #define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE #define pthread_cancel PTHREAD_CANCEL #define pthread_cancel_e PTHREAD_CANCEL_E #define pthread_cond_broadcast PTHREAD_COND_BROADCAST #define pthread_cond_destroy PTHREAD_COND_DESTROY #define pthread_cond_init PTHREAD_COND_INIT #define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP #define pthread_cond_signal PTHREAD_COND_SIGNAL #define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP #define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT #define pthread_cond_wait PTHREAD_COND_WAIT #define pthread_condattr_create PTHREAD_CONDATTR_CREATE #define pthread_condattr_delete PTHREAD_CONDATTR_DELETE #define pthread_condattr_init PTHREAD_CONDATTR_INIT #define pthread_create PTHREAD_CREATE #define pthread_delay_np PTHREAD_DELAY_NP #define pthread_detach PTHREAD_DETACH #define pthread_equal PTHREAD_EQUAL #define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP #define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP #define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP #define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP #define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP #define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP #define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP #define pthread_exit PTHREAD_EXIT #define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP #define pthread_getprio PTHREAD_GETPRIO #define pthread_getschedparam PTHREAD_GETSCHEDPARAM #define pthread_getscheduler PTHREAD_GETSCHEDULER #define pthread_getspecific PTHREAD_GETSPECIFIC #define pthread_getunique_np PTHREAD_GETUNIQUE_NP #define pthread_join PTHREAD_JOIN #define pthread_join32 PTHREAD_JOIN32 #define pthread_key_create PTHREAD_KEY_CREATE #define pthread_key_delete PTHREAD_KEY_DELETE #define pthread_keycreate PTHREAD_KEYCREATE #define pthread_kill PTHREAD_KILL #define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY #define pthread_mutex_init PTHREAD_MUTEX_INIT #define pthread_mutex_lock PTHREAD_MUTEX_LOCK #define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK #define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE #define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE #define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY #define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP #define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT #define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP #define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP #define pthread_once PTHREAD_ONCE #define pthread_resume_np PTHREAD_RESUME_NP #define pthread_self PTHREAD_SELF #define pthread_setasynccancel PTHREAD_SETASYNCCANCEL #define pthread_setcancel PTHREAD_SETCANCEL #define pthread_setcancelstate PTHREAD_SETCANCELSTATE #define pthread_setcanceltype PTHREAD_SETCANCELTYPE #define pthread_setprio PTHREAD_SETPRIO #define pthread_setschedparam PTHREAD_SETSCHEDPARAM #define pthread_setscheduler PTHREAD_SETSCHEDULER #define pthread_setspecific PTHREAD_SETSPECIFIC #define pthread_suspend_np PTHREAD_SUSPEND_NP #define pthread_testcancel PTHREAD_TESTCANCEL #define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP #define pthread_yield PTHREAD_YIELD #define pthread_yield_np PTHREAD_YIELD_NP #define rectObjClass RECTOBJCLASS #define rectObjClassRec RECTOBJCLASSREC #define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS #define shellWidgetClass SHELLWIDGETCLASS #define shmat SHMAT #define shmctl SHMCTL #define shmdt SHMDT #define shmget SHMGET #define smg$create_key_table SMG$CREATE_KEY_TABLE #define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD #define smg$read_composed_line SMG$READ_COMPOSED_LINE #define sys$add_ident SYS$ADD_IDENT #define sys$asctoid SYS$ASCTOID #define sys$assign SYS$ASSIGN #define sys$bintim SYS$BINTIM #define sys$cancel SYS$CANCEL #define sys$cantim SYS$CANTIM #define sys$check_access SYS$CHECK_ACCESS #define sys$close SYS$CLOSE #define sys$connect SYS$CONNECT #define sys$create SYS$CREATE #define sys$create_user_profile SYS$CREATE_USER_PROFILE #define sys$crembx SYS$CREMBX #define sys$creprc SYS$CREPRC #define sys$crmpsc SYS$CRMPSC #define sys$dassgn SYS$DASSGN #define sys$dclast SYS$DCLAST #define sys$dclexh SYS$DCLEXH #define sys$delprc SYS$DELPRC #define sys$deq SYS$DEQ #define sys$dgblsc SYS$DGBLSC #define sys$display SYS$DISPLAY #define sys$enq SYS$ENQ #define sys$enqw SYS$ENQW #define sys$erase SYS$ERASE #define sys$fao SYS$FAO #define sys$faol SYS$FAOL #define sys$find_held SYS$FIND_HELD #define sys$finish_rdb SYS$FINISH_RDB #define sys$flush SYS$FLUSH #define sys$forcex SYS$FORCEX #define sys$get SYS$GET #define sys$get_security SYS$GET_SECURITY #define sys$getdviw SYS$GETDVIW #define sys$getjpi SYS$GETJPI #define sys$getjpiw SYS$GETJPIW #define sys$getlkiw SYS$GETLKIW #define sys$getmsg SYS$GETMSG #define sys$getsyi SYS$GETSYI #define sys$getsyiw SYS$GETSYIW #define sys$gettim SYS$GETTIM #define sys$getuai SYS$GETUAI #define sys$grantid SYS$GRANTID #define sys$hash_password SYS$HASH_PASSWORD #define sys$hiber SYS$HIBER #define sys$mgblsc SYS$MGBLSC #define sys$numtim SYS$NUMTIM #define sys$open SYS$OPEN #define sys$parse SYS$PARSE #define sys$parse_acl SYS$PARSE_ACL #define sys$parse_acl SYS$PARSE_ACL #define sys$persona_assume SYS$PERSONA_ASSUME #define sys$persona_create SYS$PERSONA_CREATE #define sys$persona_delete SYS$PERSONA_DELETE #define sys$process_scan SYS$PROCESS_SCAN #define sys$put SYS$PUT #define sys$qio SYS$QIO #define sys$qiow SYS$QIOW #define sys$read SYS$READ #define sys$resched SYS$RESCHED #define sys$rewind SYS$REWIND #define sys$search SYS$SEARCH #define sys$set_security SYS$SET_SECURITY #define sys$setast SYS$SETAST #define sys$setef SYS$SETEF #define sys$setimr SYS$SETIMR #define sys$setpri SYS$SETPRI #define sys$setprn SYS$SETPRN #define sys$setprv SYS$SETPRV #define sys$setswm SYS$SETSWM #define sys$setuai SYS$SETUAI #define sys$sndopr SYS$SNDOPR #define sys$synch SYS$SYNCH #define sys$trnlnm SYS$TRNLNM #define sys$update SYS$UPDATE #define sys$wake SYS$WAKE #define sys$write SYS$WRITE #define topLevelShellClassRec TOPLEVELSHELLCLASSREC #define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS #define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS #define vendorShellClassRec VENDORSHELLCLASSREC #define vendorShellWidgetClass VENDORSHELLWIDGETCLASS #define widgetClass WIDGETCLASS #define widgetClassRec WIDGETCLASSREC #define wmShellClassRec WMSHELLCLASSREC #define wmShellWidgetClass WMSHELLWIDGETCLASS #define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK #define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH #define x$soft_reenable_asts X$SOFT_REENABLE_ASTS #define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS #define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS #define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC #define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS #define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS #define xmCommandWidgetClass XMCOMMANDWIDGETCLASS #define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS #define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS #define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS #define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS #define xmFormWidgetClass XMFORMWIDGETCLASS #define xmFrameWidgetClass XMFRAMEWIDGETCLASS #define xmGadgetClass XMGADGETCLASS #define xmLabelGadgetClass XMLABELGADGETCLASS #define xmLabelWidgetClass XMLABELWIDGETCLASS #define xmListWidgetClass XMLISTWIDGETCLASS #define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS #define xmManagerClassRec XMMANAGERCLASSREC #define xmManagerWidgetClass XMMANAGERWIDGETCLASS #define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS #define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS #define xmPrimitiveClassRec XMPRIMITIVECLASSREC #define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS #define xmPushButtonClassRec XMPUSHBUTTONCLASSREC #define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS #define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS #define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS #define xmSashWidgetClass XMSASHWIDGETCLASS #define xmScaleWidgetClass XMSCALEWIDGETCLASS #define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS #define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC #define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS #define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS #define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS #define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS #define xmTextWidgetClass XMTEXTWIDGETCLASS #define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS #define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS #if (__VMS_VER < 80200000) # define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ n = badlen; \ req->length += n; \ } else \ req->length += n #endif #ifdef __cplusplus extern "C" { #endif extern void XtFree(char*); #ifdef __cplusplus } #endif #endif
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/hashmap.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/hashmap.h // Purpose: wxHashMap class // Author: Mattia Barbon // Modified by: // Created: 29/01/2002 // Copyright: (c) Mattia Barbon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_HASHMAP_H_ #define _WX_HASHMAP_H_ #include "wx/string.h" #include "wx/wxcrt.h" // In wxUSE_STD_CONTAINERS build we prefer to use the standard hash map class // but it can be either in non-standard hash_map header (old g++ and some other // STL implementations) or in C++0x standard unordered_map which can in turn be // available either in std::tr1 or std namespace itself // // To summarize: if std::unordered_map is available use it, otherwise use tr1 // and finally fall back to non-standard hash_map #if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \ && (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP)) #define HAVE_STL_HASH_MAP #endif #if wxUSE_STD_CONTAINERS && \ (defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP)) #if defined(HAVE_STD_UNORDERED_MAP) #include <unordered_map> #define WX_HASH_MAP_NAMESPACE std #elif defined(HAVE_TR1_UNORDERED_MAP) #include <tr1/unordered_map> #define WX_HASH_MAP_NAMESPACE std::tr1 #endif #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME #elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) #if defined(HAVE_EXT_HASH_MAP) #include <ext/hash_map> #elif defined(HAVE_HASH_MAP) #include <hash_map> #endif #if defined(HAVE_GNU_CXX_HASH_MAP) #define WX_HASH_MAP_NAMESPACE __gnu_cxx #elif defined(HAVE_STD_HASH_MAP) #define WX_HASH_MAP_NAMESPACE std #endif #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME #else // !wxUSE_STD_CONTAINERS || no std::{hash,unordered}_map class available #define wxNEEDS_WX_HASH_MAP #include <stddef.h> // for ptrdiff_t // private struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase { _wxHashTable_NodeBase() : m_next(NULL) {} _wxHashTable_NodeBase* m_next; // Cannot do this: // wxDECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase); // without rewriting the macros, which require a public copy constructor. }; // private class WXDLLIMPEXP_BASE _wxHashTableBase2 { public: typedef void (*NodeDtor)(_wxHashTable_NodeBase*); typedef size_t (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*); typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*); protected: static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node); static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table, NodeDtor dtor ); static _wxHashTable_NodeBase* GetFirstNode( size_t buckets, _wxHashTable_NodeBase** table ) { for( size_t i = 0; i < buckets; ++i ) if( table[i] ) return table[i]; return NULL; } // as static const unsigned prime_count = 31 but works with all compilers enum { prime_count = 31 }; static const unsigned long ms_primes[prime_count]; // returns the first prime in ms_primes greater than n static unsigned long GetNextPrime( unsigned long n ); // returns the first prime in ms_primes smaller than n // ( or ms_primes[0] if n is very small ) static unsigned long GetPreviousPrime( unsigned long n ); static void CopyHashTable( _wxHashTable_NodeBase** srcTable, size_t srcBuckets, _wxHashTableBase2* dst, _wxHashTable_NodeBase** dstTable, BucketFromNode func, ProcessNode proc ); static void** AllocTable( size_t sz ) { return (void **)calloc(sz, sizeof(void*)); } static void FreeTable(void *table) { free(table); } }; #define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T,\ PTROPERATOR, CLASSNAME, CLASSEXP, \ SHOULD_GROW, SHOULD_SHRINK ) \ CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ { \ public: \ typedef KEY_T key_type; \ typedef VALUE_T value_type; \ typedef HASH_T hasher; \ typedef KEY_EQ_T key_equal; \ \ typedef size_t size_type; \ typedef ptrdiff_t difference_type; \ typedef value_type* pointer; \ typedef const value_type* const_pointer; \ typedef value_type& reference; \ typedef const value_type& const_reference; \ /* should these be protected? */ \ typedef const KEY_T const_key_type; \ typedef const VALUE_T const_mapped_type; \ public: \ typedef KEY_EX_T key_extractor; \ typedef CLASSNAME Self; \ protected: \ _wxHashTable_NodeBase** m_table; \ size_t m_tableBuckets; \ size_t m_items; \ hasher m_hasher; \ key_equal m_equals; \ key_extractor m_getKey; \ public: \ struct Node:public _wxHashTable_NodeBase \ { \ public: \ Node( const value_type& value ) \ : m_value( value ) {} \ Node* next() { return static_cast<Node*>(m_next); } \ \ value_type m_value; \ }; \ \ protected: \ static void DeleteNode( _wxHashTable_NodeBase* node ) \ { \ delete static_cast<Node*>(node); \ } \ public: \ /* */ \ /* forward iterator */ \ /* */ \ CLASSEXP Iterator \ { \ public: \ Node* m_node; \ Self* m_ht; \ \ Iterator() : m_node(NULL), m_ht(NULL) {} \ Iterator( Node* node, const Self* ht ) \ : m_node(node), m_ht(const_cast<Self*>(ht)) {} \ bool operator ==( const Iterator& it ) const \ { return m_node == it.m_node; } \ bool operator !=( const Iterator& it ) const \ { return m_node != it.m_node; } \ protected: \ Node* GetNextNode() \ { \ size_type bucket = GetBucketForNode(m_ht,m_node); \ for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \ { \ if( m_ht->m_table[i] ) \ return static_cast<Node*>(m_ht->m_table[i]); \ } \ return NULL; \ } \ \ void PlusPlus() \ { \ Node* next = m_node->next(); \ m_node = next ? next : GetNextNode(); \ } \ }; \ friend class Iterator; \ \ public: \ CLASSEXP iterator : public Iterator \ { \ public: \ iterator() : Iterator() {} \ iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \ iterator& operator++() { PlusPlus(); return *this; } \ iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ reference operator *() const { return m_node->m_value; } \ PTROPERATOR(pointer) \ }; \ \ CLASSEXP const_iterator : public Iterator \ { \ public: \ const_iterator() : Iterator() {} \ const_iterator(iterator i) : Iterator(i) {} \ const_iterator( Node* node, const Self* ht ) \ : Iterator(node, const_cast<Self*>(ht)) {} \ const_iterator& operator++() { PlusPlus();return *this; } \ const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ const_reference operator *() const { return m_node->m_value; } \ PTROPERATOR(const_pointer) \ }; \ \ CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ const key_equal& k_eq = key_equal(), \ const key_extractor& k_ex = key_extractor() ) \ : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ m_items( 0 ), \ m_hasher( hfun ), \ m_equals( k_eq ), \ m_getKey( k_ex ) \ { \ m_table = (_wxHashTable_NodeBase**)AllocTable(m_tableBuckets); \ } \ \ CLASSNAME( const Self& ht ) \ : m_table(NULL), \ m_tableBuckets( 0 ), \ m_items( ht.m_items ), \ m_hasher( ht.m_hasher ), \ m_equals( ht.m_equals ), \ m_getKey( ht.m_getKey ) \ { \ HashCopy( ht ); \ } \ \ const Self& operator=( const Self& ht ) \ { \ if (&ht != this) \ { \ clear(); \ m_hasher = ht.m_hasher; \ m_equals = ht.m_equals; \ m_getKey = ht.m_getKey; \ m_items = ht.m_items; \ HashCopy( ht ); \ } \ return *this; \ } \ \ ~CLASSNAME() \ { \ clear(); \ \ FreeTable(m_table); \ } \ \ hasher hash_funct() { return m_hasher; } \ key_equal key_eq() { return m_equals; } \ \ /* removes all elements from the hash table, but does not */ \ /* shrink it ( perhaps it should ) */ \ void clear() \ { \ DeleteNodes(m_tableBuckets, m_table, DeleteNode); \ m_items = 0; \ } \ \ size_type size() const { return m_items; } \ size_type max_size() const { return size_type(-1); } \ bool empty() const { return size() == 0; } \ \ const_iterator end() const { return const_iterator(NULL, this); } \ iterator end() { return iterator(NULL, this); } \ const_iterator begin() const \ { return const_iterator(static_cast<Node*>(GetFirstNode(m_tableBuckets, m_table)), this); } \ iterator begin() \ { return iterator(static_cast<Node*>(GetFirstNode(m_tableBuckets, m_table)), this); } \ \ size_type erase( const const_key_type& key ) \ { \ _wxHashTable_NodeBase** node = GetNodePtr(key); \ \ if( !node ) \ return 0; \ \ --m_items; \ _wxHashTable_NodeBase* temp = (*node)->m_next; \ delete static_cast<Node*>(*node); \ (*node) = temp; \ if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ return 1; \ } \ \ protected: \ static size_type GetBucketForNode( Self* ht, Node* node ) \ { \ return ht->m_hasher( ht->m_getKey( node->m_value ) ) \ % ht->m_tableBuckets; \ } \ static Node* CopyNode( Node* node ) { return new Node( *node ); } \ \ Node* GetOrCreateNode( const value_type& value, bool& created ) \ { \ const const_key_type& key = m_getKey( value ); \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ Node* node = static_cast<Node*>(m_table[bucket]); \ \ while( node ) \ { \ if( m_equals( m_getKey( node->m_value ), key ) ) \ { \ created = false; \ return node; \ } \ node = node->next(); \ } \ created = true; \ return CreateNode( value, bucket); \ }\ Node * CreateNode( const value_type& value, size_t bucket ) \ {\ Node* node = new Node( value ); \ node->m_next = m_table[bucket]; \ m_table[bucket] = node; \ \ /* must be after the node is inserted */ \ ++m_items; \ if( SHOULD_GROW( m_tableBuckets, m_items ) ) \ ResizeTable( m_tableBuckets ); \ \ return node; \ } \ void CreateNode( const value_type& value ) \ {\ CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \ }\ \ /* returns NULL if not found */ \ _wxHashTable_NodeBase** GetNodePtr(const const_key_type& key) const \ { \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ _wxHashTable_NodeBase** node = &m_table[bucket]; \ \ while( *node ) \ { \ if (m_equals(m_getKey(static_cast<Node*>(*node)->m_value), key)) \ return node; \ node = &(*node)->m_next; \ } \ \ return NULL; \ } \ \ /* returns NULL if not found */ \ /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ Node* GetNode( const const_key_type& key ) const \ { \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ Node* node = static_cast<Node*>(m_table[bucket]); \ \ while( node ) \ { \ if( m_equals( m_getKey( node->m_value ), key ) ) \ return node; \ node = node->next(); \ } \ \ return NULL; \ } \ \ void ResizeTable( size_t newSize ) \ { \ newSize = GetNextPrime( (unsigned long)newSize ); \ _wxHashTable_NodeBase** srcTable = m_table; \ size_t srcBuckets = m_tableBuckets; \ m_table = (_wxHashTable_NodeBase**)AllocTable( newSize ); \ m_tableBuckets = newSize; \ \ CopyHashTable( srcTable, srcBuckets, \ this, m_table, \ (BucketFromNode)GetBucketForNode,\ (ProcessNode)&DummyProcessNode ); \ FreeTable(srcTable); \ } \ \ /* this must be called _after_ m_table has been cleaned */ \ void HashCopy( const Self& ht ) \ { \ ResizeTable( ht.size() ); \ CopyHashTable( ht.m_table, ht.m_tableBuckets, \ (_wxHashTableBase2*)this, \ m_table, \ (BucketFromNode)GetBucketForNode, \ (ProcessNode)CopyNode ); \ } \ }; // defines an STL-like pair class CLASSNAME storing two fields: first of type // KEY_T and second of type VALUE_T #define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \ CLASSEXP CLASSNAME \ { \ public: \ typedef KEY_T first_type; \ typedef VALUE_T second_type; \ typedef KEY_T t1; \ typedef VALUE_T t2; \ typedef const KEY_T const_t1; \ typedef const VALUE_T const_t2; \ \ CLASSNAME(const const_t1& f, const const_t2& s) \ : first(const_cast<t1&>(f)), second(const_cast<t2&>(s)) {} \ \ t1 first; \ t2 second; \ }; // defines the class CLASSNAME returning the key part (of type KEY_T) from a // pair of type PAIR_T #define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \ CLASSEXP CLASSNAME \ { \ typedef KEY_T key_type; \ typedef PAIR_T pair_type; \ typedef const key_type const_key_type; \ typedef const pair_type const_pair_type; \ typedef const_key_type& const_key_reference; \ typedef const_pair_type& const_pair_reference; \ public: \ CLASSNAME() { } \ const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\ \ /* the dummy assignment operator is needed to suppress compiler */ \ /* warnings from hash table class' operator=(): gcc complains about */ \ /* "statement with no effect" without it */ \ CLASSNAME& operator=(const CLASSNAME&) { return *this; } \ }; // grow/shrink predicates inline bool never_grow( size_t, size_t ) { return false; } inline bool never_shrink( size_t, size_t ) { return false; } inline bool grow_lf70( size_t buckets, size_t items ) { return float(items)/float(buckets) >= 0.85f; } #endif // various hash map implementations // ---------------------------------------------------------------------------- // hashing and comparison functors // ---------------------------------------------------------------------------- // NB: implementation detail: all of these classes must have dummy assignment // operators to suppress warnings about "statement with no effect" from gcc // in the hash table class assignment operator (where they're assigned) #ifndef wxNEEDS_WX_HASH_MAP // integer types struct WXDLLIMPEXP_BASE wxIntegerHash { private: WX_HASH_MAP_NAMESPACE::hash<long> longHash; WX_HASH_MAP_NAMESPACE::hash<unsigned long> ulongHash; WX_HASH_MAP_NAMESPACE::hash<int> intHash; WX_HASH_MAP_NAMESPACE::hash<unsigned int> uintHash; WX_HASH_MAP_NAMESPACE::hash<short> shortHash; WX_HASH_MAP_NAMESPACE::hash<unsigned short> ushortHash; #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG // hash<wxLongLong_t> ought to work but doesn't on some compilers #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \ || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2) size_t longlongHash( wxLongLong_t x ) const { return longHash( wx_truncate_cast(long, x) ) ^ longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) ); } #elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG WX_HASH_MAP_NAMESPACE::hash<long> longlongHash; #else WX_HASH_MAP_NAMESPACE::hash<wxLongLong_t> longlongHash; #endif #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG public: wxIntegerHash() { } size_t operator()( long x ) const { return longHash( x ); } size_t operator()( unsigned long x ) const { return ulongHash( x ); } size_t operator()( int x ) const { return intHash( x ); } size_t operator()( unsigned int x ) const { return uintHash( x ); } size_t operator()( short x ) const { return shortHash( x ); } size_t operator()( unsigned short x ) const { return ushortHash( x ); } #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG size_t operator()( wxLongLong_t x ) const { return longlongHash(x); } size_t operator()( wxULongLong_t x ) const { return longlongHash(x); } #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } }; #else // wxNEEDS_WX_HASH_MAP // integer types struct WXDLLIMPEXP_BASE wxIntegerHash { wxIntegerHash() { } unsigned long operator()( long x ) const { return (unsigned long)x; } unsigned long operator()( unsigned long x ) const { return x; } unsigned long operator()( int x ) const { return (unsigned long)x; } unsigned long operator()( unsigned int x ) const { return x; } unsigned long operator()( short x ) const { return (unsigned long)x; } unsigned long operator()( unsigned short x ) const { return x; } #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG wxULongLong_t operator()( wxLongLong_t x ) const { return static_cast<wxULongLong_t>(x); } wxULongLong_t operator()( wxULongLong_t x ) const { return x; } #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG wxIntegerHash& operator=(const wxIntegerHash&) { return *this; } }; #endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP struct WXDLLIMPEXP_BASE wxIntegerEqual { wxIntegerEqual() { } bool operator()( long a, long b ) const { return a == b; } bool operator()( unsigned long a, unsigned long b ) const { return a == b; } bool operator()( int a, int b ) const { return a == b; } bool operator()( unsigned int a, unsigned int b ) const { return a == b; } bool operator()( short a, short b ) const { return a == b; } bool operator()( unsigned short a, unsigned short b ) const { return a == b; } #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; } bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; } #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; } }; // pointers struct WXDLLIMPEXP_BASE wxPointerHash { wxPointerHash() { } #ifdef wxNEEDS_WX_HASH_MAP wxUIntPtr operator()( const void* k ) const { return wxPtrToUInt(k); } #else size_t operator()( const void* k ) const { return (size_t)k; } #endif wxPointerHash& operator=(const wxPointerHash&) { return *this; } }; struct WXDLLIMPEXP_BASE wxPointerEqual { wxPointerEqual() { } bool operator()( const void* a, const void* b ) const { return a == b; } wxPointerEqual& operator=(const wxPointerEqual&) { return *this; } }; // wxString, char*, wchar_t* struct WXDLLIMPEXP_BASE wxStringHash { wxStringHash() {} unsigned long operator()( const wxString& x ) const { return stringHash( x.wx_str() ); } unsigned long operator()( const wchar_t* x ) const { return stringHash( x ); } unsigned long operator()( const char* x ) const { return stringHash( x ); } #if WXWIN_COMPATIBILITY_2_8 static unsigned long wxCharStringHash( const wxChar* x ) { return stringHash(x); } #if wxUSE_UNICODE static unsigned long charStringHash( const char* x ) { return stringHash(x); } #endif #endif // WXWIN_COMPATIBILITY_2_8 static unsigned long stringHash( const wchar_t* ); static unsigned long stringHash( const char* ); wxStringHash& operator=(const wxStringHash&) { return *this; } }; struct WXDLLIMPEXP_BASE wxStringEqual { wxStringEqual() {} bool operator()( const wxString& a, const wxString& b ) const { return a == b; } bool operator()( const wxChar* a, const wxChar* b ) const { return wxStrcmp( a, b ) == 0; } #if wxUSE_UNICODE bool operator()( const char* a, const char* b ) const { return strcmp( a, b ) == 0; } #endif // wxUSE_UNICODE wxStringEqual& operator=(const wxStringEqual&) { return *this; } }; #ifdef wxNEEDS_WX_HASH_MAP #define wxPTROP_NORMAL(pointer) \ pointer operator ->() const { return &(m_node->m_value); } #define wxPTROP_NOP(pointer) #define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ _WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, \ CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, wxPTROP_NORMAL, \ CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ { \ public: \ typedef VALUE_T mapped_type; \ _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ \ explicit CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ key_equal eq = key_equal() ) \ : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ CLASSNAME##_wxImplementation_KeyEx() ) {} \ \ mapped_type& operator[]( const const_key_type& key ) \ { \ bool created; \ return GetOrCreateNode( \ CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \ created)->m_value.second; \ } \ \ const_iterator find( const const_key_type& key ) const \ { \ return const_iterator( GetNode( key ), this ); \ } \ \ iterator find( const const_key_type& key ) \ { \ return iterator( GetNode( key ), this ); \ } \ \ Insert_Result insert( const value_type& v ) \ { \ bool created; \ Node *node = GetOrCreateNode( \ CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \ created); \ return Insert_Result(iterator(node, this), created); \ } \ \ size_type erase( const key_type& k ) \ { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ void erase( const iterator& it ) { erase( (*it).first ); } \ \ /* count() == 0 | 1 */ \ size_type count( const const_key_type& key ) \ { \ return GetNode( key ) ? 1u : 0u; \ } \ } #endif // wxNEEDS_WX_HASH_MAP // these macros are to be used in the user code #define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) #define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ CLASSNAME, class ) #define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ CLASSNAME, class ) // and these do exactly the same thing but should be used inside the // library #define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL ) #define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \ CLASSNAME, class WXDLLIMPEXP_CORE ) #define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ CLASSNAME, DECL ) #define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ class WXDLLIMPEXP_CORE ) #define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ CLASSNAME, DECL ) #define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ class WXDLLIMPEXP_CORE ) // delete all hash elements // // NB: the class declaration of the hash elements must be visible from the // place where you use this macro, otherwise the proper destructor may not // be called (a decent compiler should give a warning about it, but don't // count on it)! #define WX_CLEAR_HASH_MAP(type, hashmap) \ { \ type::iterator it, en; \ for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \ delete it->second; \ (hashmap).clear(); \ } //--------------------------------------------------------------------------- // Declarations of common hashmap classes WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap, class WXDLLIMPEXP_BASE ); WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxUIntPtr, wxStringToNumHashMap, class WXDLLIMPEXP_BASE ); #endif // _WX_HASHMAP_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/fontdata.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/fontdata.h // Author: Julian Smart // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FONTDATA_H_ #define _WX_FONTDATA_H_ #include "wx/font.h" #include "wx/colour.h" #include "wx/encinfo.h" class WXDLLIMPEXP_CORE wxFontData : public wxObject { public: wxFontData(); virtual ~wxFontData(); wxFontData(const wxFontData& data); wxFontData& operator=(const wxFontData& data); void SetAllowSymbols(bool flag) { m_allowSymbols = flag; } bool GetAllowSymbols() const { return m_allowSymbols; } void SetColour(const wxColour& colour) { m_fontColour = colour; } const wxColour& GetColour() const { return m_fontColour; } void SetShowHelp(bool flag) { m_showHelp = flag; } bool GetShowHelp() const { return m_showHelp; } void EnableEffects(bool flag) { m_enableEffects = flag; } bool GetEnableEffects() const { return m_enableEffects; } void SetInitialFont(const wxFont& font) { m_initialFont = font; } wxFont GetInitialFont() const { return m_initialFont; } void SetChosenFont(const wxFont& font) { m_chosenFont = font; } wxFont GetChosenFont() const { return m_chosenFont; } void SetRange(int minRange, int maxRange) { m_minSize = minRange; m_maxSize = maxRange; } // encoding info is split into 2 parts: the logical wxWin encoding // (wxFontEncoding) and a structure containing the native parameters for // it (wxNativeEncodingInfo) wxFontEncoding GetEncoding() const { return m_encoding; } void SetEncoding(wxFontEncoding encoding) { m_encoding = encoding; } wxNativeEncodingInfo& EncodingInfo() { return m_encodingInfo; } // public for backwards compatibility only: don't use directly wxColour m_fontColour; bool m_showHelp; bool m_allowSymbols; bool m_enableEffects; wxFont m_initialFont; wxFont m_chosenFont; int m_minSize; int m_maxSize; private: wxFontEncoding m_encoding; wxNativeEncodingInfo m_encodingInfo; wxDECLARE_DYNAMIC_CLASS(wxFontData); }; #endif // _WX_FONTDATA_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/peninfobase.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/peninfobase.h // Purpose: Declaration of wxPenInfoBase class and related constants // Author: Adrien Tétar, Vadim Zeitlin // Created: 2017-09-10 // Copyright: (c) 2017 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_PENINFOBASE_H_ #define _WX_PENINFOBASE_H_ #include "wx/bitmap.h" #include "wx/colour.h" #include "wx/gdicmn.h" // for wxDash enum wxPenStyle { wxPENSTYLE_INVALID = -1, wxPENSTYLE_SOLID = wxSOLID, wxPENSTYLE_DOT = wxDOT, wxPENSTYLE_LONG_DASH = wxLONG_DASH, wxPENSTYLE_SHORT_DASH = wxSHORT_DASH, wxPENSTYLE_DOT_DASH = wxDOT_DASH, wxPENSTYLE_USER_DASH = wxUSER_DASH, wxPENSTYLE_TRANSPARENT = wxTRANSPARENT, wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE, wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK, wxPENSTYLE_STIPPLE = wxSTIPPLE, wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL, wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG, wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL, wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS, wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL, wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL, wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST, wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST }; enum wxPenJoin { wxJOIN_INVALID = -1, wxJOIN_BEVEL = 120, wxJOIN_MITER, wxJOIN_ROUND }; enum wxPenCap { wxCAP_INVALID = -1, wxCAP_ROUND = 130, wxCAP_PROJECTING, wxCAP_BUTT }; // ---------------------------------------------------------------------------- // wxPenInfoBase is a common base for wxPenInfo and wxGraphicsPenInfo // ---------------------------------------------------------------------------- // This class uses CRTP, the template parameter is the derived class itself. template <class T> class wxPenInfoBase { public: // Setters for the various attributes. All of them return the object itself // so that the calls to them could be chained. T& Colour(const wxColour& colour) { m_colour = colour; return This(); } T& Style(wxPenStyle style) { m_style = style; return This(); } T& Stipple(const wxBitmap& stipple) { m_stipple = stipple; m_style = wxPENSTYLE_STIPPLE; return This(); } T& Dashes(int nb_dashes, const wxDash *dash) { m_nb_dashes = nb_dashes; m_dash = const_cast<wxDash*>(dash); return This(); } T& Join(wxPenJoin join) { m_join = join; return This(); } T& Cap(wxPenCap cap) { m_cap = cap; return This(); } // Accessors are mostly meant to be used by wxWidgets itself. wxColour GetColour() const { return m_colour; } wxBitmap GetStipple() const { return m_stipple; } wxPenStyle GetStyle() const { return m_style; } wxPenJoin GetJoin() const { return m_join; } wxPenCap GetCap() const { return m_cap; } int GetDashes(wxDash **ptr) const { *ptr = m_dash; return m_nb_dashes; } int GetDashCount() const { return m_nb_dashes; } wxDash* GetDash() const { return m_dash; } // Convenience bool IsTransparent() const { return m_style == wxPENSTYLE_TRANSPARENT; } protected: wxPenInfoBase(const wxColour& colour, wxPenStyle style) : m_colour(colour) { m_nb_dashes = 0; m_dash = NULL; m_join = wxJOIN_ROUND; m_cap = wxCAP_ROUND; m_style = style; } private: // Helper to return this object itself cast to its real type T. T& This() { return static_cast<T&>(*this); } wxColour m_colour; wxBitmap m_stipple; wxPenStyle m_style; wxPenJoin m_join; wxPenCap m_cap; int m_nb_dashes; wxDash* m_dash; }; #endif // _WX_PENINFOBASE_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/versioninfo.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/versioninfo.h // Purpose: declaration of wxVersionInfo class // Author: Troels K // Created: 2010-11-22 // Copyright: (c) 2010 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_VERSIONINFO_H_ #define _WX_VERSIONINFO_H_ #include "wx/string.h" // ---------------------------------------------------------------------------- // wxVersionInfo: represents version information // ---------------------------------------------------------------------------- class wxVersionInfo { public: wxVersionInfo(const wxString& name = wxString(), int major = 0, int minor = 0, int micro = 0, const wxString& description = wxString(), const wxString& copyright = wxString()) { m_name = name; m_major = major; m_minor = minor; m_micro = micro; m_description = description; m_copyright = copyright; } // Default copy ctor, assignment operator and dtor are ok. const wxString& GetName() const { return m_name; } int GetMajor() const { return m_major; } int GetMinor() const { return m_minor; } int GetMicro() const { return m_micro; } wxString ToString() const { return HasDescription() ? GetDescription() : GetVersionString(); } wxString GetVersionString() const { wxString str; str << m_name << ' ' << GetMajor() << '.' << GetMinor(); if ( GetMicro() ) str << '.' << GetMicro(); return str; } bool HasDescription() const { return !m_description.empty(); } const wxString& GetDescription() const { return m_description; } bool HasCopyright() const { return !m_copyright.empty(); } const wxString& GetCopyright() const { return m_copyright; } private: wxString m_name, m_description, m_copyright; int m_major, m_minor, m_micro; }; #endif // _WX_VERSIONINFO_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ptr_shrd.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/ptr_shrd.h // Purpose: compatibility wrapper for wx/sharedptr.h // Author: Vadim Zeitlin // Created: 2009-02-03 // Copyright: (c) 2009 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // do not include this file in any new code, include wx/sharedptr.h instead #include "wx/sharedptr.h"
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/log.h
///////////////////////////////////////////////////////////////////////////// // Name: wx/log.h // Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) // Author: Vadim Zeitlin // Modified by: // Created: 29/01/98 // Copyright: (c) 1998 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_LOG_H_ #define _WX_LOG_H_ #include "wx/defs.h" #include "wx/cpp.h" // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- // NB: this is needed even if wxUSE_LOG == 0 typedef unsigned long wxLogLevel; // the trace masks have been superseded by symbolic trace constants, they're // for compatibility only and will be removed soon - do NOT use them #if WXWIN_COMPATIBILITY_2_8 #define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) #define wxTraceMessages 0x0002 // trace window messages/X callbacks #define wxTraceResAlloc 0x0004 // trace GDI resource allocation #define wxTraceRefCount 0x0008 // trace various ref counting operations #ifdef __WINDOWS__ #define wxTraceOleCalls 0x0100 // OLE interface calls #endif typedef unsigned long wxTraceMask; #endif // WXWIN_COMPATIBILITY_2_8 // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/string.h" #include "wx/strvararg.h" // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- class WXDLLIMPEXP_FWD_BASE wxObject; #if wxUSE_GUI class WXDLLIMPEXP_FWD_CORE wxFrame; #endif // wxUSE_GUI #if wxUSE_LOG #include "wx/arrstr.h" #include <time.h> // for time_t #include "wx/dynarray.h" #include "wx/hashmap.h" #include "wx/msgout.h" #if wxUSE_THREADS #include "wx/thread.h" #endif // wxUSE_THREADS // wxUSE_LOG_DEBUG enables the debug log messages #ifndef wxUSE_LOG_DEBUG #if wxDEBUG_LEVEL #define wxUSE_LOG_DEBUG 1 #else // !wxDEBUG_LEVEL #define wxUSE_LOG_DEBUG 0 #endif #endif // wxUSE_LOG_TRACE enables the trace messages, they are disabled by default #ifndef wxUSE_LOG_TRACE #if wxDEBUG_LEVEL #define wxUSE_LOG_TRACE 1 #else // !wxDEBUG_LEVEL #define wxUSE_LOG_TRACE 0 #endif #endif // wxUSE_LOG_TRACE // wxLOG_COMPONENT identifies the component which generated the log record and // can be #define'd to a user-defined value when compiling the user code to use // component-based filtering (see wxLog::SetComponentLevel()) #ifndef wxLOG_COMPONENT // this is a variable and not a macro in order to allow the user code to // just #define wxLOG_COMPONENT without #undef'ining it first extern WXDLLIMPEXP_DATA_BASE(const char *) wxLOG_COMPONENT; #ifdef WXBUILDING #define wxLOG_COMPONENT "wx" #endif #endif // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // different standard log levels (you may also define your own) enum wxLogLevelValues { wxLOG_FatalError, // program can't continue, abort immediately wxLOG_Error, // a serious error, user must be informed about it wxLOG_Warning, // user is normally informed about it but may be ignored wxLOG_Message, // normal message (i.e. normal output of a non GUI app) wxLOG_Status, // informational: might go to the status line of GUI app wxLOG_Info, // informational message (a.k.a. 'Verbose') wxLOG_Debug, // never shown to the user, disabled in release mode wxLOG_Trace, // trace messages are also only enabled in debug mode wxLOG_Progress, // used for progress indicator (not yet) wxLOG_User = 100, // user defined levels start here wxLOG_Max = 10000 }; // symbolic trace masks - wxLogTrace("foo", "some trace message...") will be // discarded unless the string "foo" has been added to the list of allowed // ones with AddTraceMask() #define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete) #define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks #define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation #define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations #ifdef __WINDOWS__ #define wxTRACE_OleCalls wxT("ole") // OLE interface calls #endif #include "wx/iosfwrap.h" // ---------------------------------------------------------------------------- // information about a log record, i.e. unit of log output // ---------------------------------------------------------------------------- class wxLogRecordInfo { public: // default ctor creates an uninitialized object wxLogRecordInfo() { memset(this, 0, sizeof(*this)); } // normal ctor, used by wxLogger specifies the location of the log // statement; its time stamp and thread id are set up here wxLogRecordInfo(const char *filename_, int line_, const char *func_, const char *component_) { filename = filename_; func = func_; line = line_; component = component_; // don't initialize the timestamp yet, we might not need it at all if // the message doesn't end up being logged and otherwise we'll fill it // just before logging it, which won't change it by much and definitely // less than a second resolution of the timestamp timestamp = 0; #if wxUSE_THREADS threadId = wxThread::GetCurrentId(); #endif // wxUSE_THREADS m_data = NULL; } // we need to define copy ctor and assignment operator because of m_data wxLogRecordInfo(const wxLogRecordInfo& other) { Copy(other); } wxLogRecordInfo& operator=(const wxLogRecordInfo& other) { if ( &other != this ) { delete m_data; Copy(other); } return *this; } // dtor is non-virtual, this class is not meant to be derived from ~wxLogRecordInfo() { delete m_data; } // the file name and line number of the file where the log record was // generated, if available or NULL and 0 otherwise const char *filename; int line; // the name of the function where the log record was generated (may be NULL // if the compiler doesn't support __FUNCTION__) const char *func; // the name of the component which generated this message, may be NULL if // not set (i.e. wxLOG_COMPONENT not defined) const char *component; // time of record generation time_t timestamp; #if wxUSE_THREADS // id of the thread which logged this record wxThreadIdType threadId; #endif // wxUSE_THREADS // store an arbitrary value in this record context // // wxWidgets always uses keys starting with "wx.", e.g. "wx.sys_error" void StoreValue(const wxString& key, wxUIntPtr val) { if ( !m_data ) m_data = new ExtraData; m_data->numValues[key] = val; } void StoreValue(const wxString& key, const wxString& val) { if ( !m_data ) m_data = new ExtraData; m_data->strValues[key] = val; } // these functions retrieve the value of either numeric or string key, // return false if not found bool GetNumValue(const wxString& key, wxUIntPtr *val) const { if ( !m_data ) return false; const wxStringToNumHashMap::const_iterator it = m_data->numValues.find(key); if ( it == m_data->numValues.end() ) return false; *val = it->second; return true; } bool GetStrValue(const wxString& key, wxString *val) const { if ( !m_data ) return false; const wxStringToStringHashMap::const_iterator it = m_data->strValues.find(key); if ( it == m_data->strValues.end() ) return false; *val = it->second; return true; } private: void Copy(const wxLogRecordInfo& other) { memcpy(this, &other, sizeof(*this)); if ( other.m_data ) m_data = new ExtraData(*other.m_data); } // extra data associated with the log record: this is completely optional // and can be used to pass information from the log function to the log // sink (e.g. wxLogSysError() uses this to pass the error code) struct ExtraData { wxStringToNumHashMap numValues; wxStringToStringHashMap strValues; }; // NULL if not used ExtraData *m_data; }; #define wxLOG_KEY_TRACE_MASK "wx.trace_mask" // ---------------------------------------------------------------------------- // log record: a unit of log output // ---------------------------------------------------------------------------- struct wxLogRecord { wxLogRecord(wxLogLevel level_, const wxString& msg_, const wxLogRecordInfo& info_) : level(level_), msg(msg_), info(info_) { } wxLogLevel level; wxString msg; wxLogRecordInfo info; }; // ---------------------------------------------------------------------------- // Derive from this class to customize format of log messages. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxLogFormatter { public: // Default constructor. wxLogFormatter() { } // Trivial but virtual destructor for the base class. virtual ~wxLogFormatter() { } // Override this method to implement custom formatting of the given log // record. The default implementation simply prepends a level-dependent // prefix to the message and optionally adds a time stamp. virtual wxString Format(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) const; protected: // Override this method to change just the time stamp formatting. It is // called by default Format() implementation. virtual wxString FormatTime(time_t t) const; }; // ---------------------------------------------------------------------------- // derive from this class to redirect (or suppress, or ...) log messages // normally, only a single instance of this class exists but it's not enforced // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxLog { public: // ctor wxLog() : m_formatter(new wxLogFormatter) { } // make dtor virtual for all derived classes virtual ~wxLog(); // log messages selection // ---------------------- // these functions allow to completely disable all log messages or disable // log messages at level less important than specified for the current // thread // is logging enabled at all now? static bool IsEnabled() { #if wxUSE_THREADS if ( !wxThread::IsMain() ) return IsThreadLoggingEnabled(); #endif // wxUSE_THREADS return ms_doLog; } // change the flag state, return the previous one static bool EnableLogging(bool enable = true) { #if wxUSE_THREADS if ( !wxThread::IsMain() ) return EnableThreadLogging(enable); #endif // wxUSE_THREADS const bool doLogOld = ms_doLog; ms_doLog = enable; return doLogOld; } // return the current global log level static wxLogLevel GetLogLevel() { return ms_logLevel; } // set global log level: messages with level > logLevel will not be logged static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } // set the log level for the given component static void SetComponentLevel(const wxString& component, wxLogLevel level); // return the effective log level for this component, falling back to // parent component and to the default global log level if necessary // // NB: component argument is passed by value and not const reference in an // attempt to encourage compiler to avoid an extra copy: as we modify // the component internally, we'd create one anyhow and like this it // can be avoided if the string is a temporary anyhow static wxLogLevel GetComponentLevel(wxString component); // is logging of messages from this component enabled at this level? // // usually always called with wxLOG_COMPONENT as second argument static bool IsLevelEnabled(wxLogLevel level, wxString component) { return IsEnabled() && level <= GetComponentLevel(component); } // enable/disable messages at wxLOG_Verbose level (only relevant if the // current log level is greater or equal to it) // // notice that verbose mode can be activated by the standard command-line // '--verbose' option static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } // check if verbose messages are enabled static bool GetVerbose() { return ms_bVerbose; } // message buffering // ----------------- // flush shows all messages if they're not logged immediately (FILE // and iostream logs don't need it, but wxLogGui does to avoid showing // 17 modal dialogs one after another) virtual void Flush(); // flush the active target if any and also output any pending messages from // background threads static void FlushActive(); // only one sink is active at each moment get current log target, will call // wxAppTraits::CreateLogTarget() to create one if none exists static wxLog *GetActiveTarget(); // change log target, logger may be NULL static wxLog *SetActiveTarget(wxLog *logger); #if wxUSE_THREADS // change log target for the current thread only, shouldn't be called from // the main thread as it doesn't use thread-specific log target static wxLog *SetThreadActiveTarget(wxLog *logger); #endif // wxUSE_THREADS // suspend the message flushing of the main target until the next call // to Resume() - this is mainly for internal use (to prevent wxYield() // from flashing the messages) static void Suspend() { ms_suspendCount++; } // must be called for each Suspend()! static void Resume() { ms_suspendCount--; } // should GetActiveTarget() try to create a new log object if the // current is NULL? static void DontCreateOnDemand(); // Make GetActiveTarget() create a new log object again. static void DoCreateOnDemand(); // log the count of repeating messages instead of logging the messages // multiple times static void SetRepetitionCounting(bool bRepetCounting = true) { ms_bRepetCounting = bRepetCounting; } // gets duplicate counting status static bool GetRepetitionCounting() { return ms_bRepetCounting; } // add string trace mask static void AddTraceMask(const wxString& str); // add string trace mask static void RemoveTraceMask(const wxString& str); // remove all string trace masks static void ClearTraceMasks(); // get string trace masks: note that this is MT-unsafe if other threads can // call AddTraceMask() concurrently static const wxArrayString& GetTraceMasks(); // is this trace mask in the list? static bool IsAllowedTraceMask(const wxString& mask); // log formatting // ----------------- // Change wxLogFormatter object used by wxLog to format the log messages. // // wxLog takes ownership of the pointer passed in but the caller is // responsible for deleting the returned pointer. wxLogFormatter* SetFormatter(wxLogFormatter* formatter); // All the time stamp related functions below only work when the default // wxLogFormatter is being used. Defining a custom formatter overrides them // as it could use its own time stamp format or format messages without // using time stamp at all. // sets the time stamp string format: this is used as strftime() format // string for the log targets which add time stamps to the messages; set // it to empty string to disable time stamping completely. static void SetTimestamp(const wxString& ts) { ms_timestamp = ts; } // disable time stamping of log messages static void DisableTimestamp() { SetTimestamp(wxEmptyString); } // get the current timestamp format string (maybe empty) static const wxString& GetTimestamp() { return ms_timestamp; } // helpers: all functions in this section are mostly for internal use only, // don't call them from your code even if they are not formally deprecated // put the time stamp into the string if ms_timestamp is not empty (don't // change it otherwise); the first overload uses the current time. static void TimeStamp(wxString *str); static void TimeStamp(wxString *str, time_t t); // these methods should only be called from derived classes DoLogRecord(), // DoLogTextAtLevel() and DoLogText() implementations respectively and // shouldn't be called directly, use logging functions instead void LogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) { DoLogRecord(level, msg, info); } void LogTextAtLevel(wxLogLevel level, const wxString& msg) { DoLogTextAtLevel(level, msg); } void LogText(const wxString& msg) { DoLogText(msg); } // this is a helper used by wxLogXXX() functions, don't call it directly // and see DoLog() for function to overload in the derived classes static void OnLog(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info); // version called when no information about the location of the log record // generation is available (but the time stamp is), it mainly exists for // backwards compatibility, don't use it in new code static void OnLog(wxLogLevel level, const wxString& msg, time_t t); // a helper calling the above overload with current time static void OnLog(wxLogLevel level, const wxString& msg) { OnLog(level, msg, time(NULL)); } // this method exists for backwards compatibility only, don't use bool HasPendingMessages() const { return true; } // don't use integer masks any more, use string trace masks instead #if WXWIN_COMPATIBILITY_2_8 static wxDEPRECATED_INLINE( void SetTraceMask(wxTraceMask ulMask), ms_ulTraceMask = ulMask; ) // this one can't be marked deprecated as it's used in our own wxLogger // below but it still is deprecated and shouldn't be used static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } #endif // WXWIN_COMPATIBILITY_2_8 protected: // the logging functions that can be overridden: DoLogRecord() is called // for every "record", i.e. a unit of log output, to be logged and by // default formats the message and passes it to DoLogTextAtLevel() which in // turn passes it to DoLogText() by default // override this method if you want to change message formatting or do // dynamic filtering virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info); // override this method to redirect output to different channels depending // on its level only; if even the level doesn't matter, override // DoLogText() instead virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); // this function is not pure virtual as it might not be needed if you do // the logging in overridden DoLogRecord() or DoLogTextAtLevel() directly // but if you do not override them in your derived class you must override // this one as the default implementation of it simply asserts virtual void DoLogText(const wxString& msg); // the rest of the functions are for backwards compatibility only, don't // use them in new code; if you're updating your existing code you need to // switch to overriding DoLogRecord/Text() above (although as long as these // functions exist, log classes using them will continue to work) #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED_BUT_USED_INTERNALLY( virtual void DoLog(wxLogLevel level, const char *szString, time_t t) ); wxDEPRECATED_BUT_USED_INTERNALLY( virtual void DoLog(wxLogLevel level, const wchar_t *wzString, time_t t) ); // these shouldn't be used by new code wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( virtual void DoLogString(const char *WXUNUSED(szString), time_t WXUNUSED(t)), wxEMPTY_PARAMETER_VALUE ) wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( virtual void DoLogString(const wchar_t *WXUNUSED(wzString), time_t WXUNUSED(t)), wxEMPTY_PARAMETER_VALUE ) #endif // WXWIN_COMPATIBILITY_2_8 // log a message indicating the number of times the previous message was // repeated if previous repetition counter is strictly positive, does // nothing otherwise; return the old value of repetition counter unsigned LogLastRepeatIfNeeded(); private: #if wxUSE_THREADS // called from FlushActive() to really log any buffered messages logged // from the other threads void FlushThreadMessages(); // these functions are called for non-main thread only by IsEnabled() and // EnableLogging() respectively static bool IsThreadLoggingEnabled(); static bool EnableThreadLogging(bool enable = true); #endif // wxUSE_THREADS // get the active log target for the main thread, auto-creating it if // necessary // // this is called from GetActiveTarget() and OnLog() when they're called // from the main thread static wxLog *GetMainThreadActiveTarget(); // called from OnLog() if it's called from the main thread or if we have a // (presumably MT-safe) thread-specific logger and by FlushThreadMessages() // when it plays back the buffered messages logged from the other threads void CallDoLogNow(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info); // variables // ---------------- wxLogFormatter *m_formatter; // We own this pointer. // static variables // ---------------- // if true, don't log the same message multiple times, only log it once // with the number of times it was repeated static bool ms_bRepetCounting; static wxLog *ms_pLogger; // currently active log sink static bool ms_doLog; // false => all logging disabled static bool ms_bAutoCreate; // create new log targets on demand? static bool ms_bVerbose; // false => ignore LogInfo messages static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel static size_t ms_suspendCount; // if positive, logs are not flushed // format string for strftime(), if empty, time stamping log messages is // disabled static wxString ms_timestamp; #if WXWIN_COMPATIBILITY_2_8 static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour #endif // WXWIN_COMPATIBILITY_2_8 }; // ---------------------------------------------------------------------------- // "trivial" derivations of wxLog // ---------------------------------------------------------------------------- // log everything except for the debug/trace messages (which are passed to // wxMessageOutputDebug) to a buffer class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog { public: wxLogBuffer() { } // get the string contents with all messages logged const wxString& GetBuffer() const { return m_str; } // show the buffer contents to the user in the best possible way (this uses // wxMessageOutputMessageBox) and clear it virtual void Flush() wxOVERRIDE; protected: virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg) wxOVERRIDE; private: wxString m_str; wxDECLARE_NO_COPY_CLASS(wxLogBuffer); }; // log everything to a "FILE *", stderr by default class WXDLLIMPEXP_BASE wxLogStderr : public wxLog, protected wxMessageOutputStderr { public: // redirect log output to a FILE wxLogStderr(FILE *fp = NULL, const wxMBConv &conv = wxConvWhateverWorks); protected: // implement sink function virtual void DoLogText(const wxString& msg) wxOVERRIDE; wxDECLARE_NO_COPY_CLASS(wxLogStderr); }; #if wxUSE_STD_IOSTREAM // log everything to an "ostream", cerr by default class WXDLLIMPEXP_BASE wxLogStream : public wxLog, private wxMessageOutputWithConv { public: // redirect log output to an ostream wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL, const wxMBConv& conv = wxConvWhateverWorks); protected: // implement sink function virtual void DoLogText(const wxString& msg) wxOVERRIDE; // using ptr here to avoid including <iostream.h> from this file wxSTD ostream *m_ostr; wxDECLARE_NO_COPY_CLASS(wxLogStream); }; #endif // wxUSE_STD_IOSTREAM // ---------------------------------------------------------------------------- // /dev/null log target: suppress logging until this object goes out of scope // ---------------------------------------------------------------------------- // example of usage: /* void Foo() { wxFile file; // wxFile.Open() normally complains if file can't be opened, we don't // want it wxLogNull logNo; if ( !file.Open("bar") ) ... process error ourselves ... // ~wxLogNull called, old log sink restored } */ class WXDLLIMPEXP_BASE wxLogNull { public: wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { } ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } private: bool m_flagOld; // the previous value of the wxLog::ms_doLog }; // ---------------------------------------------------------------------------- // chaining log target: installs itself as a log target and passes all // messages to the real log target given to it in the ctor but also forwards // them to the previously active one // // note that you don't have to call SetActiveTarget() with this class, it // does it itself in its ctor // ---------------------------------------------------------------------------- class WXDLLIMPEXP_BASE wxLogChain : public wxLog { public: wxLogChain(wxLog *logger); virtual ~wxLogChain(); // change the new log target void SetLog(wxLog *logger); // this can be used to temporarily disable (and then reenable) passing // messages to the old logger (by default we do pass them) void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } // are we passing the messages to the previous log target? bool IsPassingMessages() const { return m_bPassMessages; } // return the previous log target (may be NULL) wxLog *GetOldLog() const { return m_logOld; } // override base class version to flush the old logger as well virtual void Flush() wxOVERRIDE; // call to avoid destroying the old log target void DetachOldLog() { m_logOld = NULL; } protected: // pass the record to the old logger if needed virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) wxOVERRIDE; private: // the current log target wxLog *m_logNew; // the previous log target wxLog *m_logOld; // do we pass the messages to the old logger? bool m_bPassMessages; wxDECLARE_NO_COPY_CLASS(wxLogChain); }; // a chain log target which uses itself as the new logger #define wxLogPassThrough wxLogInterposer class WXDLLIMPEXP_BASE wxLogInterposer : public wxLogChain { public: wxLogInterposer(); private: wxDECLARE_NO_COPY_CLASS(wxLogInterposer); }; // a temporary interposer which doesn't destroy the old log target // (calls DetachOldLog) class WXDLLIMPEXP_BASE wxLogInterposerTemp : public wxLogChain { public: wxLogInterposerTemp(); private: wxDECLARE_NO_COPY_CLASS(wxLogInterposerTemp); }; #if wxUSE_GUI // include GUI log targets: #include "wx/generic/logg.h" #endif // wxUSE_GUI // ---------------------------------------------------------------------------- // wxLogger // ---------------------------------------------------------------------------- // wxLogger is a helper class used by wxLogXXX() functions implementation, // don't use it directly as it's experimental and subject to change (OTOH it // might become public in the future if it's deemed to be useful enough) // contains information about the context from which a log message originates // and provides Log() vararg method which forwards to wxLog::OnLog() and passes // this context to it class wxLogger { public: // ctor takes the basic information about the log record wxLogger(wxLogLevel level, const char *filename, int line, const char *func, const char *component) : m_level(level), m_info(filename, line, func, component) { } // store extra data in our log record and return this object itself (so // that further calls to its functions could be chained) template <typename T> wxLogger& Store(const wxString& key, T val) { m_info.StoreValue(key, val); return *this; } // hack for "overloaded" wxLogXXX() functions: calling this method // indicates that we may have an extra first argument preceding the format // string and that if we do have it, we should store it in m_info using the // given key (while by default 0 value will be used) wxLogger& MaybeStore(const wxString& key, wxUIntPtr value = 0) { wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" ); m_optKey = key; m_info.StoreValue(key, value); return *this; } // non-vararg function used by wxVLogXXX(): // log the message at the level specified in the ctor if this log message // is enabled void LogV(const wxString& format, va_list argptr) { // remember that fatal errors can't be disabled if ( m_level == wxLOG_FatalError || wxLog::IsLevelEnabled(m_level, m_info.component) ) DoCallOnLog(format, argptr); } // overloads used by functions with optional leading arguments (whose // values are stored in the key passed to MaybeStore()) void LogV(long num, const wxString& format, va_list argptr) { Store(m_optKey, num); LogV(format, argptr); } void LogV(void *ptr, const wxString& format, va_list argptr) { Store(m_optKey, wxPtrToUInt(ptr)); LogV(format, argptr); } void LogVTrace(const wxString& mask, const wxString& format, va_list argptr) { if ( !wxLog::IsAllowedTraceMask(mask) ) return; Store(wxLOG_KEY_TRACE_MASK, mask); LogV(format, argptr); } // vararg functions used by wxLogXXX(): // will log the message at the level specified in the ctor // // notice that this function supposes that the caller already checked that // the level was enabled and does no checks itself WX_DEFINE_VARARG_FUNC_VOID ( Log, 1, (const wxFormatString&), DoLog, DoLogUtf8 ) // same as Log() but with an extra numeric or pointer parameters: this is // used to pass an optional value by storing it in m_info under the name // passed to MaybeStore() and is required to support "overloaded" versions // of wxLogStatus() and wxLogSysError() WX_DEFINE_VARARG_FUNC_VOID ( Log, 2, (long, const wxFormatString&), DoLogWithNum, DoLogWithNumUtf8 ) // unfortunately we can't use "void *" here as we get overload ambiguities // with Log(wxFormatString, ...) when the first argument is a "char *" or // "wchar_t *" then -- so we only allow passing wxObject here, which is // ugly but fine in practice as this overload is only used by wxLogStatus() // whose first argument is a wxFrame WX_DEFINE_VARARG_FUNC_VOID ( Log, 2, (wxObject *, const wxFormatString&), DoLogWithPtr, DoLogWithPtrUtf8 ) // log the message at the level specified as its first argument // // as the macros don't have access to the level argument in this case, this // function does check that the level is enabled itself WX_DEFINE_VARARG_FUNC_VOID ( LogAtLevel, 2, (wxLogLevel, const wxFormatString&), DoLogAtLevel, DoLogAtLevelUtf8 ) // special versions for wxLogTrace() which is passed either string or // integer mask as first argument determining whether the message should be // logged or not WX_DEFINE_VARARG_FUNC_VOID ( LogTrace, 2, (const wxString&, const wxFormatString&), DoLogTrace, DoLogTraceUtf8 ) #if WXWIN_COMPATIBILITY_2_8 WX_DEFINE_VARARG_FUNC_VOID ( LogTrace, 2, (wxTraceMask, const wxFormatString&), DoLogTraceMask, DoLogTraceMaskUtf8 ) #endif // WXWIN_COMPATIBILITY_2_8 private: #if !wxUSE_UTF8_LOCALE_ONLY void DoLog(const wxChar *format, ...) { va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } void DoLogWithNum(long num, const wxChar *format, ...) { Store(m_optKey, num); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } void DoLogWithPtr(void *ptr, const wxChar *format, ...) { Store(m_optKey, wxPtrToUInt(ptr)); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } void DoLogAtLevel(wxLogLevel level, const wxChar *format, ...) { if ( !wxLog::IsLevelEnabled(level, m_info.component) ) return; va_list argptr; va_start(argptr, format); DoCallOnLog(level, format, argptr); va_end(argptr); } void DoLogTrace(const wxString& mask, const wxChar *format, ...) { if ( !wxLog::IsAllowedTraceMask(mask) ) return; Store(wxLOG_KEY_TRACE_MASK, mask); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } #if WXWIN_COMPATIBILITY_2_8 void DoLogTraceMask(wxTraceMask mask, const wxChar *format, ...) { if ( (wxLog::GetTraceMask() & mask) != mask ) return; Store(wxLOG_KEY_TRACE_MASK, mask); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } #endif // WXWIN_COMPATIBILITY_2_8 #endif // !wxUSE_UTF8_LOCALE_ONLY #if wxUSE_UNICODE_UTF8 void DoLogUtf8(const char *format, ...) { va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } void DoLogWithNumUtf8(long num, const char *format, ...) { Store(m_optKey, num); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } void DoLogWithPtrUtf8(void *ptr, const char *format, ...) { Store(m_optKey, wxPtrToUInt(ptr)); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } void DoLogAtLevelUtf8(wxLogLevel level, const char *format, ...) { if ( !wxLog::IsLevelEnabled(level, m_info.component) ) return; va_list argptr; va_start(argptr, format); DoCallOnLog(level, format, argptr); va_end(argptr); } void DoLogTraceUtf8(const wxString& mask, const char *format, ...) { if ( !wxLog::IsAllowedTraceMask(mask) ) return; Store(wxLOG_KEY_TRACE_MASK, mask); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } #if WXWIN_COMPATIBILITY_2_8 void DoLogTraceMaskUtf8(wxTraceMask mask, const char *format, ...) { if ( (wxLog::GetTraceMask() & mask) != mask ) return; Store(wxLOG_KEY_TRACE_MASK, mask); va_list argptr; va_start(argptr, format); DoCallOnLog(format, argptr); va_end(argptr); } #endif // WXWIN_COMPATIBILITY_2_8 #endif // wxUSE_UNICODE_UTF8 void DoCallOnLog(wxLogLevel level, const wxString& format, va_list argptr) { // As explained in wxLogRecordInfo ctor, we don't initialize its // timestamp to avoid calling time() unnecessary, but now that we are // about to log the message, we do need to do it. m_info.timestamp = time(NULL); wxLog::OnLog(level, wxString::FormatV(format, argptr), m_info); } void DoCallOnLog(const wxString& format, va_list argptr) { DoCallOnLog(m_level, format, argptr); } const wxLogLevel m_level; wxLogRecordInfo m_info; wxString m_optKey; wxDECLARE_NO_COPY_CLASS(wxLogger); }; // ============================================================================ // global functions // ============================================================================ // ---------------------------------------------------------------------------- // get error code/error message from system in a portable way // ---------------------------------------------------------------------------- // return the last system error code WXDLLIMPEXP_BASE unsigned long wxSysErrorCode(); // return the error message for given (or last if 0) error code WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); // return the error message for given (or last if 0) error code WXDLLIMPEXP_BASE wxString wxSysErrorMsgStr(unsigned long nErrCode = 0); // ---------------------------------------------------------------------------- // define wxLog<level>() functions which can be used by application instead of // stdio, iostream &c for log messages for easy redirection // ---------------------------------------------------------------------------- /* The code below is unreadable because it (unfortunately unavoidably) contains a lot of macro magic but all it does is to define wxLogXXX() such that you can call them as vararg functions to log a message at the corresponding level. More precisely, it defines: - wxLog{FatalError,Error,Warning,Message,Verbose,Debug}() functions taking the format string and additional vararg arguments if needed. - wxLogGeneric(wxLogLevel level, const wxString& format, ...) which takes the log level explicitly. - wxLogSysError(const wxString& format, ...) and wxLogSysError(long err, const wxString& format, ...) which log a wxLOG_Error severity message with the error message corresponding to the system error code err or the last error. - wxLogStatus(const wxString& format, ...) which logs the message into the status bar of the main application window and its overload wxLogStatus(wxFrame *frame, const wxString& format, ...) which logs it into the status bar of the specified frame. - wxLogTrace(Mask mask, const wxString& format, ...) which only logs the message is the specified mask is enabled. This comes in two kinds: Mask can be a wxString or a long. Both are deprecated. In addition, wxVLogXXX() versions of all the functions above are also defined. They take a va_list argument instead of "...". */ // creates wxLogger object for the current location #define wxMAKE_LOGGER(level) \ wxLogger(wxLOG_##level, __FILE__, __LINE__, __WXFUNCTION__, wxLOG_COMPONENT) // this macro generates the expression which logs whatever follows it in // parentheses at the level specified as argument #define wxDO_LOG(level) wxMAKE_LOGGER(level).Log // this is the non-vararg equivalent #define wxDO_LOGV(level, format, argptr) \ wxMAKE_LOGGER(level).LogV(format, argptr) // this macro declares wxLog<level>() macro which logs whatever follows it if // logging at specified level is enabled (notice that if it is false, the // following arguments are not even evaluated which is good as it avoids // unnecessary overhead) // // Note: the strange (because executing at most once) for() loop because we // must arrange for wxDO_LOG() to be at the end of the macro and using a // more natural "if (IsLevelEnabled()) wxDO_LOG()" would result in wrong // behaviour for the following code ("else" would bind to the wrong "if"): // // if ( cond ) // wxLogError("!!!"); // else // ... // // See also #11829 for the problems with other simpler approaches, // notably the need for two macros due to buggy __LINE__ in MSVC. #define wxDO_LOG_IF_ENABLED_HELPER(level, loopvar) \ for ( bool loopvar = false; \ !loopvar && wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT); \ loopvar = true ) \ wxDO_LOG(level) #define wxDO_LOG_IF_ENABLED(level) \ wxDO_LOG_IF_ENABLED_HELPER(level, wxMAKE_UNIQUE_NAME(wxlogcheck)) // wxLogFatalError() is special as it can't be disabled #define wxLogFatalError wxDO_LOG(FatalError) #define wxVLogFatalError(format, argptr) wxDO_LOGV(FatalError, format, argptr) #define wxLogError wxDO_LOG_IF_ENABLED(Error) #define wxVLogError(format, argptr) wxDO_LOGV(Error, format, argptr) #define wxLogWarning wxDO_LOG_IF_ENABLED(Warning) #define wxVLogWarning(format, argptr) wxDO_LOGV(Warning, format, argptr) #define wxLogMessage wxDO_LOG_IF_ENABLED(Message) #define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr) #define wxLogInfo wxDO_LOG_IF_ENABLED(Info) #define wxVLogInfo(format, argptr) wxDO_LOGV(Info, format, argptr) // this one is special as it only logs if we're in verbose mode #define wxLogVerbose \ if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \ wxLog::GetVerbose()) ) \ {} \ else \ wxDO_LOG(Info) #define wxVLogVerbose(format, argptr) \ if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \ wxLog::GetVerbose()) ) \ {} \ else \ wxDO_LOGV(Info, format, argptr) // another special case: the level is passed as first argument of the function // and so is not available to the macro // // notice that because of this, arguments of wxLogGeneric() are currently // always evaluated, unlike for the other log functions #define wxLogGeneric wxMAKE_LOGGER(Max).LogAtLevel #define wxVLogGeneric(level, format, argptr) \ if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \ {} \ else \ wxDO_LOGV(level, format, argptr) // wxLogSysError() needs to stash the error code value in the log record info // so it needs special handling too; additional complications arise because the // error code may or not be present as the first argument // // notice that we unfortunately can't avoid the call to wxSysErrorCode() even // though it may be unneeded if an explicit error code is passed to us because // the message might not be logged immediately (e.g. it could be queued for // logging from the main thread later) and so we can't to wait until it is // logged to determine whether we have last error or not as it will be too late // and it will have changed already by then (in fact it even changes when // wxString::Format() is called because of vsnprintf() inside it so it can // change even much sooner) #define wxLOG_KEY_SYS_ERROR_CODE "wx.sys_error" #define wxLogSysError \ if ( !wxLog::IsLevelEnabled(wxLOG_Error, wxLOG_COMPONENT) ) \ {} \ else \ wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ wxSysErrorCode()).Log // unfortunately we can't have overloaded macros so we can't define versions // both with and without error code argument and have to rely on LogV() // overloads in wxLogger to select between them #define wxVLogSysError \ wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ wxSysErrorCode()).LogV #if wxUSE_GUI // wxLogStatus() is similar to wxLogSysError() as it allows to optionally // specify the frame to which the message should go #define wxLOG_KEY_FRAME "wx.frame" #define wxLogStatus \ if ( !wxLog::IsLevelEnabled(wxLOG_Status, wxLOG_COMPONENT) ) \ {} \ else \ wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).Log #define wxVLogStatus \ wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).LogV #endif // wxUSE_GUI #else // !wxUSE_LOG #undef wxUSE_LOG_DEBUG #define wxUSE_LOG_DEBUG 0 #undef wxUSE_LOG_TRACE #define wxUSE_LOG_TRACE 0 // define macros for defining log functions which do nothing at all #define wxDEFINE_EMPTY_LOG_FUNCTION(level) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \ inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \ va_list WXUNUSED(argptr)) { } \ #define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \ inline void wxVLog##level(argclass WXUNUSED(arg), \ const wxFormatString& WXUNUSED(format), \ va_list WXUNUSED(argptr)) {} wxDEFINE_EMPTY_LOG_FUNCTION(FatalError); wxDEFINE_EMPTY_LOG_FUNCTION(Error); wxDEFINE_EMPTY_LOG_FUNCTION(SysError); wxDEFINE_EMPTY_LOG_FUNCTION2(SysError, long); wxDEFINE_EMPTY_LOG_FUNCTION(Warning); wxDEFINE_EMPTY_LOG_FUNCTION(Message); wxDEFINE_EMPTY_LOG_FUNCTION(Info); wxDEFINE_EMPTY_LOG_FUNCTION(Verbose); wxDEFINE_EMPTY_LOG_FUNCTION2(Generic, wxLogLevel); #if wxUSE_GUI wxDEFINE_EMPTY_LOG_FUNCTION(Status); wxDEFINE_EMPTY_LOG_FUNCTION2(Status, wxFrame *); #endif // wxUSE_GUI // Empty Class to fake wxLogNull class WXDLLIMPEXP_BASE wxLogNull { public: wxLogNull() { } }; // Dummy macros to replace some functions. #define wxSysErrorCode() (unsigned long)0 #define wxSysErrorMsg( X ) (const wxChar*)NULL #define wxSysErrorMsgStr( X ) wxEmptyString // Fake symbolic trace masks... for those that are used frequently #define wxTRACE_OleCalls wxEmptyString // OLE interface calls #endif // wxUSE_LOG/!wxUSE_LOG // debug functions can be completely disabled in optimized builds // if these log functions are disabled, we prefer to define them as (empty) // variadic macros as this completely removes them and their argument // evaluation from the object code but if this is not supported by compiler we // use empty inline functions instead (defining them as nothing would result in // compiler warnings) // // note that making wxVLogDebug/Trace() themselves (empty inline) functions is // a bad idea as some compilers are stupid enough to not inline even empty // functions if their parameters are complicated enough, but by defining them // as an empty inline function we ensure that even dumbest compilers optimise // them away #ifdef __BORLANDC__ // but Borland gives "W8019: Code has no effect" for wxLogNop() so we need // to define it differently for it to avoid these warnings (same problem as // with wxUnusedVar()) #define wxLogNop() { } #else inline void wxLogNop() { } #endif #if wxUSE_LOG_DEBUG #define wxLogDebug wxDO_LOG_IF_ENABLED(Debug) #define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr) #else // !wxUSE_LOG_DEBUG #define wxVLogDebug(fmt, valist) wxLogNop() #ifdef HAVE_VARIADIC_MACROS #define wxLogDebug(fmt, ...) wxLogNop() #else // !HAVE_VARIADIC_MACROS WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&)) #endif #endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG #if wxUSE_LOG_TRACE #define wxLogTrace \ if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \ {} \ else \ wxMAKE_LOGGER(Trace).LogTrace #define wxVLogTrace \ if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \ {} \ else \ wxMAKE_LOGGER(Trace).LogVTrace #else // !wxUSE_LOG_TRACE #define wxVLogTrace(mask, fmt, valist) wxLogNop() #ifdef HAVE_VARIADIC_MACROS #define wxLogTrace(mask, fmt, ...) wxLogNop() #else // !HAVE_VARIADIC_MACROS #if WXWIN_COMPATIBILITY_2_8 WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&)) #endif WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&)) #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS #endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE // wxLogFatalError helper: show the (fatal) error to the user in a safe way, // i.e. without using wxMessageBox() for example because it could crash void WXDLLIMPEXP_BASE wxSafeShowMessage(const wxString& title, const wxString& text); // ---------------------------------------------------------------------------- // debug only logging functions: use them with API name and error code // ---------------------------------------------------------------------------- #if wxUSE_LOG_DEBUG // make life easier for people using VC++ IDE: clicking on the message // will take us immediately to the place of the failed API #ifdef __VISUALC__ #define wxLogApiError(api, rc) \ wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ __FILE__, __LINE__, api, \ (long)rc, wxSysErrorMsgStr(rc)) #else // !VC++ #define wxLogApiError(api, rc) \ wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \ wxT("error 0x%08lx (%s)."), \ __FILE__, __LINE__, api, \ (long)rc, wxSysErrorMsgStr(rc)) #endif // VC++/!VC++ #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) #else // !wxUSE_LOG_DEBUG #define wxLogApiError(api, err) wxLogNop() #define wxLogLastError(api) wxLogNop() #endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG // macro which disables debug logging in release builds: this is done by // default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly #if defined(NDEBUG) && wxUSE_LOG_DEBUG #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() \ wxLog::SetLogLevel(wxLOG_Info) #else // !NDEBUG #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() #endif // NDEBUG/!NDEBUG #endif // _WX_LOG_H_
h
rticonnextdds-usecases
data/projects/rticonnextdds-usecases/VehicleTracking/ExampleCode/thirdparty/wxWidgets-3.1.2/Win32/include/wx/ioswrap.h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/ioswrap.h // Purpose: includes the correct iostream headers for current compiler // Author: Vadim Zeitlin // Modified by: // Created: 03.02.99 // Copyright: (c) 1998 Vadim Zeitlin <[email protected]> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #if wxUSE_STD_IOSTREAM #include "wx/beforestd.h" #if wxUSE_IOSTREAMH # include <iostream.h> #else # include <iostream> #endif #include "wx/afterstd.h" #ifdef __WINDOWS__ # include "wx/msw/winundef.h" #endif #endif // wxUSE_STD_IOSTREAM
h