EmptyChaos 822326eea9 Update wxWidgets to 3.1.0
From wxWidgets master 81570ae070b35c9d52de47b1f14897f3ff1a66c7.

include/wx/defs.h -- __w64 warning disable patch by comex brought forward.

include/wx/msw/window.h -- added GetContentScaleFactor() which was not implemented on Windows but is necessary for wxBitmap scaling on Mac OS X so it needs to work to avoid #ifdef-ing the code.

src/gtk/window.cpp -- Modified DoSetClientSize() to direct call wxWindowGTK::DoSetSize() instead of using public wxWindowBase::SetSize() which now prevents derived classes (like wxAuiToolbar) intercepting the call and breaking it. This matches Windows which does NOT need to call DoSetSize internally. End result is this fixes Dolphin's debug tools toolbars on Linux.

src/osx/window_osx.cpp -- Same fix as for GTK since it has the same issue.

src/msw/radiobox.cpp -- Hacked to fix display in HiDPI (was clipping off end of text).

Updated CMakeLists for Linux and Mac OS X. Small code changes to Dolphin to fix debug error boxes, deprecation warnings, and retain previous UI behavior on Windows.
2016-06-26 15:25:29 +10:00

121 lines
3.8 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: wx/scopedarray.h
// Purpose: scoped smart pointer class
// Author: Vadim Zeitlin
// Created: 2009-02-03
// Copyright: (c) Jesse Lovelace and original Boost authors (see below)
// (c) 2009 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCOPED_ARRAY_H_
#define _WX_SCOPED_ARRAY_H_
#include "wx/defs.h"
#include "wx/checkeddelete.h"
// ----------------------------------------------------------------------------
// wxScopedArray: A scoped array
// ----------------------------------------------------------------------------
template <class T>
class wxScopedArray
{
public:
typedef T element_type;
wxEXPLICIT wxScopedArray(T * array = NULL) : m_array(array) { }
wxEXPLICIT wxScopedArray(size_t count) : m_array(new T[count]) { }
~wxScopedArray() { delete [] m_array; }
// test for pointer validity: defining conversion to unspecified_bool_type
// and not more obvious bool to avoid implicit conversions to integer types
typedef T *(wxScopedArray<T>::*unspecified_bool_type)() const;
operator unspecified_bool_type() const
{
return m_array ? &wxScopedArray<T>::get : NULL;
}
void reset(T *array = NULL)
{
if ( array != m_array )
{
delete [] m_array;
m_array = array;
}
}
T& operator[](size_t n) const { return m_array[n]; }
T *get() const { return m_array; }
void swap(wxScopedArray &other)
{
T * const tmp = other.m_array;
other.m_array = m_array;
m_array = tmp;
}
private:
T *m_array;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T);
};
// ----------------------------------------------------------------------------
// old macro based implementation
// ----------------------------------------------------------------------------
// the same but for arrays instead of simple pointers
#define wxDECLARE_SCOPED_ARRAY(T, name)\
class name \
{ \
private: \
T * m_ptr; \
name(name const &); \
name & operator=(name const &); \
\
public: \
wxEXPLICIT name(T * p = NULL) : m_ptr(p) \
{} \
\
~name(); \
void reset(T * p = NULL); \
\
T & operator[](long int i) const\
{ \
wxASSERT(m_ptr != NULL); \
wxASSERT(i >= 0); \
return m_ptr[i]; \
} \
\
T * get() const \
{ \
return m_ptr; \
} \
\
void swap(name & ot) \
{ \
T * tmp = ot.m_ptr; \
ot.m_ptr = m_ptr; \
m_ptr = tmp; \
} \
};
#define wxDEFINE_SCOPED_ARRAY(T, name) \
name::~name() \
{ \
wxCHECKED_DELETE_ARRAY(m_ptr); \
} \
void name::reset(T * p){ \
if (m_ptr != p) \
{ \
wxCHECKED_DELETE_ARRAY(m_ptr); \
m_ptr = p; \
} \
}
#endif // _WX_SCOPED_ARRAY_H_