Add wxEnhMetaFile::Detach().
Allow getting the handle from this class, this is useful if it needs to be passed to some other library, for example. Closes #15706. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -51,6 +51,7 @@ wxMSW:
|
|||||||
- Fix loading of bitmap with non-pre-multiplied alpha (Artur Wieczorek).
|
- Fix loading of bitmap with non-pre-multiplied alpha (Artur Wieczorek).
|
||||||
- Support multiline strings in wxDC::DrawRotatedText() (Artur Wieczorek).
|
- Support multiline strings in wxDC::DrawRotatedText() (Artur Wieczorek).
|
||||||
- Fix stretchable spacers in vertical toolbars (Artur Wieczorek).
|
- Fix stretchable spacers in vertical toolbars (Artur Wieczorek).
|
||||||
|
- Add wxEnhMetaFile::Detach() (Luca Bacci).
|
||||||
|
|
||||||
wxOSX/Cocoa:
|
wxOSX/Cocoa:
|
||||||
|
|
||||||
|
@@ -52,13 +52,21 @@ public:
|
|||||||
// this method
|
// this method
|
||||||
bool SetClipboard(int width = 0, int height = 0);
|
bool SetClipboard(int width = 0, int height = 0);
|
||||||
|
|
||||||
|
// Detach the HENHMETAFILE from this object, i.e. don't delete the handle
|
||||||
|
// in the dtor -- the caller is now responsible for doing this, e.g. using
|
||||||
|
// Free() method below.
|
||||||
|
WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = 0; return h; }
|
||||||
|
|
||||||
|
// Destroy the given HENHMETAFILE object.
|
||||||
|
static void Free(WXHANDLE handle);
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
WXHANDLE GetHENHMETAFILE() const { return m_hMF; }
|
WXHANDLE GetHENHMETAFILE() const { return m_hMF; }
|
||||||
void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; }
|
void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init();
|
void Init();
|
||||||
void Free();
|
void Free() { Free(m_hMF); }
|
||||||
void Assign(const wxEnhMetaFile& mf);
|
void Assign(const wxEnhMetaFile& mf);
|
||||||
|
|
||||||
// we don't use these functions (but probably should) but have to implement
|
// we don't use these functions (but probably should) but have to implement
|
||||||
|
@@ -120,11 +120,12 @@ void wxEnhMetaFile::Assign(const wxEnhMetaFile& mf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxEnhMetaFile::Free()
|
/* static */
|
||||||
|
void wxEnhMetaFile::Free(WXHANDLE handle)
|
||||||
{
|
{
|
||||||
if ( m_hMF )
|
if ( handle )
|
||||||
{
|
{
|
||||||
if ( !::DeleteEnhMetaFile(GetEMF()) )
|
if ( !::DeleteEnhMetaFile((HENHMETAFILE) handle) )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("DeleteEnhMetaFile"));
|
wxLogLastError(wxT("DeleteEnhMetaFile"));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user