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,7 +7,6 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_IMAGLIST
|
||||
@ -17,19 +16,14 @@
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#include "wx/icon.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/dc.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxImageList
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
|
||||
|
||||
|
||||
wxImageList::wxImageList( int width, int height, bool mask, int initialCount )
|
||||
{
|
||||
(void)Create(width, height, mask, initialCount);
|
||||
@ -99,6 +93,7 @@ int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
|
||||
wxBitmap bmp( bitmap );
|
||||
if (mask.Ok())
|
||||
bmp.SetMask( new wxMask( mask ) );
|
||||
|
||||
return Add( bmp );
|
||||
}
|
||||
|
||||
@ -106,6 +101,7 @@ int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
|
||||
{
|
||||
wxImage img = bitmap.ConvertToImage();
|
||||
img.SetMaskColour( maskColour.Red(), maskColour.Green(), maskColour.Blue() );
|
||||
|
||||
return Add( wxBitmap( img ) );
|
||||
}
|
||||
|
||||
@ -155,6 +151,7 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap )
|
||||
if (index == (int) m_images.GetCount() - 1)
|
||||
{
|
||||
delete node->GetData();
|
||||
|
||||
m_images.Erase( node );
|
||||
m_images.Append( newBitmap );
|
||||
}
|
||||
@ -162,6 +159,7 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap )
|
||||
{
|
||||
wxList::compatibility_iterator next = node->GetNext();
|
||||
delete node->GetData();
|
||||
|
||||
m_images.Erase( node );
|
||||
m_images.Insert( next, newBitmap );
|
||||
}
|
||||
@ -236,10 +234,12 @@ bool wxImageList::GetSize( int index, int &width, int &height ) const
|
||||
width = bm->GetWidth();
|
||||
height = bm->GetHeight();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxImageList::Draw( int index, wxDC &dc, int x, int y,
|
||||
bool wxImageList::Draw(
|
||||
int index, wxDC &dc, int x, int y,
|
||||
int flags, bool WXUNUSED(solidBackground) )
|
||||
{
|
||||
wxList::compatibility_iterator node = m_images.Item( index );
|
||||
|
@ -9,7 +9,6 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
@ -25,52 +24,53 @@
|
||||
|
||||
#include "wx/metafile.h"
|
||||
#include "wx/clipbrd.h"
|
||||
|
||||
#include "wx/mac/private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern bool wxClipboardIsOpen;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
|
||||
|
||||
class wxMetafileRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLEXPORT wxMetafile;
|
||||
|
||||
public:
|
||||
wxMetafileRefData(void);
|
||||
~wxMetafileRefData(void);
|
||||
wxMetafileRefData();
|
||||
~wxMetafileRefData();
|
||||
|
||||
private:
|
||||
PicHandle m_metafile;
|
||||
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
QDPictRef m_qdPictRef;
|
||||
#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;
|
||||
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
m_qdPictRef = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxMetafileRefData::~wxMetafileRefData(void)
|
||||
wxMetafileRefData::~wxMetafileRefData()
|
||||
{
|
||||
if (m_metafile)
|
||||
{
|
||||
KillPicture( (PicHandle)m_metafile );
|
||||
m_metafile = 0;
|
||||
m_metafile = NULL;
|
||||
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
QDPictRelease( m_qdPictRef );
|
||||
m_qdPictRef = NULL;
|
||||
@ -84,10 +84,11 @@ wxMetaFile::wxMetaFile(const wxString& file)
|
||||
|
||||
M_METAFILEDATA->m_metafile = 0;
|
||||
wxASSERT_MSG( file.empty(), wxT("no file based metafile support yet") );
|
||||
/*
|
||||
|
||||
#if 0
|
||||
if (!file.IsNull() && (file.Cmp("") == 0))
|
||||
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile( file );
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
wxMetaFile::~wxMetaFile()
|
||||
@ -109,7 +110,7 @@ bool wxMetaFile::SetClipboard(int width, int height)
|
||||
bool success = true;
|
||||
|
||||
#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)
|
||||
return false;
|
||||
|
||||
@ -119,8 +120,8 @@ bool wxMetaFile::SetClipboard(int width, int height)
|
||||
wxTheClipboard->Open();
|
||||
wxTheClipboard->Clear();
|
||||
}
|
||||
wxDataObject *data =
|
||||
new wxMetafileDataObject( *this) ;
|
||||
|
||||
wxDataObject *data = new wxMetafileDataObject( *this );
|
||||
success = wxTheClipboard->SetData( data );
|
||||
if (!alreadyOpen)
|
||||
wxTheClipboard->Close();
|
||||
@ -136,15 +137,17 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
|
||||
m_refData = new wxMetafileRefData;
|
||||
|
||||
M_METAFILEDATA->m_metafile = (PicHandle) mf;
|
||||
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
size_t sz = GetHandleSize( (Handle) M_METAFILEDATA->m_metafile );
|
||||
wxMemoryBuffer* membuf = new wxMemoryBuffer( sz );
|
||||
void *data = membuf->GetWriteBuf( sz );
|
||||
memcpy( data, *M_METAFILEDATA->m_metafile, sz );
|
||||
membuf->UngetWriteBuf( sz );
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData( membuf , data , sz ,
|
||||
wxMacMemoryBufferReleaseProc ) ;
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData(
|
||||
membuf, data, sz, wxMacMemoryBufferReleaseProc );
|
||||
M_METAFILEDATA->m_qdPictRef = NULL;
|
||||
|
||||
if ( provider != NULL )
|
||||
{
|
||||
M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider );
|
||||
@ -178,12 +181,14 @@ bool wxMetaFile::Play(wxDC *dc)
|
||||
DrawPicture( pict , &(**pict).picFrame );
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxSize wxMetaFile::GetSize() const
|
||||
{
|
||||
wxSize size = wxDefaultSize ;
|
||||
|
||||
if ( Ok() )
|
||||
{
|
||||
PicHandle pict = (PicHandle) GetHMETAFILE() ;
|
||||
@ -195,10 +200,7 @@ wxSize wxMetaFile::GetSize() const
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Metafile device context
|
||||
*
|
||||
*/
|
||||
// Metafile device context
|
||||
|
||||
// New constructor that takes origin and extent. If you use this, don't
|
||||
// give origin/extent arguments to wxMakeMetaFilePlaceable.
|
||||
@ -207,10 +209,11 @@ wxMetaFileDC::wxMetaFileDC(const wxString& filename ,
|
||||
int width , int height ,
|
||||
const wxString& WXUNUSED(description) )
|
||||
{
|
||||
wxASSERT_MSG( width == 0 || height == 0 , _T("no arbitration of metafilesize supported") ) ;
|
||||
wxASSERT_MSG( filename.empty() , _T("no file based metafile support yet")) ;
|
||||
wxASSERT_MSG( width == 0 || height == 0 , wxT("no arbitration of metafilesize supported") );
|
||||
wxASSERT_MSG( filename.empty() , wxT("no file based metafile support yet"));
|
||||
|
||||
m_metaFile = new wxMetaFile( filename );
|
||||
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
#else
|
||||
Rect r = { 0, 0, height, width };
|
||||
@ -220,8 +223,10 @@ wxMetaFileDC::wxMetaFileDC(const wxString& filename ,
|
||||
|
||||
m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) );
|
||||
::GetPort( (GrafPtr*) &m_macPort );
|
||||
|
||||
m_ok = true ;
|
||||
#endif
|
||||
|
||||
SetMapMode( wxMM_TEXT );
|
||||
}
|
||||
|
||||
@ -231,16 +236,19 @@ wxMetaFileDC::~wxMetaFileDC()
|
||||
|
||||
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() ;
|
||||
if (width) (*width) = sz.x;
|
||||
if (height) (*height) = sz.y;
|
||||
if (width)
|
||||
(*width) = sz.x;
|
||||
if (height)
|
||||
(*height) = sz.y;
|
||||
}
|
||||
|
||||
wxMetaFile *wxMetaFileDC::Close()
|
||||
{
|
||||
ClosePicture() ;
|
||||
|
||||
return m_metaFile;
|
||||
}
|
||||
|
||||
@ -254,6 +262,7 @@ bool wxMetafileDataObject::GetDataHere(void *buf) const
|
||||
{
|
||||
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
|
||||
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -263,6 +272,7 @@ bool wxMetafileDataObject::SetData(size_t len, const void *buf)
|
||||
SetHandleSize( handle, len );
|
||||
memcpy( *handle, buf, len );
|
||||
m_metafile.SetHMETAFILE( (WXHMETAFILE) handle );
|
||||
|
||||
return true ;
|
||||
}
|
||||
#endif
|
||||
|
@ -25,22 +25,23 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING)
|
||||
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
wxTabCtrl::wxTabCtrl()
|
||||
{
|
||||
m_macIsUserPane = false;
|
||||
m_imageList = NULL;
|
||||
}
|
||||
|
||||
bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
bool wxTabCtrl::Create( wxWindow *parent,
|
||||
wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
m_macIsUserPane = FALSE ;
|
||||
|
||||
if ( !wxControl::Create(parent, id, pos, size,
|
||||
style, wxDefaultValidator, name) )
|
||||
return false;
|
||||
|
||||
m_macIsUserPane = false;
|
||||
m_imageList = NULL;
|
||||
|
||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
||||
return false;
|
||||
|
||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
||||
|
||||
UInt16 tabstyle = kControlTabDirectionNorth;
|
||||
@ -56,12 +57,14 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
||||
}
|
||||
|
||||
m_peer = new wxMacControl( this );
|
||||
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
||||
tabsize , tabstyle, 0, NULL, m_peer->GetControlRefAddr() ) );
|
||||
|
||||
OSStatus err = CreateTabsControl(
|
||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||
tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
|
||||
verify_noerr( err );
|
||||
|
||||
MacPostControlCreate( pos, size );
|
||||
return TRUE ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxTabCtrl::~wxTabCtrl()
|
||||
@ -72,139 +75,124 @@ void wxTabCtrl::Command(wxCommandEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
// Delete all items
|
||||
bool wxTabCtrl::DeleteAllItems()
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete an item
|
||||
bool wxTabCtrl::DeleteItem(int item)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the selection
|
||||
int wxTabCtrl::GetSelection() const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the tab with the current keyboard focus
|
||||
//
|
||||
int wxTabCtrl::GetCurFocus() const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the associated image list
|
||||
wxImageList * wxTabCtrl::GetImageList() const
|
||||
{
|
||||
return m_imageList;
|
||||
}
|
||||
|
||||
// Get the number of items
|
||||
int wxTabCtrl::GetItemCount() const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the rect corresponding to the tab
|
||||
bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the number of rows
|
||||
int wxTabCtrl::GetRowCount() const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the item text
|
||||
wxString wxTabCtrl::GetItemText(int item) const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
// Get the item image
|
||||
int wxTabCtrl::GetItemImage(int item) const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the item data
|
||||
void* wxTabCtrl::GetItemData(int item) const
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Hit test
|
||||
int wxTabCtrl::HitTest(const wxPoint& pt, long& flags)
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Insert an item
|
||||
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the selection
|
||||
int wxTabCtrl::SetSelection(int item)
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set the image list
|
||||
void wxTabCtrl::SetImageList(wxImageList* imageList)
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
}
|
||||
|
||||
// Set the text for an item
|
||||
bool wxTabCtrl::SetItemText(int item, const wxString& text)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the image for an item
|
||||
bool wxTabCtrl::SetItemImage(int item, int image)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the data for an item
|
||||
bool wxTabCtrl::SetItemData(int item, void* data)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
// TODO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the size for a fixed-width tab control
|
||||
void wxTabCtrl::SetItemSize(const wxSize& size)
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
}
|
||||
|
||||
// Set the padding between tabs
|
||||
void wxTabCtrl::SetPadding(const wxSize& padding)
|
||||
{
|
||||
// TODO
|
||||
// TODO:
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user