Remove unused carbon files
These files where no longer referenced by any build system and where probably left overs from before carbon was removed.
This commit is contained in:
parent
7a729e8a85
commit
c9c2d1fba4
@ -1,57 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/carbon/private/overlay.h
|
||||
// Purpose: wxOverlayImpl declaration
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2006-10-20
|
||||
// Copyright: (c) wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MAC_CARBON_PRIVATE_OVERLAY_H_
|
||||
#define _WX_MAC_CARBON_PRIVATE_OVERLAY_H_
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/toplevel.h"
|
||||
#include "wx/graphics.h"
|
||||
|
||||
class wxOverlayImpl
|
||||
{
|
||||
public:
|
||||
wxOverlayImpl() ;
|
||||
~wxOverlayImpl() ;
|
||||
|
||||
|
||||
// clears the overlay without restoring the former state
|
||||
// to be done eg when the window content has been changed and repainted
|
||||
void Reset();
|
||||
|
||||
// returns true if it has been setup
|
||||
bool IsOk();
|
||||
|
||||
void Init( wxDC* dc, int x , int y , int width , int height );
|
||||
|
||||
void BeginDrawing( wxDC* dc);
|
||||
|
||||
void EndDrawing( wxDC* dc);
|
||||
|
||||
void Clear( wxDC* dc);
|
||||
|
||||
private:
|
||||
OSStatus CreateOverlayWindow();
|
||||
|
||||
void MacGetBounds( Rect *bounds );
|
||||
|
||||
WindowRef m_overlayWindow;
|
||||
WindowRef m_overlayParentWindow;
|
||||
CGContextRef m_overlayContext ;
|
||||
// we store the window in case we would have to issue a Refresh()
|
||||
wxWindow* m_window ;
|
||||
|
||||
int m_x ;
|
||||
int m_y ;
|
||||
int m_width ;
|
||||
int m_height ;
|
||||
} ;
|
||||
|
||||
#endif // _WX_MAC_CARBON_PRIVATE_OVERLAY_H_
|
@ -1,79 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/colordlg.cpp
|
||||
// Purpose: wxColourDialog class. NOTE: you can use the generic class
|
||||
// if you wish, instead of implementing this.
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/colordlg.h"
|
||||
#include "wx/fontdlg.h"
|
||||
#include "wx/modalhook.h"
|
||||
|
||||
|
||||
#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX && wxUSE_COLOURDLG
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog);
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
/*
|
||||
* wxColourDialog
|
||||
*/
|
||||
|
||||
wxColourDialog::wxColourDialog()
|
||||
{
|
||||
m_dialogParent = NULL;
|
||||
}
|
||||
|
||||
wxColourDialog::wxColourDialog(wxWindow *parent, const wxColourData *data)
|
||||
{
|
||||
Create(parent, data);
|
||||
}
|
||||
|
||||
bool wxColourDialog::Create(wxWindow *parent, const wxColourData *data)
|
||||
{
|
||||
m_dialogParent = parent;
|
||||
|
||||
if (data)
|
||||
m_colourData = *data;
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxColourDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
RGBColor currentColor ;
|
||||
|
||||
m_colourData.m_dataColour.GetRGBColor( ¤tColor );
|
||||
NColorPickerInfo info;
|
||||
OSStatus err ;
|
||||
memset(&info, 0, sizeof(info)) ;
|
||||
// TODO : use parent to determine better position and then kAtSpecifiedOrigin
|
||||
info.placeWhere = kCenterOnMainScreen ;
|
||||
info.flags = kColorPickerDialogIsMoveable | kColorPickerDialogIsModal ;
|
||||
info.theColor.color.rgb.red = currentColor.red ;
|
||||
info.theColor.color.rgb.green = currentColor.green ;
|
||||
info.theColor.color.rgb.blue = currentColor.blue ;
|
||||
wxDialog::OSXBeginModalDialog();
|
||||
err = NPickColor(&info);
|
||||
wxDialog::OSXEndModalDialog();
|
||||
if ((err == noErr) && info.newColorChosen)
|
||||
{
|
||||
currentColor.red = info.theColor.color.rgb.red ;
|
||||
currentColor.green = info.theColor.color.rgb.green ;
|
||||
currentColor.blue = info.theColor.color.rgb.blue ;
|
||||
m_colourData.m_dataColour = currentColor;
|
||||
|
||||
return wxID_OK;
|
||||
}
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,604 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/icon.cpp
|
||||
// Purpose: wxIcon class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
#include "wx/icon.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/image.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject);
|
||||
|
||||
#define M_ICONDATA ((wxIconRefData *)m_refData)
|
||||
|
||||
#define wxOSX_ICON_USE_NSIMAGE wxOSX_BITMAP_NATIVE_ACCESS
|
||||
|
||||
#if wxOSX_ICON_USE_NSIMAGE
|
||||
|
||||
// implementation based on NSImage
|
||||
|
||||
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
wxIconRefData() { Init(); }
|
||||
wxIconRefData( WX_NSImage image, int desiredWidth, int desiredHeight );
|
||||
wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
|
||||
|
||||
virtual ~wxIconRefData() { Free(); }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_nsImage != NULL; }
|
||||
virtual void Free();
|
||||
|
||||
int GetWidth() const { return (int) wxOSXGetImageSize(m_nsImage).width; }
|
||||
int GetHeight() const { return (int) wxOSXGetImageSize(m_nsImage).height; }
|
||||
|
||||
WX_NSImage GetImage() const;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void Create( NSImage* icon, int desiredWidth, int desiredHeight );
|
||||
NSImage* m_nsImage;
|
||||
|
||||
// We can (easily) copy m_iconRef so we don't implement the copy ctor.
|
||||
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
|
||||
};
|
||||
|
||||
|
||||
wxIconRefData::wxIconRefData( NSImage* icon, int desiredWidth, int desiredHeight )
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(icon, desiredWidth, desiredHeight);
|
||||
}
|
||||
|
||||
wxIconRefData::wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight )
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(wxOSXGetNSImageFromIconRef(iconref), desiredWidth, desiredHeight);
|
||||
ReleaseIconRef(iconref);
|
||||
}
|
||||
|
||||
void wxIconRefData::Create( NSImage* icon, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) )
|
||||
{
|
||||
if ( icon )
|
||||
{
|
||||
m_nsImage = icon;
|
||||
wxMacCocoaRetain(icon);
|
||||
}
|
||||
}
|
||||
|
||||
void wxIconRefData::Init()
|
||||
{
|
||||
m_nsImage = NULL;
|
||||
}
|
||||
|
||||
void wxIconRefData::Free()
|
||||
{
|
||||
if ( m_nsImage )
|
||||
{
|
||||
wxMacCocoaRelease(m_nsImage);
|
||||
}
|
||||
}
|
||||
|
||||
WX_NSImage wxIconRefData::GetImage() const
|
||||
{
|
||||
wxASSERT( IsOk() );
|
||||
|
||||
return m_nsImage;
|
||||
}
|
||||
|
||||
#else // !wxOSX_ICON_USE_NSIMAGE
|
||||
|
||||
// implementation based on IconRef
|
||||
|
||||
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
wxIconRefData() { Init(); }
|
||||
wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
|
||||
virtual ~wxIconRefData() { Free(); }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_iconRef != NULL; }
|
||||
virtual void Free();
|
||||
|
||||
void SetWidth( int width ) { m_width = width; }
|
||||
void SetHeight( int height ) { m_height = height; }
|
||||
|
||||
int GetWidth() const { return m_width; }
|
||||
int GetHeight() const { return m_height; }
|
||||
|
||||
WXHICON GetHICON() const { return (WXHICON) m_iconRef; }
|
||||
|
||||
WX_NSImage GetImage() const;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
IconRef m_iconRef;
|
||||
|
||||
mutable NSImage* m_nsImage;
|
||||
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
// We can (easily) copy m_iconRef so we don't implement the copy ctor.
|
||||
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
|
||||
};
|
||||
|
||||
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
|
||||
{
|
||||
Init();
|
||||
m_iconRef = (IconRef)( icon ) ;
|
||||
|
||||
// Standard sizes
|
||||
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
|
||||
SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ;
|
||||
}
|
||||
|
||||
void wxIconRefData::Init()
|
||||
{
|
||||
m_iconRef = NULL ;
|
||||
m_nsImage = NULL;
|
||||
|
||||
m_width =
|
||||
m_height = 0;
|
||||
}
|
||||
|
||||
void wxIconRefData::Free()
|
||||
{
|
||||
if ( m_iconRef )
|
||||
{
|
||||
ReleaseIconRef( m_iconRef ) ;
|
||||
m_iconRef = NULL ;
|
||||
}
|
||||
|
||||
if ( m_nsImage )
|
||||
{
|
||||
wxMacCocoaRelease(m_nsImage);
|
||||
}
|
||||
}
|
||||
|
||||
WX_NSImage wxIconRefData::GetImage() const
|
||||
{
|
||||
wxASSERT( IsOk() );
|
||||
|
||||
if ( m_nsImage == 0 )
|
||||
{
|
||||
m_nsImage = wxOSXGetNSImageFromIconRef(m_iconRef);
|
||||
CFRetain(m_nsImage);
|
||||
}
|
||||
|
||||
return m_nsImage;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
wxIcon::wxIcon()
|
||||
{
|
||||
}
|
||||
|
||||
wxIcon::wxIcon( const char bits[], int width, int height )
|
||||
{
|
||||
wxBitmap bmp( bits, width, height ) ;
|
||||
CopyFromBitmap( bmp ) ;
|
||||
}
|
||||
|
||||
wxIcon::wxIcon(const char* const* bits)
|
||||
{
|
||||
wxBitmap bmp( bits ) ;
|
||||
CopyFromBitmap( bmp ) ;
|
||||
}
|
||||
|
||||
wxIcon::wxIcon(
|
||||
const wxString& icon_file, wxBitmapType flags,
|
||||
int desiredWidth, int desiredHeight )
|
||||
{
|
||||
LoadFile( icon_file, flags, desiredWidth, desiredHeight );
|
||||
}
|
||||
|
||||
#if wxOSX_USE_ICONREF
|
||||
wxIcon::wxIcon(WXHICON icon, const wxSize& size)
|
||||
: wxGDIObject()
|
||||
{
|
||||
// as the icon owns that ref, we have to acquire it as well
|
||||
if (icon)
|
||||
AcquireIconRef( (IconRef) icon ) ;
|
||||
|
||||
m_refData = new wxIconRefData( icon, size.x, size.y ) ;
|
||||
}
|
||||
|
||||
WXHICON wxIcon::GetHICON() const
|
||||
{
|
||||
wxASSERT( IsOk() ) ;
|
||||
|
||||
return (WXHICON) ((wxIconRefData*)m_refData)->GetHICON() ;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxIcon::~wxIcon()
|
||||
{
|
||||
}
|
||||
|
||||
wxGDIRefData *wxIcon::CreateGDIRefData() const
|
||||
{
|
||||
return new wxIconRefData;
|
||||
}
|
||||
|
||||
wxGDIRefData *
|
||||
wxIcon::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
|
||||
{
|
||||
wxFAIL_MSG( wxS("Cloning icons is not implemented in wxCarbon.") );
|
||||
|
||||
return new wxIconRefData;
|
||||
}
|
||||
|
||||
int wxIcon::GetWidth() const
|
||||
{
|
||||
wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") );
|
||||
|
||||
return M_ICONDATA->GetWidth();
|
||||
}
|
||||
|
||||
int wxIcon::GetHeight() const
|
||||
{
|
||||
wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") );
|
||||
|
||||
return M_ICONDATA->GetHeight();
|
||||
}
|
||||
|
||||
int wxIcon::GetDepth() const
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
WX_NSImage wxIcon::GetImage() const
|
||||
{
|
||||
wxCHECK_MSG( IsOk(), NULL, wxT("invalid icon") );
|
||||
|
||||
return M_ICONDATA->GetImage() ;
|
||||
}
|
||||
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
void wxIcon::SetDepth( int WXUNUSED(depth) )
|
||||
{
|
||||
}
|
||||
|
||||
void wxIcon::SetWidth( int WXUNUSED(width) )
|
||||
{
|
||||
}
|
||||
|
||||
void wxIcon::SetHeight( int WXUNUSED(height) )
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
// Load an icon based on resource name or filel name
|
||||
// Return true on success, false otherwise
|
||||
bool wxIcon::LoadFile(
|
||||
const wxString& filename, wxBitmapType type,
|
||||
int desiredWidth, int desiredHeight )
|
||||
{
|
||||
if( type == wxBITMAP_TYPE_ICON_RESOURCE )
|
||||
{
|
||||
if( LoadIconFromSystemResource( filename, desiredWidth, desiredHeight ) )
|
||||
return true;
|
||||
else
|
||||
return LoadIconFromBundleResource( filename, desiredWidth, desiredHeight );
|
||||
}
|
||||
else if( type == wxBITMAP_TYPE_ICON )
|
||||
{
|
||||
return LoadIconFromFile( filename, desiredWidth, desiredHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
return LoadIconAsBitmap( filename, type, desiredWidth, desiredHeight );
|
||||
}
|
||||
}
|
||||
|
||||
// Load a well known system icon by its wxWidgets identifier
|
||||
// Returns true on success, false otherwise
|
||||
bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desiredWidth, int desiredHeight)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
OSType theId = 0 ;
|
||||
|
||||
if ( resourceName == wxT("wxICON_INFORMATION") )
|
||||
{
|
||||
theId = kAlertNoteIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_QUESTION") )
|
||||
{
|
||||
theId = kAlertCautionIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_WARNING") )
|
||||
{
|
||||
theId = kAlertCautionIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_ERROR") )
|
||||
{
|
||||
theId = kAlertStopIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_FOLDER") )
|
||||
{
|
||||
theId = kGenericFolderIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_FOLDER_OPEN") )
|
||||
{
|
||||
theId = kOpenFolderIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_NORMAL_FILE") )
|
||||
{
|
||||
theId = kGenericDocumentIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_EXECUTABLE_FILE") )
|
||||
{
|
||||
theId = kGenericApplicationIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_CDROM") )
|
||||
{
|
||||
theId = kGenericCDROMIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_FLOPPY") )
|
||||
{
|
||||
theId = kGenericFloppyIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_HARDDISK") )
|
||||
{
|
||||
theId = kGenericHardDiskIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_REMOVABLE") )
|
||||
{
|
||||
theId = kGenericRemovableMediaIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_DELETE") )
|
||||
{
|
||||
theId = kToolbarDeleteIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_GO_BACK") )
|
||||
{
|
||||
theId = kBackwardArrowIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_GO_FORWARD") )
|
||||
{
|
||||
theId = kForwardArrowIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_GO_HOME") )
|
||||
{
|
||||
theId = kToolbarHomeIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_HELP_SETTINGS") )
|
||||
{
|
||||
theId = kGenericFontIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT("wxICON_HELP_PAGE") )
|
||||
{
|
||||
theId = kGenericDocumentIcon ;
|
||||
}
|
||||
else if ( resourceName == wxT( "wxICON_PRINT" ) )
|
||||
{
|
||||
theId = kPrintMonitorFolderIcon;
|
||||
}
|
||||
else if ( resourceName == wxT( "wxICON_HELP_FOLDER" ) )
|
||||
{
|
||||
theId = kHelpFolderIcon;
|
||||
}
|
||||
|
||||
if ( theId != 0 )
|
||||
{
|
||||
IconRef iconRef = NULL ;
|
||||
__Verify_noErr(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ;
|
||||
if ( iconRef )
|
||||
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ;
|
||||
}
|
||||
|
||||
return IsOk();
|
||||
}
|
||||
|
||||
// Load an icon of type 'icns' by resource by name
|
||||
// The resource must exist in one of the currently accessible bundles
|
||||
// (usually this means the application bundle for the current application)
|
||||
// Return true on success, false otherwise
|
||||
bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desiredWidth, int desiredHeight)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
#if wxOSX_USE_ICONREF
|
||||
IconRef iconRef = NULL ;
|
||||
|
||||
// first look in the resource fork
|
||||
if ( iconRef == NULL )
|
||||
{
|
||||
Str255 theName ;
|
||||
|
||||
wxMacStringToPascal( resourceName , theName ) ;
|
||||
Handle resHandle = GetNamedResource( 'icns' , theName ) ;
|
||||
if ( resHandle != 0L )
|
||||
{
|
||||
IconFamilyHandle iconFamily = (IconFamilyHandle) resHandle ;
|
||||
OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef );
|
||||
|
||||
if ( err != noErr )
|
||||
{
|
||||
wxFAIL_MSG("Error when constructing icon ref");
|
||||
}
|
||||
|
||||
ReleaseResource( resHandle ) ;
|
||||
}
|
||||
}
|
||||
if ( iconRef == NULL )
|
||||
{
|
||||
wxCFStringRef name(resourceName);
|
||||
FSRef iconFSRef;
|
||||
|
||||
wxCFRef<CFURLRef> iconURL(CFBundleCopyResourceURL(CFBundleGetMainBundle(), name, CFSTR("icns"), NULL));
|
||||
|
||||
if (CFURLGetFSRef(iconURL, &iconFSRef))
|
||||
{
|
||||
// Get a handle on the icon family
|
||||
IconFamilyHandle iconFamily;
|
||||
OSStatus err = ReadIconFromFSRef( &iconFSRef, &iconFamily );
|
||||
|
||||
if ( err == noErr )
|
||||
{
|
||||
err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef );
|
||||
}
|
||||
ReleaseResource( (Handle) iconFamily );
|
||||
}
|
||||
}
|
||||
|
||||
if ( iconRef )
|
||||
{
|
||||
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight );
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load an icon from an icon file using the underlying OS X API
|
||||
// The icon file must be in a format understood by the OS
|
||||
// Return true for success, false otherwise
|
||||
bool wxIcon::LoadIconFromFile(const wxString& filename, int desiredWidth, int desiredHeight)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
bool result = false;
|
||||
|
||||
#if wxOSX_USE_ICONREF
|
||||
OSStatus err;
|
||||
// Get a file system reference
|
||||
FSRef fsRef;
|
||||
err = FSPathMakeRef( (const wxUint8*)filename.utf8_str().data(), &fsRef, NULL );
|
||||
|
||||
if( err != noErr )
|
||||
return false;
|
||||
|
||||
// Get a handle on the icon family
|
||||
IconFamilyHandle iconFamily;
|
||||
err = ReadIconFromFSRef( &fsRef, &iconFamily );
|
||||
|
||||
if( err != noErr )
|
||||
return false;
|
||||
|
||||
// Get the icon reference itself
|
||||
IconRef iconRef;
|
||||
err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef );
|
||||
|
||||
if( err == noErr )
|
||||
{
|
||||
// If everything is OK, assign m_refData
|
||||
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight );
|
||||
result = true;
|
||||
}
|
||||
|
||||
// Release the iconFamily before returning
|
||||
ReleaseResource( (Handle) iconFamily );
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
// Load an icon from a file using functionality from wxWidgets
|
||||
// A suitable bitmap handler (or image handler) must be available
|
||||
// Return true on success, false otherwise
|
||||
bool wxIcon::LoadIconAsBitmap(const wxString& filename, wxBitmapType type, int desiredWidth, int desiredHeight)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
wxBitmapHandler *handler = wxBitmap::FindHandler( type );
|
||||
|
||||
if ( handler )
|
||||
{
|
||||
wxBitmap bmp ;
|
||||
if ( handler->LoadFile( &bmp , filename, type, desiredWidth, desiredHeight ))
|
||||
{
|
||||
CopyFromBitmap( bmp ) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
else
|
||||
{
|
||||
wxImage loadimage( filename, type );
|
||||
if (loadimage.IsOk())
|
||||
{
|
||||
if ( desiredWidth == -1 )
|
||||
desiredWidth = loadimage.GetWidth() ;
|
||||
if ( desiredHeight == -1 )
|
||||
desiredHeight = loadimage.GetHeight() ;
|
||||
if ( desiredWidth != loadimage.GetWidth() || desiredHeight != loadimage.GetHeight() )
|
||||
loadimage.Rescale( desiredWidth , desiredHeight ) ;
|
||||
|
||||
wxBitmap bmp( loadimage );
|
||||
CopyFromBitmap( bmp ) ;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
|
||||
{
|
||||
UnRef() ;
|
||||
|
||||
#if wxOSX_ICON_USE_NSIMAGE
|
||||
m_refData = new wxIconRefData( bmp.GetImage() , bmp.GetWidth(), bmp.GetHeight() ) ;
|
||||
#else
|
||||
// as the bitmap owns that ref, we have to acquire it as well
|
||||
|
||||
int w = bmp.GetWidth() ;
|
||||
int h = bmp.GetHeight() ;
|
||||
int sz = wxMax( w , h ) ;
|
||||
|
||||
if ( sz == 24 || sz == 64 )
|
||||
{
|
||||
wxBitmap scaleBmp( bmp.ConvertToImage().Scale( w * 2 , h * 2 ) ) ;
|
||||
m_refData = new wxIconRefData( (WXHICON) scaleBmp.CreateIconRef(), bmp.GetWidth(), bmp.GetHeight() ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_refData = new wxIconRefData( (WXHICON) bmp.CreateIconRef() , bmp.GetWidth(), bmp.GetHeight() ) ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler);
|
||||
|
||||
bool wxICONResourceHandler::LoadFile(
|
||||
wxBitmap *bitmap, const wxString& name, wxBitmapType WXUNUSED(flags),
|
||||
int desiredWidth, int desiredHeight )
|
||||
{
|
||||
wxIcon icon ;
|
||||
if ( icon.LoadFile( name , wxBITMAP_TYPE_ICON_RESOURCE , desiredWidth , desiredHeight ) )
|
||||
{
|
||||
bitmap->CopyFromIcon( icon ) ;
|
||||
return bitmap->IsOk() ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,11 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/main.cpp
|
||||
// Purpose: Entry point
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// We don't put main() in the library any more. GD.
|
@ -1,182 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/carbon/overlay.cpp
|
||||
// Purpose: common wxOverlay code
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2006-10-20
|
||||
// Copyright: (c) wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/overlay.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/private/overlay.h"
|
||||
|
||||
#ifdef wxHAS_NATIVE_OVERLAY
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
wxOverlayImpl::wxOverlayImpl()
|
||||
{
|
||||
m_window = NULL ;
|
||||
m_overlayContext = NULL ;
|
||||
m_overlayWindow = NULL ;
|
||||
}
|
||||
|
||||
wxOverlayImpl::~wxOverlayImpl()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
bool wxOverlayImpl::IsOk()
|
||||
{
|
||||
return m_overlayWindow != NULL ;
|
||||
}
|
||||
|
||||
void wxOverlayImpl::MacGetBounds( Rect *bounds )
|
||||
{
|
||||
int x, y;
|
||||
x=y=0;
|
||||
m_window->MacWindowToRootWindow( &x , &y ) ;
|
||||
wxNonOwnedWindow* tlw = m_window->MacGetTopLevelWindow();
|
||||
tlw->GetNonOwnedPeer()->WindowToScreen( &x, &y );
|
||||
|
||||
bounds->top = y+m_y;
|
||||
bounds->left = x+m_x;
|
||||
bounds->bottom = y+m_y+m_height;
|
||||
bounds->right = x+m_x+m_width;
|
||||
}
|
||||
|
||||
OSStatus wxOverlayImpl::CreateOverlayWindow()
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute;
|
||||
|
||||
if ( m_window )
|
||||
{
|
||||
m_overlayParentWindow =(WindowRef) m_window->MacGetTopLevelWindowRef();
|
||||
|
||||
Rect bounds ;
|
||||
MacGetBounds(&bounds);
|
||||
err = CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, &m_overlayWindow );
|
||||
if ( err == noErr )
|
||||
{
|
||||
SetWindowGroup( m_overlayWindow, GetWindowGroup(m_overlayParentWindow)); // Put them in the same group so that their window layers are consistent
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_overlayParentWindow = NULL ;
|
||||
CGRect cgbounds ;
|
||||
cgbounds = CGDisplayBounds(CGMainDisplayID());
|
||||
Rect bounds;
|
||||
bounds.top = (short)cgbounds.origin.y;
|
||||
bounds.left = (short)cgbounds.origin.x;
|
||||
bounds.bottom = (short)(bounds.top + cgbounds.size.height);
|
||||
bounds.right = (short)(bounds.left + cgbounds.size.width);
|
||||
err = CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, &m_overlayWindow );
|
||||
}
|
||||
ShowWindow(m_overlayWindow);
|
||||
return err;
|
||||
}
|
||||
|
||||
void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height )
|
||||
{
|
||||
wxASSERT_MSG( !IsOk() , _("You cannot Init an overlay twice") );
|
||||
|
||||
m_window = dc->GetWindow();
|
||||
m_x = x ;
|
||||
m_y = y ;
|
||||
if ( dc->IsKindOf( CLASSINFO( wxClientDC ) ))
|
||||
{
|
||||
wxPoint origin = m_window->GetClientAreaOrigin();
|
||||
m_x += origin.x;
|
||||
m_y += origin.y;
|
||||
}
|
||||
m_width = width ;
|
||||
m_height = height ;
|
||||
|
||||
OSStatus err = CreateOverlayWindow();
|
||||
wxASSERT_MSG( err == noErr , _("Couldn't create the overlay window") );
|
||||
#ifndef __LP64__
|
||||
err = QDBeginCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext);
|
||||
#endif
|
||||
CGContextTranslateCTM( m_overlayContext, 0, m_height );
|
||||
CGContextScaleCTM( m_overlayContext, 1, -1 );
|
||||
CGContextTranslateCTM( m_overlayContext, -m_x , -m_y );
|
||||
wxASSERT_MSG( err == noErr , _("Couldn't init the context on the overlay window") );
|
||||
}
|
||||
|
||||
void wxOverlayImpl::BeginDrawing( wxDC* dc)
|
||||
{
|
||||
wxDCImpl *impl = dc->GetImpl();
|
||||
wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
|
||||
if (win_impl)
|
||||
{
|
||||
win_impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
|
||||
dc->SetClippingRegion( m_x , m_y , m_width , m_height ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxOverlayImpl::EndDrawing( wxDC* dc)
|
||||
{
|
||||
wxDCImpl *impl = dc->GetImpl();
|
||||
wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
|
||||
if (win_impl)
|
||||
win_impl->SetGraphicsContext(NULL);
|
||||
|
||||
CGContextFlush( m_overlayContext );
|
||||
}
|
||||
|
||||
void wxOverlayImpl::Clear(wxDC* WXUNUSED(dc))
|
||||
{
|
||||
wxASSERT_MSG( IsOk() , _("You cannot Clear an overlay that is not inited") );
|
||||
CGRect box = CGRectMake( m_x - 1, m_y - 1 , m_width + 2 , m_height + 2 );
|
||||
CGContextClearRect( m_overlayContext, box );
|
||||
}
|
||||
|
||||
void wxOverlayImpl::Reset()
|
||||
{
|
||||
if ( m_overlayContext )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
OSStatus err = QDEndCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext);
|
||||
if ( err != noErr )
|
||||
{
|
||||
wxFAIL_MSG("Couldn't end the context on the overlay window");
|
||||
}
|
||||
#endif
|
||||
m_overlayContext = NULL ;
|
||||
}
|
||||
|
||||
// todo : don't dispose, only hide and reposition on next run
|
||||
if (m_overlayWindow)
|
||||
{
|
||||
DisposeWindow(m_overlayWindow);
|
||||
m_overlayWindow = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxHAS_NATIVE_OVERLAY
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user