Merge remote-tracking branch 'remotes/upstream/master'

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2021-11-15 10:13:08 +01:00
3768 changed files with 506219 additions and 517007 deletions

View File

@@ -76,8 +76,10 @@
#define wxCOMPILER_PREFIX vc140
#elif _MSC_VER >= 1910 && _MSC_VER < 1920
#define wxCOMPILER_PREFIX vc141
#elif _MSC_VER >= 1920 && _MSC_VER < 2000
#elif _MSC_VER >= 1920 && _MSC_VER < 1930
#define wxCOMPILER_PREFIX vc142
#elif _MSC_VER >= 1930 && _MSC_VER < 2000
#define wxCOMPILER_PREFIX vc143
#else
#error "Unknown MSVC 14.x compiler version, please report to wx-dev."
#endif
@@ -181,7 +183,7 @@
#if !defined(WXUSINGDLL)
#if !defined(wxNO_NET_LIB)
#pragma comment(lib, "wsock32")
#pragma comment(lib, "ws2_32")
#endif
#if wxUSE_XML && !defined(wxNO_XML_LIB) && !defined(wxNO_EXPAT_LIB)

View File

@@ -100,7 +100,7 @@ public:
// string <-> wxAcceleratorEntry conversion
// ----------------------------------------
// returns a wxString for the this accelerator.
// returns a wxString for this accelerator.
// this function formats it using the <flags>-<keycode> format
// where <flags> maybe a hyphen-separated list of "shift|alt|ctrl"
wxString ToString() const { return AsPossiblyLocalizedString(true); }

View File

@@ -66,7 +66,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxAddRemoveCtrlNameStr)
const wxString& name = wxASCII_STR(wxAddRemoveCtrlNameStr))
{
Init();
@@ -78,7 +78,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxAddRemoveCtrlNameStr);
const wxString& name = wxASCII_STR(wxAddRemoveCtrlNameStr));
virtual ~wxAddRemoveCtrl();

View File

@@ -44,7 +44,7 @@ public:
// sets the matrix to the respective values
virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) = 0;
// gets the component valuess of the matrix
// gets the component values of the matrix
virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const = 0;
// concatenates the matrix

View File

@@ -447,6 +447,14 @@
// Recommended setting: 1 (but may be safely disabled if you don't use it)
#define wxUSE_SECRETSTORE 1
// Allow the use of the OS built-in spell checker in wxTextCtrl.
//
// Default is 1, the corresponding wxTextCtrl functions simply won't do
// anything if the functionality is not supported by the current platform.
//
// Recommended setting: 1 unless you want to save a tiny bit of code.
#define wxUSE_SPELLCHECK 1
// Use wxStandardPaths class which allows to retrieve some standard locations
// in the file system
//
@@ -497,7 +505,7 @@
// Recommended setting: 1
#define wxUSE_TIMER 1
// Use wxStopWatch clas.
// Use wxStopWatch class.
//
// Default is 1
//
@@ -561,14 +569,10 @@
// 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
// Recommended setting: 1.
#define wxUSE_IPV6 1
// Set to 1 to enable virtual file systems (required by wxHTML)
#define wxUSE_FILESYSTEM 1
@@ -632,6 +636,38 @@
// wxMimeTypesManager class
#define wxUSE_MIMETYPE 1
// wxWebRequest allows usage of system libraries for HTTP(S) requests.
//
// Note that for wxWebRequest to be built, at least one of its backends must be
// available. Under MSW and macOS this will always be the case unless
// explicitly disabled.
//
// Default is 1
//
// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies
// on libcurl on Unix systems.
#define wxUSE_WEBREQUEST 1
// wxWebRequest backend based on NSURLSession
//
// Default is 1 under macOS.
//
// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1,
// otherwise wxWebRequest won't be available at all under Mac.
#ifdef __APPLE__
#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST
#else
#define wxUSE_WEBREQUEST_URLSESSION 0
#endif
// wxWebRequest backend based on libcurl, can be used under all platforms.
//
// Default is 0 for MSW and macOS, detected automatically when using configure.
//
// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required
// for wxWebRequest to be available at all.
#define wxUSE_WEBREQUEST_CURL 0
// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP
// or wxURL you need to set this to 1.
//
@@ -708,10 +744,10 @@
// 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.
// Default is 1
//
// Recommended setting: 1 (required by XRC)
#define wxUSE_XML wxUSE_XRC
#define wxUSE_XML 1
// Use wxWidget's AUI docking system
//
@@ -1021,7 +1057,7 @@
// Default is 1.
//
// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it
// it used by wxComboBox
// is used by wxComboBox
#define wxUSE_COMBOCTRL 1
// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox
@@ -1129,13 +1165,20 @@
// depends on it)
#define wxUSE_INFOBAR 1
// Use wxMenu, wxMenuBar, wxMenuItem.
// Use wxMenu, wxMenuItem.
//
// Default is 1.
//
// Recommended setting: 1 (can't be disabled under MSW)
#define wxUSE_MENUS 1
// Use wxMenuBar.
//
// Default is 1.
//
// Recommended setting: 1 (can't be disabled under MSW)
#define wxUSE_MENUBAR 1
// Use wxNotificationMessage.
//
// wxNotificationMessage allows to show non-intrusive messages to the user
@@ -1293,6 +1336,9 @@
// number entry dialog
#define wxUSE_NUMBERDLG 1
// credential entry dialog
#define wxUSE_CREDENTIALDLG 1
// splash screen class
#define wxUSE_SPLASH 1
@@ -1379,6 +1425,14 @@
// otherwise.
#define wxUSE_GLCANVAS 1
// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be
// automatically enabled if EGL support is detected. EGL support is only
// available under Unix platforms.
//
// Default is 0.
//
#define wxUSE_GLCANVAS_EGL 0
// wxRichTextCtrl allows editing of styled text.
//
// Default is 1.

View File

@@ -39,8 +39,8 @@ public:
explicit wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY);
#ifdef wxHAS_MEMBER_DEFAULT
wxAnimation(const wxAnimation&) wxMEMBER_DEFAULT;
wxAnimation& operator=(const wxAnimation&) wxMEMBER_DEFAULT;
wxAnimation(const wxAnimation&) = default;
wxAnimation& operator=(const wxAnimation&) = default;
#endif
bool IsOk() const;
@@ -171,7 +171,7 @@ protected:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAC_DEFAULT_STYLE,
const wxString& name = wxAnimationCtrlNameStr)
const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr))
: wxGenericAnimationCtrl(parent, id, anim, pos, size, style, name)
{}

View File

@@ -28,7 +28,7 @@ class WXDLLIMPEXP_FWD_CORE 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)
to store it which is format-dependent. 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.

View File

@@ -148,7 +148,7 @@ private:
/**
Helper macro for defining user value types.
Even though C++ RTTI would be fully available to use, we'd have to to
Even though C++ RTTI would be fully available to use, we'd have to
facilitate sub-type system which allows, for instance, wxAny with
signed short '15' to be treated equal to wxAny with signed long long '15'.
Having sm_instance is important here.
@@ -504,8 +504,10 @@ extern WXDLLIMPEXP_BASE bool wxAnyConvertString(const wxString& value,
wxAnyValueBuffer& dst);
WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString)
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr,
wxAnyConvertString, wxString)
#endif
WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr,
wxAnyConvertString, wxString)
@@ -757,11 +759,13 @@ public:
}
// These two constructors are needed to deal with string literals
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxAny(const char* value)
{
m_type = wxAnyValueTypeImpl<const char*>::sm_instance.get();
wxAnyValueTypeImpl<const char*>::SetValue(value, m_buffer);
}
#endif
wxAny(const wchar_t* value)
{
m_type = wxAnyValueTypeImpl<const wchar_t*>::sm_instance.get();
@@ -865,11 +869,13 @@ public:
#endif
// These two operators are needed to deal with string literals
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxAny& operator=(const char* value)
{
Assign(value);
return *this;
}
#endif
wxAny& operator=(const wchar_t* value)
{
Assign(value);
@@ -888,8 +894,10 @@ public:
return value == value2;
}
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
bool operator==(const char* value) const
{ return (*this) == wxString(value); }
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
bool operator==(const wchar_t* value) const
{ return (*this) == wxString(value); }
@@ -1017,6 +1025,13 @@ public:
#endif
private:
#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING
wxAny(const char*); // Disabled
wxAny& operator=(const char *&value); // Disabled
wxAny& operator=(const char value[]); // Disabled
wxAny& operator==(const char *value); // Disabled
#endif
// Assignment functions
void AssignAny(const wxAny& any)
{

View File

@@ -41,7 +41,7 @@
#define wxBU_NOTEXT 0x0002
#include "wx/bitmap.h"
#include "wx/bmpbndl.h"
#include "wx/control.h"
// ----------------------------------------------------------------------------
@@ -55,7 +55,7 @@ public:
// show the image in the button in addition to the label: this method is
// supported on all (major) platforms
void SetBitmap(const wxBitmap& bitmap, wxDirection dir = wxLEFT)
void SetBitmap(const wxBitmapBundle& bitmap, wxDirection dir = wxLEFT)
{
SetBitmapLabel(bitmap);
SetBitmapPosition(dir);
@@ -71,15 +71,15 @@ public:
// SetBitmapXXX() methods (except for SetBitmapLabel() which is a synonym
// for it anyhow) and that all bitmaps passed to these functions should be
// of the same size.
void SetBitmapLabel(const wxBitmap& bitmap)
void SetBitmapLabel(const wxBitmapBundle& bitmap)
{ DoSetBitmap(bitmap, State_Normal); }
void SetBitmapPressed(const wxBitmap& bitmap)
void SetBitmapPressed(const wxBitmapBundle& bitmap)
{ DoSetBitmap(bitmap, State_Pressed); }
void SetBitmapDisabled(const wxBitmap& bitmap)
void SetBitmapDisabled(const wxBitmapBundle& bitmap)
{ DoSetBitmap(bitmap, State_Disabled); }
void SetBitmapCurrent(const wxBitmap& bitmap)
void SetBitmapCurrent(const wxBitmapBundle& bitmap)
{ DoSetBitmap(bitmap, State_Current); }
void SetBitmapFocus(const wxBitmap& bitmap)
void SetBitmapFocus(const wxBitmapBundle& bitmap)
{ DoSetBitmap(bitmap, State_Focused); }
wxBitmap GetBitmapLabel() const { return DoGetBitmap(State_Normal); }
@@ -113,6 +113,7 @@ public:
// backwards compatible names for pressed/current bitmaps: they're not
// deprecated as there is nothing really wrong with using them and no real
// advantage to using the new names but the new names are still preferred
// (and need to be used when using wxBitmapBundle and not just wxBitmap)
wxBitmap GetBitmapSelected() const { return GetBitmapPressed(); }
wxBitmap GetBitmapHover() const { return GetBitmapCurrent(); }
@@ -161,7 +162,7 @@ protected:
virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const
{ return wxBitmap(); }
virtual void DoSetBitmap(const wxBitmap& WXUNUSED(bitmap),
virtual void DoSetBitmap(const wxBitmapBundle& WXUNUSED(bitmap),
State WXUNUSED(which))
{ }

View File

@@ -65,6 +65,7 @@ public:
bool operator!() const { return !((bool)*this); }
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
// and these are the conversions operator which allow to assign the result
// of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*)
operator const char *() const
@@ -94,6 +95,7 @@ public:
return p;
}
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
operator const wchar_t *() const
{
@@ -104,7 +106,7 @@ public:
// surrogates as we do for now)
//
// just remember that this works as long as wxString keeps an internal
// buffer with its wide wide char representation, just as with AsChar()
// buffer with its wide char representation, just as with AsChar()
// above
return m_str->c_str().AsWChar() + (m_iter - m_str->begin());
}
@@ -112,7 +114,7 @@ public:
// Because the objects of this class are only used as return type for
// functions which can return NULL we can skip providing dereferencing
// operators: the code using this class must test it for NULL first and if
// it does anything else with it it has to assign it to either char* or
// it does anything else with it has to assign it to either char* or
// wchar_t* itself, before dereferencing.
//
// IOW this

View File

@@ -622,6 +622,10 @@ public:
// there are none, will return NULL)
virtual wxWindow *GetTopWindow() const;
// convenient helper which is safe to use even if there is no wxApp at
// all, it will just return NULL in this case
static wxWindow *GetMainTopWindow();
// control the exit behaviour: by default, the program will exit the
// main loop (and so, usually, terminate) when the last top-level
// program window is deleted. Beware that if you disable this behaviour

View File

@@ -88,6 +88,16 @@ public:
// return true to suppress subsequent asserts, false to continue as before
virtual bool ShowAssertDialog(const wxString& msg) = 0;
// show the message safely to the user, i.e. show it in a message box if
// possible (even in a console application!) or return false if we can't do
// it (e.g. GUI is not initialized at all)
//
// note that this function can be called even when wxApp doesn't exist, as
// it's supposed to be always safe to call -- hence the name
//
// return true if the message box was shown, false if nothing was done
virtual bool SafeMessageBox(const wxString& text, const wxString& title) = 0;
// return true if fprintf(stderr) goes somewhere, false otherwise
virtual bool HasStderr() = 0;
@@ -154,11 +164,13 @@ public:
}
protected:
#if wxUSE_STACKWALKER
// utility function: returns the stack frame as a plain wxString
// Helper function mostly useful for derived classes ShowAssertDialog()
// implementation.
//
// Returns the stack frame as a plain (and possibly empty) wxString.
virtual wxString GetAssertStackTrace();
#endif
#endif // wxUSE_STACKWALKER
private:
static wxSocketManager *ms_manager;
@@ -208,6 +220,8 @@ public:
virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE;
virtual bool HasStderr() wxOVERRIDE;
virtual bool SafeMessageBox(const wxString& text,
const wxString& title) wxOVERRIDE;
// the GetToolkitVersion for console application is always the same
wxPortId GetToolkitVersion(int *verMaj = NULL,
@@ -248,6 +262,13 @@ public:
virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE;
virtual bool HasStderr() wxOVERRIDE;
// Win32 has its own implementation using native message box directly in
// the base class, don't override it.
#ifndef __WIN32__
virtual bool SafeMessageBox(const wxString& text,
const wxString& title) wxOVERRIDE;
#endif // !__WIN32__
virtual bool IsUsingUniversalWidgets() const wxOVERRIDE
{
#ifdef __WXUNIVERSAL__

View File

@@ -80,7 +80,7 @@ private:
/////////////////////////////////////////////////////////////////////////////
// wxArchiveInputStream
//
// GetNextEntry() returns an wxArchiveEntry object containing the meta-data
// GetNextEntry() returns a 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.

View File

@@ -42,12 +42,30 @@ wxDictionaryStringSortAscending(const wxString& s1, const wxString& s2)
return cmp ? cmp : s1.Cmp(s2);
}
inline int wxCMPFUNC_CONV
wxDictionaryStringSortDescending(const wxString& s1, const wxString& s2)
{
return wxDictionaryStringSortAscending(s2, s1);
}
WXDLLIMPEXP_BASE
int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2);
WXDLLIMPEXP_BASE
int wxCMPFUNC_CONV wxCmpNaturalGeneric(const wxString& s1, const wxString& s2);
inline int wxCMPFUNC_CONV wxNaturalStringSortAscending(const wxString& s1, const wxString& s2)
{
return wxCmpNatural(s1, s2);
}
inline int wxCMPFUNC_CONV wxNaturalStringSortDescending(const wxString& s1, const wxString& s2)
{
return wxCmpNatural(s2, s1);
}
#if wxUSE_STD_CONTAINERS
typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*);
@@ -380,6 +398,11 @@ private:
// (if the old buffer is big enough, just return NULL).
wxString *Grow(size_t nIncrement);
// Binary search in the sorted array: return the index of the string if it's
// present, otherwise, if lowerBound is true, return the position at which
// the string should be inserted and if it's false return wxNOT_FOUND.
size_t BinarySearch(const wxString& str, bool lowerBound) const;
size_t m_nSize, // current size of the array
m_nCount; // current number of elements

View File

@@ -15,6 +15,7 @@
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/iconbndl.h"
#include "wx/bmpbndl.h"
class WXDLLIMPEXP_FWD_CORE wxArtProvidersList;
class WXDLLIMPEXP_FWD_CORE wxArtProviderCache;
@@ -27,7 +28,7 @@ class wxArtProviderModule;
typedef wxString wxArtClient;
typedef wxString wxArtID;
#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + "_C")
#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + wxASCII_STR("_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)
@@ -154,13 +155,21 @@ public:
// 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 wxArtClient& client = wxASCII_STR(wxART_OTHER),
const wxSize& size = wxDefaultSize);
// Query the providers for bitmapbundle with given ID and return it.
// If none is available, then the search for a bitmap with the same properties
// is performed. If successful, the bitmap is wrapped into a bitmap bundle.
static wxBitmapBundle
GetBitmapBundle(const wxArtID& id,
const wxArtClient& client = wxASCII_STR(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 wxArtClient& client = wxASCII_STR(wxART_OTHER),
const wxSize& size = wxDefaultSize);
// Helper used by GetMessageBoxIcon(): return the art id corresponding to
@@ -173,13 +182,13 @@ public:
// can be set)
static wxIcon GetMessageBoxIcon(int flags)
{
return GetIcon(GetMessageBoxIconId(flags), wxART_MESSAGE_BOX);
return GetIcon(GetMessageBoxIconId(flags), wxASCII_STR(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);
const wxArtClient& client = wxASCII_STR(wxART_OTHER));
// Gets native size for given 'client' or wxDefaultSize if it doesn't
// have native equivalent
@@ -189,8 +198,10 @@ public:
// 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).
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("use wxBitmap::Rescale() instead.")
static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded);
#endif // WXWIN_COMPATIBILITY_3_0
protected:
friend class wxArtProviderModule;
@@ -223,6 +234,15 @@ protected:
return wxNullBitmap;
}
// Derived classes must override CreateBitmapBundle if they provide
// a bundle that cannot be represented through an ordinary bitmap.
virtual wxBitmapBundle CreateBitmapBundle(const wxArtID& id,
const wxArtClient& client,
const wxSize& size)
{
return wxBitmapBundle(CreateBitmap(id, client, size));
}
virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id),
const wxArtClient& WXUNUSED(client))
{

View File

@@ -211,6 +211,11 @@ public:
void SetAlignment(int l) { m_alignment = l; }
int GetAlignment() const { return m_alignment; }
bool CanBeToggled() const
{
return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO;
}
private:
wxWindow* m_window; // item's associated window

View File

@@ -55,6 +55,7 @@ enum wxAuiNotebookOption
wxAUI_NB_MIDDLE_CLICK_CLOSE
};
wxALLOW_COMBINING_ENUMS(wxAuiNotebookOption, wxBorder)

View File

@@ -26,7 +26,7 @@
// dock art provider code - a dock provider provides all drawing
// functionality to the wxAui dock manager. This allows the dock
// manager to have plugable look-and-feels
// manager to have pluggable look-and-feels
class WXDLLIMPEXP_AUI wxAuiDockArt
{
@@ -35,6 +35,7 @@ public:
wxAuiDockArt() { }
virtual ~wxAuiDockArt() { }
virtual wxAuiDockArt* Clone() = 0;
virtual int GetMetric(int id) = 0;
virtual void SetMetric(int id, int newVal) = 0;
virtual void SetFont(int id, const wxFont& font) = 0;
@@ -92,6 +93,7 @@ public:
wxAuiDefaultDockArt();
wxAuiDockArt* Clone() wxOVERRIDE;
int GetMetric(int metricId) wxOVERRIDE;
void SetMetric(int metricId, int newVal) wxOVERRIDE;
wxColour GetColour(int id) wxOVERRIDE;

View File

@@ -46,6 +46,8 @@ public:
// Allow processing accelerators to the parent frame
virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE;
wxAuiManager& GetAuiManager() { return m_mgr; }
protected:
virtual void OnMoveStart();
virtual void OnMoving(const wxRect& windowRect, wxDirection dir);

View File

@@ -413,6 +413,9 @@ public:
void SetFlags(unsigned int flags);
unsigned int GetFlags() const;
static bool AlwaysUsesLiveResize();
bool HasLiveResize() const;
void SetManagedWindow(wxWindow* managedWnd);
wxWindow* GetManagedWindow() const;
@@ -483,7 +486,7 @@ public:
public:
// deprecated -- please use SetManagedWindow() and
// deprecated -- please use SetManagedWindow()
// and GetManagedWindow() instead
wxDEPRECATED( void SetFrame(wxFrame* frame) );
@@ -552,6 +555,7 @@ public:
protected:
// protected events
void OnDestroy(wxWindowDestroyEvent& evt);
void OnPaint(wxPaintEvent& evt);
void OnEraseBackground(wxEraseEvent& evt);
void OnSize(wxSizeEvent& evt);
@@ -599,7 +603,6 @@ protected:
wxRect m_lastHint; // last hint rectangle
wxPoint m_lastMouseMove; // last mouse move position (see OnMotion)
int m_currentDragItem;
bool m_skipping;
bool m_hasMaximized;
double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume

View File

@@ -46,7 +46,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr);
const wxString& name = wxASCII_STR(wxFrameNameStr));
~wxAuiMDIParentFrame();
@@ -56,7 +56,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr );
const wxString& name = wxASCII_STR(wxFrameNameStr) );
void SetArtProvider(wxAuiTabArt* provider);
wxAuiTabArt* GetArtProvider();
@@ -131,7 +131,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual ~wxAuiMDIChildFrame();
bool Create(wxAuiMDIParentFrame *parent,
@@ -140,7 +140,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
const wxString& name = wxASCII_STR(wxFrameNameStr));
#if wxUSE_MENUS
virtual void SetMenuBar(wxMenuBar *menuBar) wxOVERRIDE;

View File

@@ -54,7 +54,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxBannerWindowNameStr)
const wxString& name = wxASCII_STR(wxBannerWindowNameStr))
{
Init();
@@ -68,7 +68,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxBannerWindowNameStr);
const wxString& name = wxASCII_STR(wxBannerWindowNameStr));
// Provide an existing bitmap to show. For wxLEFT orientation the bitmap is

View File

@@ -42,7 +42,7 @@ inline wxString wxBase64Encode(const void *src, size_t srcLen)
wxCharBuffer dst(dstLen);
wxBase64Encode(dst.data(), dstLen, src, srcLen);
return dst;
return wxASCII_STR(dst);
}
inline wxString wxBase64Encode(const wxMemoryBuffer& buf)

View File

@@ -97,6 +97,9 @@ class WXDLLIMPEXP_CORE wxBitmapHelpers
public:
// Create a new wxBitmap from the PNG data in the given buffer.
static wxBitmap NewFromPNGData(const void* data, size_t size);
// Rescale the given bitmap to the requested size.
static void Rescale(wxBitmap& bmp, const wxSize& sizeNeeded);
};
@@ -174,8 +177,7 @@ public:
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool CreateScaled(int w, int h, int d, double logicalScale)
{ return Create(wxRound(w*logicalScale), wxRound(h*logicalScale), d); }
virtual bool CreateScaled(int w, int h, int d, double logicalScale);
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
@@ -185,11 +187,11 @@ public:
{ return wxSize(GetWidth(), GetHeight()); }
// support for scaled bitmaps
virtual double GetScaleFactor() const { return 1.0; }
virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); }
virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); }
virtual wxSize GetScaledSize() const
{ return wxSize(wxRound(GetScaledWidth()), wxRound(GetScaledHeight())); }
virtual void SetScaleFactor(double scale);
virtual double GetScaleFactor() const;
virtual double GetScaledWidth() const;
virtual double GetScaledHeight() const;
virtual wxSize GetScaledSize() const;
#if wxUSE_IMAGE
virtual wxImage ConvertToImage() const = 0;
@@ -221,7 +223,7 @@ public:
#endif // wxUSE_PALETTE
// copies the contents and mask of the given (colour) icon to the bitmap
virtual bool CopyFromIcon(const wxIcon& icon) = 0;
bool CopyFromIcon(const wxIcon& icon);
// implementation:
#if WXWIN_COMPATIBILITY_3_0

207
include/wx/bmpbndl.h Normal file
View File

@@ -0,0 +1,207 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/bmpbndl.h
// Purpose: Declaration of wxBitmapBundle class.
// Author: Vadim Zeitlin
// Created: 2021-09-22
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BMPBNDL_H_
#define _WX_BMPBNDL_H_
#include "wx/bitmap.h"
#include "wx/object.h"
#include "wx/vector.h"
class wxBitmapBundleImpl;
class WXDLLIMPEXP_FWD_CORE wxWindow;
// It should be possible to implement SVG rasterizing without raw bitmap
// support using wxDC::DrawSpline(), but currently we don't do it and so
// FromSVG() is only available in the ports providing raw bitmap access.
#ifdef wxHAS_RAW_BITMAP
#define wxHAS_SVG
#endif
// ----------------------------------------------------------------------------
// wxBitmapBundle provides 1 or more versions of a bitmap, all bundled together
// ----------------------------------------------------------------------------
// This class has value semantics and can be copied cheaply.
class WXDLLIMPEXP_CORE wxBitmapBundle
{
public:
// Default ctor constructs an empty bundle which can't be used for
// anything, but can be assigned something later.
wxBitmapBundle();
// This conversion ctor from a single bitmap does the same thing as
// FromBitmap() and only exists for interoperability with the existing code
// using wxBitmap.
wxBitmapBundle(const wxBitmap& bitmap);
// This is similar to above and also exists only for compatibility.
wxBitmapBundle(const wxIcon& icon);
// Another conversion ctor from a single image: this one is needed to allow
// passing wxImage to the functions that used to take wxBitmap but now take
// wxBitmapBundle.
wxBitmapBundle(const wxImage& image);
// Default copy ctor and assignment operator and dtor would be ok, but need
// to be defined out of line, where wxBitmapBundleImpl is fully declared.
wxBitmapBundle(const wxBitmapBundle& other);
wxBitmapBundle& operator=(const wxBitmapBundle& other);
~wxBitmapBundle();
// Create from the given collection of bitmaps (all of which must be valid,
// but if the vector itself is empty, empty bundle is returned).
static wxBitmapBundle FromBitmaps(const wxVector<wxBitmap>& bitmaps);
static wxBitmapBundle FromBitmaps(const wxBitmap& bitmap1,
const wxBitmap& bitmap2);
// Create from a single bitmap (this is only useful for compatibility
// with the existing code). Returns empty bundle if bitmap is invalid.
static wxBitmapBundle FromBitmap(const wxBitmap& bitmap);
static wxBitmapBundle FromImage(const wxImage& image);
// It should be possible to implement SVG rasterizing without raw bitmap
// support using wxDC::DrawSpline(), but currently we don't do it and so
// FromSVG() is only available in the ports providing raw bitmap access.
#ifdef wxHAS_SVG
// Create from the SVG data (data is supposed to be in UTF-8 encoding).
// Notice that the data here is non-const because it can be temporarily
// modified while parsing it.
static wxBitmapBundle FromSVG(char* data, const wxSize& sizeDef);
// This overload currently makes a copy of the data.
static wxBitmapBundle FromSVG(const char* data, const wxSize& sizeDef);
#endif // wxHAS_SVG
// Create from the resources: all existing versions of the bitmap of the
// form name_2x or name@2x (and also using other factors) will be used.
static wxBitmapBundle FromResources(const wxString& name);
// Create from files: all existing versions of the bitmap of the
// form filename_2x or name@2x (and also using other factors) will be used.
static wxBitmapBundle FromFiles(const wxString& fullpathname);
static wxBitmapBundle FromFiles(const wxString& path, const wxString& filename, const wxString& extension = wxASCII_STR("png"));
// Create from existing implementation
static wxBitmapBundle FromImpl(wxBitmapBundleImpl* impl);
// Check if bitmap bundle is non-empty.
bool IsOk() const { return m_impl; }
// Get the size of the bitmap represented by this bundle when using the
// default DPI, i.e. 100% scaling. Returns invalid size for empty bundle.
wxSize GetDefaultSize() const;
// Get preferred size, i.e. usually the closest size in which a bitmap is
// available to the ideal size determined from the default size and the DPI
// scaling, for the given window.
wxSize GetPreferredSizeFor(const wxWindow* window) const;
wxSize GetPreferredSizeAtScale(double scale) const;
// Get bitmap of the specified size, creating a new bitmap from the closest
// available size by rescaling it if necessary.
//
// If size == wxDefaultSize, GetDefaultSize() is used for it instead.
wxBitmap GetBitmap(const wxSize& size) const;
// Helper combining GetBitmap() and GetPreferredSizeFor(): returns the
// bitmap of the size appropriate for the current DPI scaling of the given
// window.
wxBitmap GetBitmapFor(const wxWindow* window) const;
// Access implementation
wxBitmapBundleImpl* GetImpl() const { return m_impl.get(); }
private:
typedef wxObjectDataPtr<wxBitmapBundleImpl> wxBitmapBundleImplPtr;
// Private ctor used by static factory functions to create objects of this
// class. It takes ownership of the pointer (which must be non-null).
explicit wxBitmapBundle(wxBitmapBundleImpl* impl);
wxBitmapBundleImplPtr m_impl;
};
// This macro can be used to create a bundle from resources on the platforms
// that support it and from name_png and name_2x_png on the other ones.
#ifdef wxHAS_IMAGE_RESOURCES
#define wxBITMAP_BUNDLE_2(name) wxBitmapBundle::FromResources(#name)
#else
#define wxBITMAP_BUNDLE_2(name) \
wxBitmapBundle::FromBitmaps(wxBITMAP_PNG_FROM_DATA(name), \
wxBITMAP_PNG_FROM_DATA(name##_2x))
#endif
// Inline functions implementation.
/* static */ inline
wxBitmapBundle wxBitmapBundle::FromBitmaps(const wxBitmap& bitmap1,
const wxBitmap& bitmap2)
{
wxVector<wxBitmap> bitmaps;
if ( bitmap1.IsOk() )
bitmaps.push_back(bitmap1);
if ( bitmap2.IsOk() )
bitmaps.push_back(bitmap2);
return FromBitmaps(bitmaps);
}
/* static */ inline
wxBitmapBundle wxBitmapBundle::FromBitmap(const wxBitmap& bitmap)
{
return wxBitmapBundle(bitmap);
}
/* static */ inline
wxBitmapBundle wxBitmapBundle::FromImage(const wxImage& image)
{
if ( !image.IsOk() )
return wxBitmapBundle();
return FromBitmap(wxBitmap(image));
}
// ----------------------------------------------------------------------------
// wxBitmapBundleImpl is the base class for all wxBitmapBundle implementations
// ----------------------------------------------------------------------------
// This class inherits from wxRefCounter to make it possible to use it with
// wxObjectDataPtr in wxBitmapBundle.
//
// It doesn't need to be used directly, but may be inherited from in order to
// implement custom bitmap bundles.
class WXDLLIMPEXP_CORE wxBitmapBundleImpl : public wxRefCounter
{
protected:
virtual ~wxBitmapBundleImpl();
public:
// Return the size of the bitmaps represented by this bundle in the default
// DPI (a.k.a. 100% resolution).
//
// Must always return a valid size.
virtual wxSize GetDefaultSize() const = 0;
// Return the preferred size that should be used at the given scale.
//
// Must always return a valid size.
virtual wxSize GetPreferredSizeAtScale(double scale) const = 0;
// Retrieve the bitmap of exactly the given size.
//
// Note that this function is non-const because it may generate the bitmap
// on demand and cache it.
virtual wxBitmap GetBitmap(const wxSize& size) = 0;
};
#endif // _WX_BMPBNDL_H_

View File

@@ -65,11 +65,25 @@ public:
validator, name);
}
/*
Derived classes also need to declare, but not define, as it's done in
common code in bmpbtncmn.cpp, the following function:
bool CreateCloseButton(wxWindow* parent,
wxWindowID winid,
const wxString& name = wxString());
which is used by NewCloseButton(), and, as Create(), must be
called on default-constructed wxBitmapButton object.
*/
// Special creation function for a standard "Close" bitmap. It allows to
// simply create a close button with the image appropriate for the current
// platform.
static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid);
static wxBitmapButton*
NewCloseButton(wxWindow* parent,
wxWindowID winid,
const wxString& name = wxString());
// set/get the margins around the button
virtual void SetMargins(int x, int y)
@@ -85,8 +99,9 @@ protected:
// function called when any of the bitmaps changes
virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; }
virtual void DoSetBitmap(const wxBitmap& bitmap, State which)
virtual wxBitmap DoGetBitmap(State which) const
{ return m_bitmaps[which].GetBitmap(wxDefaultSize); }
virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which)
{ m_bitmaps[which] = bitmap; OnSetBitmap(); }
virtual wxSize DoGetBitmapMargins() const
@@ -100,8 +115,8 @@ protected:
m_marginY = y;
}
// the bitmaps for various states
wxBitmap m_bitmaps[State_Max];
// the bitmap bundles for various states
wxBitmapBundle m_bitmaps[State_Max];
// the margins around the bitmap
int m_marginX,

View File

@@ -339,7 +339,7 @@ protected:
void OnSize(wxSizeEvent& event);
// controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook)
wxControl *m_bookctrl;
wxWindow *m_bookctrl;
// Whether to shrink to fit current page
bool m_fitToCurrentPage;

View File

@@ -105,11 +105,6 @@ extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList;
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
// Unfortunately some compilers have ambiguity issues when enum comparisons are
// overloaded so we have to disable the overloads in this case, see
// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants only")
inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t)
{
@@ -122,6 +117,4 @@ inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t)
return static_cast<int>(s) != static_cast<int>(t);
}
#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
#endif // _WX_BRUSH_H_BASE_

View File

@@ -81,8 +81,6 @@
// ABI-compatible with the corresponding version of the MSVC and we want to
// allow using it compile the application code using MSVC-built DLLs.
#define __WX_BO_COMPILER ",Intel C++"
#elif defined(__BORLANDC__)
#define __WX_BO_COMPILER ",Borland C++"
#else
#define __WX_BO_COMPILER
#endif

View File

@@ -153,6 +153,7 @@ protected:
m_window = window;
m_width = width;
m_height = height;
DoSize();
return true;
}

View File

@@ -90,7 +90,7 @@ namespace Catch
{
#if wxUSE_UNICODE
if ( !iswprint(*i) )
s += wxString::Format("\\u%04X", *i).ToStdString();
s += wxString::Format(wxASCII_STR("\\u%04X"), *i).ToAscii();
else
#endif // wxUSE_UNICODE
s += *i;
@@ -278,10 +278,10 @@ inline std::string wxGetCurrentTestName()
// Use this macro to assert with the given formatted message (it should contain
// the format string and arguments in a separate pair of parentheses)
#define WX_ASSERT_MESSAGE(msg, cond) \
CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str()), (cond))
CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str(wxConvLibc)), (cond))
#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \
CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str()), \
CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str(wxConvLibc)), \
(expected), (actual))
#endif // _WX_CATCH_CPPUNIT_H_

View File

@@ -93,9 +93,6 @@
/* VC++ and BC++ starting with 5.2 have TCHAR support */
#ifdef __VISUALC__
#define wxHAVE_TCHAR_SUPPORT
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
#define wxHAVE_TCHAR_SUPPORT
#include <ctype.h>
#elif defined(__MINGW32__)
#define wxHAVE_TCHAR_SUPPORT
#include <stddef.h>
@@ -199,11 +196,7 @@
Notice that we use an intermediate macro to allow x to be expanded
if it's a macro itself.
*/
#ifndef wxCOMPILER_BROKEN_CONCAT_OPER
#define wxT(x) wxCONCAT_HELPER(L, x)
#else
#define wxT(x) wxPREPEND_L(x)
#endif
#define wxT(x) wxCONCAT_HELPER(L, x)
#endif /* ASCII/Unicode */
#endif /* !defined(wxT) */
@@ -223,11 +216,7 @@
/*
As above with wxT(), wxS() argument is expanded if it's a macro.
*/
#ifndef wxCOMPILER_BROKEN_CONCAT_OPER
#define wxS(x) wxCONCAT_HELPER(L, x)
#else
#define wxS(x) wxPREPEND_L(x)
#endif
#define wxS(x) wxCONCAT_HELPER(L, x)
#else /* wxUSE_UNICODE_UTF8 || ANSI */
#define wxS(x) x
#endif

View File

@@ -18,11 +18,8 @@
**************************************************
If you get an error saying "wxUSE_FOO must be defined", it means that you
are not using the correct up-to-date version of setup.h. This happens most
often when using git or snapshots and a new symbol was added to setup0.h
and you haven't updated your local setup.h to reflect it. If this is the
case, you need to propagate the changes from setup0.h to your setup.h and,
if using makefiles under MSW, also remove setup.h under the build directory
are not using the correct up-to-date version of setup.h. If you're building
using makefiles under MSW, also remove setup.h under the build directory
(lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that the new setup.h is
copied there.
@@ -285,6 +282,14 @@
# endif
#endif /* !defined(wxUSE_SECRETSTORE) */
#ifndef wxUSE_SPELLCHECK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_SPELLCHECK must be defined, please read comment near the top of this file."
# else
# define wxUSE_SPELLCHECK 1
# endif
#endif /* !defined(wxUSE_SPELLCHECK) */
#ifndef wxUSE_STDPATHS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STDPATHS must be defined, please read comment near the top of this file."
@@ -927,6 +932,14 @@
# endif
#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */
#ifndef wxUSE_MENUBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MENUBAR must be defined, please read comment near the top of this file."
# else
# define wxUSE_MENUBAR 0
# endif
#endif /* !defined(wxUSE_MENUBAR) */
#ifndef wxUSE_MENUS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MENUS must be defined, please read comment near the top of this file."
@@ -1239,6 +1252,14 @@
# endif
#endif /* !defined(wxUSE_VALIDATORS) */
#ifndef wxUSE_WEBREQUEST
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WEBREQUEST must be defined, please read comment near the top of this file."
# else
# define wxUSE_WEBREQUEST 0
# endif
#endif /* !defined(wxUSE_WEBREQUEST) */
#ifndef wxUSE_WEBVIEW
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WEBVIEW must be defined, please read comment near the top of this file."
@@ -2128,6 +2149,7 @@
# if wxUSE_FONTDLG || \
wxUSE_FILEDLG || \
wxUSE_CHOICEDLG || \
wxUSE_CREDENTIALDLG || \
wxUSE_NUMBERDLG || \
wxUSE_TEXTDLG || \
wxUSE_DIRDLG || \
@@ -2261,14 +2283,25 @@
# endif
#endif /* wxUSE_SVG */
#if wxUSE_TASKBARICON && !wxUSE_MENUS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARICON requires wxUSE_MENUS"
# else
# undef wxUSE_TASKBARICON
# define wxUSE_TASKBARICON 0
# endif
#endif /* wxUSE_TASKBARICON */
#if !wxUSE_MENUS
# if wxUSE_MENUBAR
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MENUBAR requires wxUSE_MENUS"
# else
# undef wxUSE_MENUBAR
# define wxUSE_MENUBAR 0
# endif
# endif /* wxUSE_MENUBAR */
# if wxUSE_TASKBARICON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARICON requires wxUSE_MENUS"
# else
# undef wxUSE_TASKBARICON
# define wxUSE_TASKBARICON 0
# endif
# endif /* wxUSE_TASKBARICON */
#endif /* !wxUSE_MENUS */
#if !wxUSE_VARIANT
# if wxUSE_DATAVIEWCTRL
@@ -2300,6 +2333,15 @@
# endif
#endif /* wxUSE_WEBVIEW && !any web view backend */
#if wxUSE_WEBREQUEST && !(wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL)
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WEBREQUEST requires at least one backend"
# else
# undef wxUSE_WEBREQUEST
# define wxUSE_WEBREQUEST 0
# endif
#endif /* wxUSE_WEBREQUEST && !any web request backend */
#if wxUSE_PREFERENCES_EDITOR
/*
We can use either a generic implementation, using wxNotebook, or a
@@ -2392,6 +2434,17 @@
# endif
#endif /* wxUSE_RICHTEXT */
#if wxUSE_RICHTOOLTIP
# if !wxUSE_POPUPWIN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxRichToolTip requires wxUSE_POPUPWIN"
# else
# undef wxUSE_POPUPWIN
# define wxUSE_POPUPWIN 1
# endif
# endif
#endif /* wxUSE_RICHTOOLTIP */
#if wxUSE_PROPGRID
# if !wxUSE_VARIANT
# ifdef wxABORT_ON_CONFIG_ERROR
@@ -2403,6 +2456,17 @@
# endif
#endif /* wxUSE_PROPGRID */
#if wxUSE_TIPWINDOW
# if !wxUSE_POPUPWIN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxTipWindow requires wxUSE_POPUPWIN"
# else
# undef wxUSE_POPUPWIN
# define wxUSE_POPUPWIN 1
# endif
# endif
#endif /* wxUSE_TIPWINDOW */
#endif /* wxUSE_GUI */
#endif /* _WX_CHKCONF_H_ */

View File

@@ -74,7 +74,7 @@ protected:
// 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
// same prototype for their constructor (and also explains why we use
// define instead of a typedef)
// since GTK > 2.4, there is GtkColorButton
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
@@ -108,7 +108,7 @@ public:
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)
const wxString& name = wxASCII_STR(wxColourPickerCtrlNameStr))
{ Create(parent, id, col, pos, size, style, validator, name); }
bool Create(wxWindow *parent, wxWindowID id,
@@ -117,7 +117,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr);
const wxString& name = wxASCII_STR(wxColourPickerCtrlNameStr));
public: // public API

View File

@@ -35,7 +35,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxBORDER_NONE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCollapsibleHeaderCtrlNameStr)
const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr))
{
Create(parent, id, label, pos, size, style, validator, name);
}
@@ -47,7 +47,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxBORDER_NONE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCollapsibleHeaderCtrlNameStr)
const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr))
{
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
@@ -91,7 +91,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxBORDER_NONE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCollapsibleHeaderCtrlNameStr)
const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr))
{
Create(parent, id, label, pos, size, style, validator, name);
}

View File

@@ -20,6 +20,12 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
//
// It avoids the need to repeat these lines across all colour.h files, since
// Set() is a virtual function and thus cannot be called by wxColourBase ctors
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
#define wxWXCOLOUR_CTOR_FROM_CHAR \
wxColour(const char *colourName) { Init(); Set(colourName); }
#else // wxNO_IMPLICIT_WXSTRING_ENCODING
#define wxWXCOLOUR_CTOR_FROM_CHAR
#endif
#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \
wxColour() { Init(); } \
wxColour(ChannelType red, \
@@ -29,7 +35,7 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
{ Init(); Set(red, green, blue, alpha); } \
wxColour(unsigned long colRGB) { Init(); Set(colRGB ); } \
wxColour(const wxString& colourName) { Init(); Set(colourName); } \
wxColour(const char *colourName) { Init(); Set(colourName); } \
wxWXCOLOUR_CTOR_FROM_CHAR \
wxColour(const wchar_t *colourName) { Init(); Set(colourName); }

View File

@@ -197,6 +197,10 @@ public:
// get the popup window containing the popup control
wxWindow *GetPopupWindow() const { return m_winPopup; }
// Set the control to use instead of the default text control for the main
// (always visible) part of the combobox.
void SetMainControl(wxWindow* win);
// Get the text control which is part of the combobox.
wxTextCtrl *GetTextCtrl() const { return m_text; }
@@ -509,9 +513,6 @@ protected:
// (e.g. from WriteText())
void OnSetValue(const wxString& value);
// Installs standard input handler to combo (and optionally to the textctrl)
void InstallInputHandlers();
// Flags for DrawButton
enum
{
@@ -575,6 +576,15 @@ protected:
void OnKeyEvent(wxKeyEvent& event);
void OnCharEvent(wxKeyEvent& event);
void OnTextFocus(wxFocusEvent& event);
void OnTextKey(wxKeyEvent& event);
void OnPopupActivate(wxActivateEvent& event);
void OnPopupKey(wxKeyEvent& event);
void OnPopupSize(wxSizeEvent& event);
void OnPopupMouseEvent(wxMouseEvent& event);
// Set customization flags (directs how wxComboCtrlBase helpers behave)
void Customize( wxUint32 flags ) { m_iFlags |= flags; }
@@ -617,8 +627,12 @@ protected:
// This is used when control is unfocused and m_valueString is empty
wxString m_hintText;
// the text control and button we show all the time
// This pointer is non-null if we use a text control, and not some other
// window, as the main control.
wxTextCtrl* m_text;
// the window and button we show all the time
wxWindow* m_mainWindow;
wxWindow* m_btn;
// wxPopupWindow or similar containing the window managed by the interface.
@@ -630,18 +644,9 @@ protected:
// popup interface
wxComboPopup* m_popupInterface;
// this is input etc. handler for the text control
wxEvtHandler* m_textEvtHandler;
// this is for the top level window
wxEvtHandler* m_toplevEvtHandler;
// this is for the control in popup
wxEvtHandler* m_popupEvtHandler;
// this is for the popup window
wxEvtHandler* m_popupWinEvtHandler;
// main (ie. topmost) window of a composite control (default = this)
wxWindow* m_mainCtrlWnd;
@@ -720,14 +725,15 @@ protected:
// is the text-area background colour overridden?
bool m_hasTcBgCol;
// flags used while popup is shown
bool m_beenInsidePopup;
bool m_blockEventsToPopup;
private:
void Init();
wxByte m_ignoreEvtText; // Number of next EVT_TEXTs to ignore
// Is popup window wxPopupTransientWindow, wxPopupWindow or wxDialog?
wxByte m_popupWinType;
wxDECLARE_EVENT_TABLE();
wxDECLARE_ABSTRACT_CLASS(wxComboCtrlBase);

View File

@@ -35,8 +35,8 @@ public:
// override these methods to disambiguate between two base classes versions
virtual void Clear() wxOVERRIDE
{
wxTextEntry::Clear();
wxItemContainer::Clear();
wxTextEntry::Clear();
}
// IsEmpty() is ambiguous because we inherit it from both wxItemContainer

View File

@@ -40,7 +40,7 @@ public:
long style = 0,
const wxValidator& validator =
wxDefaultValidator,
const wxString& name = wxButtonNameStr)
const wxString& name = wxASCII_STR(wxButtonNameStr))
: wxButton(parent,
id,
mainLabel + '\n' + note,
@@ -103,7 +103,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
const wxString& name = wxASCII_STR(wxButtonNameStr))
: wxCommandLinkButtonBase()
{
Create(parent, id, mainLabel, note, pos, size, style, validator, name);
@@ -117,7 +117,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
const wxString& name = wxASCII_STR(wxButtonNameStr));
virtual void SetMainLabelAndNote(const wxString& mainLabel,
const wxString& note) wxOVERRIDE
@@ -147,7 +147,7 @@ private:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
const wxString& name = wxASCII_STR(wxButtonNameStr))
: wxGenericCommandLinkButton(parent,
id,
mainLabel,

View File

@@ -35,10 +35,8 @@
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__
#if __VISUALC__ < 1400
# error "This Visual C++ version is not supported any longer (at least MSVC 2005 required)."
#elif __VISUALC__ < 1500
# define __VISUALC8__
#elif __VISUALC__ < 1600
@@ -60,8 +58,6 @@
# 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

View File

@@ -218,11 +218,17 @@ private:
win = win->GetParent();
}
child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnChar, this);
// Make all keyboard events occurring in sub-windows appear as coming
// from the main window itself.
child->Bind(wxEVT_KEY_DOWN, &wxCompositeWindow::OnKeyEvent, this);
child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnKeyEvent, this);
child->Bind(wxEVT_KEY_UP, &wxCompositeWindow::OnKeyEvent, this);
}
void OnChar(wxKeyEvent& event)
void OnKeyEvent(wxKeyEvent& event)
{
wxEventObjectOriginSetter setThis(event, this, this->GetId());
if ( !this->ProcessWindowEvent(event) )
event.Skip();
}

View File

@@ -186,6 +186,15 @@ public:
bool Read(const wxString& key, bool* val) const;
bool Read(const wxString& key, bool* val, bool defVal) const;
// read a 64-bit number when long is 32 bits
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
bool Read(const wxString& key, wxLongLong_t *pl) const;
bool Read(const wxString& key, wxLongLong_t *pl, wxLongLong_t defVal) const;
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
bool Read(const wxString& key, size_t* val) const;
bool Read(const wxString& key, size_t* val, size_t defVal) const;
#if wxUSE_BASE64
// read a binary data block
bool Read(const wxString& key, wxMemoryBuffer* data) const
@@ -225,14 +234,19 @@ public:
// we have to provide a separate version for C strings as otherwise the
// template Read() would be used
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxString Read(const wxString& key, const char* defVal) const
{ return Read(key, wxString(defVal)); }
#endif
wxString Read(const wxString& key, const wchar_t* defVal) const
{ return Read(key, wxString(defVal)); }
long ReadLong(const wxString& key, long defVal) const
{ long l; (void)Read(key, &l, defVal); return l; }
wxLongLong_t ReadLongLong(const wxString& key, wxLongLong_t defVal) const
{ wxLongLong_t ll; (void)Read(key, &ll, defVal); return ll; }
double ReadDouble(const wxString& key, double defVal) const
{ double d; (void)Read(key, &d, defVal); return d; }
@@ -268,10 +282,12 @@ public:
// we have to provide a separate version for C strings as otherwise they
// would be converted to bool and not to wxString as expected!
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
bool Write(const wxString& key, const char *value)
{ return Write(key, wxString(value)); }
bool Write(const wxString& key, const unsigned char *value)
{ return Write(key, wxString(value)); }
#endif
bool Write(const wxString& key, const wchar_t *value)
{ return Write(key, wxString(value)); }
@@ -300,8 +316,16 @@ public:
bool Write(const wxString& key, unsigned long value)
{ return DoWriteLong(key, value); }
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
bool Write(const wxString& key, wxLongLong_t value)
{ return DoWriteLongLong(key, value); }
bool Write(const wxString& key, wxULongLong_t value)
{ return DoWriteLongLong(key, value); }
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
bool Write(const wxString& key, float value)
{ return DoWriteDouble(key, value); }
{ return DoWriteDouble(key, double(value)); }
// Causes ambiguities in under OpenVMS
#if !defined( __VMS )
@@ -370,6 +394,9 @@ protected:
// do read/write the values of different types
virtual bool DoReadString(const wxString& key, wxString *pStr) const = 0;
virtual bool DoReadLong(const wxString& key, long *pl) const = 0;
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
virtual bool DoReadLongLong(const wxString& key, wxLongLong_t *pll) const;
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
virtual bool DoReadDouble(const wxString& key, double* val) const;
virtual bool DoReadBool(const wxString& key, bool* val) const;
#if wxUSE_BASE64
@@ -378,6 +405,9 @@ protected:
virtual bool DoWriteString(const wxString& key, const wxString& value) = 0;
virtual bool DoWriteLong(const wxString& key, long value) = 0;
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
virtual bool DoWriteLongLong(const wxString& key, wxLongLong_t value);
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
virtual bool DoWriteDouble(const wxString& key, double value);
virtual bool DoWriteBool(const wxString& key, bool value);
#if wxUSE_BASE64

View File

@@ -42,7 +42,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr);
const wxString& name = wxASCII_STR(wxControlNameStr));
// get the control alignment (left/right/centre, top/bottom/centre)
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }

View File

@@ -78,6 +78,8 @@ public:
virtual size_t GetMBNulLen() const wxOVERRIDE { return m_conv->GetMBNulLen(); }
virtual bool IsUTF8() const wxOVERRIDE { return m_conv && m_conv->IsUTF8(); }
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvAuto(*this); }
// return the BOM type of this buffer
@@ -91,6 +93,14 @@ public:
return m_bomType;
}
wxFontEncoding GetEncoding() const;
// Return true if the fall-back encoding is used
bool IsUsingFallbackEncoding() const
{
return m_ownsConv && m_bomType == wxBOM_None;
}
private:
// common part of all ctors
void Init()

View File

@@ -41,16 +41,6 @@
/* a Unicode-friendly version of wxSTRINGIZE_T */
#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x))
/*
Special workarounds for compilers with broken "##" operator. For all the
other ones we can just use it directly.
*/
#ifdef wxCOMPILER_BROKEN_CONCAT_OPER
#define wxPREPEND_L(x) L ## x
#define wxAPPEND_i64(x) x ## i64
#define wxAPPEND_ui64(x) x ## ui64
#endif /* wxCOMPILER_BROKEN_CONCAT_OPER */
/*
Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the
current line number to the given identifier to reduce the probability of the
@@ -150,20 +140,6 @@
#ifdef HAVE_VARIADIC_MACROS
/*
This is a hack to make it possible to use variadic macros with g++ 3.x even
when using -pedantic[-errors] option: without this, it would complain that
"anonymous variadic macros were introduced in C99"
and the option disabling this warning (-Wno-variadic-macros) is only
available in gcc 4.0 and later, so until then this hack is the only thing we
can do.
*/
#if defined(__GNUC__) && __GNUC__ == 3
#pragma GCC system_header
#endif /* gcc-3.x */
/*
wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x),
for every remaining argument 'x', with 'pos' being its 1-based index in

15
include/wx/creddlg.h Normal file
View File

@@ -0,0 +1,15 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/creddlg.h
// Purpose: wxCredentialEntryDialog interface
// Author: Tobias Taschner
// Created: 2018-10-23
// Copyright: (c) 2018 wxWidgets development team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CREDDLG_H_BASE
#define _WX_CREDDLG_H_BASE
#include "wx/generic/creddlgg.h"
#endif // _WX_CREDDLG_H_BASE

View File

@@ -36,7 +36,9 @@
wxTextDataObject | wxBitmapDataObject
|
wxCustomDataObject
|
|
wxImageDataObject
*/
// ============================================================================
@@ -545,6 +547,22 @@ private:
wxDECLARE_NO_COPY_CLASS(wxCustomDataObject);
};
// ----------------------------------------------------------------------------
// wxImageDataObject - data object for wxImage
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxImageDataObject : public wxCustomDataObject
{
public:
explicit wxImageDataObject(const wxImage& image = wxNullImage);
void SetImage(const wxImage& image);
wxImage GetImage() const;
private:
wxDECLARE_NO_COPY_CLASS(wxImageDataObject);
};
// ----------------------------------------------------------------------------
// include platform-specific declarations of wxXXXBase classes
// ----------------------------------------------------------------------------

View File

@@ -208,7 +208,7 @@ public:
// return true if the given item has a value to display in the given
// column: this is always true except for container items which by default
// only show their label in the first column (but see HasContainerColumns())
bool HasValue(const wxDataViewItem& item, unsigned col) const
virtual bool HasValue(const wxDataViewItem& item, unsigned col) const
{
return col == 0 || !IsContainer(item) || HasContainerColumns(item);
}
@@ -514,6 +514,12 @@ public:
virtual void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE { m_bitmap = bitmap; }
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
// Special accessor for use by wxWidgets only returning the width that was
// explicitly set, either by the application, using SetWidth(), or by the
// user, resizing the column interactively. It is usually the same as
// GetWidth(), but can be different for the last column.
virtual int WXGetSpecifiedWidth() const { return GetWidth(); }
protected:
wxDataViewRenderer *m_renderer;
int m_model_column;
@@ -734,6 +740,7 @@ public:
virtual void UnselectAll() = 0;
void Expand( const wxDataViewItem & item );
void ExpandChildren( const wxDataViewItem & item );
void ExpandAncestors( const wxDataViewItem & item );
virtual void Collapse( const wxDataViewItem & item ) = 0;
virtual bool IsExpanded( const wxDataViewItem & item ) const = 0;
@@ -787,7 +794,9 @@ protected:
// Just expand this item assuming it is already shown, i.e. its parent has
// been already expanded using ExpandAncestors().
virtual void DoExpand(const wxDataViewItem & item) = 0;
//
// If expandChildren is true, also expand all its children recursively.
virtual void DoExpand(const wxDataViewItem & item, bool expandChildren) = 0;
private:
// Implementation of the public Set/GetCurrentItem() methods which are only
@@ -899,8 +908,8 @@ public:
int GetDragFlags() const { return m_dragFlags; }
void SetDropEffect( wxDragResult effect ) { m_dropEffect = effect; }
wxDragResult GetDropEffect() const { return m_dropEffect; }
// for plaforms (currently only OSX) that support Drag/Drop insertion of items,
// this is the proposed child index for the insertion
// For platforms (currently generic and OSX) that support Drag/Drop
// insertion of items, this is the proposed child index for the insertion.
void SetProposedDropIndex(int index) { m_proposedDropIndex = index; }
int GetProposedDropIndex() const { return m_proposedDropIndex;}
#endif // wxUSE_DRAG_AND_DROP

View File

@@ -44,7 +44,10 @@ enum
// wxDatePickerCtrl: allow the user to enter the date
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDatePickerCtrlBase : public wxDateTimePickerCtrl
// The template argument must be a class deriving from wxDateTimePickerCtrlBase
// (i.e. in practice either this class itself or wxDateTimePickerCtrl).
template <typename Base>
class WXDLLIMPEXP_ADV wxDatePickerCtrlCommonBase : public Base
{
public:
/*
@@ -75,6 +78,10 @@ public:
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0;
};
// This class is defined mostly for compatibility and is used as the base class
// by native wxDatePickerCtrl implementations.
typedef wxDatePickerCtrlCommonBase<wxDateTimePickerCtrl> wxDatePickerCtrlBase;
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/datectrl.h"

View File

@@ -723,7 +723,7 @@ public:
// 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
// consider getting the whole Tm structure first and retrieving the
// value from it - this is much more efficient
Tm GetTm(const TimeZone& tz = Local) const;
@@ -861,7 +861,7 @@ public:
return m_time != dt.m_time;
}
// arithmetics with dates (see also below for more operators)
// arithmetic with dates (see also below for more operators)
// ------------------------------------------------------------------------
// return the sum of the date with a time span (positive or negative)
@@ -955,7 +955,7 @@ public:
bool ParseFormat(const wxString& date,
wxString::const_iterator *end)
{
return ParseFormat(date, wxDefaultDateTimeFormat, wxDefaultDateTime, end);
return ParseFormat(date, wxASCII_STR(wxDefaultDateTimeFormat), wxDefaultDateTime, end);
}
// parse a string containing date, time or both in ISO 8601 format
@@ -1000,7 +1000,7 @@ public:
// 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,
wxString Format(const wxString& format = wxASCII_STR(wxDefaultDateTimeFormat),
const TimeZone& tz = Local) const;
// preferred date representation for the current locale
wxString FormatDate() const { return Format(wxS("%x")); }
@@ -1035,7 +1035,7 @@ public:
}
wxAnyStrPtr ParseFormat(const wxString& date,
const wxString& format = wxDefaultDateTimeFormat,
const wxString& format = wxASCII_STR(wxDefaultDateTimeFormat),
const wxDateTime& dateDef = wxDefaultDateTime)
{
wxString::const_iterator end;
@@ -1070,7 +1070,7 @@ public:
// 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
// Unfortunately those 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
@@ -1084,14 +1084,14 @@ public:
const wchar_t* ParseRfc822Date(const wchar_t* date);
void ParseFormat(const wxCStrData& date,
const wxString& format = wxDefaultDateTimeFormat,
const wxString& format = wxASCII_STR(wxDefaultDateTimeFormat),
const wxDateTime& dateDef = wxDefaultDateTime)
{ ParseFormat(wxString(date), format, dateDef); }
const char* ParseFormat(const char* date,
const wxString& format = wxDefaultDateTimeFormat,
const wxString& format = wxASCII_STR(wxDefaultDateTimeFormat),
const wxDateTime& dateDef = wxDefaultDateTime);
const wchar_t* ParseFormat(const wchar_t* date,
const wxString& format = wxDefaultDateTimeFormat,
const wxString& format = wxASCII_STR(wxDefaultDateTimeFormat),
const wxDateTime& dateDef = wxDefaultDateTime);
void ParseDateTime(const wxCStrData& datetime)
@@ -1207,7 +1207,7 @@ public:
// no dtor
// arithmetics with time spans (see also below for more operators)
// arithmetic with time spans (see also below for more operators)
// ------------------------------------------------------------------------
// return the sum of two timespans
@@ -1337,7 +1337,7 @@ public:
// 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;
wxString Format(const wxString& format = wxASCII_STR(wxDefaultTimeSpanFormat)) const;
// implementation
// ------------------------------------------------------------------------
@@ -1448,7 +1448,7 @@ public:
// returns 7*GetWeeks() + GetDays()
int GetTotalDays() const { return 7*m_weeks + m_days; }
// arithmetics with date spans (see also below for more operators)
// arithmetic with date spans (see also below for more operators)
// ------------------------------------------------------------------------
// return sum of two date spans
@@ -1848,7 +1848,7 @@ inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt,
}
// ----------------------------------------------------------------------------
// wxDateTime arithmetics
// wxDateTime arithmetic
// ----------------------------------------------------------------------------
inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
@@ -1997,7 +1997,7 @@ inline int wxTimeSpan::GetWeeks() const
}
// ----------------------------------------------------------------------------
// wxTimeSpan arithmetics
// wxTimeSpan arithmetic
// ----------------------------------------------------------------------------
inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const

View File

@@ -32,6 +32,13 @@ public:
// Set/get the date or time (in the latter case, time part is ignored).
virtual void SetValue(const wxDateTime& dt) = 0;
virtual wxDateTime GetValue() const = 0;
// For the controls with wxDP_ALLOWNONE style, set the string displayed
// when the control doesn't have any valid value. Currently this is only
// actually used under MSW, where it can be used to override the previous
// value which is still displayed by the control in this case, and ignored
// elsewhere.
virtual void SetNullText(const wxString& WXUNUSED(text)) { }
};
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)

View File

@@ -292,7 +292,6 @@ public:
void GetSize(int *width, int *height) const
{
DoGetSize(width, height);
return ;
}
wxSize GetSize() const
@@ -323,13 +322,20 @@ public:
// flushing the content of this dc immediately eg onto screen
virtual void Flush() { }
// coordinates conversions and transforms
virtual wxPoint DeviceToLogical(wxCoord x, wxCoord y) const;
virtual wxPoint LogicalToDevice(wxCoord x, wxCoord y) const;
virtual wxSize DeviceToLogicalRel(int x, int y) const;
virtual wxSize LogicalToDeviceRel(int x, int y) const;
// bounding box
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
{
// Bounding box is internally stored in device units.
x = LogicalToDeviceX(x);
y = LogicalToDeviceY(y);
wxPoint ptDev = LogicalToDevice(x, y);
x = ptDev.x;
y = ptDev.y;
if ( m_isBBoxValid )
{
if ( x < m_minX ) m_minX = x;
@@ -355,10 +361,10 @@ public:
}
// 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; }
wxCoord MinX() const { return m_isBBoxValid ? DeviceToLogical(m_minX, m_minY).x : 0; }
wxCoord MaxX() const { return m_isBBoxValid ? DeviceToLogical(m_maxX, m_maxY).x : 0; }
wxCoord MinY() const { return m_isBBoxValid ? DeviceToLogical(m_minX, m_minY).y : 0; }
wxCoord MaxY() const { return m_isBBoxValid ? DeviceToLogical(m_maxX, m_maxY).y : 0; }
// setters and getters
@@ -528,7 +534,7 @@ public:
virtual void ComputeScaleAndOrigin();
// this needs to overidden if the axis is inverted
// this needs to overridden if the axis is inverted
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
virtual double GetContentScaleFactor() const { return m_contentScaleFactor; }
@@ -736,7 +742,7 @@ protected:
// 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.
wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; // Some derived classes operate directly on clipping box given in logical units.
wxRasterOperationMode m_logicalFunction;
int m_backgroundMode;
@@ -758,6 +764,9 @@ private:
// Return the full DC area in logical coordinates.
wxRect GetLogicalArea() const;
wxCoord m_devClipX1, m_devClipY1, m_devClipX2, m_devClipY2; // For proper calculations of clipping box we need to store it in device units.
bool m_useDevClipCoords;
wxDECLARE_ABSTRACT_CLASS(wxDCImpl);
};
@@ -1008,6 +1017,14 @@ public:
{ return m_pimpl->DeviceToLogicalXRel(x); }
wxCoord DeviceToLogicalYRel(wxCoord y) const
{ return m_pimpl->DeviceToLogicalYRel(y); }
wxPoint DeviceToLogical(const wxPoint& pt) const
{ return m_pimpl->DeviceToLogical(pt.x, pt.y); }
wxPoint DeviceToLogical(wxCoord x, wxCoord y) const
{ return m_pimpl->DeviceToLogical(x, y); }
wxSize DeviceToLogicalRel(const wxSize& dim) const
{ return m_pimpl->DeviceToLogicalRel(dim.x, dim.y); }
wxSize DeviceToLogicalRel(int x, int y) const
{ return m_pimpl->DeviceToLogicalRel(x, y); }
wxCoord LogicalToDeviceX(wxCoord x) const
{ return m_pimpl->LogicalToDeviceX(x); }
wxCoord LogicalToDeviceY(wxCoord y) const
@@ -1016,6 +1033,14 @@ public:
{ return m_pimpl->LogicalToDeviceXRel(x); }
wxCoord LogicalToDeviceYRel(wxCoord y) const
{ return m_pimpl->LogicalToDeviceYRel(y); }
wxPoint LogicalToDevice(const wxPoint& pt) const
{ return m_pimpl->LogicalToDevice(pt.x, pt.y); }
wxPoint LogicalToDevice(wxCoord x, wxCoord y) const
{ return m_pimpl->LogicalToDevice(x, y); }
wxSize LogicalToDeviceRel(const wxSize& dim) const
{ return m_pimpl->LogicalToDeviceRel(dim.x, dim.y); }
wxSize LogicalToDeviceRel(int x, int y) const
{ return m_pimpl->LogicalToDeviceRel(x, y); }
void SetMapMode(wxMappingMode mode)
{ m_pimpl->SetMapMode(mode); }
@@ -1456,7 +1481,7 @@ class WXDLLIMPEXP_CORE wxDCTextBgModeChanger
public:
wxDCTextBgModeChanger(wxDC& dc) : m_dc(dc), m_modeOld(wxBRUSHSTYLE_INVALID) { }
wxDCTextBgModeChanger(wxDC& dc, int mode) : m_dc(dc)
wxDCTextBgModeChanger(wxDC& dc, int mode) : m_dc(dc), m_modeOld(wxBRUSHSTYLE_INVALID)
{
Set(mode);
}

View File

@@ -38,7 +38,7 @@ public:
#ifdef __WXMSW__
// override wxDC virtual functions to provide access to HDC associated with
// this Graphics object (implemented in src/msw/graphics.cpp)
// underlying wxGraphicsContext
virtual WXHDC AcquireHDC() wxOVERRIDE;
virtual void ReleaseHDC(WXHDC hdc) wxOVERRIDE;
#endif // __WXMSW__
@@ -121,6 +121,12 @@ public:
virtual void ResetTransformMatrix() wxOVERRIDE;
#endif // wxUSE_DC_TRANSFORM_MATRIX
// coordinates conversions and transforms
virtual wxPoint DeviceToLogical(wxCoord x, wxCoord y) const wxOVERRIDE;
virtual wxPoint LogicalToDevice(wxCoord x, wxCoord y) const wxOVERRIDE;
virtual wxSize DeviceToLogicalRel(int x, int y) const wxOVERRIDE;
virtual wxSize LogicalToDeviceRel(int x, int y) const wxOVERRIDE;
// the true implementations
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE;
@@ -221,10 +227,15 @@ protected:
// wxGraphicsContext, in the expectation that the derived class will do it
wxGCDCImpl(wxDC* owner, int);
#ifdef __WXOSX__
virtual wxPoint OSXGetOrigin() const { return wxPoint(); }
#endif
// scaling variables
bool m_logicalFunctionSupported;
wxGraphicsMatrix m_matrixOriginal;
wxGraphicsMatrix m_matrixCurrent;
wxGraphicsMatrix m_matrixCurrentInv;
#if wxUSE_DC_TRANSFORM_MATRIX
wxAffineMatrix2D m_matrixExtTransform;
#endif // wxUSE_DC_TRANSFORM_MATRIX

View File

@@ -127,23 +127,7 @@ public:
return wxCOPY;
}
virtual void SetLogicalOrigin(wxCoord x, wxCoord y) wxOVERRIDE
{
wxDCImpl::SetLogicalOrigin(x, y);
m_graphics_changed = true;
}
virtual void SetDeviceOrigin(wxCoord x, wxCoord y) wxOVERRIDE
{
wxDCImpl::SetDeviceOrigin(x, y);
m_graphics_changed = true;
}
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) wxOVERRIDE
{
wxDCImpl::SetAxisOrientation(xLeftRight, yBottomUp);
m_graphics_changed = true;
}
virtual void ComputeScaleAndOrigin() wxOVERRIDE;
virtual void SetBackground(const wxBrush& brush) wxOVERRIDE;
virtual void SetBackgroundMode(int mode) wxOVERRIDE;
@@ -198,6 +182,9 @@ private:
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset) wxOVERRIDE;
#if wxUSE_SPLINES
void DoDrawSpline(const wxPointList* points) wxOVERRIDE;
#endif // wxUSE_SPLINES
virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE;
@@ -252,11 +239,7 @@ private:
wxCoord* externalLeading = NULL,
const wxFont* theFont = NULL) const wxOVERRIDE;
virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE
{
DoSetClippingRegion(region.GetBox().x, region.GetBox().y,
region.GetBox().width, region.GetBox().height);
}
virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE;
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord w, wxCoord h) wxOVERRIDE;

View File

@@ -331,6 +331,8 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
#define wxFAIL
#define wxFAIL_MSG(msg)
#define wxFAIL_COND_MSG(cond, msg)
#define wxFAIL_MSG_AT(msg, file, line, func)
#define wxFAIL_COND_MSG_AT(cond, msg, file, line, func)
#endif // wxDEBUG_LEVEL
#if wxDEBUG_LEVEL >= 2
@@ -371,7 +373,7 @@ extern void WXDLLIMPEXP_BASE wxAbort();
wxFAIL_COND_MSG(#cond, msg); \
op; \
} \
struct wxDummyCheckStruct /* just to force a semicolon */
struct wxMAKE_UNIQUE_NAME(wxDummyCheckStruct) /* to force a semicolon */
// check which returns with the specified return code if the condition fails
#define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg)

View File

@@ -98,7 +98,7 @@
*/
#pragma warning(disable: 4127) /* conditional expression is constant */
/* There are too many false positivies for this one, particularly when
/* There are too many false positives for this one, particularly when
using templates like wxVector<T> */
/* class 'foo' needs to have dll-interface to be used by clients of
class 'bar'" */
@@ -157,11 +157,6 @@
#endif /* VC++ 8 */
#endif /* __VISUALC__ */
/* suppress some Borland C++ warnings */
#ifdef __BORLANDC__
# pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */
#endif /* __BORLANDC__ */
/*
g++ gives a warning when a class has private dtor if it has no friends but
this is a perfectly valid situation for a ref-counted class which destroys
@@ -290,13 +285,10 @@ typedef short int WXTYPE;
still requires handling MSVS specially, unfortunately) */
#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14)
#define wxHAS_MEMBER_DEFAULT
#define wxMEMBER_DEFAULT = default
#define wxHAS_NOEXCEPT
#define wxNOEXCEPT noexcept
#else
#define wxMEMBER_DEFAULT
#define wxNOEXCEPT
#endif
@@ -484,10 +476,9 @@ typedef short int WXTYPE;
#ifndef HAVE_WOSTREAM
/*
Mingw <= 3.4 and all versions of Cygwin don't have std::wostream
Cygwin is the only platform which doesn't have std::wostream
*/
#if (!defined(__MINGW32__) || wxCHECK_GCC_VERSION(4, 0)) && \
!defined(__CYGWIN__)
#if !defined(__CYGWIN__)
#define HAVE_WOSTREAM
#endif
#endif /* HAVE_WOSTREAM */
@@ -501,7 +492,6 @@ typedef short int WXTYPE;
#if defined(__GNUWIN32__)
#define wxSTDCALL __attribute__((stdcall))
#else
/* both VC++ and Borland understand this */
#define wxSTDCALL _stdcall
#endif
@@ -532,7 +522,7 @@ typedef short int WXTYPE;
#define wxC_CALLING_CONV
#endif /* compiler */
/* callling convention for the qsort(3) callback */
/* calling convention for the qsort(3) callback */
#define wxCMPFUNC_CONV wxC_CALLING_CONV
/* compatibility :-( */
@@ -546,12 +536,14 @@ typedef short int WXTYPE;
/* ---------------------------------------------------------------------------- */
/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */
#if defined(__GNUC__) && !wxUSE_UNICODE
# define WX_ATTRIBUTE_FORMAT(like, m, n) __attribute__ ((__format__ (like, m, n)))
#else
# define WX_ATTRIBUTE_FORMAT(like, m, n)
#endif
#ifndef WX_ATTRIBUTE_PRINTF
# if defined(__GNUC__) && !wxUSE_UNICODE
# define WX_ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
# else
# define WX_ATTRIBUTE_PRINTF(m, n)
# endif
# define WX_ATTRIBUTE_PRINTF(m, n) WX_ATTRIBUTE_FORMAT(__printf__, m, n)
# define WX_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF(1, 2)
# define WX_ATTRIBUTE_PRINTF_2 WX_ATTRIBUTE_PRINTF(2, 3)
@@ -581,14 +573,29 @@ typedef short int WXTYPE;
/*
Macros for marking functions as being deprecated.
The preferred macro in the new code is wxDEPRECATED_MSG() which allows to
explain why is the function deprecated. Almost all the existing code uses
the older wxDEPRECATED() or its variants currently, but this will hopefully
change in the future.
The preferred macro in the new code is wxDEPRECATED_ATTR() which expands to
the standard [[deprecated]] attribute if supported and allows to explain
why is the function deprecated. If supporting older compilers is important,
wxDEPRECATED_MSG() can be used as it's almost universally available and
still allows to explain the reason for the deprecation.
However almost all the existing code uses the older wxDEPRECATED() or its
variants currently, but this will hopefully change in the future.
*/
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(deprecated)
/* gcc 5 claims to support this attribute, but actually doesn't */
#if !defined(__GNUC__) || wxCHECK_GCC_VERSION(6, 0)
#define wxHAS_DEPRECATED_ATTR
#endif
#endif
#endif
/* The basic compiler-specific construct to generate a deprecation warning. */
#ifdef __clang__
#ifdef wxHAS_DEPRECATED_ATTR
#define wxDEPRECATED_DECL [[deprecated]]
#elif defined(__clang__)
#define wxDEPRECATED_DECL __attribute__((deprecated))
#elif defined(__GNUC__)
#define wxDEPRECATED_DECL __attribute__((deprecated))
@@ -598,13 +605,28 @@ typedef short int WXTYPE;
#define wxDEPRECATED_DECL
#endif
#ifdef wxHAS_DEPRECATED_ATTR
#define wxDEPRECATED_ATTR(msg) [[deprecated(msg)]]
#else
/*
Note that we can't fall back on wxDEPRECATED_DECL here, as the standard
attribute works in places where the compiler-specific one don't,
notably it can be used after enumerator declaration with MSVC, while
__declspec(deprecated) can't occur there as it can only be used before
the declaration.
*/
#define wxDEPRECATED_ATTR(msg)
#endif
/*
Macro taking the deprecation message. It applies to the next declaration.
If the compiler doesn't support showing the message, this degrades to a
simple wxDEPRECATED(), i.e. at least gives a warning, if possible.
*/
#if defined(__clang__) && defined(__has_extension)
#ifdef wxHAS_DEPRECATED_ATTR
#define wxDEPRECATED_MSG(msg) [[deprecated(msg)]]
#elif defined(__clang__) && defined(__has_extension)
#if __has_extension(attribute_deprecated_with_message)
#define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#else
@@ -625,15 +647,11 @@ typedef short int WXTYPE;
*/
#define wxDEPRECATED(x) wxDEPRECATED_DECL x
#if defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 4)
/*
We need to add dummy "inline" to allow gcc < 3.4 to handle the
deprecation attribute on the constructors.
*/
#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x)
#else
#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x)
#endif
/*
This macro used to be defined differently for gcc < 3.4, but we don't
support it any more, so it's just the same thing as wxDEPRECATED now.
*/
#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x)
/*
Macro which marks the function as being deprecated but also defines it
@@ -670,6 +688,9 @@ typedef short int WXTYPE;
wxGCC_WARNING_SUPPRESS(float-equal)
inline bool wxIsSameDouble(double x, double y) { return x == y; }
wxGCC_WARNING_RESTORE(float-equal)
Note that these macros apply to both gcc and clang, even though they only
have "GCC" in their names.
*/
#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6)
# define wxGCC_WARNING_SUPPRESS(x) \
@@ -682,6 +703,17 @@ typedef short int WXTYPE;
# define wxGCC_WARNING_RESTORE(x)
#endif
/*
Similar macros but for gcc-specific warnings.
*/
#ifdef __GNUC__
# define wxGCC_ONLY_WARNING_SUPPRESS(x) wxGCC_WARNING_SUPPRESS(x)
# define wxGCC_ONLY_WARNING_RESTORE(x) wxGCC_WARNING_RESTORE(x)
#else
# define wxGCC_ONLY_WARNING_SUPPRESS(x)
# define wxGCC_ONLY_WARNING_RESTORE(x)
#endif
/* Specific macros for -Wcast-function-type warning new in gcc 8. */
#if wxCHECK_GCC_VERSION(8, 0)
#define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() \
@@ -716,6 +748,39 @@ typedef short int WXTYPE;
# define wxCLANG_WARNING_RESTORE(x)
#endif
/*
Specific macro for disabling warnings related to not using override: this
has to be done differently for gcc and clang and is only supported since
gcc 5.1.
*/
#if defined(__clang__)
# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() \
wxCLANG_WARNING_SUPPRESS(suggest-override) \
wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override)
# define wxWARNING_RESTORE_MISSING_OVERRIDE() \
wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \
wxCLANG_WARNING_RESTORE(suggest-override)
#elif wxCHECK_GCC_VERSION(5, 1)
# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() \
wxGCC_WARNING_SUPPRESS(suggest-override)
# define wxWARNING_RESTORE_MISSING_OVERRIDE() \
wxGCC_WARNING_RESTORE(suggest-override)
#else
# define wxWARNING_SUPPRESS_MISSING_OVERRIDE()
# define wxWARNING_RESTORE_MISSING_OVERRIDE()
#endif
/*
Macros above don't work with gcc 11 due to a compiler bug, unless we also
use "override" in the function declaration -- but this breaks other
compilers, so define a specific macro for gcc 11 only.
*/
#if wxCHECK_GCC_VERSION(11, 0)
# define wxDUMMY_OVERRIDE wxOVERRIDE
#else
# define wxDUMMY_OVERRIDE
#endif
/*
Combination of the two variants above: should be used for deprecated
functions which are defined inline and are used by wxWidgets itself.
@@ -850,12 +915,8 @@ typedef short int WXTYPE;
/* sometimes the value of a variable is *really* not used, to suppress the */
/* resulting warning you may pass it to this function */
#ifdef __cplusplus
# ifdef __BORLANDC__
# define wxUnusedVar(identifier) identifier
# else
template <class T>
inline void wxUnusedVar(const T& WXUNUSED(t)) { }
# endif
template <class T>
inline void wxUnusedVar(const T& WXUNUSED(t)) { }
#endif
/* ---------------------------------------------------------------------------- */
@@ -1235,6 +1296,28 @@ typedef double wxDouble;
/* Geometric flags */
/* ---------------------------------------------------------------------------- */
/*
In C++20 operations on the elements of different enums are deprecated and
many compilers (clang 10+, gcc 11+, MSVS 2019) warn about combining them,
as a lot of existing code using them does, so we provide explicit operators
for doing this, that do the same thing as would happen without them, but
without the warnings.
*/
#if defined(__cplusplus) && (__cplusplus >= 202002L)
#define wxALLOW_COMBINING_ENUMS_IMPL(en1, en2) \
inline int operator|(en1 v1, en2 v2) \
{ return static_cast<int>(v1) | static_cast<int>(v2); } \
inline int operator+(en1 v1, en2 v2) \
{ return static_cast<int>(v1) + static_cast<int>(v2); }
#define wxALLOW_COMBINING_ENUMS(en1, en2) \
wxALLOW_COMBINING_ENUMS_IMPL(en1, en2) \
wxALLOW_COMBINING_ENUMS_IMPL(en2, en1)
#else /* !C++ 20 */
/* Don't bother doing anything in this case. */
#define wxALLOW_COMBINING_ENUMS(en1, en2)
#endif /* C++ 20 */
enum wxGeometryCentre
{
wxCENTRE = 0x0001,
@@ -1332,7 +1415,7 @@ enum wxStretch
wxGROW = 0x2000,
wxEXPAND = wxGROW,
wxSHAPED = 0x4000,
wxTILE = wxSHAPED | wxFIXED_MINSIZE,
wxTILE = 0xc000, /* wxSHAPED | wxFIXED_MINSIZE */
/* a mask to extract stretch from the combination of flags */
wxSTRETCH_MASK = 0x7000 /* sans wxTILE */
@@ -1360,6 +1443,16 @@ enum wxBorder
/* This makes it easier to specify a 'normal' border for a control */
#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN
/*
Elements of these enums can be combined with each other when using
wxSizer::Add() overload not using wxSizerFlags.
*/
wxALLOW_COMBINING_ENUMS(wxAlignment, wxDirection)
wxALLOW_COMBINING_ENUMS(wxAlignment, wxGeometryCentre)
wxALLOW_COMBINING_ENUMS(wxAlignment, wxStretch)
wxALLOW_COMBINING_ENUMS(wxDirection, wxStretch)
wxALLOW_COMBINING_ENUMS(wxDirection, wxGeometryCentre)
/* ---------------------------------------------------------------------------- */
/* Window style flags */
/* ---------------------------------------------------------------------------- */
@@ -1643,6 +1736,19 @@ enum wxBorder
#define wxLI_HORIZONTAL wxHORIZONTAL
#define wxLI_VERTICAL wxVERTICAL
/*
wxTextCtrl flags also used by other controls.
wxComboBox, wxSpinCtrl and maybe others can also use some of these flags,
so define them in common header. More wxTE_XXX are in wx/textctrl.h.
*/
#define wxTE_READONLY 0x0010
#define wxTE_MULTILINE 0x0020
#define wxTE_PROCESS_TAB 0x0040
#define wxTE_PROCESS_ENTER 0x0400
#define wxTE_PASSWORD 0x0800
/*
* extended dialog specifiers. these values are stored in a different
@@ -1940,17 +2046,9 @@ enum wxStandardID
/* wxWindowID type */
/* ---------------------------------------------------------------------------- */
/*
* wxWindowID used to be just a typedef defined here, now it's a class, but we
* still continue to define it here for compatibility, so that the code using
* it continues to compile even if it includes just wx/defs.h.
*
* Notice that wx/windowid.h can only be included after wxID_XYZ definitions
* (as it uses them).
*/
#if defined(__cplusplus) && wxUSE_GUI
#include "wx/windowid.h"
#endif
/* Note that this is defined even in non-GUI code as the same type is also used
for e.g. timer IDs. */
typedef int wxWindowID;
/* ---------------------------------------------------------------------------- */
/* other constants */
@@ -2141,6 +2239,7 @@ enum wxDataFormatId
wxDF_LOCALE = 16,
wxDF_PRIVATE = 20,
wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */
wxDF_PNG = 31, /* Note: does not correspond to CF_ constant */
wxDF_MAX
};
@@ -2334,8 +2433,30 @@ enum wxKeyCode
WXK_MEDIA_STOP,
WXK_MEDIA_PLAY_PAUSE,
WXK_LAUNCH_MAIL,
WXK_LAUNCH_APP1,
WXK_LAUNCH_APP2
// Events for these keys are currently only generated by wxGTK, with the
// exception of WXK_LAUNCH_{A,B}, see WXK_LAUNCH_APP{1,2} below.
WXK_LAUNCH_0,
WXK_LAUNCH_1,
WXK_LAUNCH_2,
WXK_LAUNCH_3,
WXK_LAUNCH_4,
WXK_LAUNCH_5,
WXK_LAUNCH_6,
WXK_LAUNCH_7,
WXK_LAUNCH_8,
WXK_LAUNCH_9,
WXK_LAUNCH_A,
WXK_LAUNCH_B,
WXK_LAUNCH_C,
WXK_LAUNCH_D,
WXK_LAUNCH_E,
WXK_LAUNCH_F,
// These constants are the same as the corresponding GTK keys, so give them
// the same value, but they are also generated by wxMSW.
WXK_LAUNCH_APP1 = WXK_LAUNCH_A,
WXK_LAUNCH_APP2 = WXK_LAUNCH_B
};
/* This enum contains bit mask constants used in wxKeyEvent */
@@ -2592,6 +2713,7 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);
#ifdef __DARWIN__
#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref;
#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref;
#endif
#ifdef __WXMAC__
@@ -2619,15 +2741,43 @@ typedef void* WXDisplay;
* core frameworks
*/
typedef const void * CFTypeRef;
#if __has_attribute(objc_bridge) && __has_feature(objc_bridge_id) && __has_feature(objc_bridge_id_on_typedefs)
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFData )
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString )
typedef struct __CFString * CFMutableStringRef;
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFDictionary )
#ifdef __OBJC__
@class NSArray;
@class NSString;
@class NSData;
@class NSDictionary;
#endif
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFArray )
typedef struct __CFArray * CFMutableArrayRef;
#define WXOSX_BRIDGED_TYPE(T) __attribute__((objc_bridge(T)))
#define WXOSX_BRIDGED_MUTABLE_TYPE(T) __attribute__((objc_bridge_mutable(T)))
#else
#define WXOSX_BRIDGED_TYPE(T)
#define WXOSX_BRIDGED_MUTABLE_TYPE(T)
#endif
#define DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( name ) \
typedef const struct WXOSX_BRIDGED_TYPE(NS##name) __CF##name* CF##name##Ref;
#define DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( name ) \
typedef struct WXOSX_BRIDGED_MUTABLE_TYPE(NSMutable##name) __CF##name* CFMutable##name##Ref;
typedef const WXOSX_BRIDGED_TYPE(id) void * CFTypeRef;
DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( Data )
DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( Data )
DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( String )
DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( String )
DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( Dictionary )
DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( Dictionary )
DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( Array )
DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( Array )
DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource )
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont )
@@ -2777,6 +2927,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSRotationGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSPressGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSTouch);
DECLARE_WXCOCOA_OBJC_CLASS(NSPasteboard);
DECLARE_WXCOCOA_OBJC_CLASS(WKWebView);
typedef WX_NSWindow WXWindow;
typedef WX_NSView WXWidget;
@@ -2785,9 +2936,12 @@ typedef WX_NSMenu WXHMENU;
typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
typedef WX_NSOpenGLContext WXGLContext;
typedef WX_NSPasteboard OSXPasteboard;
typedef WX_WKWebView OSXWebViewPtr;
#elif wxOSX_USE_IPHONE
DECLARE_WXCOCOA_OBJC_CLASS(UIMenu);
DECLARE_WXCOCOA_OBJC_CLASS(UIMenuItem);
DECLARE_WXCOCOA_OBJC_CLASS(UIWindow);
DECLARE_WXCOCOA_OBJC_CLASS(UImage);
DECLARE_WXCOCOA_OBJC_CLASS(UIView);
@@ -2796,23 +2950,18 @@ DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
DECLARE_WXCOCOA_OBJC_CLASS(UIWebView);
DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard);
typedef WX_UIWindow WXWindow;
typedef WX_UIView WXWidget;
typedef WX_UIImage WXImage;
typedef WX_UIMenu WXHMENU;
typedef WX_EAGLContext WXGLContext;
typedef WX_NSString WXGLPixelFormat;
typedef WX_UIWebView OSXWebViewPtr;
typedef WX_UIPasteboard WXOSXPasteboard;
#endif
#if wxOSX_USE_COCOA_OR_CARBON
DECLARE_WXCOCOA_OBJC_CLASS(WebView);
typedef WX_WebView OSXWebViewPtr;
#endif
#endif /* __WXMAC__ */

View File

@@ -63,9 +63,6 @@ public:
virtual void SetPalette(const wxPalette& palette);
#endif
// copies the contents and mask of the given (colour) icon to the bitmap
virtual bool CopyFromIcon(const wxIcon& icon);
static void InitStandardHandlers();
// raw bitmap access support functions

View File

@@ -11,6 +11,7 @@
#define _WX_DFB_CURSOR_H_
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxImage;
//-----------------------------------------------------------------------------
// wxCursor
@@ -24,6 +25,10 @@ public:
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
#if wxUSE_IMAGE
wxCursor(const wxImage& image);
wxCursor(const char* const* xpmData);
#endif // wxUSE_IMAGE
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);

View File

@@ -23,7 +23,7 @@
*/
#define wxDFB_DECLARE_INTERFACE(name) \
class wx##name; \
typedef wxDfbPtr<wx##name> wx##name##Ptr;
typedef wxDfbPtr<wx##name> wx##name##Ptr
//-----------------------------------------------------------------------------

View File

@@ -74,7 +74,7 @@ public:
bool Create(const wxNativeFontInfo& fontinfo);
// implement base class pure virtuals
virtual float GetFractionalPointSize() const;
virtual double GetFractionalPointSize() const;
virtual wxFontStyle GetStyle() const;
virtual int GetNumericWeight() const;
virtual wxString GetFaceName() const;
@@ -83,7 +83,7 @@ public:
virtual bool IsFixedWidth() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetFractionalPointSize(float pointSize);
virtual void SetFractionalPointSize(double pointSize);
virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(wxFontStyle style);
virtual void SetNumericWeight(int weight);

View File

@@ -38,7 +38,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
const wxString& name = wxASCII_STR(wxPanelNameStr))
{
Init();
@@ -50,7 +50,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
const wxString& name = wxASCII_STR(wxPanelNameStr));
virtual ~wxNonOwnedWindow();

View File

@@ -25,7 +25,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
@@ -38,7 +38,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
const wxString& name = wxASCII_STR(wxFrameNameStr));
// implement base class pure virtuals
virtual void Maximize(bool maximize = true);

View File

@@ -39,7 +39,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
const wxString& name = wxASCII_STR(wxPanelNameStr))
{
Init();
Create(parent, id, pos, size, style, name);
@@ -52,7 +52,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
const wxString& name = wxASCII_STR(wxPanelNameStr));
// implement base class (pure) virtual methods
// -------------------------------------------

View File

@@ -105,7 +105,10 @@ public:
// check whether it contains wxDIALOG_NO_PARENT bit.
//
// This function always returns a valid top level window or NULL.
wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const;
wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const
{
return DoGetParentForDialog(wxDIALOG_MODALITY_APP_MODAL, parent, style);
}
// This overload can only be used for already initialized windows, i.e. not
// from the ctor. It uses the current window parent and style.
@@ -114,6 +117,16 @@ public:
return GetParentForModalDialog(GetParent(), GetWindowStyle());
}
// This function is similar to GetParentForModalDialog() but should be used
// for modeless dialogs and skips the checks irrelevant for them (currently
// just the one checking that the candidate parent window is visible, as it
// is possible to create a modeless dialog before its parent is shown if it
// is only shown later, after showing the parent).
wxWindow *GetParentForModelessDialog(wxWindow *parent, long style) const
{
return DoGetParentForDialog(wxDIALOG_MODALITY_NONE, parent, style);
}
#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL
// splits text up at newlines and places the lines into a vertical
// wxBoxSizer, with the given maximum width, lines will not be wrapped
@@ -243,9 +256,15 @@ protected:
static bool sm_layoutAdaptation;
private:
// helper of GetParentForModalDialog(): returns the passed in window if it
// can be used as our parent or NULL if it can't
wxWindow *CheckIfCanBeUsedAsParent(wxWindow *parent) const;
// Common implementation of GetParentFor{Modal,Modeless}Dialog().
wxWindow *DoGetParentForDialog(wxDialogModality modality,
wxWindow *parent,
long style) const;
// helper of DoGetParentForDialog(): returns the passed in window if it
// can be used as parent for this kind of dialog or NULL if it can't
wxWindow *CheckIfCanBeUsedAsParent(wxDialogModality modality,
wxWindow *parent) const;
// Helper of OnCharHook() and OnCloseWindow(): find the appropriate button
// for closing the dialog and send a click event for it.

View File

@@ -66,7 +66,7 @@ public:
// 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
// dial the given ISP, use username and password to authenticate
//
// if no nameOfISP is given, the function will select the default one
//
@@ -118,11 +118,11 @@ public:
// set misc wxDialUpManager options
// --------------------------------
// enable automatical checks for the connection status and sending of
// enable automatic 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.
// instantaneous.
//
// Returns false if couldn't set up automatic check for online status.
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0;

View File

@@ -25,8 +25,22 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];
/*
The flags below must coexist with the following flags in m_windowStyle
#define wxCAPTION 0x20000000
#define wxMAXIMIZE 0x00002000
#define wxCLOSE_BOX 0x00001000
#define wxSYSTEM_MENU 0x00000800
wxBORDER_NONE = 0x00200000
#define wxRESIZE_BORDER 0x00000040
#define wxDIALOG_NO_PARENT 0x00000020
*/
#define wxDD_CHANGE_DIR 0x0100
#define wxDD_DIR_MUST_EXIST 0x0200
#define wxDD_MULTIPLE 0x0400
#define wxDD_SHOW_HIDDEN 0x0001
// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it
#define wxDD_NEW_DIR_BUTTON 0
@@ -42,12 +56,12 @@ class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog
public:
wxDirDialogBase() {}
wxDirDialogBase(wxWindow *parent,
const wxString& title = wxDirSelectorPromptStr,
const wxString& title = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxDirDialogNameStr)
const wxString& name = wxASCII_STR(wxDirDialogNameStr))
{
Create(parent, title, defaultPath, style, pos, sz, name);
}
@@ -56,12 +70,12 @@ public:
bool Create(wxWindow *parent,
const wxString& title = wxDirSelectorPromptStr,
const wxString& title = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxDirDialogNameStr)
const wxString& name = wxASCII_STR(wxDirDialogNameStr))
{
if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name))
return false;
@@ -74,11 +88,22 @@ public:
virtual void SetPath(const wxString& path) { m_path = path; }
virtual wxString GetMessage() const { return m_message; }
virtual wxString GetPath() const { return m_path; }
virtual wxString GetPath() const
{
wxCHECK_MSG( !HasFlag(wxDD_MULTIPLE), wxString(),
"When using wxDD_MULTIPLE, must call GetPaths() instead" );
return m_path;
}
virtual void GetPaths(wxArrayString& paths) const
{
paths = m_paths;
}
protected:
wxString m_message;
wxString m_path;
wxArrayString m_paths;
};
@@ -111,7 +136,7 @@ protected:
// ----------------------------------------------------------------------------
WXDLLIMPEXP_CORE wxString
wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
wxDirSelector(const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,

View File

@@ -87,6 +87,24 @@ public:
// get the resolution of this monitor in pixels per inch
wxSize GetPPI() const;
// get the default resolution for displays on this platform
static int GetStdPPIValue()
{
#ifdef __WXOSX__
return 72;
#else
return 96;
#endif
}
static wxSize GetStdPPI()
{
return wxSize(GetStdPPIValue(), GetStdPPIValue());
}
// get the scaling used by this display
double GetScaleFactor() const;
// name may be empty
wxString GetName() const;

View File

@@ -20,9 +20,9 @@
# define WXIMPORT __attribute__ ((visibility("default")))
#elif defined(__WINDOWS__)
/*
__declspec works in BC++ 5 and later as well as VC++.
__declspec works in as VC++.
*/
# if defined(__VISUALC__) || defined(__BORLANDC__)
# if defined(__VISUALC__)
# define WXEXPORT __declspec(dllexport)
# define WXIMPORT __declspec(dllimport)
/*

View File

@@ -187,9 +187,9 @@ public:
virtual bool GetData() = 0;
// sets the default action for drag and drop:
// use wxDragMove or wxDragCopy to set deafult action to move or copy
// use wxDragMove or wxDragCopy to set default action to move or copy
// and use wxDragNone (default) to set default action specified by
// initialization of draging (see wxDropSourceBase::DoDragDrop())
// initialization of dragging (see wxDropSourceBase::DoDragDrop())
void SetDefaultAction(wxDragResult action)
{ m_defaultAction = action; }

View File

@@ -41,7 +41,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
: wxDocMDIParentFrameBase(manager,
parent, id, title, pos, size, style, name)
{
@@ -72,7 +72,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
: wxDocMDIChildFrameBase(doc, view,
parent, id, title, pos, size, style, name)
{

View File

@@ -691,7 +691,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Create(doc, view, parent, id, title, pos, size, style, name);
}
@@ -704,7 +704,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
if ( !wxDocChildFrameAnyBase::Create(doc, view, this) )
return false;
@@ -767,7 +767,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
: wxDocChildFrameBase(doc, view,
parent, id, title, pos, size, style, name)
{
@@ -781,7 +781,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
return wxDocChildFrameBase::Create
(
@@ -845,7 +845,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
: wxDocParentFrameAnyBase(this)
{
Create(manager, frame, id, title, pos, size, style, name);
@@ -858,7 +858,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
m_docManager = manager;
@@ -920,7 +920,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
: wxDocParentFrameBase(manager,
parent, id, title, pos, size, style, name)
{
@@ -933,7 +933,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr)
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
return wxDocParentFrameBase::Create(manager,
parent, id, title,

View File

@@ -300,7 +300,7 @@ class WXDLLIMPEXP_CORE wxDataViewCustomRendererBase
public:
// Constructor must specify the usual renderer parameters which we simply
// pass to the base class
wxDataViewCustomRendererBase(const wxString& varianttype = "string",
wxDataViewCustomRendererBase(const wxString& varianttype = wxASCII_STR("string"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT)
: wxDataViewCustomRendererRealBase(varianttype, mode, align)
@@ -527,6 +527,8 @@ public:
virtual wxSize GetSize() const wxOVERRIDE;
private:
wxString FormatDate() const;
wxDateTime m_date;
};
#else // !wxUSE_DATEPICKCTRL

View File

@@ -255,6 +255,9 @@ public:
Add(item);
}
protected:
SCMPFUNC GetCompareFunction() const wxNOEXCEPT { return m_fnCompare; }
private:
SCMPFUNC m_fnCompare;
};
@@ -442,7 +445,7 @@ private:
// under Windows if needed.
//
// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL
// and so must be used used inside the library. The second kind (USER_EXPORTED)
// and so must be used inside the library. The second kind (USER_EXPORTED)
// allow the user code to do it when it wants. This is needed if you have a dll
// that wants to export a wxArray daubed with your own import/export goo.
//
@@ -612,7 +615,7 @@ private:
// 2) Detach() just removes the object from the array (returning pointer to it)
//
// NB1: Base type T should have an accessible copy ctor if Add(T&) is used
// NB2: Never ever cast a array to it's base type: as dtor is not virtual
// NB2: Never ever cast an array to it's base type: as dtor is not virtual
// and so you risk having at least the memory leaks and probably worse
//
// Some functions of this class are not inline, so it takes some space to
@@ -628,7 +631,7 @@ private:
// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the
// element_type must be fully defined (i.e. forward declaration is not
// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of
// two allows to break cicrcular dependencies with classes which have member
// two allows to break circcular dependencies with classes which have member
// variables of objarray type.
// ----------------------------------------------------------------------------

View File

@@ -18,11 +18,6 @@
#include "wx/string.h"
#include "wx/dynarray.h"
// note that we have our own dlerror() implementation under Darwin
#if defined(HAVE_DLERROR) || defined(__DARWIN__)
#define wxHAVE_DYNLIB_ERROR
#endif
class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator;
// ----------------------------------------------------------------------------
@@ -31,15 +26,9 @@ class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator;
#if defined(__WINDOWS__)
typedef WXHMODULE wxDllType;
#elif defined(__DARWIN__)
// Don't include dlfcn.h on Darwin, we may be using our own replacements.
typedef void *wxDllType;
#elif defined(HAVE_DLOPEN)
#include <dlfcn.h>
typedef void *wxDllType;
#elif defined(HAVE_SHL_LOAD)
#include <dl.h>
typedef shl_t wxDllType;
#elif defined(__WXMAC__)
#include <CodeFragments.h>
typedef CFragConnectionID wxDllType;
@@ -253,6 +242,9 @@ public:
// library couldn't be loaded but simply returns NULL
static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT);
// attach to an existing handle
void Attach(wxDllType h) { Unload(); m_handle = h; }
// detach the library object from its handle, i.e. prevent the object from
// unloading the library in its dtor -- the caller is now responsible for
// doing this
@@ -365,11 +357,9 @@ protected:
// common part of GetSymbol() and HasSymbol()
void* DoGetSymbol(const wxString& name, bool* success = NULL) const;
#ifdef wxHAVE_DYNLIB_ERROR
// log the error after a dlxxx() function failure
static void Error();
#endif // wxHAVE_DYNLIB_ERROR
// log the error after an OS dynamic library function failure
static void ReportError(const wxString& msg,
const wxString& name = wxString());
// the handle to DLL or NULL
wxDllType m_handle;

View File

@@ -36,10 +36,10 @@ typedef wxDLManifest wxDLImports;
// ---------------------------------------------------------------------------
// NOTE: Do not attempt to use a base class pointer to this class.
// wxDL is not virtual and we deliberately hide some of it's
// wxDL is not virtual and we deliberately hide some of its
// methods here.
//
// Unless you know exacty why you need to, you probably shouldn't
// Unless you know exactly why you need to, you probably shouldn't
// instantiate this class directly anyway, use wxPluginManager
// instead.

View File

@@ -41,7 +41,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxEL_DEFAULT_STYLE,
const wxString& name = wxEditableListBoxNameStr)
const wxString& name = wxASCII_STR(wxEditableListBoxNameStr))
{
Init();
Create(parent, id, label, pos, size, style, name);
@@ -52,7 +52,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxEL_DEFAULT_STYLE,
const wxString& name = wxEditableListBoxNameStr);
const wxString& name = wxASCII_STR(wxEditableListBoxNameStr));
void SetStrings(const wxArrayString& strings);
void GetStrings(wxArrayString& strings) const;

View File

@@ -96,7 +96,7 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject
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
// under given platform. wxPLATFORM_CURRENT means the platform
// this binary was compiled for
//
// Examples:

View File

@@ -31,14 +31,10 @@
#include "wx/vector.h"
#include "wx/meta/convertible.h"
#include "wx/meta/removeref.h"
// Currently VC7 is known to not be able to compile CallAfter() code, so
// disable it for it (FIXME-VC7).
#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(8)
#include "wx/meta/removeref.h"
#define wxHAS_CALL_AFTER
#endif
// This is now always defined, but keep it for backwards compatibility.
#define wxHAS_CALL_AFTER
// ----------------------------------------------------------------------------
// forward declarations
@@ -144,43 +140,58 @@ inline wxEventFunction wxEventFunctionCast(void (wxEvtHandler::*func)(T&))
wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
}
// Special hack to remove "noexcept" from the function type when using C++17 or
// later: static_cast<> below would fail to cast a member function pointer to a
// member of a derived class to the base class if noexcept is specified for the
// former, so remove it first if necessary.
// In good old pre-C++17 times we could just static_cast the event handler,
// defined in some class deriving from wxEvtHandler, to the "functype" which is
// a type of wxEvtHandler method. But with C++17 this doesn't work when the
// handler is a noexcept function, so we need to cast it to a noexcept function
// pointer first.
#if __cplusplus >= 201703L
namespace wxPrivate
{
// Generic template version, doing nothing.
template <typename T>
struct RemoveNoexceptEventHandler
// Cast to noexcept function type first if necessary.
template <typename E, typename C>
constexpr auto DoCast(void (C::*pmf)(E&))
{
using type = T;
return static_cast<void (wxEvtHandler::*)(E&)>(pmf);
}
template <typename E, typename C>
constexpr auto DoCast(void (C::*pmf)(E&) noexcept)
{
return static_cast<void (wxEvtHandler::*)(E&)>(
static_cast<void (wxEvtHandler::*)(E&) noexcept>(pmf)
);
}
// Helper used to recover the type of the handler argument from the function
// type. This is required in order to explicitly pass this type to DoCast<> as
// the compiler would be unable to deduce it for overloaded functions.
// Generic template version, doing nothing.
template <typename F>
struct EventArgOf;
// Specialization sufficient to cover all event handler function types.
template <typename C, typename E>
struct EventArgOf<void (C::*)(E&)>
{
using type = E;
};
// Specialization removing noexcept when it's specified.
//
// Note that this doesn't pretend to be generally suitable, this is just enough
// to work in our particular case.
template <typename R, typename C, typename E>
struct RemoveNoexceptEventHandler<R (C::*)(E&) noexcept>
{
using type = R (C::*)(E&);
};
} // namespace wxPrivate
#define wxREMOVE_NOEXCEPT_EVENT_HANDLER(pmf) \
static_cast<wxPrivate::RemoveNoexceptEventHandler<decltype(pmf)>::type>(pmf)
#define wxEventHandlerNoexceptCast(functype, pmf) \
wxPrivate::DoCast<wxPrivate::EventArgOf<functype>::type>(pmf)
#else
#define wxREMOVE_NOEXCEPT_EVENT_HANDLER(pmf) pmf
#define wxEventHandlerNoexceptCast(functype, pmf) static_cast<functype>(pmf)
#endif
// Try to cast the given event handler to the correct handler type:
#define wxEVENT_HANDLER_CAST( functype, func ) \
wxEventFunctionCast(static_cast<functype>(wxREMOVE_NOEXCEPT_EVENT_HANDLER(&func)))
wxEventFunctionCast(wxEventHandlerNoexceptCast(functype, &func))
// The tag is a type associated to the event type (which is an integer itself,
@@ -666,6 +677,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
class WXDLLIMPEXP_FWD_CORE wxShowEvent;
class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
class WXDLLIMPEXP_FWD_CORE wxFullScreenEvent;
class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
@@ -817,6 +829,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_FULLSCREEN, wxFullScreenEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent);
@@ -1184,6 +1197,35 @@ private:
wxDECLARE_NO_COPY_CLASS(wxPropagateOnce);
};
// Helper class changing the event object to make the event appear as coming
// from a different source: this is somewhat of a hack, but avoids copying the
// events just to change their event object field.
class wxEventObjectOriginSetter
{
public:
wxEventObjectOriginSetter(wxEvent& event, wxObject* source, int winid = 0)
: m_event(event),
m_sourceOrig(event.GetEventObject()),
m_idOrig(event.GetId())
{
m_event.SetEventObject(source);
m_event.SetId(winid);
}
~wxEventObjectOriginSetter()
{
m_event.SetId(m_idOrig);
m_event.SetEventObject(m_sourceOrig);
}
private:
wxEvent& m_event;
wxObject* const m_sourceOrig;
const int m_idOrig;
wxDECLARE_NO_COPY_CLASS(wxEventObjectOriginSetter);
};
// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn()
// return true for the handler passed to its ctor.
class wxEventProcessInHandlerOnly
@@ -1356,8 +1398,6 @@ private:
// done asynchronously, i.e. at some later time, instead of immediately when
// the event object is constructed.
#ifdef wxHAS_CALL_AFTER
// This is a base class used to process all method calls.
class wxAsyncMethodCallEvent : public wxEvent
{
@@ -1538,9 +1578,6 @@ private:
FunctorType m_fn;
};
#endif // wxHAS_CALL_AFTER
#if wxUSE_GUI
@@ -1655,7 +1692,7 @@ private:
};
// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
// Scroll event class, derived from wxCommandEvent. wxScrollEvents are
// sent by wxSlider and wxScrollBar.
/*
wxEVT_SCROLL_TOP
@@ -2181,6 +2218,9 @@ public:
// get the raw key flags (platform-dependent)
wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
// returns true if this is a key auto repeat event
bool IsAutoRepeat() const { return m_isRepeat; }
// Find the position of the event
void GetPosition(wxCoord *xpos, wxCoord *ypos) const
{
@@ -2190,7 +2230,7 @@ public:
*ypos = GetY();
}
// This version if provided only for backwards compatiblity, don't use.
// This version if provided only for backwards compatibility, don't use.
void GetPosition(long *xpos, long *ypos) const
{
if (xpos)
@@ -2242,6 +2282,9 @@ public:
wxUint32 m_rawCode;
wxUint32 m_rawFlags;
// Indicates whether the key event is a repeat
bool m_isRepeat;
private:
// Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK
// type. This is used by all ctors.
@@ -2268,6 +2311,7 @@ private:
#if wxUSE_UNICODE
m_uniChar = evt.m_uniChar;
#endif
m_isRepeat = evt.m_isRepeat;
}
// Initialize m_x and m_y using the current mouse cursor position if
@@ -2710,6 +2754,30 @@ private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent);
};
/*
wxEVT_FULLSCREEN
*/
class WXDLLIMPEXP_CORE wxFullScreenEvent : public wxEvent
{
public:
wxFullScreenEvent(int winid = 0, bool fullscreen = true)
: wxEvent(winid, wxEVT_FULLSCREEN)
{ m_fullscreen = fullscreen; }
wxFullScreenEvent(const wxFullScreenEvent& event)
: wxEvent(event)
{ m_fullscreen = event.m_fullscreen; }
bool IsFullScreen() const { return m_fullscreen; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxFullScreenEvent(*this); }
protected:
bool m_fullscreen;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFullScreenEvent);
};
// Joystick event class
/*
wxEVT_JOY_BUTTON_DOWN,
@@ -2892,6 +2960,7 @@ public:
m_setShown =
m_setText =
m_setChecked = false;
m_isCheckable = true;
}
wxUpdateUIEvent(const wxUpdateUIEvent& event)
: wxCommandEvent(event),
@@ -2902,6 +2971,7 @@ public:
m_setShown(event.m_setShown),
m_setText(event.m_setText),
m_setChecked(event.m_setChecked),
m_isCheckable(event.m_isCheckable),
m_text(event.m_text)
{ }
@@ -2919,6 +2989,10 @@ public:
void Show(bool show) { m_shown = show; m_setShown = true; }
void SetText(const wxString& text) { m_text = text; m_setText = true; }
// A flag saying if the item can be checked. True by default.
bool IsCheckable() const { return m_isCheckable; }
void DisallowCheck() { m_isCheckable = false; }
// Sets the interval between updates in milliseconds.
// Set to -1 to disable updates, or to 0 to update as frequently as possible.
static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
@@ -2951,6 +3025,7 @@ protected:
bool m_setShown;
bool m_setText;
bool m_setChecked;
bool m_isCheckable;
wxString m_text;
#if wxUSE_LONGLONG
static wxLongLong sm_lastUpdate;
@@ -3011,7 +3086,7 @@ private:
/*
wxEVT_MOUSE_CAPTURE_LOST
The window losing the capture receives this message, unless it released it
The window losing the capture receives this message, unless it released
it itself or unless wxWindow::CaptureMouse was called on another window
(and so capture will be restored when the new capturer releases it).
*/
@@ -3065,6 +3140,13 @@ public:
wxSize GetOldDPI() const { return m_oldDPI; }
wxSize GetNewDPI() const { return m_newDPI; }
// Scale the value by the ratio between new and old DPIs carried by this
// event.
wxSize Scale(wxSize sz) const;
int ScaleX(int x) const { return Scale(wxSize(x, -1)).x; }
int ScaleY(int y) const { return Scale(wxSize(-1, y)).y; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxDPIChangedEvent(*this); }
private:
@@ -3657,7 +3739,6 @@ public:
static void WXConsumeException();
#endif // wxUSE_EXCEPTIONS
#ifdef wxHAS_CALL_AFTER
// Asynchronous method calls: these methods schedule the given method
// pointer for a later call (during the next idle event loop iteration).
//
@@ -3701,7 +3782,6 @@ public:
{
QueueEvent(new wxAsyncMethodCallEventFunctor<T>(this, fn));
}
#endif // wxHAS_CALL_AFTER
// Connecting and disconnecting
@@ -4273,17 +4353,13 @@ typedef void (wxEvtHandler::*wxPressAndTapEventFunction)(wxPressAndTapEvent&);
private: \
static const wxEventTableEntry sm_eventTableEntries[]; \
protected: \
wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \
const wxEventTable* GetEventTable() const; \
wxEventHashTable& GetEventHashTable() const; \
wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \
wxWARNING_SUPPRESS_MISSING_OVERRIDE() \
const wxEventTable* GetEventTable() const wxDUMMY_OVERRIDE; \
wxEventHashTable& GetEventHashTable() const wxDUMMY_OVERRIDE; \
wxWARNING_RESTORE_MISSING_OVERRIDE() \
static const wxEventTable sm_eventTable; \
static wxEventHashTable sm_eventHashTable
// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
// sm_eventTable before using it in GetEventTable() or the compiler gives
// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
#define wxBEGIN_EVENT_TABLE(theClass, baseClass) \
const wxEventTable theClass::sm_eventTable = \
{ &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \

View File

@@ -59,7 +59,7 @@ public:
private:
// Objects of this class are made to be stored in a linked list in
// wxEvtHandler so put the next node ponter directly in the class itself.
// wxEvtHandler so put the next node pointer directly in the class itself.
wxEventFilter* m_next;
// And provide access to it for wxEvtHandler [only].

View File

@@ -41,7 +41,7 @@
It's important to note that YieldFor() is used to selectively process the
events generated by the NATIVE toolkit.
Events syntethized by wxWidgets code or by user code are instead selectively
Events synthesized by wxWidgets code or by user code are instead selectively
processed thanks to the logic built into wxEvtHandler::ProcessPendingEvents().
In fact, when wxEvtHandler::ProcessPendingEvents gets called from inside a
YieldFor() call, wxEventLoopBase::IsEventAllowedInsideYield is used to decide

View File

@@ -26,7 +26,7 @@ class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl;
// Flags for wxFindReplaceData.Flags
// ----------------------------------------------------------------------------
// flages used by wxFindDialogEvent::GetFlags()
// flags used by wxFindDialogEvent::GetFlags()
enum wxFindReplaceFlags
{
// downward search/replace selected (otherwise - upwards)

View File

@@ -53,13 +53,8 @@
#undef wxHAS_CRASH_REPORT
#endif
/* wxRE_ADVANCED is not always available, depending on regex library used
* (it's unavailable only if compiling via configure against system library) */
#ifndef WX_NO_REGEX_ADVANCED
#define wxHAS_REGEX_ADVANCED
#else
#undef wxHAS_REGEX_ADVANCED
#endif
/* wxRE_ADVANCED is always defined now and kept for compatibility only. */
#define wxHAS_REGEX_ADVANCED
/* Pango-based ports and wxDFB use UTF-8 for text and font encodings
* internally and so their fonts can handle any encodings: */

View File

@@ -68,14 +68,14 @@ public:
wxFileDialogBase () { Init(); }
wxFileDialogBase(wxWindow *parent,
const wxString& message = wxFileSelectorPromptStr,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxFileDialogNameStr)
const wxString& name = wxASCII_STR(wxFileDialogNameStr))
{
Init();
Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name);
@@ -85,14 +85,14 @@ public:
bool Create(wxWindow *parent,
const wxString& message = wxFileSelectorPromptStr,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxFileDialogNameStr);
const wxString& name = wxASCII_STR(wxFileDialogNameStr));
bool HasFdFlag(int flag) const { return HasFlag(flag); }
@@ -104,10 +104,19 @@ public:
virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
virtual wxString GetMessage() const { return m_message; }
virtual wxString GetPath() const { return m_path; }
virtual wxString GetPath() const
{
wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetPaths() instead" );
return m_path;
}
virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); }
virtual wxString GetDirectory() const { return m_dir; }
virtual wxString GetFilename() const { return m_fileName; }
virtual wxString GetFilename() const
{
wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetFilenames() instead" );
return m_fileName;
}
virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); }
virtual wxString GetWildcard() const { return m_wildCard; }
virtual int GetFilterIndex() const { return m_filterIndex; }
@@ -172,6 +181,9 @@ protected:
{ return m_extraControlCreator != NULL; }
// get the size of the extra control by creating and deleting it
wxSize GetExtraControlSize();
// Helper function for native file dialog usage where no wx events
// are processed.
void UpdateExtraControlUI();
private:
ExtraControlCreatorFunction m_extraControlCreator;
@@ -188,22 +200,22 @@ private:
// File selector - backward compatibility
WXDLLIMPEXP_CORE wxString
wxFileSelector(const wxString& message = wxFileSelectorPromptStr,
wxFileSelector(const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& default_path = wxEmptyString,
const wxString& default_filename = wxEmptyString,
const wxString& default_extension = wxEmptyString,
const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
int flags = 0,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord);
// An extended version of wxFileSelector
WXDLLIMPEXP_CORE wxString
wxFileSelectorEx(const wxString& message = wxFileSelectorPromptStr,
wxFileSelectorEx(const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& default_path = wxEmptyString,
const wxString& default_filename = wxEmptyString,
int *indexDefaultExtension = NULL,
const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
int flags = 0,
wxWindow *parent = NULL,
int x = wxDefaultCoord, int y = wxDefaultCoord);

View File

@@ -32,12 +32,6 @@
#endif // __WINDOWS__
#endif // native Win compiler
#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
// this (3.1 I believe) and how to test for it.
// If this works for Borland 4.0 as well, then no worries.
#include <dir.h>
#endif
#include <fcntl.h> // O_RDONLY &c
// ----------------------------------------------------------------------------
@@ -127,8 +121,7 @@ enum wxPosixPermissions
( \
defined(__VISUALC__) || \
defined(__MINGW64_TOOLCHAIN__) || \
(defined(__MINGW32__) && !defined(__WINE__)) || \
defined(__BORLANDC__) \
(defined(__MINGW32__) && !defined(__WINE__)) \
)
// temporary defines just used immediately below
@@ -183,8 +176,6 @@ enum wxPosixPermissions
#endif
#endif
// other Windows compilers (Borland) don't have huge file support (or at
// least not all functions needed for it by wx) currently
// types
@@ -195,33 +186,14 @@ enum wxPosixPermissions
typedef off_t wxFileOffset;
#endif
// at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope
// resolution operator present in wxPOSIX_IDENT for it
#ifdef __BORLANDC__
#define wxPOSIX_STRUCT(s) struct s
#else
#define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s)
#endif
// Borland is special in that it uses _stat with Unicode functions (for
// MSVC compatibility?) but stat with ANSI ones
#ifdef __BORLANDC__
#if wxHAS_HUGE_FILES
#define wxStructStat struct stati64
#else
#if wxUSE_UNICODE
#define wxStructStat struct _stat
#else
#define wxStructStat struct stat
#endif
#endif
#else // !__BORLANDC__
#ifdef wxHAS_HUGE_FILES
#define wxStructStat struct _stati64
#else
#define wxStructStat struct _stat
#endif
#endif // __BORLANDC__/!__BORLANDC__
#define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s)
#ifdef wxHAS_HUGE_FILES
#define wxStructStat struct _stati64
#else
#define wxStructStat struct _stat
#endif
// functions
@@ -232,7 +204,7 @@ enum wxPosixPermissions
// to avoid using them as they're not present in earlier versions and
// always using the native functions spelling is easier than testing for
// the versions
#if defined(__BORLANDC__) || defined(__MINGW64_TOOLCHAIN__)
#if defined(__MINGW64_TOOLCHAIN__)
#define wxPOSIX_IDENT(func) ::func
#else // by default assume MSVC-compatible names
#define wxPOSIX_IDENT(func) _ ## func
@@ -263,15 +235,13 @@ enum wxPosixPermissions
#define wxTell wxPOSIX_IDENT(tell)
#endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES
#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540)
// NB: this one is not POSIX and always has the underscore
#define wxFsync _commit
// could be already defined by configure (Cygwin)
#ifndef HAVE_FSYNC
#define HAVE_FSYNC
#endif
#endif // BORLANDC
#define wxFsync _commit
// could be already defined by configure (Cygwin)
#ifndef HAVE_FSYNC
#define HAVE_FSYNC
#endif
#define wxEof wxPOSIX_IDENT(eof)
@@ -297,14 +267,8 @@ enum wxPosixPermissions
// then wide char ones
#if wxUSE_UNICODE
// special workaround for buggy wopen() in bcc 5.5
#if defined(__BORLANDC__) && \
(__BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551)
WXDLLIMPEXP_BASE int wxCRT_OpenW(const wxChar *pathname,
int flags, mode_t mode);
#else
#define wxCRT_OpenW _wopen
#endif
#define wxCRT_OpenW _wopen
wxDECL_FOR_STRICT_MINGW32(int, _wopen, (const wchar_t*, int, ...))
wxDECL_FOR_STRICT_MINGW32(int, _waccess, (const wchar_t*, int))
@@ -417,7 +381,10 @@ enum wxPosixPermissions
#define wxCRT_Access access
#define wxCRT_Chmod chmod
#define wxCRT_Readlink readlink
#define wxHAS_NATIVE_LSTAT
#define wxHAS_NATIVE_READLINK
#endif // platforms
// if the platform doesn't have symlinks, define wxCRT_Lstat to be the same as
@@ -442,6 +409,11 @@ inline int wxChmod(const wxString& path, mode_t mode)
inline int wxOpen(const wxString& path, int flags, mode_t mode)
{ return wxCRT_Open(path.fn_str(), flags, mode); }
#if defined(wxHAS_NATIVE_READLINK)
inline ssize_t wxReadlink(const wxString& path, char* buf, int size)
{ return wxCRT_Readlink(path.fn_str(), buf, size); }
#endif
inline int wxStat(const wxString& path, wxStructStat *buf)
{ return wxCRT_Stat(path.fn_str(), buf); }
inline int wxLstat(const wxString& path, wxStructStat *buf)

View File

@@ -24,6 +24,13 @@ class WXDLLIMPEXP_FWD_CORE wxMenu;
class WXDLLIMPEXP_FWD_BASE wxConfigBase;
class WXDLLIMPEXP_FWD_BASE wxFileName;
enum wxFileHistoryMenuPathStyle
{
wxFH_PATH_SHOW_IF_DIFFERENT,
wxFH_PATH_SHOW_NEVER,
wxFH_PATH_SHOW_ALWAYS
};
// ----------------------------------------------------------------------------
// File history management
// ----------------------------------------------------------------------------
@@ -60,17 +67,26 @@ public:
void SetBaseId(wxWindowID baseId) { m_idBase = baseId; }
wxWindowID GetBaseId() const { return m_idBase; }
void SetMenuPathStyle(wxFileHistoryMenuPathStyle style);
wxFileHistoryMenuPathStyle GetMenuPathStyle() const { return m_menuPathStyle; }
protected:
// Last n files
wxArrayString m_fileHistory;
wxArrayString m_fileHistory;
// Menus to maintain (may need several for an MDI app)
wxList m_fileMenus;
wxList m_fileMenus;
// Max files to maintain
size_t m_fileMaxFiles;
size_t m_fileMaxFiles;
// Style of the paths in the menu labels
wxFileHistoryMenuPathStyle m_menuPathStyle;
private:
void DoRefreshLabels();
// The ID of the first history menu item (Doesn't have to be wxID_FILE1)
wxWindowID m_idBase;

View File

@@ -70,9 +70,19 @@ enum wxPathNormalize
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_LONG = 0x0020, // make the path the long form (MSW-only)
wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut
wxPATH_NORM_ALL = 0x00ff & ~wxPATH_NORM_CASE
// Don't use this constant, it used to correspond to the default
// Normalize() behaviour but this is deprecated now.
wxPATH_NORM_DEPR_OLD_DEFAULT= 0x00ff & ~wxPATH_NORM_CASE,
// This constant name is misleading, as it doesn't really include all the
// flags above, so its use is discouraged, please use the flags you want
// explicitly instead.
wxPATH_NORM_ALL
wxDEPRECATED_ATTR("specify the wanted flags explicitly to avoid surprises")
= wxPATH_NORM_DEPR_OLD_DEFAULT
};
// what exactly should GetPath() return?
@@ -105,8 +115,8 @@ enum
// 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
wxFILE_EXISTS_FIFO = 0x0010, // check for existence of a FIFO
wxFILE_EXISTS_SOCKET = 0x0020, // 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
@@ -133,7 +143,7 @@ public:
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
// is constructed (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; }
@@ -341,15 +351,21 @@ public:
// 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
// normalize the path using the specified normalizations, use
// MakeAbsolute() for a simpler form applying the standard ones
//
// this may be done using another (than current) value of cwd
bool Normalize(int flags = wxPATH_NORM_ALL,
bool Normalize(int flags,
const wxString& cwd = wxEmptyString,
wxPathFormat format = wxPATH_NATIVE);
// using wxPATH_NORM_ALL may give unexpected results, so avoid using
// this function and call Normalize(wxPATH_NORM_ENV_VARS | ...)
// explicitly if you really need environment variables expansion
wxDEPRECATED_MSG("specify the wanted flags explicitly to avoid surprises")
bool Normalize()
{ return Normalize(wxPATH_NORM_DEPR_OLD_DEFAULT); }
// get a path path relative to the given base directory, i.e. opposite
// of Normalize
//
@@ -361,7 +377,7 @@ public:
bool MakeRelativeTo(const wxString& pathBase = wxEmptyString,
wxPathFormat format = wxPATH_NATIVE);
// make the path absolute
// make the path absolute and resolve any "." and ".." in it
//
// this may be done using another (than current) value of cwd
bool MakeAbsolute(const wxString& cwd = wxEmptyString,
@@ -369,6 +385,15 @@ public:
{ return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE |
wxPATH_NORM_TILDE, cwd, format); }
// Convenient helper for returning the absolute path corresponding to
// the given one.
wxString GetAbsolutePath(const wxString& cwd = wxEmptyString,
wxPathFormat format = wxPATH_NATIVE) const
{
wxFileName fn(*this);
fn.MakeAbsolute(cwd, format);
return fn.GetFullPath();
}
// If the path is a symbolic link (Unix-only), indicate that all
// filesystem operations on this path should be performed on the link
@@ -389,6 +414,9 @@ public:
return !m_dontFollowLinks;
}
// Resolve a wxFileName object representing a link to its target
wxFileName ResolveLink();
#if defined(__WIN32__) && wxUSE_OLE
// if the path is a shortcut, return the target and optionally,
// the arguments
@@ -406,7 +434,7 @@ public:
// fn.ReplaceEnvVariable("OPENWINHOME");
// // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile"
bool ReplaceEnvVariable(const wxString& envname,
const wxString& replacementFmtString = "$%s",
const wxString& replacementFmtString = wxS("$%s"),
wxPathFormat format = wxPATH_NATIVE);
// replaces, if present in the path, the home directory for the given user
@@ -467,7 +495,7 @@ public:
// 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
// is this is a DOS path which begins with a windows unique volume name
// ('\\?\Volume{guid}\')?
static bool IsMSWUniqueVolumeNamePath(const wxString& path,
wxPathFormat format = wxPATH_NATIVE);
@@ -575,12 +603,12 @@ public:
// returns the size in a human readable form
wxString
GetHumanReadableSize(const wxString& nullsize = wxGetTranslation("Not available"),
GetHumanReadableSize(const wxString& nullsize = wxGetTranslation(wxASCII_STR("Not available")),
int precision = 1,
wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const;
static wxString
GetHumanReadableSize(const wxULongLong& sz,
const wxString& nullsize = wxGetTranslation("Not available"),
const wxString& nullsize = wxGetTranslation(wxASCII_STR("Not available")),
int precision = 1,
wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL);
#endif // wxUSE_LONGLONG
@@ -598,7 +626,21 @@ private:
// check whether this dir is valid for Append/Prepend/InsertDir()
static bool IsValidDirComponent(const wxString& dir);
// flags used with DoSetPath()
enum
{
SetPath_PathOnly = 0,
SetPath_MayHaveVolume = 1
};
// helper of public SetPath() also used internally
void DoSetPath(const wxString& path, wxPathFormat format,
int flags = SetPath_MayHaveVolume);
// the drive/volume/device specification (always empty for Unix)
//
// for the drive letters, contains just the letter itself, but for MSW UNC
// and volume GUID paths, it starts with double backslash, e.g. "\\share"
wxString m_volume;
// the path components of the file

View File

@@ -126,7 +126,7 @@ protected:
// 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...
// same prototype for the constructor...
// since GTK >= 2.6, there is GtkFileButton
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/filepicker.h"
@@ -235,13 +235,13 @@ public:
wxFilePickerCtrl(wxWindow *parent,
wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = wxFileSelectorPromptStr,
const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFLP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFilePickerCtrlNameStr)
const wxString& name = wxASCII_STR(wxFilePickerCtrlNameStr))
{
Create(parent, id, path, message, wildcard, pos, size, style,
validator, name);
@@ -250,13 +250,13 @@ public:
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = wxFileSelectorPromptStr,
const wxString& wildcard = wxFileSelectorDefaultWildcardStr,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFLP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFilePickerCtrlNameStr);
const wxString& name = wxASCII_STR(wxFilePickerCtrlNameStr));
void SetFileName(const wxFileName &filename)
{ SetPath(filename.GetFullPath()); }
@@ -339,24 +339,24 @@ public:
wxDirPickerCtrl(wxWindow *parent, wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = wxDirSelectorPromptStr,
const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDirPickerCtrlNameStr)
const wxString& name = wxASCII_STR(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 wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDirPickerCtrlNameStr);
const wxString& name = wxASCII_STR(wxDirPickerCtrlNameStr));
void SetDirName(const wxFileName &dirname)
{ SetPath(dirname.GetPath()); }

View File

@@ -129,22 +129,30 @@ public:
// Default ctor uses the default font size appropriate for the current
// platform.
wxFontInfo()
{ InitPointSize(-1.0f); }
: m_pointSize(-1.0)
, m_pixelSize(wxDefaultSize)
{
Init();
}
// These ctors specify the font size, either in points or in pixels.
// Point size is a floating point number, however we also accept all
// integer sizes using the simple template ctor below.
explicit wxFontInfo(float pointSize)
{ InitPointSize(pointSize); }
explicit wxFontInfo(const wxSize& pixelSize) : m_pixelSize(pixelSize)
{ Init(); }
// Need to define this one to avoid casting double to int too.
explicit wxFontInfo(double pointSize)
{ InitPointSize(static_cast<float>(pointSize)); }
template <typename T>
explicit wxFontInfo(T pointSize)
{ InitPointSize(ToFloatPointSize(pointSize)); }
: m_pointSize(pointSize >= 0.0 ? pointSize : -1.0)
, m_pixelSize(wxDefaultSize)
{
Init();
if (!wxIsSameDouble(m_pointSize, pointSize))
{
wxFAIL_MSG("Invalid font point size");
}
}
explicit wxFontInfo(const wxSize& pixelSize)
: m_pointSize(-1.0)
, m_pixelSize(pixelSize)
{
Init();
}
// Default copy ctor, assignment operator and dtor are OK
// Setters for the various attributes. All of them return the object itself
// so that the calls to them could be chained.
@@ -185,7 +193,6 @@ public:
wxFontInfo& Encoding(wxFontEncoding encoding)
{ m_encoding = encoding; return *this; }
// Set all flags at once.
wxFontInfo& AllFlags(int flags)
{
@@ -200,13 +207,12 @@ public:
return *this;
}
// Accessors are mostly meant to be used by wxFont itself to extract the
// various pieces of the font description.
bool IsUsingSizeInPixels() const { return m_pixelSize != wxDefaultSize; }
float GetFractionalPointSize() const { return m_pointSize; }
int GetPointSize() const { return ToIntPointSize(m_pointSize); }
double GetFractionalPointSize() const { return m_pointSize; }
int GetPointSize() const { return wxRound(m_pointSize); }
wxSize GetPixelSize() const { return m_pixelSize; }
// If face name is not empty, it has priority, otherwise use family.
@@ -250,28 +256,6 @@ public:
wxFontEncoding GetEncoding() const { return m_encoding; }
// Default copy ctor, assignment operator and dtor are OK.
// Helper functions for converting between integer and fractional sizes.
static int ToIntPointSize(float pointSize) { return wxRound(pointSize); }
static float ToFloatPointSize(int pointSize)
{
wxCHECK_MSG( pointSize == -1 || pointSize >= 0,
-1, "Invalid font point size" );
// Huge values are not exactly representable as floats, so don't accept
// those neither as they can only be due to a mistake anyhow: nobody
// could possibly need a font of size 16777217pt (which is the first
// value for which this fails).
const float f = static_cast<float>(pointSize);
wxCHECK_MSG( static_cast<int>(f) == pointSize,
-1, "Font point size out of range" );
return f;
}
// Another helper for converting arbitrary numeric weight to the closest
// value of wxFontWeight enum. It should be avoided in the new code (also
// note that the function for the conversion in the other direction is
@@ -296,21 +280,12 @@ public:
private:
void Init()
{
m_pointSize = -1;
m_family = wxFONTFAMILY_DEFAULT;
m_flags = wxFONTFLAG_DEFAULT;
m_weight = wxFONTWEIGHT_NORMAL;
m_encoding = wxFONTENCODING_DEFAULT;
}
void InitPointSize(float pointSize)
{
Init();
m_pointSize = pointSize;
m_pixelSize = wxDefaultSize;
}
// Turn on or off the given bit in m_flags depending on the value of the
// boolean argument.
void SetFlag(int flag, bool on)
@@ -324,7 +299,7 @@ private:
// The size information: if m_pixelSize is valid (!= wxDefaultSize), then
// it is used. Otherwise m_pointSize is used, except if it is < 0, which
// means that the platform dependent font size should be used instead.
float m_pointSize;
double m_pointSize;
wxSize m_pixelSize;
wxFontFamily m_family;
@@ -420,12 +395,12 @@ public:
#endif // wxUSE_PRIVATE_FONTS
// comparison
bool operator==(const wxFont& font) const;
bool operator!=(const wxFont& font) const { return !(*this == font); }
bool operator==(const wxFontBase& font) const;
bool operator!=(const wxFontBase& font) const { return !(*this == font); }
// accessors: get the font characteristics
virtual int GetPointSize() const;
virtual float GetFractionalPointSize() const = 0;
virtual double GetFractionalPointSize() const = 0;
virtual wxSize GetPixelSize() const;
virtual bool IsUsingSizeInPixels() const;
wxFontFamily GetFamily() const;
@@ -447,7 +422,7 @@ public:
// change the font characteristics
virtual void SetPointSize( int pointSize );
virtual void SetFractionalPointSize( float pointSize ) = 0;
virtual void SetFractionalPointSize( double pointSize ) = 0;
virtual void SetPixelSize( const wxSize& pixelSize );
virtual void SetFamily( wxFontFamily family ) = 0;
virtual void SetStyle( wxFontStyle style ) = 0;
@@ -501,13 +476,6 @@ public:
// account as well.
static int GetNumericWeightOf(wxFontWeight weight);
// Some ports need to modify the font object when the DPI of the window it
// is used with changes, this function can be used to do it.
//
// Currently it is only used in wxMSW and is not considered to be part of
// wxWidgets public API.
virtual void WXAdjustToPPI(const wxSize& WXUNUSED(ppi)) { }
// this doesn't do anything and is kept for compatibility only
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);)
@@ -709,11 +677,6 @@ extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList;
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
// Unfortunately some compilers have ambiguity issues when enum comparisons are
// overloaded so we have to disable the overloads in this case, see
// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \
inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t)
{ return static_cast<int>(s) == static_cast<int>(t); }
@@ -733,6 +696,4 @@ wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \
inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t)
{ return static_cast<int>(s) != static_cast<int>(t); }
#endif // // wxCOMPILER_NO_OVERLOAD_ON_ENUM
#endif // _WX_FONT_H_BASE_

View File

@@ -12,6 +12,14 @@
#include "wx/colour.h"
#include "wx/encinfo.h"
// Possible values for RestrictSelection() flags.
enum
{
wxFONTRESTRICT_NONE = 0,
wxFONTRESTRICT_SCALABLE = 1 << 0,
wxFONTRESTRICT_FIXEDPITCH = 1 << 1
};
class WXDLLIMPEXP_CORE wxFontData : public wxObject
{
public:
@@ -33,6 +41,9 @@ public:
void EnableEffects(bool flag) { m_enableEffects = flag; }
bool GetEnableEffects() const { return m_enableEffects; }
void RestrictSelection(int flags) { m_restrictSelection = flags; }
int GetRestrictSelection() const { return m_restrictSelection; }
void SetInitialFont(const wxFont& font) { m_initialFont = font; }
wxFont GetInitialFont() const { return m_initialFont; }
@@ -63,6 +74,7 @@ public:
private:
wxFontEncoding m_encoding;
wxNativeEncodingInfo m_encodingInfo;
int m_restrictSelection;
wxDECLARE_DYNAMIC_CLASS(wxFontData);
};

View File

@@ -95,7 +95,7 @@ protected:
// ----------------------------------------------------------------------------
// wxFontPickerCtrl: platform-independent class which embeds the
// platform-dependent wxFontPickerWidget andm if wxFNTP_USE_TEXTCTRL style is
// platform-dependent wxFontPickerWidget and if wxFNTP_USE_TEXTCTRL style is
// used, a textctrl next to it.
// ----------------------------------------------------------------------------
@@ -117,7 +117,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerCtrlNameStr)
const wxString& name = wxASCII_STR(wxFontPickerCtrlNameStr))
: m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
Create(parent, id, initial, pos, size, style, validator, name);
@@ -130,7 +130,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerCtrlNameStr);
const wxString& name = wxASCII_STR(wxFontPickerCtrlNameStr));
public: // public API

View File

@@ -132,18 +132,18 @@ public:
// MSW-specific: get point size from LOGFONT height using specified DPI,
// or screen DPI when 0.
static float GetPointSizeAtPPI(int lfHeight, int ppi = 0);
static double GetPointSizeAtPPI(int lfHeight, int ppi = 0);
// MSW-specific: get the height value in pixels using LOGFONT convention
// (i.e. negative) corresponding to the given size in points and DPI.
static int GetLogFontHeightAtPPI(float size, int ppi);
static int GetLogFontHeightAtPPI(double size, int ppi);
LOGFONT lf;
// MSW only has limited support for fractional point sizes and we need to
// store the fractional point size separately if it was initially specified
// as we can't losslessly recover it from LOGFONT later.
float pointSize;
double pointSize;
#elif defined(__WXOSX__)
public:
wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
@@ -173,6 +173,7 @@ public:
static CGFloat GetCTWeight( CTFontRef font );
static CGFloat GetCTWeight( CTFontDescriptorRef font );
static CGFloat GetCTwidth( CTFontDescriptorRef font );
static CGFloat GetCTSlant( CTFontDescriptorRef font );
CTFontDescriptorRef GetCTFontDescriptor() const;
@@ -182,6 +183,7 @@ private:
// attributes for regenerating a CTFontDescriptor, stay close to native values
// for better roundtrip fidelity
CGFloat m_ctWeight;
CGFloat m_ctWidth;
wxFontStyle m_style;
CGFloat m_ctSize;
wxFontFamily m_family;
@@ -208,7 +210,7 @@ public :
//
#define wxNO_NATIVE_FONTINFO
float pointSize;
double pointSize;
wxFontFamily family;
wxFontStyle style;
int weight;
@@ -280,7 +282,7 @@ public:
// accessors and modifiers for the font elements
int GetPointSize() const;
float GetFractionalPointSize() const;
double GetFractionalPointSize() const;
wxSize GetPixelSize() const;
wxFontStyle GetStyle() const;
wxFontWeight GetWeight() const;
@@ -292,7 +294,7 @@ public:
wxFontEncoding GetEncoding() const;
void SetPointSize(int pointsize);
void SetFractionalPointSize(float pointsize);
void SetFractionalPointSize(double pointsize);
void SetPixelSize(const wxSize& pixelSize);
void SetStyle(wxFontStyle style);
void SetNumericWeight(int weight);
@@ -305,7 +307,7 @@ public:
// Helper used in many ports: use the normal font size if the input is
// negative, as we handle -1 as meaning this for compatibility.
void SetSizeOrDefault(float size)
void SetSizeOrDefault(double size)
{
SetFractionalPointSize
(

View File

@@ -18,12 +18,14 @@
#include "wx/toplevel.h" // the base class
#include "wx/statusbr.h"
// the default names for various classs
// the default names for various classes
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[];
class WXDLLIMPEXP_FWD_CORE wxFrame;
#if wxUSE_MENUBAR
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
#endif
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
class WXDLLIMPEXP_FWD_CORE wxStatusBar;
class WXDLLIMPEXP_FWD_CORE wxToolBar;
@@ -64,7 +66,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
const wxString& name = wxASCII_STR(wxFrameNameStr));
// frame state
// -----------
@@ -78,6 +80,7 @@ public:
// ------------------
#if wxUSE_MENUS
#if wxUSE_MENUBAR
virtual void SetMenuBar(wxMenuBar *menubar);
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
@@ -85,7 +88,7 @@ public:
// 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;
#endif
// generate menu command corresponding to the given menu item
//
// returns true if processed
@@ -106,7 +109,7 @@ public:
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxSTB_DEFAULT_STYLE,
wxWindowID winid = 0,
const wxString& name = wxStatusLineNameStr);
const wxString& name = wxASCII_STR(wxStatusLineNameStr));
// return a new status bar
virtual wxStatusBar *OnCreateStatusBar(int number,
long style,
@@ -136,7 +139,7 @@ public:
// create main toolbar bycalling OnCreateToolBar()
virtual wxToolBar* CreateToolBar(long style = -1,
wxWindowID winid = wxID_ANY,
const wxString& name = wxToolBarNameStr);
const wxString& name = wxASCII_STR(wxToolBarNameStr));
// return a new toolbar
virtual wxToolBar *OnCreateToolBar(long style,
wxWindowID winid,
@@ -192,7 +195,7 @@ protected:
// test whether this window makes part of the frame
virtual bool IsOneOfBars(const wxWindow *win) const wxOVERRIDE;
#if wxUSE_MENUS
#if wxUSE_MENUBAR
// override to update menu bar position when the frame size changes
virtual void PositionMenuBar() { }
@@ -203,13 +206,15 @@ protected:
// override to do something special when the menu bar is attached to the
// frame
virtual void AttachMenuBar(wxMenuBar *menubar);
#endif // wxUSE_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();
#if wxUSE_MENUBAR
wxMenuBar *m_frameMenuBar;
#endif // wxUSE_MENUS
#endif // wxUSE_MENUBAR
#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR)
// the saved status bar text overwritten by DoGiveHelp()

View File

@@ -370,15 +370,7 @@ protected:
static wxString GetCanonicalPath(const wxFileName& path)
{
wxFileName path_copy = wxFileName(path);
if ( !path_copy.Normalize() )
{
wxFAIL_MSG(wxString::Format("Unable to normalize path '%s'",
path.GetFullPath()));
return wxEmptyString;
}
return path_copy.GetFullPath();
return path.GetAbsolutePath();
}

View File

@@ -24,7 +24,7 @@
#define wxGA_HORIZONTAL wxHORIZONTAL
#define wxGA_VERTICAL wxVERTICAL
// Available since Windows 7 only. With this style, the value of guage will
// Available since Windows 7 only. With this style, the value of gauge will
// reflect on the taskbar button.
#define wxGA_PROGRESS 0x0010
// Win32 only, is default (and only) on some other platforms
@@ -66,7 +66,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxGaugeNameStr);
const wxString& name = wxASCII_STR(wxGaugeNameStr));
// determinate mode API

View File

@@ -183,10 +183,19 @@ enum wxEllipsizeMode
// macros
// ---------------------------------------------------------------------------
// The difference between wxHAS_IMAGES_IN_RESOURCES and wxHAS_IMAGE_RESOURCES
// is that the former is, historically, only defined under MSW while the latter
// is also defined under macOS, which uses a different resource concept, and
// may be also defined for any other ports where images don't need to be
// embedded into the program text in order to be available during run-time.
#if defined(__WINDOWS__) && wxUSE_WXDIB
#define wxHAS_IMAGES_IN_RESOURCES
#endif
#if defined(wxHAS_IMAGES_IN_RESOURCES) || defined(__WXOSX__)
#define wxHAS_IMAGE_RESOURCES
#endif
/* Useful macro for creating icons portably, for example:
wxIcon *icon = new wxICON(sample);
@@ -224,7 +233,7 @@ enum wxEllipsizeMode
#endif // platform
/* Another macro: this one is for portable creation of bitmaps. We assume that
under Unix bitmaps live in XPMs and under Windows they're in ressources.
under Unix bitmaps live in XPMs and under Windows they're in resources.
*/
#if defined(__WINDOWS__) && wxUSE_WXDIB
@@ -256,7 +265,7 @@ enum wxEllipsizeMode
// resource type and under OS X the PNG file with the specified name must be
// available in the resource subdirectory of the bundle. Elsewhere, this is
// exactly the same thing as wxBITMAP_PNG_FROM_DATA() described above.
#if (defined(__WINDOWS__) && wxUSE_WXDIB) || defined(__WXOSX__)
#ifdef wxHAS_IMAGE_RESOURCES
#define wxBITMAP_PNG(name) wxBitmap(wxS(#name), wxBITMAP_TYPE_PNG_RESOURCE)
#else
#define wxBITMAP_PNG(name) wxBITMAP_PNG_FROM_DATA(name)
@@ -825,7 +834,7 @@ public:
return r;
}
// return true if the point is (not strcitly) inside the rect
// return true if the point is (not strictly) inside the rect
bool Contains(int x, int y) const;
bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); }
// return true if the rectangle 'rect' is (not strictly) inside this rect
@@ -837,7 +846,7 @@ public:
// like Union() but don't ignore empty rectangles
wxRect& operator+=(const wxRect& rect);
// intersections of two rectrangles not testing for empty rectangles
// intersections of two rectangles not testing for empty rectangles
wxRect& operator*=(const wxRect& rect);
// centre this rectangle in the given (usually, but not necessarily,
@@ -939,7 +948,7 @@ public:
wxStockGDI creates the stock GDI objects on demand. Pointers to the
created objects are stored in the ms_stockObject array, which is indexed
by the Item enum values. Platorm-specific fonts can be created by
by the Item enum values. Platform-specific fonts can be created by
implementing a derived class with an override for the GetFont function.
wxStockGDI operates as a singleton, accessed through the ms_instance
pointer. By default this pointer is set to an instance of wxStockGDI.

View File

@@ -28,7 +28,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAC_DEFAULT_STYLE,
const wxString& name = wxAnimationCtrlNameStr)
const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr))
{
Init();
@@ -42,7 +42,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAC_DEFAULT_STYLE,
const wxString& name = wxAnimationCtrlNameStr);
const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr));
~wxGenericAnimationCtrl();

View File

@@ -41,7 +41,7 @@ public:
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr)
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr))
: wxOwnerDrawnComboBox(),
wxBitmapComboBoxBase()
{
@@ -59,7 +59,7 @@ public:
const wxArrayString& choices,
long style,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr);
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
@@ -70,7 +70,7 @@ public:
const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr);
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
@@ -80,10 +80,12 @@ public:
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr);
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
virtual ~wxBitmapComboBox();
virtual wxString GetStringSelection() const wxOVERRIDE;
// Adds item with image to the end of the combo box.
int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);

View File

@@ -31,7 +31,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxToolBarNameStr)
const wxString& name = wxASCII_STR(wxToolBarNameStr))
{
Init();
@@ -43,7 +43,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxToolBarNameStr );
const wxString& name = wxASCII_STR(wxToolBarNameStr) );
virtual ~wxButtonToolBar();
@@ -66,8 +66,8 @@ protected:
virtual wxToolBarToolBase *CreateTool(int id,
const wxString& label,
const wxBitmap& bmpNormal,
const wxBitmap& bmpDisabled,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled,
wxItemKind kind,
wxObject *clientData,
const wxString& shortHelp,

View File

@@ -34,7 +34,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxCalendarNameStr);
const wxString& name = wxASCII_STR(wxCalendarNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
@@ -42,7 +42,7 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxCalendarNameStr);
const wxString& name = wxASCII_STR(wxCalendarNameStr));
virtual ~wxGenericCalendarCtrl();

View File

@@ -33,7 +33,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxCLRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerWidgetNameStr)
const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr))
{
Create(parent, id, col, pos, size, style, validator, name);
}
@@ -59,7 +59,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxCLRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerWidgetNameStr);
const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr));
void OnButtonClick(wxCommandEvent &);
@@ -71,6 +71,8 @@ protected:
void UpdateColour() wxOVERRIDE;
void OnDPIChanged(wxDPIChangedEvent& event);
// the colour data shown in wxColourPickerCtrlGeneric
// controls. This member is static so that all colour pickers
// in the program share the same set of custom colours.

Some files were not shown because too many files have changed in this diff Show More