cleanup - reformat
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
633ecf268b
commit
274b7a40ef
@ -7,29 +7,23 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_IMAGLIST
|
#if wxUSE_IMAGLIST
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
|
|
||||||
#include "wx/icon.h"
|
#include "wx/icon.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxImageList
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
|
||||||
|
|
||||||
|
|
||||||
wxImageList::wxImageList( int width, int height, bool mask, int initialCount )
|
wxImageList::wxImageList( int width, int height, bool mask, int initialCount )
|
||||||
{
|
{
|
||||||
(void)Create(width, height, mask, initialCount);
|
(void)Create(width, height, mask, initialCount);
|
||||||
@ -73,7 +67,7 @@ int wxImageList::Add( const wxIcon &bitmap )
|
|||||||
m_height = bitmap.GetHeight();
|
m_height = bitmap.GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_images.GetCount()-1;
|
return m_images.GetCount() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxImageList::Add( const wxBitmap &bitmap )
|
int wxImageList::Add( const wxBitmap &bitmap )
|
||||||
@ -83,7 +77,7 @@ int wxImageList::Add( const wxBitmap &bitmap )
|
|||||||
_T("invalid bitmap size in wxImageList: this might work ")
|
_T("invalid bitmap size in wxImageList: this might work ")
|
||||||
_T("on this platform but definitely won't under Windows.") );
|
_T("on this platform but definitely won't under Windows.") );
|
||||||
|
|
||||||
m_images.Append( new wxBitmap(bitmap) );
|
m_images.Append( new wxBitmap( bitmap ) );
|
||||||
|
|
||||||
if (m_width == 0 && m_height == 0)
|
if (m_width == 0 && m_height == 0)
|
||||||
{
|
{
|
||||||
@ -91,22 +85,24 @@ int wxImageList::Add( const wxBitmap &bitmap )
|
|||||||
m_height = bitmap.GetHeight();
|
m_height = bitmap.GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_images.GetCount()-1;
|
return m_images.GetCount() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
|
int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
|
||||||
{
|
{
|
||||||
wxBitmap bmp(bitmap);
|
wxBitmap bmp( bitmap );
|
||||||
if (mask.Ok())
|
if (mask.Ok())
|
||||||
bmp.SetMask(new wxMask(mask));
|
bmp.SetMask( new wxMask( mask ) );
|
||||||
return Add(bmp);
|
|
||||||
|
return Add( bmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
|
int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
|
||||||
{
|
{
|
||||||
wxImage img = bitmap.ConvertToImage();
|
wxImage img = bitmap.ConvertToImage();
|
||||||
img.SetMaskColour(maskColour.Red(), maskColour.Green(), maskColour.Blue());
|
img.SetMaskColour( maskColour.Red(), maskColour.Green(), maskColour.Blue() );
|
||||||
return Add(wxBitmap(img));
|
|
||||||
|
return Add( wxBitmap( img ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the bitmap
|
// Get the bitmap
|
||||||
@ -120,9 +116,9 @@ wxBitmap wxImageList::GetBitmap(int index) const
|
|||||||
if ( obj == NULL )
|
if ( obj == NULL )
|
||||||
return wxNullBitmap ;
|
return wxNullBitmap ;
|
||||||
else if ( obj->IsKindOf(CLASSINFO(wxIcon)) )
|
else if ( obj->IsKindOf(CLASSINFO(wxIcon)) )
|
||||||
return wxBitmap( *(wx_static_cast(wxIcon*,obj)) ) ;
|
return wxBitmap( *(wx_static_cast(wxIcon*, obj)) ) ;
|
||||||
else
|
else
|
||||||
return *(wx_static_cast(wxBitmap*,obj)) ;
|
return *(wx_static_cast(wxBitmap*, obj)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the icon
|
// Get the icon
|
||||||
@ -135,13 +131,13 @@ wxIcon wxImageList::GetIcon(int index) const
|
|||||||
wxObject* obj = (wxObject*) node->GetData();
|
wxObject* obj = (wxObject*) node->GetData();
|
||||||
if ( obj == NULL )
|
if ( obj == NULL )
|
||||||
return wxNullIcon ;
|
return wxNullIcon ;
|
||||||
else if( obj->IsKindOf(CLASSINFO(wxBitmap)) )
|
else if ( obj->IsKindOf(CLASSINFO(wxBitmap)) )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("cannot convert from bitmap to icon") ) ;
|
wxFAIL_MSG( wxT("cannot convert from bitmap to icon") ) ;
|
||||||
return wxNullIcon ;
|
return wxNullIcon ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return *(wx_static_cast(wxIcon*,obj)) ;
|
return *(wx_static_cast(wxIcon*, obj)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImageList::Replace( int index, const wxBitmap &bitmap )
|
bool wxImageList::Replace( int index, const wxBitmap &bitmap )
|
||||||
@ -150,11 +146,12 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap )
|
|||||||
|
|
||||||
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
||||||
|
|
||||||
wxBitmap* newBitmap = new wxBitmap(bitmap) ;
|
wxBitmap* newBitmap = new wxBitmap( bitmap );
|
||||||
|
|
||||||
if (index == (int) m_images.GetCount() - 1)
|
if (index == (int) m_images.GetCount() - 1)
|
||||||
{
|
{
|
||||||
delete node->GetData();
|
delete node->GetData();
|
||||||
|
|
||||||
m_images.Erase( node );
|
m_images.Erase( node );
|
||||||
m_images.Append( newBitmap );
|
m_images.Append( newBitmap );
|
||||||
}
|
}
|
||||||
@ -162,6 +159,7 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap )
|
|||||||
{
|
{
|
||||||
wxList::compatibility_iterator next = node->GetNext();
|
wxList::compatibility_iterator next = node->GetNext();
|
||||||
delete node->GetData();
|
delete node->GetData();
|
||||||
|
|
||||||
m_images.Erase( node );
|
m_images.Erase( node );
|
||||||
m_images.Insert( next, newBitmap );
|
m_images.Insert( next, newBitmap );
|
||||||
}
|
}
|
||||||
@ -175,7 +173,7 @@ bool wxImageList::Replace( int index, const wxIcon &bitmap )
|
|||||||
|
|
||||||
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
||||||
|
|
||||||
wxIcon* newBitmap = new wxIcon(bitmap) ;
|
wxIcon* newBitmap = new wxIcon( bitmap );
|
||||||
|
|
||||||
if (index == (int) m_images.GetCount() - 1)
|
if (index == (int) m_images.GetCount() - 1)
|
||||||
{
|
{
|
||||||
@ -224,7 +222,7 @@ bool wxImageList::GetSize( int index, int &width, int &height ) const
|
|||||||
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
||||||
|
|
||||||
wxObject *obj = (wxObject*)node->GetData();
|
wxObject *obj = (wxObject*)node->GetData();
|
||||||
if( obj->IsKindOf(CLASSINFO(wxIcon)))
|
if (obj->IsKindOf(CLASSINFO(wxIcon)))
|
||||||
{
|
{
|
||||||
wxIcon *bm = wx_static_cast( wxIcon* , obj ) ;
|
wxIcon *bm = wx_static_cast( wxIcon* , obj ) ;
|
||||||
width = bm->GetWidth();
|
width = bm->GetWidth();
|
||||||
@ -236,21 +234,23 @@ bool wxImageList::GetSize( int index, int &width, int &height ) const
|
|||||||
width = bm->GetWidth();
|
width = bm->GetWidth();
|
||||||
height = bm->GetHeight();
|
height = bm->GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImageList::Draw( int index, wxDC &dc, int x, int y,
|
bool wxImageList::Draw(
|
||||||
int flags, bool WXUNUSED(solidBackground) )
|
int index, wxDC &dc, int x, int y,
|
||||||
|
int flags, bool WXUNUSED(solidBackground) )
|
||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = m_images.Item( index );
|
wxList::compatibility_iterator node = m_images.Item( index );
|
||||||
|
|
||||||
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
wxCHECK_MSG( node, false, wxT("wrong index in image list") );
|
||||||
|
|
||||||
wxObject *obj = (wxObject*)node->GetData();
|
wxObject *obj = (wxObject*)node->GetData();
|
||||||
if( obj->IsKindOf(CLASSINFO(wxIcon)))
|
if (obj->IsKindOf(CLASSINFO(wxIcon)))
|
||||||
{
|
{
|
||||||
wxIcon *bm = wx_static_cast( wxIcon* , obj ) ;
|
wxIcon *bm = wx_static_cast( wxIcon* , obj ) ;
|
||||||
dc.DrawIcon( *bm , x, y);
|
dc.DrawIcon( *bm , x, y );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
@ -19,61 +18,62 @@
|
|||||||
#if wxUSE_METAFILE
|
#if wxUSE_METAFILE
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/metafile.h"
|
#include "wx/metafile.h"
|
||||||
#include "wx/clipbrd.h"
|
#include "wx/clipbrd.h"
|
||||||
|
|
||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern bool wxClipboardIsOpen;
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
|
IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
|
||||||
|
|
||||||
class wxMetafileRefData: public wxGDIRefData
|
class wxMetafileRefData: public wxGDIRefData
|
||||||
{
|
{
|
||||||
friend class WXDLLEXPORT wxMetafile;
|
friend class WXDLLEXPORT wxMetafile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxMetafileRefData(void);
|
wxMetafileRefData();
|
||||||
~wxMetafileRefData(void);
|
~wxMetafileRefData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PicHandle m_metafile;
|
PicHandle m_metafile;
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
QDPictRef m_qdPictRef ;
|
QDPictRef m_qdPictRef;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern bool wxClipboardIsOpen;
|
||||||
|
|
||||||
/*
|
|
||||||
* Metafiles
|
|
||||||
* Currently, the only purpose for making a metafile is to put
|
|
||||||
* it on the clipboard.
|
|
||||||
*/
|
|
||||||
|
|
||||||
wxMetafileRefData::wxMetafileRefData(void)
|
// Metafiles:
|
||||||
|
// Currently, the only purpose for making a metafile
|
||||||
|
// is to put it on the clipboard.
|
||||||
|
|
||||||
|
wxMetafileRefData::wxMetafileRefData()
|
||||||
{
|
{
|
||||||
m_metafile = 0;
|
m_metafile = 0;
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
m_qdPictRef = NULL ;
|
m_qdPictRef = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMetafileRefData::~wxMetafileRefData(void)
|
wxMetafileRefData::~wxMetafileRefData()
|
||||||
{
|
{
|
||||||
if (m_metafile)
|
if (m_metafile)
|
||||||
{
|
{
|
||||||
KillPicture( (PicHandle) m_metafile ) ;
|
KillPicture( (PicHandle)m_metafile );
|
||||||
m_metafile = 0;
|
m_metafile = NULL;
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
QDPictRelease( m_qdPictRef ) ;
|
QDPictRelease( m_qdPictRef );
|
||||||
m_qdPictRef = NULL ;
|
m_qdPictRef = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,11 +83,12 @@ wxMetaFile::wxMetaFile(const wxString& file)
|
|||||||
m_refData = new wxMetafileRefData;
|
m_refData = new wxMetafileRefData;
|
||||||
|
|
||||||
M_METAFILEDATA->m_metafile = 0;
|
M_METAFILEDATA->m_metafile = 0;
|
||||||
wxASSERT_MSG( file.empty() , wxT("no file based metafile support yet") ) ;
|
wxASSERT_MSG( file.empty(), wxT("no file based metafile support yet") );
|
||||||
/*
|
|
||||||
|
#if 0
|
||||||
if (!file.IsNull() && (file.Cmp("") == 0))
|
if (!file.IsNull() && (file.Cmp("") == 0))
|
||||||
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
|
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile( file );
|
||||||
*/
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMetaFile::~wxMetaFile()
|
wxMetaFile::~wxMetaFile()
|
||||||
@ -109,19 +110,19 @@ bool wxMetaFile::SetClipboard(int width, int height)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
//TODO finishi this port , we need the data obj first
|
// TODO: to finish this port, we need the data obj first
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool alreadyOpen=wxTheClipboard->IsOpened() ;
|
bool alreadyOpen = wxTheClipboard->IsOpened();
|
||||||
if (!alreadyOpen)
|
if (!alreadyOpen)
|
||||||
{
|
{
|
||||||
wxTheClipboard->Open();
|
wxTheClipboard->Open();
|
||||||
wxTheClipboard->Clear();
|
wxTheClipboard->Clear();
|
||||||
}
|
}
|
||||||
wxDataObject *data =
|
|
||||||
new wxMetafileDataObject( *this) ;
|
wxDataObject *data = new wxMetafileDataObject( *this );
|
||||||
success = wxTheClipboard->SetData(data);
|
success = wxTheClipboard->SetData( data );
|
||||||
if (!alreadyOpen)
|
if (!alreadyOpen)
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
#endif
|
#endif
|
||||||
@ -131,24 +132,26 @@ bool wxMetaFile::SetClipboard(int width, int height)
|
|||||||
|
|
||||||
void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
|
void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
|
||||||
{
|
{
|
||||||
UnRef() ;
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxMetafileRefData;
|
m_refData = new wxMetafileRefData;
|
||||||
|
|
||||||
M_METAFILEDATA->m_metafile = (PicHandle) mf;
|
M_METAFILEDATA->m_metafile = (PicHandle) mf;
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
size_t sz = GetHandleSize( (Handle) M_METAFILEDATA->m_metafile ) ;
|
size_t sz = GetHandleSize( (Handle) M_METAFILEDATA->m_metafile );
|
||||||
wxMemoryBuffer* membuf = new wxMemoryBuffer( sz ) ;
|
wxMemoryBuffer* membuf = new wxMemoryBuffer( sz );
|
||||||
void * data = membuf->GetWriteBuf(sz) ;
|
void *data = membuf->GetWriteBuf( sz );
|
||||||
memcpy( data , *M_METAFILEDATA->m_metafile , sz ) ;
|
memcpy( data, *M_METAFILEDATA->m_metafile, sz );
|
||||||
membuf->UngetWriteBuf(sz) ;
|
membuf->UngetWriteBuf( sz );
|
||||||
CGDataProviderRef provider = CGDataProviderCreateWithData( membuf , data , sz ,
|
CGDataProviderRef provider = CGDataProviderCreateWithData(
|
||||||
wxMacMemoryBufferReleaseProc ) ;
|
membuf, data, sz, wxMacMemoryBufferReleaseProc );
|
||||||
M_METAFILEDATA->m_qdPictRef = NULL ;
|
M_METAFILEDATA->m_qdPictRef = NULL;
|
||||||
|
|
||||||
if ( provider != NULL )
|
if ( provider != NULL )
|
||||||
{
|
{
|
||||||
M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider ) ;
|
M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider );
|
||||||
CGDataProviderRelease( provider ) ;
|
CGDataProviderRelease( provider );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -163,27 +166,29 @@ bool wxMetaFile::Play(wxDC *dc)
|
|||||||
|
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
QDPictRef cgPictRef = M_METAFILEDATA->m_qdPictRef ;
|
QDPictRef cgPictRef = M_METAFILEDATA->m_qdPictRef;
|
||||||
CGContextRef cg = ((wxMacCGContext*)(dc->GetGraphicContext()))->GetNativeContext() ;
|
CGContextRef cg = ((wxMacCGContext*)(dc->GetGraphicContext()))->GetNativeContext();
|
||||||
CGRect bounds = QDPictGetBounds( cgPictRef ) ;
|
CGRect bounds = QDPictGetBounds( cgPictRef );
|
||||||
|
|
||||||
CGContextSaveGState(cg);
|
CGContextSaveGState( cg );
|
||||||
CGContextTranslateCTM(cg, 0 , bounds.size.width );
|
CGContextTranslateCTM( cg, 0 , bounds.size.width );
|
||||||
CGContextScaleCTM(cg, 1, -1);
|
CGContextScaleCTM( cg, 1, -1 );
|
||||||
QDPictDrawToCGContext( cg , bounds , cgPictRef ) ;
|
QDPictDrawToCGContext( cg , bounds, cgPictRef );
|
||||||
CGContextRestoreGState( cg ) ;
|
CGContextRestoreGState( cg );
|
||||||
#else
|
#else
|
||||||
PicHandle pict = (PicHandle) GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) GetHMETAFILE();
|
||||||
wxMacPortSetter helper( dc ) ;
|
wxMacPortSetter helper( dc );
|
||||||
DrawPicture( pict , &(**pict).picFrame ) ;
|
DrawPicture( pict , &(**pict).picFrame );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxMetaFile::GetSize() const
|
wxSize wxMetaFile::GetSize() const
|
||||||
{
|
{
|
||||||
wxSize size = wxDefaultSize ;
|
wxSize size = wxDefaultSize ;
|
||||||
|
|
||||||
if ( Ok() )
|
if ( Ok() )
|
||||||
{
|
{
|
||||||
PicHandle pict = (PicHandle) GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) GetHMETAFILE() ;
|
||||||
@ -195,10 +200,7 @@ wxSize wxMetaFile::GetSize() const
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Metafile device context
|
||||||
* Metafile device context
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// New constructor that takes origin and extent. If you use this, don't
|
// New constructor that takes origin and extent. If you use this, don't
|
||||||
// give origin/extent arguments to wxMakeMetaFilePlaceable.
|
// give origin/extent arguments to wxMakeMetaFilePlaceable.
|
||||||
@ -207,22 +209,25 @@ wxMetaFileDC::wxMetaFileDC(const wxString& filename ,
|
|||||||
int width , int height ,
|
int width , int height ,
|
||||||
const wxString& WXUNUSED(description) )
|
const wxString& WXUNUSED(description) )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( width == 0 || height == 0 , _T("no arbitration of metafilesize supported") ) ;
|
wxASSERT_MSG( width == 0 || height == 0 , wxT("no arbitration of metafilesize supported") );
|
||||||
wxASSERT_MSG( filename.empty() , _T("no file based metafile support yet")) ;
|
wxASSERT_MSG( filename.empty() , wxT("no file based metafile support yet"));
|
||||||
|
|
||||||
|
m_metaFile = new wxMetaFile( filename );
|
||||||
|
|
||||||
m_metaFile = new wxMetaFile(filename) ;
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
#else
|
#else
|
||||||
Rect r={0,0,height,width} ;
|
Rect r = { 0, 0, height, width };
|
||||||
|
|
||||||
RectRgn( (RgnHandle) m_macBoundaryClipRgn , &r ) ;
|
RectRgn( (RgnHandle) m_macBoundaryClipRgn , &r );
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn );
|
||||||
|
|
||||||
|
m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) );
|
||||||
|
::GetPort( (GrafPtr*) &m_macPort );
|
||||||
|
|
||||||
m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) ) ;
|
|
||||||
::GetPort( (GrafPtr*) &m_macPort ) ;
|
|
||||||
m_ok = true ;
|
m_ok = true ;
|
||||||
#endif
|
#endif
|
||||||
SetMapMode(wxMM_TEXT);
|
|
||||||
|
SetMapMode( wxMM_TEXT );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMetaFileDC::~wxMetaFileDC()
|
wxMetaFileDC::~wxMetaFileDC()
|
||||||
@ -231,38 +236,43 @@ wxMetaFileDC::~wxMetaFileDC()
|
|||||||
|
|
||||||
void wxMetaFileDC::DoGetSize(int *width, int *height) const
|
void wxMetaFileDC::DoGetSize(int *width, int *height) const
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_metaFile , _T("GetSize() doesn't work without a metafile") );
|
wxCHECK_RET( m_metaFile , wxT("GetSize() doesn't work without a metafile") );
|
||||||
|
|
||||||
wxSize sz = m_metaFile->GetSize() ;
|
wxSize sz = m_metaFile->GetSize() ;
|
||||||
if (width) (*width) = sz.x;
|
if (width)
|
||||||
if (height) (*height) = sz.y;
|
(*width) = sz.x;
|
||||||
|
if (height)
|
||||||
|
(*height) = sz.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMetaFile *wxMetaFileDC::Close()
|
wxMetaFile *wxMetaFileDC::Close()
|
||||||
{
|
{
|
||||||
ClosePicture() ;
|
ClosePicture() ;
|
||||||
|
|
||||||
return m_metaFile;
|
return m_metaFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_DATAOBJ
|
#if wxUSE_DATAOBJ
|
||||||
size_t wxMetafileDataObject::GetDataSize() const
|
size_t wxMetafileDataObject::GetDataSize() const
|
||||||
{
|
{
|
||||||
return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
|
return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMetafileDataObject::GetDataHere(void *buf) const
|
bool wxMetafileDataObject::GetDataHere(void *buf) const
|
||||||
{
|
{
|
||||||
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
|
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
|
||||||
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
|
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) );
|
||||||
return true ;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMetafileDataObject::SetData(size_t len, const void *buf)
|
bool wxMetafileDataObject::SetData(size_t len, const void *buf)
|
||||||
{
|
{
|
||||||
Handle handle = NewHandle( len ) ;
|
Handle handle = NewHandle( len );
|
||||||
SetHandleSize( handle , len ) ;
|
SetHandleSize( handle, len );
|
||||||
memcpy( *handle , buf , len ) ;
|
memcpy( *handle, buf, len );
|
||||||
m_metafile.SetHMETAFILE( (WXHMETAFILE) handle ) ;
|
m_metafile.SetHMETAFILE( (WXHMETAFILE) handle );
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,26 +25,27 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING)
|
|||||||
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
|
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
wxTabCtrl::wxTabCtrl()
|
wxTabCtrl::wxTabCtrl()
|
||||||
{
|
{
|
||||||
|
m_macIsUserPane = false;
|
||||||
m_imageList = NULL;
|
m_imageList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
bool wxTabCtrl::Create( wxWindow *parent,
|
||||||
long style, const wxString& name)
|
wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||||
|
long style, const wxString& name )
|
||||||
{
|
{
|
||||||
m_macIsUserPane = FALSE ;
|
m_macIsUserPane = false;
|
||||||
|
|
||||||
if ( !wxControl::Create(parent, id, pos, size,
|
|
||||||
style, wxDefaultValidator, name) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_imageList = NULL;
|
m_imageList = NULL;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
UInt16 tabstyle = kControlTabDirectionNorth ;
|
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
||||||
ControlTabSize tabsize = kControlTabSizeLarge ;
|
|
||||||
|
UInt16 tabstyle = kControlTabDirectionNorth;
|
||||||
|
ControlTabSize tabsize = kControlTabSizeLarge;
|
||||||
if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
|
if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
|
||||||
tabsize = kControlTabSizeSmall ;
|
tabsize = kControlTabSizeSmall ;
|
||||||
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
||||||
@ -55,13 +56,15 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
|||||||
tabsize = kControlSizeSmall;
|
tabsize = kControlSizeSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_peer = new wxMacControl(this) ;
|
m_peer = new wxMacControl( this );
|
||||||
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
OSStatus err = CreateTabsControl(
|
||||||
tabsize , tabstyle, 0, NULL, m_peer->GetControlRefAddr() ) );
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||||
|
tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
|
||||||
|
verify_noerr( err );
|
||||||
|
|
||||||
|
MacPostControlCreate( pos, size );
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
return true;
|
||||||
return TRUE ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTabCtrl::~wxTabCtrl()
|
wxTabCtrl::~wxTabCtrl()
|
||||||
@ -72,139 +75,124 @@ void wxTabCtrl::Command(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all items
|
|
||||||
bool wxTabCtrl::DeleteAllItems()
|
bool wxTabCtrl::DeleteAllItems()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete an item
|
|
||||||
bool wxTabCtrl::DeleteItem(int item)
|
bool wxTabCtrl::DeleteItem(int item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the selection
|
|
||||||
int wxTabCtrl::GetSelection() const
|
int wxTabCtrl::GetSelection() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the tab with the current keyboard focus
|
// Get the tab with the current keyboard focus
|
||||||
|
//
|
||||||
int wxTabCtrl::GetCurFocus() const
|
int wxTabCtrl::GetCurFocus() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the associated image list
|
wxImageList * wxTabCtrl::GetImageList() const
|
||||||
wxImageList* wxTabCtrl::GetImageList() const
|
|
||||||
{
|
{
|
||||||
return m_imageList;
|
return m_imageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the number of items
|
|
||||||
int wxTabCtrl::GetItemCount() const
|
int wxTabCtrl::GetItemCount() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the rect corresponding to the tab
|
// Get the rect corresponding to the tab
|
||||||
bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
|
bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the number of rows
|
|
||||||
int wxTabCtrl::GetRowCount() const
|
int wxTabCtrl::GetRowCount() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the item text
|
|
||||||
wxString wxTabCtrl::GetItemText(int item) const
|
wxString wxTabCtrl::GetItemText(int item) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the item image
|
|
||||||
int wxTabCtrl::GetItemImage(int item) const
|
int wxTabCtrl::GetItemImage(int item) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the item data
|
|
||||||
void* wxTabCtrl::GetItemData(int item) const
|
void* wxTabCtrl::GetItemData(int item) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hit test
|
|
||||||
int wxTabCtrl::HitTest(const wxPoint& pt, long& flags)
|
int wxTabCtrl::HitTest(const wxPoint& pt, long& flags)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert an item
|
|
||||||
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
|
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the selection
|
|
||||||
int wxTabCtrl::SetSelection(int item)
|
int wxTabCtrl::SetSelection(int item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the image list
|
|
||||||
void wxTabCtrl::SetImageList(wxImageList* imageList)
|
void wxTabCtrl::SetImageList(wxImageList* imageList)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the text for an item
|
|
||||||
bool wxTabCtrl::SetItemText(int item, const wxString& text)
|
bool wxTabCtrl::SetItemText(int item, const wxString& text)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the image for an item
|
|
||||||
bool wxTabCtrl::SetItemImage(int item, int image)
|
bool wxTabCtrl::SetItemImage(int item, int image)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the data for an item
|
|
||||||
bool wxTabCtrl::SetItemData(int item, void* data)
|
bool wxTabCtrl::SetItemData(int item, void* data)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the size for a fixed-width tab control
|
// Set the size for a fixed-width tab control
|
||||||
void wxTabCtrl::SetItemSize(const wxSize& size)
|
void wxTabCtrl::SetItemSize(const wxSize& size)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the padding between tabs
|
// Set the padding between tabs
|
||||||
void wxTabCtrl::SetPadding(const wxSize& padding)
|
void wxTabCtrl::SetPadding(const wxSize& padding)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user