icon support moved to wxBitmap, allowing for fully transparent usage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -69,7 +69,7 @@ protected:
 | 
				
			|||||||
  WXHBITMAP m_maskBitmap;
 | 
					  WXHBITMAP m_maskBitmap;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum { kMacBitmapTypeUnknownType , kMacBitmapTypeGrafWorld, kMacBitmapTypePict } ;
 | 
					enum { kMacBitmapTypeUnknownType , kMacBitmapTypeGrafWorld, kMacBitmapTypePict , kMacBitmapTypeIcon } ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
 | 
					class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -92,6 +92,7 @@ public:
 | 
				
			|||||||
	int						m_bitmapType ;
 | 
						int						m_bitmapType ;
 | 
				
			||||||
	PicHandle			m_hPict ;
 | 
						PicHandle			m_hPict ;
 | 
				
			||||||
	WXHBITMAP     m_hBitmap;
 | 
						WXHBITMAP     m_hBitmap;
 | 
				
			||||||
 | 
						WXHICON m_hIcon ;
 | 
				
			||||||
  wxMask *      m_bitmapMask; // Optional mask
 | 
					  wxMask *      m_bitmapMask; // Optional mask
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -211,6 +212,8 @@ protected:
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
  void SetHBITMAP(WXHBITMAP bmp);
 | 
					  void SetHBITMAP(WXHBITMAP bmp);
 | 
				
			||||||
  WXHBITMAP GetHBITMAP() const;
 | 
					  WXHBITMAP GetHBITMAP() const;
 | 
				
			||||||
 | 
					  void SetHICON(WXHICON ico);
 | 
				
			||||||
 | 
					  inline WXHICON GetHICON() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hIcon : 0); }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  PicHandle GetPict() const;
 | 
					  PicHandle GetPict() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ class WXDLLEXPORT wxDC: public wxDCBase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    virtual void Clear();
 | 
					    virtual void Clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; };
 | 
					    virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
 | 
				
			||||||
    virtual void EndDoc(void) {};
 | 
					    virtual void EndDoc(void) {};
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    virtual void StartPage(void) {};
 | 
					    virtual void StartPage(void) {};
 | 
				
			||||||
@@ -235,21 +235,22 @@ protected:
 | 
				
			|||||||
                               wxCoord xoffset, wxCoord yoffset,
 | 
					                               wxCoord xoffset, wxCoord yoffset,
 | 
				
			||||||
                               int fillStyle = wxODDEVEN_RULE);
 | 
					                               int fillStyle = wxODDEVEN_RULE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  protected:
 | 
				
			||||||
 | 
					    //begin wxmac
 | 
				
			||||||
//
 | 
					    // Variables used for scaling
 | 
				
			||||||
 | 
					 | 
				
			||||||
  public:
 | 
					 | 
				
			||||||
//begin wxmac
 | 
					 | 
				
			||||||
    double       m_mm_to_pix_x,m_mm_to_pix_y; 
 | 
					    double       m_mm_to_pix_x,m_mm_to_pix_y; 
 | 
				
			||||||
    bool         m_needComputeScaleX,m_needComputeScaleY;         // not yet used
 | 
					    // not yet used
 | 
				
			||||||
    long         m_internalDeviceOriginX,m_internalDeviceOriginY;   // If un-scrolled is non-zero or
 | 
					    bool         m_needComputeScaleX,m_needComputeScaleY;         
 | 
				
			||||||
								    // d.o. changes with scrolling.
 | 
					    // If un-scrolled is non-zero or d.o. changes with scrolling.
 | 
				
			||||||
								    // Set using SetInternalDeviceOrigin().
 | 
						// Set using SetInternalDeviceOrigin().
 | 
				
			||||||
 | 
						long         m_internalDeviceOriginX,m_internalDeviceOriginY;  
 | 
				
			||||||
 | 
						 // To be set by external classes such as wxScrolledWindow
 | 
				
			||||||
 | 
						 // using SetDeviceOrigin()
 | 
				
			||||||
 | 
					    long         m_externalDeviceOriginX,m_externalDeviceOriginY;  
 | 
				
			||||||
 | 
					                                                                    
 | 
				
			||||||
 | 
					    // Begin implementation for Mac
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
								    
 | 
													    
 | 
				
			||||||
    long         m_externalDeviceOriginX,m_externalDeviceOriginY;   // To be set by external classes
 | 
					 | 
				
			||||||
                                                                    // such as wxScrolledWindow
 | 
					 | 
				
			||||||
								    // using SetDeviceOrigin()
 | 
					 | 
				
			||||||
	GrafPtr				m_macPort ;
 | 
						GrafPtr				m_macPort ;
 | 
				
			||||||
	GWorldPtr			m_macMask ;
 | 
						GWorldPtr			m_macMask ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,21 +18,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "wx/bitmap.h"
 | 
					#include "wx/bitmap.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    friend class WXDLLEXPORT wxBitmap;
 | 
					 | 
				
			||||||
    friend class WXDLLEXPORT wxIcon;
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
    wxIconRefData();
 | 
					 | 
				
			||||||
    ~wxIconRefData();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
  WXHICON m_hIcon;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define M_ICONDATA ((wxIconRefData *)m_refData)
 | 
					 | 
				
			||||||
#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Icon
 | 
					// Icon
 | 
				
			||||||
class WXDLLEXPORT wxIcon: public wxBitmap
 | 
					class WXDLLEXPORT wxIcon: public wxBitmap
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -44,8 +29,8 @@ public:
 | 
				
			|||||||
  // Copy constructors
 | 
					  // Copy constructors
 | 
				
			||||||
  inline wxIcon(const wxIcon& icon) { Ref(icon); }
 | 
					  inline wxIcon(const wxIcon& icon) { Ref(icon); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxIcon( const char **bits, int width=-1, int height=-1 );
 | 
					  wxIcon( const char **data );
 | 
				
			||||||
  wxIcon( char **bits, int width=-1, int height=-1 );
 | 
					  wxIcon( char **data );
 | 
				
			||||||
  wxIcon(const char bits[], int width, int height);
 | 
					  wxIcon(const char bits[], int width, int height);
 | 
				
			||||||
  wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE,
 | 
					  wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE,
 | 
				
			||||||
    int desiredWidth = -1, int desiredHeight = -1);
 | 
					    int desiredWidth = -1, int desiredHeight = -1);
 | 
				
			||||||
@@ -59,11 +44,6 @@ public:
 | 
				
			|||||||
  inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
 | 
					  inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
 | 
				
			||||||
  inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
 | 
					  inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
 | 
				
			||||||
  inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
 | 
					  inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  void SetHICON(WXHICON ico);
 | 
					 | 
				
			||||||
  inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  virtual bool Ok() const { return (m_refData != NULL) ; }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,21 +50,9 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
 | 
				
			|||||||
	virtual void OnPaint( wxPaintEvent &event ) ;
 | 
						virtual void OnPaint( wxPaintEvent &event ) ;
 | 
				
			||||||
  void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
 | 
					  void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
 | 
					  inline wxBitmap& GetBitmap() const { return m_messageBitmap; }
 | 
				
			||||||
 | 
					    const wxIcon& GetIcon() const { return (const wxIcon&) GetBitmap() ; }
 | 
				
			||||||
    // for compatibility with wxMSW
 | 
					    void  SetIcon(const wxIcon& icon) {SetBitmap( icon ) ; }
 | 
				
			||||||
    const wxIcon& GetIcon() const
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        // don't use wxDynamicCast, icons and bitmaps are really the same thing
 | 
					 | 
				
			||||||
        // in wxGTK
 | 
					 | 
				
			||||||
        return (const wxIcon &)m_messageBitmap;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // for compatibility with wxMSW
 | 
					 | 
				
			||||||
    void  SetIcon(const wxIcon& icon)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        SetBitmap( (const wxBitmap&) icon );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // overriden base class virtuals
 | 
					  // overriden base class virtuals
 | 
				
			||||||
  virtual bool AcceptsFocus() const { return FALSE; }
 | 
					  virtual bool AcceptsFocus() const { return FALSE; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -747,7 +747,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    panel = new wxPanel(m_notebook);
 | 
					    panel = new wxPanel(m_notebook);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(__WXMOTIF__) && !defined(__WXMAC__) && !defined(__WIN16__)  // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16.
 | 
					#if !defined(__WXMOTIF__) && !defined(__WIN16__)  // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16.
 | 
				
			||||||
    wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
 | 
					    wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
 | 
				
			||||||
    wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon,
 | 
					    wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon,
 | 
				
			||||||
                                                   wxPoint(10, 10));
 | 
					                                                   wxPoint(10, 10));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,8 +25,11 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <math.h>
 | 
					#include <math.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __WXMAC__
 | 
				
			||||||
 | 
					// does this not give redefine errors on other platforms ?
 | 
				
			||||||
#define wxInt32 int
 | 
					#define wxInt32 int
 | 
				
			||||||
#define wxUint32 unsigned int
 | 
					#define wxUint32 unsigned int
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef FALSE
 | 
					#ifndef FALSE
 | 
				
			||||||
#define FALSE 0
 | 
					#define FALSE 0
 | 
				
			||||||
@@ -57,12 +60,23 @@ static wxInt32 read_char(FILE *f)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static wxInt32 read_short(FILE *f)
 | 
					static wxInt32 read_short(FILE *f)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return (read_char(f)<<8) | read_char(f);
 | 
					    // the execution path was not always correct
 | 
				
			||||||
 | 
					    // when using the direct evaluation in the return statement
 | 
				
			||||||
 | 
					    wxInt32 first = read_char(f) ;
 | 
				
			||||||
 | 
					    wxInt32 second = read_char(f) ;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					  return (first<<8) | second ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static wxInt32 read_long(FILE *f)
 | 
					static wxInt32 read_long(FILE *f)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return (read_char(f)<<24) | (read_char(f)<<16) | (read_char(f)<<8) | read_char(f);
 | 
					    // the execution path was not always correct
 | 
				
			||||||
 | 
					    // when using the direct evaluation in the return statement
 | 
				
			||||||
 | 
					    wxInt32 first = read_char(f) ;
 | 
				
			||||||
 | 
					    wxInt32 second = read_char(f) ;
 | 
				
			||||||
 | 
					    wxInt32 third = read_char(f) ;
 | 
				
			||||||
 | 
					    wxInt32 fourth = read_char(f) ;
 | 
				
			||||||
 | 
					  return (first<<24) | (second<<16) | (third<<8) | fourth ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GLfloat read_float(FILE *f)
 | 
					static GLfloat read_float(FILE *f)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,11 @@
 | 
				
			|||||||
#ifndef LW_H
 | 
					#ifndef LW_H
 | 
				
			||||||
#define LW_H
 | 
					#define LW_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <GL/gl.h>
 | 
					#ifdef __WXMAC__
 | 
				
			||||||
 | 
					#include <glu.h>
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#include <GL/glu.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LW_MAX_POINTS   200
 | 
					#define LW_MAX_POINTS   200
 | 
				
			||||||
#define LW_MAX_NAME_LEN 500
 | 
					#define LW_MAX_NAME_LEN 500
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,11 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "penguin.h"
 | 
					#include "penguin.h"
 | 
				
			||||||
 | 
					#ifdef __WXMAC__
 | 
				
			||||||
 | 
					#include <glu.h>
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
#include <GL/glu.h>
 | 
					#include <GL/glu.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define VIEW_ASPECT 1.3
 | 
					#define VIEW_ASPECT 1.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -147,16 +151,9 @@ void TestGLCanvas::OnPaint( wxPaintEvent& event )
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void TestGLCanvas::OnSize(wxSizeEvent& event)
 | 
					void TestGLCanvas::OnSize(wxSizeEvent& event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int width, height;
 | 
					    // the viewport must be initialized this way, not glViewport
 | 
				
			||||||
    GetClientSize(& width, & height);
 | 
					    // this is also necessary to update the context on some platforms
 | 
				
			||||||
    
 | 
					    wxGLCanvas::OnSize(event);
 | 
				
			||||||
#ifndef __WXMOTIF__
 | 
					 | 
				
			||||||
    if (GetContext())
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        SetCurrent();
 | 
					 | 
				
			||||||
        glViewport(0, 0, width, height);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
 | 
					void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -201,6 +201,7 @@ wxBitmapRefData::wxBitmapRefData()
 | 
				
			|||||||
    m_bitmapMask = NULL;
 | 
					    m_bitmapMask = NULL;
 | 
				
			||||||
    m_hBitmap = NULL ;
 | 
					    m_hBitmap = NULL ;
 | 
				
			||||||
    m_hPict = NULL ;
 | 
					    m_hPict = NULL ;
 | 
				
			||||||
 | 
					    m_hIcon = NULL ;
 | 
				
			||||||
    m_bitmapType = kMacBitmapTypeUnknownType ;
 | 
					    m_bitmapType = kMacBitmapTypeUnknownType ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -226,6 +227,13 @@ wxBitmapRefData::~wxBitmapRefData()
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break ;
 | 
								break ;
 | 
				
			||||||
 | 
							case kMacBitmapTypeIcon :
 | 
				
			||||||
 | 
					        	if ( m_hIcon )
 | 
				
			||||||
 | 
					        	{
 | 
				
			||||||
 | 
					        		DisposeCIcon( m_hIcon ) ;
 | 
				
			||||||
 | 
					        		m_hIcon = NULL ;
 | 
				
			||||||
 | 
					        	}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		default :
 | 
							default :
 | 
				
			||||||
			// unkown type ?
 | 
								// unkown type ?
 | 
				
			||||||
			break ;
 | 
								break ;
 | 
				
			||||||
@@ -488,7 +496,7 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
 | 
					    M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
 | 
				
			||||||
    M_BITMAPDATA->m_hBitmap = bmp ;
 | 
					    M_BITMAPDATA->m_hBitmap = bmp ;
 | 
				
			||||||
		M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
 | 
						M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxBitmap::LoadFile(const wxString& filename, long type)
 | 
					bool wxBitmap::LoadFile(const wxString& filename, long type)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,36 +52,44 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	Rect bounds ;
 | 
						Rect bounds ;
 | 
				
			||||||
	Str255 title ;
 | 
						Str255 title ;
 | 
				
			||||||
 | 
					    m_buttonBitmap = bitmap;
 | 
				
			||||||
 | 
						wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 | 
						MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 
 | 
						m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 
 | 
				
			||||||
		kControlBehaviorOffsetContents + kControlContentPictHandle , 0, 
 | 
							kControlBehaviorOffsetContents + 
 | 
				
			||||||
 | 
							    ( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
 | 
				
			||||||
	  	(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
 | 
						  	(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
 | 
				
			||||||
	wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
 | 
						wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    m_buttonBitmap = bitmap;
 | 
						ControlButtonContentInfo info ;
 | 
				
			||||||
			PicHandle	icon = NULL ;
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ( m_buttonBitmap.Ok() )
 | 
						if ( m_buttonBitmap.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
							if ( bmap->m_bitmapType == kMacBitmapTypePict ) {
 | 
				
			||||||
		if ( bmap->m_bitmapType == kMacBitmapTypePict )
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
			icon = bmap->m_hPict ;
 | 
						        info.u.picture = bmap->m_hPict ;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
			if ( m_buttonBitmap.GetMask() )
 | 
								if ( m_buttonBitmap.GetMask() )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentCIconHandle ;
 | 
				
			||||||
 | 
						        info.u.cIconHandle = bmap->m_hIcon ;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ControlButtonContentInfo info ;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	info.contentType = kControlContentPictHandle ;
 | 
					 | 
				
			||||||
	info.u.picture = icon ;
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
						UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -92,30 +100,36 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
 | 
					void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						ControlButtonContentInfo info ;
 | 
				
			||||||
    m_buttonBitmap = bitmap;
 | 
					    m_buttonBitmap = bitmap;
 | 
				
			||||||
			PicHandle	icon = NULL ;
 | 
					
 | 
				
			||||||
	if ( m_buttonBitmap.Ok() )
 | 
						if ( m_buttonBitmap.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
							wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
				
			||||||
		if ( bmap->m_bitmapType == kMacBitmapTypePict )
 | 
							if ( bmap->m_bitmapType == kMacBitmapTypePict )
 | 
				
			||||||
			icon = bmap->m_hPict ;
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
 | 
						        info.u.picture = bmap->m_hPict ;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
			if ( m_buttonBitmap.GetMask() )
 | 
								if ( m_buttonBitmap.GetMask() )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
 | 
				
			||||||
	ControlButtonContentInfo info ;
 | 
							{
 | 
				
			||||||
	
 | 
						        info.contentType = kControlContentCIconHandle ;
 | 
				
			||||||
	info.contentType = kControlContentPictHandle ;
 | 
						        info.u.cIconHandle = bmap->m_hIcon ;
 | 
				
			||||||
	info.u.picture = icon ;
 | 
							}
 | 
				
			||||||
	
 | 
							
 | 
				
			||||||
	UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
						    UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -201,6 +201,7 @@ wxBitmapRefData::wxBitmapRefData()
 | 
				
			|||||||
    m_bitmapMask = NULL;
 | 
					    m_bitmapMask = NULL;
 | 
				
			||||||
    m_hBitmap = NULL ;
 | 
					    m_hBitmap = NULL ;
 | 
				
			||||||
    m_hPict = NULL ;
 | 
					    m_hPict = NULL ;
 | 
				
			||||||
 | 
					    m_hIcon = NULL ;
 | 
				
			||||||
    m_bitmapType = kMacBitmapTypeUnknownType ;
 | 
					    m_bitmapType = kMacBitmapTypeUnknownType ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -226,6 +227,13 @@ wxBitmapRefData::~wxBitmapRefData()
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break ;
 | 
								break ;
 | 
				
			||||||
 | 
							case kMacBitmapTypeIcon :
 | 
				
			||||||
 | 
					        	if ( m_hIcon )
 | 
				
			||||||
 | 
					        	{
 | 
				
			||||||
 | 
					        		DisposeCIcon( m_hIcon ) ;
 | 
				
			||||||
 | 
					        		m_hIcon = NULL ;
 | 
				
			||||||
 | 
					        	}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		default :
 | 
							default :
 | 
				
			||||||
			// unkown type ?
 | 
								// unkown type ?
 | 
				
			||||||
			break ;
 | 
								break ;
 | 
				
			||||||
@@ -488,7 +496,7 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
 | 
					    M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
 | 
				
			||||||
    M_BITMAPDATA->m_hBitmap = bmp ;
 | 
					    M_BITMAPDATA->m_hBitmap = bmp ;
 | 
				
			||||||
		M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
 | 
						M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxBitmap::LoadFile(const wxString& filename, long type)
 | 
					bool wxBitmap::LoadFile(const wxString& filename, long type)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,36 +52,44 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	Rect bounds ;
 | 
						Rect bounds ;
 | 
				
			||||||
	Str255 title ;
 | 
						Str255 title ;
 | 
				
			||||||
 | 
					    m_buttonBitmap = bitmap;
 | 
				
			||||||
 | 
						wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 | 
						MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 
 | 
						m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 
 | 
				
			||||||
		kControlBehaviorOffsetContents + kControlContentPictHandle , 0, 
 | 
							kControlBehaviorOffsetContents + 
 | 
				
			||||||
 | 
							    ( bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
 | 
				
			||||||
	  	(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
 | 
						  	(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
 | 
				
			||||||
	wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
 | 
						wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    m_buttonBitmap = bitmap;
 | 
						ControlButtonContentInfo info ;
 | 
				
			||||||
			PicHandle	icon = NULL ;
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ( m_buttonBitmap.Ok() )
 | 
						if ( m_buttonBitmap.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
							if ( bmap->m_bitmapType == kMacBitmapTypePict ) {
 | 
				
			||||||
		if ( bmap->m_bitmapType == kMacBitmapTypePict )
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
			icon = bmap->m_hPict ;
 | 
						        info.u.picture = bmap->m_hPict ;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
			if ( m_buttonBitmap.GetMask() )
 | 
								if ( m_buttonBitmap.GetMask() )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentCIconHandle ;
 | 
				
			||||||
 | 
						        info.u.cIconHandle = bmap->m_hIcon ;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ControlButtonContentInfo info ;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	info.contentType = kControlContentPictHandle ;
 | 
					 | 
				
			||||||
	info.u.picture = icon ;
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
						UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -92,30 +100,36 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
 | 
					void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						ControlButtonContentInfo info ;
 | 
				
			||||||
    m_buttonBitmap = bitmap;
 | 
					    m_buttonBitmap = bitmap;
 | 
				
			||||||
			PicHandle	icon = NULL ;
 | 
					
 | 
				
			||||||
	if ( m_buttonBitmap.Ok() )
 | 
						if ( m_buttonBitmap.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
							wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
 | 
				
			||||||
		if ( bmap->m_bitmapType == kMacBitmapTypePict )
 | 
							if ( bmap->m_bitmapType == kMacBitmapTypePict )
 | 
				
			||||||
			icon = bmap->m_hPict ;
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
 | 
						        info.u.picture = bmap->m_hPict ;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
						        info.contentType = kControlContentPictHandle ;
 | 
				
			||||||
			if ( m_buttonBitmap.GetMask() )
 | 
								if ( m_buttonBitmap.GetMask() )
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , m_buttonBitmap.GetMask()->GetMaskBitmap() ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				icon = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
									info.u.picture = MakePict( bmap->m_hBitmap , NULL ) ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
							else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
 | 
				
			||||||
	ControlButtonContentInfo info ;
 | 
							{
 | 
				
			||||||
	
 | 
						        info.contentType = kControlContentCIconHandle ;
 | 
				
			||||||
	info.contentType = kControlContentPictHandle ;
 | 
						        info.u.cIconHandle = bmap->m_hIcon ;
 | 
				
			||||||
	info.u.picture = icon ;
 | 
							}
 | 
				
			||||||
	
 | 
							
 | 
				
			||||||
	UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
						    UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -39,12 +39,11 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
 | 
				
			|||||||
  m_ok = FALSE;
 | 
					  m_ok = FALSE;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxMemoryDC::~wxMemoryDC(void)
 | 
					wxMemoryDC::~wxMemoryDC()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if ( m_selected.Ok() )
 | 
						if ( m_selected.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
 | 
					 		UnlockPixels( GetGWorldPixMap(m_selected.GetHBITMAP()) );
 | 
				
			||||||
		UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,16 +51,14 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if ( m_selected.Ok() )
 | 
						if ( m_selected.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
 | 
					 		UnlockPixels( GetGWorldPixMap(m_selected.GetHBITMAP()) );
 | 
				
			||||||
		UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
  m_selected = bitmap;
 | 
					    m_selected = bitmap;
 | 
				
			||||||
  if (m_selected.Ok())
 | 
					    if (m_selected.Ok())
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
 | 
							if ( m_selected.GetHBITMAP() )
 | 
				
			||||||
		if ( bmap->m_hBitmap )
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			m_macPort = (GrafPtr) bmap->m_hBitmap ;
 | 
								m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
 | 
				
			||||||
			LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
 | 
								LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
 | 
				
			||||||
			wxMask * mask = bitmap.GetMask() ;
 | 
								wxMask * mask = bitmap.GetMask() ;
 | 
				
			||||||
			if ( mask )
 | 
								if ( mask )
 | 
				
			||||||
@@ -69,18 +66,17 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 | 
				
			|||||||
				m_macMask = mask->GetMaskBitmap() ;
 | 
									m_macMask = mask->GetMaskBitmap() ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 			m_ok = TRUE ;
 | 
					 			m_ok = TRUE ;
 | 
				
			||||||
			// SetBackground(wxBrush(*wxWHITE, wxSOLID));
 | 
					 | 
				
			||||||
 		}
 | 
					 		}
 | 
				
			||||||
 		else
 | 
					 		else
 | 
				
			||||||
 		{
 | 
					 		{
 | 
				
			||||||
	    m_ok = FALSE;
 | 
						        m_ok = FALSE;
 | 
				
			||||||
 		}
 | 
					 		}
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    m_ok = FALSE;
 | 
					    m_ok = FALSE;
 | 
				
			||||||
  };
 | 
					  }
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxMemoryDC::DoGetSize( int *width, int *height ) const
 | 
					void wxMemoryDC::DoGetSize( int *width, int *height ) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -93,7 +89,7 @@ void wxMemoryDC::DoGetSize( int *width, int *height ) const
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    if (width) (*width) = 0;
 | 
					    if (width) (*width) = 0;
 | 
				
			||||||
    if (height) (*height) = 0;
 | 
					    if (height) (*height) = 0;
 | 
				
			||||||
  };
 | 
					  }
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,48 +23,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
 | 
				
			|||||||
 * Icons
 | 
					 * Icons
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIconRefData::wxIconRefData()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    m_ok = FALSE;
 | 
					 | 
				
			||||||
    m_width = 0;
 | 
					 | 
				
			||||||
    m_height = 0;
 | 
					 | 
				
			||||||
    m_depth = 0;
 | 
					 | 
				
			||||||
    m_quality = 0;
 | 
					 | 
				
			||||||
    m_numColors = 0;
 | 
					 | 
				
			||||||
    m_bitmapMask = NULL;
 | 
					 | 
				
			||||||
		m_hBitmap = NULL ;
 | 
					 | 
				
			||||||
		m_hIcon = NULL ;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIconRefData::~wxIconRefData()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if ( m_hIcon )
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		DisposeCIcon( m_hIcon ) ;
 | 
					 | 
				
			||||||
		m_hIcon = NULL ;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
  if (m_bitmapMask)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    delete m_bitmapMask;
 | 
					 | 
				
			||||||
    m_bitmapMask = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIcon::wxIcon()
 | 
					wxIcon::wxIcon()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxIcon::wxIcon(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height))
 | 
					wxIcon::wxIcon(const char bits[], int width, int height) :
 | 
				
			||||||
 | 
					    wxBitmap(bits,width,height )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxIcon::wxIcon( const char **bits ) :
 | 
				
			||||||
 | 
					    wxBitmap(bits  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxIcon::wxIcon( const char **bits, int width, int height )
 | 
					wxIcon::wxIcon( char **bits ) :
 | 
				
			||||||
{
 | 
					    wxBitmap(bits )
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIcon::wxIcon( char **bits, int width, int height )
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -84,7 +59,7 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  UnRef();
 | 
					  UnRef();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  m_refData = new wxIconRefData;
 | 
					  m_refData = new wxBitmapRefData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxBitmapHandler *handler = FindHandler(type);
 | 
					  wxBitmapHandler *handler = FindHandler(type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,33 +74,55 @@ IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
 | 
				
			|||||||
bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
 | 
					bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
 | 
				
			||||||
          int desiredWidth, int desiredHeight)
 | 
					          int desiredWidth, int desiredHeight)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Str255 theName ;
 | 
						short theId = -1 ;
 | 
				
			||||||
	short theId ;
 | 
					    if ( name == "wxICON_INFO" )
 | 
				
			||||||
	OSType theType ;
 | 
					    {
 | 
				
			||||||
 | 
					        theId = kNoteIcon ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if ( name == "wxICON_QUESTION" )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        theId = kCautionIcon ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if ( name == "wxICON_WARNING" )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					         theId = kCautionIcon ;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					    else if ( name == "wxICON_ERROR" )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        theId = kStopIcon ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    	Str255 theName ;
 | 
				
			||||||
 | 
					    	OSType theType ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if TARGET_CARBON
 | 
					    #if TARGET_CARBON
 | 
				
			||||||
	c2pstrcpy( (StringPtr) theName , name ) ;
 | 
					    	c2pstrcpy( (StringPtr) theName , name ) ;
 | 
				
			||||||
#else
 | 
					    #else
 | 
				
			||||||
	strcpy( (char *) theName , name ) ;
 | 
					    	strcpy( (char *) theName , name ) ;
 | 
				
			||||||
	c2pstr( (char *) theName ) ;
 | 
					    	c2pstr( (char *) theName ) ;
 | 
				
			||||||
#endif
 | 
					    #endif
 | 
				
			||||||
	
 | 
					    	
 | 
				
			||||||
	Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
 | 
					    	Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
 | 
				
			||||||
	if ( resHandle != 0L )
 | 
					    	if ( resHandle != 0L )
 | 
				
			||||||
 | 
					    	{
 | 
				
			||||||
 | 
					    		GetResInfo( resHandle , &theId , &theType , theName ) ;
 | 
				
			||||||
 | 
					    		ReleaseResource( resHandle ) ;
 | 
				
			||||||
 | 
					    	}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
						if ( theId != -1 )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		GetResInfo( resHandle , &theId , &theType , theName ) ;
 | 
					 | 
				
			||||||
		ReleaseResource( resHandle ) ;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
 | 
							CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
 | 
				
			||||||
		if ( theIcon )
 | 
							if ( theIcon )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			M_ICONHANDLERDATA->m_hIcon = theIcon ;
 | 
								M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_width =  32 ;
 | 
								M_BITMAPHANDLERDATA->m_width =  32 ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_height = 32 ;
 | 
								M_BITMAPHANDLERDATA->m_height = 32 ;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			M_ICONHANDLERDATA->m_depth = 8 ;
 | 
								M_BITMAPHANDLERDATA->m_depth = 8 ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_ok = true ;
 | 
								M_BITMAPHANDLERDATA->m_ok = true ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_numColors = 256 ;
 | 
								M_BITMAPHANDLERDATA->m_numColors = 256 ;
 | 
				
			||||||
 | 
								M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
 | 
				
			||||||
			return TRUE ;
 | 
								return TRUE ;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,6 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
 | 
				
			|||||||
    m_foregroundColour = parent->GetForegroundColour() ;
 | 
					    m_foregroundColour = parent->GetForegroundColour() ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_messageBitmap = bitmap;
 | 
					    m_messageBitmap = bitmap;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ( id == -1 )
 | 
					    if ( id == -1 )
 | 
				
			||||||
  	    m_windowId = (int)NewControlId();
 | 
					  	    m_windowId = (int)NewControlId();
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
@@ -66,19 +65,20 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
 | 
				
			|||||||
    m_messageBitmap = bitmap;
 | 
					    m_messageBitmap = bitmap;
 | 
				
			||||||
    SetSizeOrDefault();
 | 
					    SetSizeOrDefault();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxStaticBitmap::OnPaint( wxPaintEvent &event ) 
 | 
					void wxStaticBitmap::OnPaint( wxPaintEvent &event ) 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxPaintDC dc(this);
 | 
					    wxPaintDC dc(this);
 | 
				
			||||||
    PrepareDC(dc);
 | 
					    PrepareDC(dc);
 | 
				
			||||||
	dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
 | 
					
 | 
				
			||||||
	dc.DrawBitmap( m_messageBitmap , 0 , 0 , TRUE ) ;
 | 
					    dc.DrawBitmap( m_messageBitmap , 0 , 0 , TRUE ) ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxSize wxStaticBitmap::DoGetBestSize() const
 | 
					wxSize wxStaticBitmap::DoGetBestSize() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if ( m_messageBitmap.Ok() )
 | 
					   if ( m_messageBitmap.Ok() )
 | 
				
			||||||
        return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
 | 
					       return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
 | 
				
			||||||
    else
 | 
					   else
 | 
				
			||||||
        return wxSize(16, 16);  // completely arbitrary
 | 
					       return wxSize(16, 16);  // completely arbitrary
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										756
									
								
								src/mac/dc.cpp
									
									
									
									
									
								
							
							
						
						
									
										756
									
								
								src/mac/dc.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -39,12 +39,11 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
 | 
				
			|||||||
  m_ok = FALSE;
 | 
					  m_ok = FALSE;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxMemoryDC::~wxMemoryDC(void)
 | 
					wxMemoryDC::~wxMemoryDC()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if ( m_selected.Ok() )
 | 
						if ( m_selected.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
 | 
					 		UnlockPixels( GetGWorldPixMap(m_selected.GetHBITMAP()) );
 | 
				
			||||||
		UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,16 +51,14 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if ( m_selected.Ok() )
 | 
						if ( m_selected.Ok() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
 | 
					 		UnlockPixels( GetGWorldPixMap(m_selected.GetHBITMAP()) );
 | 
				
			||||||
		UnlockPixels( GetGWorldPixMap(  (CGrafPtr) bmap->m_hBitmap ) ) ;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
  m_selected = bitmap;
 | 
					    m_selected = bitmap;
 | 
				
			||||||
  if (m_selected.Ok())
 | 
					    if (m_selected.Ok())
 | 
				
			||||||
  {
 | 
					    {
 | 
				
			||||||
		wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
 | 
							if ( m_selected.GetHBITMAP() )
 | 
				
			||||||
		if ( bmap->m_hBitmap )
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			m_macPort = (GrafPtr) bmap->m_hBitmap ;
 | 
								m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
 | 
				
			||||||
			LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
 | 
								LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
 | 
				
			||||||
			wxMask * mask = bitmap.GetMask() ;
 | 
								wxMask * mask = bitmap.GetMask() ;
 | 
				
			||||||
			if ( mask )
 | 
								if ( mask )
 | 
				
			||||||
@@ -69,18 +66,17 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 | 
				
			|||||||
				m_macMask = mask->GetMaskBitmap() ;
 | 
									m_macMask = mask->GetMaskBitmap() ;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 			m_ok = TRUE ;
 | 
					 			m_ok = TRUE ;
 | 
				
			||||||
			// SetBackground(wxBrush(*wxWHITE, wxSOLID));
 | 
					 | 
				
			||||||
 		}
 | 
					 		}
 | 
				
			||||||
 		else
 | 
					 		else
 | 
				
			||||||
 		{
 | 
					 		{
 | 
				
			||||||
	    m_ok = FALSE;
 | 
						        m_ok = FALSE;
 | 
				
			||||||
 		}
 | 
					 		}
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    m_ok = FALSE;
 | 
					    m_ok = FALSE;
 | 
				
			||||||
  };
 | 
					  }
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxMemoryDC::DoGetSize( int *width, int *height ) const
 | 
					void wxMemoryDC::DoGetSize( int *width, int *height ) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -93,7 +89,7 @@ void wxMemoryDC::DoGetSize( int *width, int *height ) const
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    if (width) (*width) = 0;
 | 
					    if (width) (*width) = 0;
 | 
				
			||||||
    if (height) (*height) = 0;
 | 
					    if (height) (*height) = 0;
 | 
				
			||||||
  };
 | 
					  }
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										111
									
								
								src/mac/icon.cpp
									
									
									
									
									
								
							
							
						
						
									
										111
									
								
								src/mac/icon.cpp
									
									
									
									
									
								
							@@ -23,48 +23,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
 | 
				
			|||||||
 * Icons
 | 
					 * Icons
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIconRefData::wxIconRefData()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    m_ok = FALSE;
 | 
					 | 
				
			||||||
    m_width = 0;
 | 
					 | 
				
			||||||
    m_height = 0;
 | 
					 | 
				
			||||||
    m_depth = 0;
 | 
					 | 
				
			||||||
    m_quality = 0;
 | 
					 | 
				
			||||||
    m_numColors = 0;
 | 
					 | 
				
			||||||
    m_bitmapMask = NULL;
 | 
					 | 
				
			||||||
		m_hBitmap = NULL ;
 | 
					 | 
				
			||||||
		m_hIcon = NULL ;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIconRefData::~wxIconRefData()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if ( m_hIcon )
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		DisposeCIcon( m_hIcon ) ;
 | 
					 | 
				
			||||||
		m_hIcon = NULL ;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
  if (m_bitmapMask)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    delete m_bitmapMask;
 | 
					 | 
				
			||||||
    m_bitmapMask = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIcon::wxIcon()
 | 
					wxIcon::wxIcon()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxIcon::wxIcon(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height))
 | 
					wxIcon::wxIcon(const char bits[], int width, int height) :
 | 
				
			||||||
 | 
					    wxBitmap(bits,width,height )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxIcon::wxIcon( const char **bits ) :
 | 
				
			||||||
 | 
					    wxBitmap(bits  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxIcon::wxIcon( const char **bits, int width, int height )
 | 
					wxIcon::wxIcon( char **bits ) :
 | 
				
			||||||
{
 | 
					    wxBitmap(bits )
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wxIcon::wxIcon( char **bits, int width, int height )
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -84,7 +59,7 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  UnRef();
 | 
					  UnRef();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  m_refData = new wxIconRefData;
 | 
					  m_refData = new wxBitmapRefData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wxBitmapHandler *handler = FindHandler(type);
 | 
					  wxBitmapHandler *handler = FindHandler(type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,33 +74,55 @@ IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
 | 
				
			|||||||
bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
 | 
					bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
 | 
				
			||||||
          int desiredWidth, int desiredHeight)
 | 
					          int desiredWidth, int desiredHeight)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Str255 theName ;
 | 
						short theId = -1 ;
 | 
				
			||||||
	short theId ;
 | 
					    if ( name == "wxICON_INFO" )
 | 
				
			||||||
	OSType theType ;
 | 
					    {
 | 
				
			||||||
 | 
					        theId = kNoteIcon ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if ( name == "wxICON_QUESTION" )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        theId = kCautionIcon ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if ( name == "wxICON_WARNING" )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					         theId = kCautionIcon ;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					    else if ( name == "wxICON_ERROR" )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        theId = kStopIcon ;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    	Str255 theName ;
 | 
				
			||||||
 | 
					    	OSType theType ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if TARGET_CARBON
 | 
					    #if TARGET_CARBON
 | 
				
			||||||
	c2pstrcpy( (StringPtr) theName , name ) ;
 | 
					    	c2pstrcpy( (StringPtr) theName , name ) ;
 | 
				
			||||||
#else
 | 
					    #else
 | 
				
			||||||
	strcpy( (char *) theName , name ) ;
 | 
					    	strcpy( (char *) theName , name ) ;
 | 
				
			||||||
	c2pstr( (char *) theName ) ;
 | 
					    	c2pstr( (char *) theName ) ;
 | 
				
			||||||
#endif
 | 
					    #endif
 | 
				
			||||||
	
 | 
					    	
 | 
				
			||||||
	Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
 | 
					    	Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
 | 
				
			||||||
	if ( resHandle != 0L )
 | 
					    	if ( resHandle != 0L )
 | 
				
			||||||
 | 
					    	{
 | 
				
			||||||
 | 
					    		GetResInfo( resHandle , &theId , &theType , theName ) ;
 | 
				
			||||||
 | 
					    		ReleaseResource( resHandle ) ;
 | 
				
			||||||
 | 
					    	}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
						if ( theId != -1 )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		GetResInfo( resHandle , &theId , &theType , theName ) ;
 | 
					 | 
				
			||||||
		ReleaseResource( resHandle ) ;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
 | 
							CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
 | 
				
			||||||
		if ( theIcon )
 | 
							if ( theIcon )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			M_ICONHANDLERDATA->m_hIcon = theIcon ;
 | 
								M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_width =  32 ;
 | 
								M_BITMAPHANDLERDATA->m_width =  32 ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_height = 32 ;
 | 
								M_BITMAPHANDLERDATA->m_height = 32 ;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			M_ICONHANDLERDATA->m_depth = 8 ;
 | 
								M_BITMAPHANDLERDATA->m_depth = 8 ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_ok = true ;
 | 
								M_BITMAPHANDLERDATA->m_ok = true ;
 | 
				
			||||||
			M_ICONHANDLERDATA->m_numColors = 256 ;
 | 
								M_BITMAPHANDLERDATA->m_numColors = 256 ;
 | 
				
			||||||
 | 
								M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
 | 
				
			||||||
			return TRUE ;
 | 
								return TRUE ;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,6 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
 | 
				
			|||||||
    m_foregroundColour = parent->GetForegroundColour() ;
 | 
					    m_foregroundColour = parent->GetForegroundColour() ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_messageBitmap = bitmap;
 | 
					    m_messageBitmap = bitmap;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ( id == -1 )
 | 
					    if ( id == -1 )
 | 
				
			||||||
  	    m_windowId = (int)NewControlId();
 | 
					  	    m_windowId = (int)NewControlId();
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
@@ -66,19 +65,20 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
 | 
				
			|||||||
    m_messageBitmap = bitmap;
 | 
					    m_messageBitmap = bitmap;
 | 
				
			||||||
    SetSizeOrDefault();
 | 
					    SetSizeOrDefault();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxStaticBitmap::OnPaint( wxPaintEvent &event ) 
 | 
					void wxStaticBitmap::OnPaint( wxPaintEvent &event ) 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxPaintDC dc(this);
 | 
					    wxPaintDC dc(this);
 | 
				
			||||||
    PrepareDC(dc);
 | 
					    PrepareDC(dc);
 | 
				
			||||||
	dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
 | 
					
 | 
				
			||||||
	dc.DrawBitmap( m_messageBitmap , 0 , 0 , TRUE ) ;
 | 
					    dc.DrawBitmap( m_messageBitmap , 0 , 0 , TRUE ) ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxSize wxStaticBitmap::DoGetBestSize() const
 | 
					wxSize wxStaticBitmap::DoGetBestSize() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if ( m_messageBitmap.Ok() )
 | 
					   if ( m_messageBitmap.Ok() )
 | 
				
			||||||
        return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
 | 
					       return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
 | 
				
			||||||
    else
 | 
					   else
 | 
				
			||||||
        return wxSize(16, 16);  // completely arbitrary
 | 
					       return wxSize(16, 16);  // completely arbitrary
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user