cleanup - reformat

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-01-09 09:46:05 +00:00
parent 633ecf268b
commit 274b7a40ef
3 changed files with 167 additions and 169 deletions

View File

@@ -7,7 +7,6 @@
// 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
@@ -17,19 +16,14 @@
#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);
@@ -99,6 +93,7 @@ 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 );
} }
@@ -106,6 +101,7 @@ 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 ) );
} }
@@ -155,6 +151,7 @@ bool wxImageList::Replace( int index, const 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 );
} }
@@ -236,10 +234,12 @@ 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 index, wxDC &dc, int x, int y,
int flags, bool WXUNUSED(solidBackground) ) int flags, bool WXUNUSED(solidBackground) )
{ {
wxList::compatibility_iterator node = m_images.Item( index ); wxList::compatibility_iterator node = m_images.Item( index );

View File

@@ -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__
@@ -25,52 +24,53 @@
#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;
@@ -84,10 +84,11 @@ wxMetaFile::wxMetaFile(const wxString& file)
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,7 +110,7 @@ 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;
@@ -119,8 +120,8 @@ bool wxMetaFile::SetClipboard(int width, int height)
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();
@@ -136,15 +137,17 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
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 );
@@ -178,12 +181,14 @@ bool wxMetaFile::Play(wxDC *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,10 +209,11 @@ 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 };
@@ -220,8 +223,10 @@ wxMetaFileDC::wxMetaFileDC(const wxString& filename ,
m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) ); m_metaFile->SetHMETAFILE( (WXHMETAFILE) OpenPicture( &r ) );
::GetPort( (GrafPtr*) &m_macPort ); ::GetPort( (GrafPtr*) &m_macPort );
m_ok = true ; m_ok = true ;
#endif #endif
SetMapMode( wxMM_TEXT ); SetMapMode( wxMM_TEXT );
} }
@@ -231,16 +236,19 @@ 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;
} }
@@ -254,6 +262,7 @@ 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;
} }
@@ -263,6 +272,7 @@ bool wxMetafileDataObject::SetData(size_t len, const void *buf)
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

View File

@@ -25,22 +25,23 @@ 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,
wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) 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;
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
return false;
Rect bounds = wxMacGetBoundsForControl( this, pos, size ); Rect bounds = wxMacGetBoundsForControl( this, pos, size );
UInt16 tabstyle = kControlTabDirectionNorth; UInt16 tabstyle = kControlTabDirectionNorth;
@@ -56,12 +57,14 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
} }
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:
} }