forward port from 2.8

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-11-09 20:35:17 +00:00
parent fd87345120
commit ebf2a1eccf
14 changed files with 214 additions and 18 deletions

View File

@@ -49,6 +49,7 @@
#ifdef __WXMAC_CARBON__
#include "wx/mac/corefoundation/cfstring.h"
#include "wx/mac/corefoundation/cfdataref.h"
#endif
#ifndef FixedToInt
@@ -429,6 +430,11 @@ public :
operator refType () const { return m_ref; }
wxMacCFRefHolder& operator=(refType r)
{
Set( r );
return *this;
}
private :
refType m_ref;
bool m_release;
@@ -438,6 +444,40 @@ private :
#if wxUSE_GUI
class wxMacToolTipTimer ;
class wxMacToolTip
{
public :
wxMacToolTip() ;
~wxMacToolTip() ;
void Setup( WindowRef window , const wxString& text , const wxPoint& localPosition ) ;
void Draw() ;
void Clear() ;
long GetMark()
{ return m_mark ; }
bool IsShown()
{ return m_shown ; }
private :
wxString m_label ;
wxPoint m_position ;
Rect m_rect ;
WindowRef m_window ;
PicHandle m_backpict ;
bool m_shown ;
long m_mark ;
#if wxUSE_TIMER
wxMacToolTipTimer* m_timer ;
#endif
#if TARGET_CARBON
wxMacCFStringHolder m_helpTextRef ;
#endif
} ;
/*
GWorldPtr wxMacCreateGWorld( int width , int height , int depth );
void wxMacDestroyGWorld( GWorldPtr gw );
@@ -448,6 +488,7 @@ CTabHandle wxMacCreateColorTable( int numColors );
*/
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 );
void wxMacReleaseBitmapButton( ControlButtonContentInfo*info );
CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
#define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
#define MAC_WXHBITMAP(a) (GWorldPtr(a))
@@ -1085,6 +1126,26 @@ public:
// graphics implementation
// ============================================================================
// make sure we all use one class for all conversions from wx to native colour
class wxMacCoreGraphicsColour
{
public:
wxMacCoreGraphicsColour();
wxMacCoreGraphicsColour(const wxBrush &brush);
~wxMacCoreGraphicsColour();
void Apply( CGContextRef cgContext );
protected:
void Init();
wxMacCFRefHolder<CGColorRef> m_color;
wxMacCFRefHolder<CGColorSpaceRef> m_colorSpace;
bool m_isPattern;
wxMacCFRefHolder<CGPatternRef> m_pattern;
CGFloat* m_patternColorComponents;
} ;
#if wxMAC_USE_CORE_GRAPHICS && !wxUSE_GRAPHICS_CONTEXT
class WXDLLEXPORT wxMacCGPath : public wxGraphicPath
@@ -1225,9 +1286,13 @@ public:
// returns a Pict from the bitmap content
PicHandle GetPictHandle();
#if wxMAC_USE_CORE_GRAPHICS
CGContextRef GetBitmapContext() const;
#else
GWorldPtr GetHBITMAP(GWorldPtr * mask = NULL ) const;
void UpdateAlphaMask() const;
#endif
int GetBytesPerRow() const { return m_bytesPerRow; }
private :
bool Create(int width , int height , int depth);
void Init();
@@ -1245,10 +1310,14 @@ private :
#endif
IconRef m_iconRef;
PicHandle m_pictHandle;
#if wxMAC_USE_CORE_GRAPHICS
CGContextRef m_hBitmap;
#else
GWorldPtr m_hBitmap;
GWorldPtr m_hMaskBitmap;
wxMemoryBuffer m_maskMemBuf;
int m_maskBytesPerRow;
#endif
};
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
@@ -1276,6 +1345,16 @@ private :
// toplevel.cpp
class wxMacDeferredWindowDeleter : public wxObject
{
public :
wxMacDeferredWindowDeleter( WindowRef windowRef );
virtual ~wxMacDeferredWindowDeleter();
protected :
WindowRef m_macWindow ;
} ;
ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow, const Point& location , WindowRef window , ControlPartCode *outPart );
#ifndef __LP64__
@@ -1331,5 +1410,78 @@ void wxMacGlobalToLocal( WindowRef window , Point*pt );
#endif
//---------------------------------------------------------------------------
// cocoa bridging utilities
//---------------------------------------------------------------------------
bool wxMacInitCocoa();
class wxMacAutoreleasePool
{
public :
wxMacAutoreleasePool();
~wxMacAutoreleasePool();
private :
void* m_pool;
};
// NSObject
void wxMacCocoaRelease( void* obj );
void wxMacCocoaAutorelease( void* obj );
void wxMacCocoaRetain( void* obj );
#if wxMAC_USE_COCOA
// NSCursor
WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY );
void wxMacCocoaSetCursor( WX_NSCursor cursor );
void wxMacCocoaHideCursor();
void wxMacCocoaShowCursor();
typedef struct tagClassicCursor
{
wxUint16 bits[16];
wxUint16 mask[16];
wxInt16 hotspot[2];
}ClassicCursor;
#else // !wxMAC_USE_COCOA
// non Darwin
typedef Cursor ClassicCursor;
#endif // wxMAC_USE_COCOA
// -------------
// Common to all
// -------------
// Cursor support
const short kwxCursorBullseye = 0;
const short kwxCursorBlank = 1;
const short kwxCursorPencil = 2;
const short kwxCursorMagnifier = 3;
const short kwxCursorNoEntry = 4;
const short kwxCursorPaintBrush = 5;
const short kwxCursorPointRight = 6;
const short kwxCursorPointLeft = 7;
const short kwxCursorQuestionArrow = 8;
const short kwxCursorRightArrow = 9;
const short kwxCursorSizeNS = 10;
const short kwxCursorSize = 11;
const short kwxCursorSizeNESW = 12;
const short kwxCursorSizeNWSE = 13;
const short kwxCursorRoller = 14;
const short kwxCursorLast = kwxCursorRoller;
// exposing our fallback cursor map
extern ClassicCursor gMacCursors[];
#endif
// _WX_PRIVATE_H_