mac updates and msw bitmapdrawing on printer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5371 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -382,6 +382,7 @@ class WXDLLEXPORT wxDC: public wxObject
|
|||||||
|
|
||||||
//begin wxmac
|
//begin wxmac
|
||||||
GrafPtr m_macPort ;
|
GrafPtr m_macPort ;
|
||||||
|
GWorldPtr m_macMask ;
|
||||||
|
|
||||||
// in order to preserve the const inheritance of the virtual functions, we have to
|
// in order to preserve the const inheritance of the virtual functions, we have to
|
||||||
// use mutable variables starting from CWPro 5
|
// use mutable variables starting from CWPro 5
|
||||||
|
@@ -111,6 +111,7 @@ public:
|
|||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
bool IsModalShowing() const { return m_modalShowing; }
|
bool IsModalShowing() const { return m_modalShowing; }
|
||||||
|
virtual bool IsTopLevel() const { return TRUE; }
|
||||||
|
|
||||||
// tooltip management
|
// tooltip management
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
|
@@ -56,6 +56,7 @@ public:
|
|||||||
const wxString& name = wxFrameNameStr);
|
const wxString& name = wxFrameNameStr);
|
||||||
|
|
||||||
virtual bool Destroy();
|
virtual bool Destroy();
|
||||||
|
virtual bool IsTopLevel() const { return TRUE; }
|
||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnMenuHighlight(wxMenuEvent& event);
|
void OnMenuHighlight(wxMenuEvent& event);
|
||||||
|
@@ -49,6 +49,13 @@ class WXDLLEXPORT wxStaticText: public wxControl
|
|||||||
// operations
|
// operations
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
|
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
|
||||||
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
|
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
|
||||||
|
// events
|
||||||
|
void OnPaint( wxPaintEvent &event ) ;
|
||||||
|
wxSize DoGetBestSize() const ;
|
||||||
|
private :
|
||||||
|
wxString m_label ;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -236,10 +236,12 @@ public :
|
|||||||
virtual void MacFireMouseEvent( EventRecord *ev ) ;
|
virtual void MacFireMouseEvent( EventRecord *ev ) ;
|
||||||
virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ;
|
virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ;
|
||||||
virtual void MacEraseBackground( Rect *rect ) ;
|
virtual void MacEraseBackground( Rect *rect ) ;
|
||||||
|
virtual void MacPaint( wxPaintEvent &event ) ;
|
||||||
WindowRef GetMacRootWindow() const ;
|
WindowRef GetMacRootWindow() const ;
|
||||||
|
|
||||||
virtual ControlHandle MacGetContainerForEmbedding() ;
|
virtual ControlHandle MacGetContainerForEmbedding() ;
|
||||||
virtual void MacSuperChangedPosition() ;
|
virtual void MacSuperChangedPosition() ;
|
||||||
|
virtual void MacSuperShown( bool show ) ;
|
||||||
|
|
||||||
bool MacSetupFocusPort() ;
|
bool MacSetupFocusPort() ;
|
||||||
bool MacSetupDrawingPort() ;
|
bool MacSetupDrawingPort() ;
|
||||||
|
@@ -117,7 +117,7 @@ public:
|
|||||||
virtual ~wxBitmap();
|
virtual ~wxBitmap();
|
||||||
|
|
||||||
// GRG, Dic/99
|
// GRG, Dic/99
|
||||||
wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect ) const;
|
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
||||||
|
|
||||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||||
bool CopyFromIcon(const wxIcon& icon);
|
bool CopyFromIcon(const wxIcon& icon);
|
||||||
|
@@ -140,19 +140,33 @@ bool MyApp::OnInit()
|
|||||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// we need this in order to allow the about menu relocation, since ABOUT is not the default id of the about menu
|
||||||
|
wxApp::s_macAboutMenuItemId = Minimal_About ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// set the frame icon
|
// set the frame icon
|
||||||
SetIcon(wxICON(mondrian));
|
SetIcon(wxICON(mondrian));
|
||||||
|
|
||||||
// create a menu bar
|
// create a menu bar
|
||||||
wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
|
wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// since the about should be in the help menu for auto-relocation we have to do a little more...
|
||||||
|
wxMenu *helpMenu = new wxMenu("", wxMENU_TEAROFF);
|
||||||
|
helpMenu->Append(Minimal_About, "&About...\tCntrl+A", "Show about dialog");
|
||||||
|
#else
|
||||||
menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
|
menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
|
#endif
|
||||||
|
|
||||||
|
menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||||
// now append the freshly created menu to the menu bar...
|
// now append the freshly created menu to the menu bar...
|
||||||
wxMenuBar *menuBar = new wxMenuBar();
|
wxMenuBar *menuBar = new wxMenuBar();
|
||||||
menuBar->Append(menuFile, "&File");
|
menuBar->Append(menuFile, "&File");
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
menuBar->Append(helpMenu, "&Help");
|
||||||
|
#endif
|
||||||
|
|
||||||
// ... and attach this menu bar to the frame
|
// ... and attach this menu bar to the frame
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
|
@@ -95,9 +95,9 @@
|
|||||||
#ifndef WX_TIMEZONE
|
#ifndef WX_TIMEZONE
|
||||||
#if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
|
#if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
|
||||||
#define WX_TIMEZONE _timezone
|
#define WX_TIMEZONE _timezone
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__MWERKS__)
|
||||||
long wxmac_timezone = 28800;
|
long wxmw_timezone = 28800;
|
||||||
#define WX_TIMEZONE wxmac_timezone ;
|
#define WX_TIMEZONE wxmw_timezone ;
|
||||||
#else // unknown platform - try timezone
|
#else // unknown platform - try timezone
|
||||||
#define WX_TIMEZONE timezone
|
#define WX_TIMEZONE timezone
|
||||||
#endif
|
#endif
|
||||||
|
@@ -883,7 +883,12 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
{
|
{
|
||||||
for(i=0; i<width; i++ )
|
for(i=0; i<width; i++ )
|
||||||
{
|
{
|
||||||
if( (*(ptdata++)!=r) | (*(ptdata++)!=g) | (*(ptdata++)!=b) )
|
// was causing a code gen bug in cw : if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
||||||
|
unsigned char cr = (*(ptdata++)) ;
|
||||||
|
unsigned char cg = (*(ptdata++)) ;
|
||||||
|
unsigned char cb = (*(ptdata++)) ;
|
||||||
|
|
||||||
|
if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
||||||
{
|
{
|
||||||
*(ptbits++) = one;
|
*(ptbits++) = one;
|
||||||
*(ptbits++) = one;
|
*(ptbits++) = one;
|
||||||
@@ -1128,6 +1133,12 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
|
|
||||||
SetGWorld( origPort , origDevice ) ;
|
SetGWorld( origPort , origDevice ) ;
|
||||||
|
|
||||||
|
if ( HasMask() )
|
||||||
|
{
|
||||||
|
wxColour colour( GetMaskRed(), GetMaskGreen(), GetMaskBlue());
|
||||||
|
wxMask *mask = new wxMask( bitmap, colour );
|
||||||
|
bitmap.SetMask( mask );
|
||||||
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -446,18 +446,14 @@ wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
|
|||||||
|
|
||||||
wxMask::wxMask()
|
wxMask::wxMask()
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a mask from a bitmap and a colour indicating
|
// Construct a mask from a bitmap and a colour indicating
|
||||||
// the transparent area
|
// the transparent area
|
||||||
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
Create(bitmap, colour);
|
Create(bitmap, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,26 +461,24 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
|||||||
// the transparent area
|
// the transparent area
|
||||||
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
|
|
||||||
Create(bitmap, paletteIndex);
|
Create(bitmap, paletteIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a mask from a mono bitmap (copies the bitmap).
|
// Construct a mask from a mono bitmap (copies the bitmap).
|
||||||
wxMask::wxMask(const wxBitmap& bitmap)
|
wxMask::wxMask(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
|
|
||||||
Create(bitmap);
|
Create(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMask::~wxMask()
|
wxMask::~wxMask()
|
||||||
{
|
{
|
||||||
// TODO: delete mask bitmap
|
if ( m_maskBitmap )
|
||||||
|
{
|
||||||
|
wxMacDestroyGWorld( m_maskBitmap ) ;
|
||||||
|
m_maskBitmap = NULL ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a mask from a mono bitmap (copies the bitmap).
|
// Create a mask from a mono bitmap (copies the bitmap).
|
||||||
@@ -506,8 +500,54 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
|
|||||||
// the transparent area
|
// the transparent area
|
||||||
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||||
{
|
{
|
||||||
// TODO
|
if ( m_maskBitmap )
|
||||||
return FALSE;
|
{
|
||||||
|
wxMacDestroyGWorld( m_maskBitmap ) ;
|
||||||
|
m_maskBitmap = NULL ;
|
||||||
|
}
|
||||||
|
wxASSERT( ((wxBitmapRefData*) bitmap.GetRefData())->m_bitmapType == kMacBitmapTypeGrafWorld ) ;
|
||||||
|
// other types would require a temporary bitmap. not yet implemented
|
||||||
|
|
||||||
|
if (!bitmap.Ok())
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;
|
||||||
|
RGBColor maskColor = colour.GetPixel() ;
|
||||||
|
|
||||||
|
// this is not very efficient, but I can't think
|
||||||
|
// of a better way of doing it
|
||||||
|
CGrafPtr origPort ;
|
||||||
|
GDHandle origDevice ;
|
||||||
|
|
||||||
|
GetGWorld( &origPort , &origDevice ) ;
|
||||||
|
for (int w = 0; w < bitmap.GetWidth(); w++)
|
||||||
|
{
|
||||||
|
for (int h = 0; h < bitmap.GetHeight(); h++)
|
||||||
|
{
|
||||||
|
RGBColor colors[2] = {
|
||||||
|
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
|
||||||
|
{ 0, 0 , 0 }
|
||||||
|
} ;
|
||||||
|
|
||||||
|
SetGWorld( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap , NULL ) ;
|
||||||
|
RGBColor col ;
|
||||||
|
GetCPixel( w , h , &col ) ;
|
||||||
|
SetGWorld( m_maskBitmap , NULL ) ;
|
||||||
|
if (col.red == maskColor.red && col.blue == maskColor.blue && col.green == maskColor.green)
|
||||||
|
{
|
||||||
|
SetCPixel( w , h , &colors[0] ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCPixel( w , h , &colors[1] ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetGWorld( origPort , origDevice ) ;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -48,8 +48,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
if ( height == -1 && bitmap.Ok())
|
if ( height == -1 && bitmap.Ok())
|
||||||
height = bitmap.GetHeight() + 2*m_marginY;
|
height = bitmap.GetHeight() + 2*m_marginY;
|
||||||
|
|
||||||
m_macHorizontalBorder = 2 ; // additional pixels around the real control
|
m_macHorizontalBorder = 0 ; // additional pixels around the real control
|
||||||
m_macVerticalBorder = 2 ;
|
m_macVerticalBorder = 0 ;
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
||||||
|
@@ -446,18 +446,14 @@ wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
|
|||||||
|
|
||||||
wxMask::wxMask()
|
wxMask::wxMask()
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a mask from a bitmap and a colour indicating
|
// Construct a mask from a bitmap and a colour indicating
|
||||||
// the transparent area
|
// the transparent area
|
||||||
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
Create(bitmap, colour);
|
Create(bitmap, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,26 +461,24 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
|||||||
// the transparent area
|
// the transparent area
|
||||||
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
|
|
||||||
Create(bitmap, paletteIndex);
|
Create(bitmap, paletteIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a mask from a mono bitmap (copies the bitmap).
|
// Construct a mask from a mono bitmap (copies the bitmap).
|
||||||
wxMask::wxMask(const wxBitmap& bitmap)
|
wxMask::wxMask(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
/* TODO
|
|
||||||
m_maskBitmap = 0;
|
m_maskBitmap = 0;
|
||||||
*/
|
|
||||||
|
|
||||||
Create(bitmap);
|
Create(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMask::~wxMask()
|
wxMask::~wxMask()
|
||||||
{
|
{
|
||||||
// TODO: delete mask bitmap
|
if ( m_maskBitmap )
|
||||||
|
{
|
||||||
|
wxMacDestroyGWorld( m_maskBitmap ) ;
|
||||||
|
m_maskBitmap = NULL ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a mask from a mono bitmap (copies the bitmap).
|
// Create a mask from a mono bitmap (copies the bitmap).
|
||||||
@@ -506,8 +500,54 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
|
|||||||
// the transparent area
|
// the transparent area
|
||||||
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||||
{
|
{
|
||||||
// TODO
|
if ( m_maskBitmap )
|
||||||
return FALSE;
|
{
|
||||||
|
wxMacDestroyGWorld( m_maskBitmap ) ;
|
||||||
|
m_maskBitmap = NULL ;
|
||||||
|
}
|
||||||
|
wxASSERT( ((wxBitmapRefData*) bitmap.GetRefData())->m_bitmapType == kMacBitmapTypeGrafWorld ) ;
|
||||||
|
// other types would require a temporary bitmap. not yet implemented
|
||||||
|
|
||||||
|
if (!bitmap.Ok())
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;
|
||||||
|
RGBColor maskColor = colour.GetPixel() ;
|
||||||
|
|
||||||
|
// this is not very efficient, but I can't think
|
||||||
|
// of a better way of doing it
|
||||||
|
CGrafPtr origPort ;
|
||||||
|
GDHandle origDevice ;
|
||||||
|
|
||||||
|
GetGWorld( &origPort , &origDevice ) ;
|
||||||
|
for (int w = 0; w < bitmap.GetWidth(); w++)
|
||||||
|
{
|
||||||
|
for (int h = 0; h < bitmap.GetHeight(); h++)
|
||||||
|
{
|
||||||
|
RGBColor colors[2] = {
|
||||||
|
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
|
||||||
|
{ 0, 0 , 0 }
|
||||||
|
} ;
|
||||||
|
|
||||||
|
SetGWorld( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap , NULL ) ;
|
||||||
|
RGBColor col ;
|
||||||
|
GetCPixel( w , h , &col ) ;
|
||||||
|
SetGWorld( m_maskBitmap , NULL ) ;
|
||||||
|
if (col.red == maskColor.red && col.blue == maskColor.blue && col.green == maskColor.green)
|
||||||
|
{
|
||||||
|
SetCPixel( w , h , &colors[0] ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCPixel( w , h , &colors[1] ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetGWorld( origPort , origDevice ) ;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -48,8 +48,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
if ( height == -1 && bitmap.Ok())
|
if ( height == -1 && bitmap.Ok())
|
||||||
height = bitmap.GetHeight() + 2*m_marginY;
|
height = bitmap.GetHeight() + 2*m_marginY;
|
||||||
|
|
||||||
m_macHorizontalBorder = 2 ; // additional pixels around the real control
|
m_macHorizontalBorder = 0 ; // additional pixels around the real control
|
||||||
m_macVerticalBorder = 2 ;
|
m_macVerticalBorder = 0 ;
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
||||||
|
@@ -59,6 +59,10 @@ void wxCheckBox::Command (wxCommandEvent & event)
|
|||||||
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
||||||
{
|
{
|
||||||
SetValue( !GetValue() ) ;
|
SetValue( !GetValue() ) ;
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
||||||
|
event.SetInt(GetValue());
|
||||||
|
event.SetEventObject(this);
|
||||||
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitmap checkbox
|
// Bitmap checkbox
|
||||||
|
@@ -34,8 +34,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
|
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 ,
|
||||||
kControlPopupButtonProc , (long) this ) ;
|
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
|
||||||
|
|
||||||
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
|
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
|
||||||
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include "wx/tabctrl.h"
|
#include "wx/tabctrl.h"
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxControlBase)
|
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
|
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
|
||||||
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
|
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
|
||||||
@@ -383,7 +383,6 @@ void wxControl::MacSuperEnabled( bool enabled )
|
|||||||
|
|
||||||
void wxControl::MacSuperShown( bool show )
|
void wxControl::MacSuperShown( bool show )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if ( m_macControl )
|
if ( m_macControl )
|
||||||
{
|
{
|
||||||
if ( !show )
|
if ( !show )
|
||||||
@@ -392,13 +391,12 @@ void wxControl::MacSuperShown( bool show )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_macShown )
|
if ( m_isShown )
|
||||||
::UMAShowControl( m_macControl ) ;
|
::UMAShowControl( m_macControl ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow::MacSuperShown( show ) ;
|
wxWindow::MacSuperShown( show ) ;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::DoSetSize(int x, int y,
|
void wxControl::DoSetSize(int x, int y,
|
||||||
|
@@ -92,44 +92,47 @@ wxFont wxNullFont;
|
|||||||
wxColour wxNullColour;
|
wxColour wxNullColour;
|
||||||
|
|
||||||
// Default window names
|
// Default window names
|
||||||
const char *wxButtonNameStr = "button";
|
const wxChar *wxButtonNameStr = wxT("button");
|
||||||
const char *wxCanvasNameStr = "canvas";
|
const wxChar *wxCanvasNameStr = wxT("canvas");
|
||||||
const char *wxCheckBoxNameStr = "check";
|
const wxChar *wxCheckBoxNameStr = wxT("check");
|
||||||
const char *wxChoiceNameStr = "choice";
|
const wxChar *wxChoiceNameStr = wxT("choice");
|
||||||
const char *wxComboBoxNameStr = "comboBox";
|
const wxChar *wxComboBoxNameStr = wxT("comboBox");
|
||||||
const char *wxDialogNameStr = "dialog";
|
const wxChar *wxDialogNameStr = wxT("dialog");
|
||||||
const char *wxFrameNameStr = "frame";
|
const wxChar *wxFrameNameStr = wxT("frame");
|
||||||
const char *wxGaugeNameStr = "gauge";
|
const wxChar *wxGaugeNameStr = wxT("gauge");
|
||||||
const char *wxStaticBoxNameStr = "groupBox";
|
const wxChar *wxStaticBoxNameStr = wxT("groupBox");
|
||||||
const char *wxListBoxNameStr = "listBox";
|
const wxChar *wxListBoxNameStr = wxT("listBox");
|
||||||
const char *wxStaticTextNameStr = "message";
|
const wxChar *wxStaticTextNameStr = wxT("message");
|
||||||
const char *wxStaticBitmapNameStr = "message";
|
const wxChar *wxStaticBitmapNameStr = wxT("message");
|
||||||
const char *wxMultiTextNameStr = "multitext";
|
const wxChar *wxMultiTextNameStr = wxT("multitext");
|
||||||
const char *wxPanelNameStr = "panel";
|
const wxChar *wxPanelNameStr = wxT("panel");
|
||||||
const char *wxRadioBoxNameStr = "radioBox";
|
const wxChar *wxRadioBoxNameStr = wxT("radioBox");
|
||||||
const char *wxRadioButtonNameStr = "radioButton";
|
const wxChar *wxRadioButtonNameStr = wxT("radioButton");
|
||||||
const char *wxBitmapRadioButtonNameStr = "radioButton";
|
const wxChar *wxBitmapRadioButtonNameStr = wxT("radioButton");
|
||||||
const char *wxScrollBarNameStr = "scrollBar";
|
const wxChar *wxScrollBarNameStr = wxT("scrollBar");
|
||||||
const char *wxSliderNameStr = "slider";
|
const wxChar *wxSliderNameStr = wxT("slider");
|
||||||
const char *wxStaticNameStr = "static";
|
const wxChar *wxStaticNameStr = wxT("static");
|
||||||
const char *wxTextCtrlWindowNameStr = "textWindow";
|
const wxChar *wxTextCtrlWindowNameStr = wxT("textWindow");
|
||||||
const char *wxTextCtrlNameStr = "text";
|
const wxChar *wxTextCtrlNameStr = wxT("text");
|
||||||
const char *wxVirtListBoxNameStr = "virtListBox";
|
const wxChar *wxVirtListBoxNameStr = wxT("virtListBox");
|
||||||
const char *wxButtonBarNameStr = "buttonbar";
|
const wxChar *wxButtonBarNameStr = wxT("buttonbar");
|
||||||
const char *wxEnhDialogNameStr = "Shell";
|
const wxChar *wxEnhDialogNameStr = wxT("Shell");
|
||||||
const char *wxToolBarNameStr = "toolbar";
|
const wxChar *wxToolBarNameStr = wxT("toolbar");
|
||||||
const char *wxStatusLineNameStr = "status_line";
|
const wxChar *wxStatusLineNameStr = wxT("status_line");
|
||||||
|
|
||||||
const char *wxGetTextFromUserPromptStr = "Input Text";
|
const wxChar *wxGetTextFromUserPromptStr = wxT("Input Text");
|
||||||
const char *wxMessageBoxCaptionStr = "Message";
|
const wxChar *wxMessageBoxCaptionStr = wxT("Message");
|
||||||
const char *wxFileSelectorPromptStr = "Select a file";
|
const wxChar *wxFileSelectorPromptStr = wxT("Select a file");
|
||||||
const char *wxFileSelectorDefaultWildcardStr = "*.*";
|
const wxChar *wxFileSelectorDefaultWildcardStr = wxT("*.*");
|
||||||
const char *wxInternalErrorStr = "wxWindows Internal Error";
|
const wxChar *wxInternalErrorStr = wxT("wxWindows Internal Error");
|
||||||
const char *wxFatalErrorStr = "wxWindows Fatal Error";
|
const wxChar *wxFatalErrorStr = wxT("wxWindows Fatal Error");
|
||||||
|
const wxChar *wxTreeCtrlNameStr = wxT("treeCtrl");
|
||||||
|
const wxChar *wxDirDialogNameStr = wxT("wxDirCtrl");
|
||||||
|
const wxChar *wxDirDialogDefaultFolderStr = wxT("/");
|
||||||
|
|
||||||
// See wx/utils.h
|
// See wx/utils.h
|
||||||
const char *wxFloatToStringStr = "%.2f";
|
const wxChar *wxFloatToStringStr = wxT("%.2f");
|
||||||
const char *wxDoubleToStringStr = "%.2f";
|
const wxChar *wxDoubleToStringStr = wxT("%.2f");
|
||||||
|
|
||||||
const wxSize wxDefaultSize(-1, -1);
|
const wxSize wxDefaultSize(-1, -1);
|
||||||
const wxPoint wxDefaultPosition(-1, -1);
|
const wxPoint wxDefaultPosition(-1, -1);
|
||||||
|
@@ -84,6 +84,7 @@ wxDC::wxDC(void)
|
|||||||
|
|
||||||
// m_palette = wxAPP_COLOURMAP;
|
// m_palette = wxAPP_COLOURMAP;
|
||||||
m_macPort = NULL ;
|
m_macPort = NULL ;
|
||||||
|
m_macMask = NULL ;
|
||||||
m_ok = FALSE ;
|
m_ok = FALSE ;
|
||||||
|
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
@@ -153,8 +154,6 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
|
|||||||
RGBColor black = { 0,0,0} ;
|
RGBColor black = { 0,0,0} ;
|
||||||
RGBForeColor( &black ) ;
|
RGBForeColor( &black ) ;
|
||||||
RGBBackColor( &white ) ;
|
RGBBackColor( &white ) ;
|
||||||
// RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
|
|
||||||
// RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
|
|
||||||
|
|
||||||
bmappixels = GetGWorldPixMap( bmapworld ) ;
|
bmappixels = GetGWorldPixMap( bmapworld ) ;
|
||||||
if ( LockPixels(bmappixels) )
|
if ( LockPixels(bmappixels) )
|
||||||
@@ -168,21 +167,20 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
|
|||||||
dest.left = XLOG2DEV(x) ;
|
dest.left = XLOG2DEV(x) ;
|
||||||
dest.bottom = YLOG2DEV(y + bmap->m_height ) ;
|
dest.bottom = YLOG2DEV(y + bmap->m_height ) ;
|
||||||
dest.right = XLOG2DEV(x + bmap->m_width ) ;
|
dest.right = XLOG2DEV(x + bmap->m_width ) ;
|
||||||
// ::ClipRect(&m_macClipRect);
|
|
||||||
CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
|
|
||||||
&source, &dest, srcCopy, NULL ) ;
|
|
||||||
/*
|
|
||||||
if ( m_clipping )
|
|
||||||
{
|
|
||||||
long x1 = XLOG2DEV(m_clipX1);
|
|
||||||
long y1 = YLOG2DEV(m_clipY1);
|
|
||||||
long x2 = XLOG2DEV(m_clipX2);
|
|
||||||
long y2 = YLOG2DEV(m_clipY2);
|
|
||||||
|
|
||||||
Rect clip = { y1 , x1 , y2 , x2 } ;
|
if ( useMask && bmp.GetMask() )
|
||||||
::ClipRect(&clip);
|
{
|
||||||
|
if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
|
||||||
|
{
|
||||||
|
CopyMask( &GrafPtr( bmapworld )->portBits , &GrafPtr( bmp.GetMask()->GetMaskBitmap( ) )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
|
&source, &source , &dest ) ;
|
||||||
|
UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
|
CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
|
&source, &dest, srcCopy, NULL ) ;
|
||||||
|
|
||||||
UnlockPixels( bmappixels ) ;
|
UnlockPixels( bmappixels ) ;
|
||||||
}
|
}
|
||||||
m_macPenInstalled = false ;
|
m_macPenInstalled = false ;
|
||||||
@@ -1071,8 +1069,6 @@ bool wxDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
|
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
|
||||||
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
|
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
|
||||||
RGBColor black = { 0,0,0} ;
|
RGBColor black = { 0,0,0} ;
|
||||||
// RGBForeColor( &black ) ;
|
|
||||||
// RGBBackColor( &white ) ;
|
|
||||||
RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
|
RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
|
||||||
RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
|
RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
|
||||||
|
|
||||||
@@ -1087,21 +1083,36 @@ bool wxDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
dstrect.left = XLOG2DEV(xdest) ;
|
dstrect.left = XLOG2DEV(xdest) ;
|
||||||
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
||||||
dstrect.right = XLOG2DEV(xdest + width ) ;
|
dstrect.right = XLOG2DEV(xdest + width ) ;
|
||||||
// ::ClipRect(&m_macClipRect);
|
|
||||||
|
short mode = (logical_func == wxCOPY ? srcCopy :
|
||||||
|
// logical_func == wxCLEAR ? WHITENESS :
|
||||||
|
// logical_func == wxSET ? BLACKNESS :
|
||||||
|
logical_func == wxINVERT ? hilite :
|
||||||
|
// logical_func == wxAND ? MERGECOPY :
|
||||||
|
logical_func == wxOR ? srcOr :
|
||||||
|
logical_func == wxSRC_INVERT ? notSrcCopy :
|
||||||
|
logical_func == wxXOR ? srcXor :
|
||||||
|
// logical_func == wxOR_REVERSE ? MERGEPAINT :
|
||||||
|
// logical_func == wxAND_REVERSE ? SRCERASE :
|
||||||
|
logical_func == wxSRC_OR ? srcOr :
|
||||||
|
// logical_func == wxSRC_AND ? SRCAND :
|
||||||
|
srcCopy );
|
||||||
|
|
||||||
|
if ( useMask && source->m_macMask )
|
||||||
|
{
|
||||||
|
wxASSERT( mode == srcCopy ) ;
|
||||||
|
if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
|
||||||
|
{
|
||||||
|
CopyMask( &GrafPtr( sourcePort )->portBits , &GrafPtr( source->m_macMask )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
|
&srcrect, &srcrect , &dstrect ) ;
|
||||||
|
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
|
CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
&srcrect, &dstrect, srcCopy, NULL ) ;
|
&srcrect, &dstrect, mode, NULL ) ;
|
||||||
/*
|
}
|
||||||
if ( m_clipping )
|
|
||||||
{
|
|
||||||
long x1 = XLOG2DEV(m_clipX1);
|
|
||||||
long y1 = YLOG2DEV(m_clipY1);
|
|
||||||
long x2 = XLOG2DEV(m_clipX2);
|
|
||||||
long y2 = YLOG2DEV(m_clipY2);
|
|
||||||
|
|
||||||
Rect clip = { y1 , x1 , y2 , x2 } ;
|
|
||||||
::ClipRect(&clip);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
UnlockPixels( bmappixels ) ;
|
UnlockPixels( bmappixels ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,6 +44,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
|||||||
if ( bmap->m_hBitmap )
|
if ( bmap->m_hBitmap )
|
||||||
{
|
{
|
||||||
m_macPort = (GrafPtr) bmap->m_hBitmap ;
|
m_macPort = (GrafPtr) bmap->m_hBitmap ;
|
||||||
|
wxMask * mask = bitmap.GetMask() ;
|
||||||
|
if ( mask )
|
||||||
|
{
|
||||||
|
m_macMask = mask->GetMaskBitmap() ;
|
||||||
|
}
|
||||||
MacSetupPort() ;
|
MacSetupPort() ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
|
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
|
||||||
|
@@ -68,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
|
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
|
||||||
|
|
||||||
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
|
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
|
||||||
(**m_macList).selFlags = lOnlyOne ;
|
(**m_macList).selFlags = 0 ;
|
||||||
if ( style & wxLB_MULTIPLE )
|
if ( style & wxLB_MULTIPLE )
|
||||||
{
|
{
|
||||||
(**m_macList).selFlags += lNoExtend ;
|
(**m_macList).selFlags += lNoExtend ;
|
||||||
}
|
}
|
||||||
@@ -77,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
(**m_macList).selFlags += lExtendDrag ;
|
(**m_macList).selFlags += lExtendDrag ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(**m_macList).selFlags = lOnlyOne ;
|
||||||
|
}
|
||||||
Point pt = (**m_macList).cellSize ;
|
Point pt = (**m_macList).cellSize ;
|
||||||
pt.v = 14 ;
|
pt.v = 14 ;
|
||||||
LCellSize( pt , m_macList ) ;
|
LCellSize( pt , m_macList ) ;
|
||||||
@@ -151,6 +155,7 @@ void wxListBox::Delete(int N)
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
||||||
m_stringArray.Remove( N ) ;
|
m_stringArray.Remove( N ) ;
|
||||||
|
m_dataArray.Remove( N ) ;
|
||||||
m_noItems --;
|
m_noItems --;
|
||||||
|
|
||||||
MacDelete( N ) ;
|
MacDelete( N ) ;
|
||||||
@@ -185,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
wxASSERT_MSG(clientData[i] == NULL,
|
wxASSERT_MSG(clientData[i] == NULL,
|
||||||
wxT("Can't use client data with owner-drawn listboxes"));
|
wxT("Can't use client data with owner-drawn listboxes"));
|
||||||
#else // !wxUSE_OWNER_DRAWN
|
#else // !wxUSE_OWNER_DRAWN
|
||||||
Append( choices[i] , clientData[0] ) ;
|
Append( choices[i] , clientData[i] ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -298,7 +303,16 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
|||||||
wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
|
wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
|
||||||
}
|
}
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
m_dataArray[N] = (char*) Client_data ;
|
wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
|
||||||
|
|
||||||
|
if ( m_dataArray.GetCount() > N )
|
||||||
|
{
|
||||||
|
m_dataArray[N] = (char*) Client_data ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dataArray.Add( (char*) Client_data ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
|
void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
|
||||||
|
@@ -55,11 +55,23 @@ void wxMacCtoPString(const char* theCString, Str255 thePString);
|
|||||||
|
|
||||||
// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
|
// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
|
||||||
|
|
||||||
void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemName , bool useShortcuts )
|
void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemText , bool useShortcuts )
|
||||||
{
|
{
|
||||||
char *p = (char *) &outMacItemText[1] ;
|
char *p = (char *) &outMacItemText[1] ;
|
||||||
short macModifiers = 0 ;
|
short macModifiers = 0 ;
|
||||||
char macShortCut = 0 ;
|
char macShortCut = 0 ;
|
||||||
|
const char *inItemName ;
|
||||||
|
wxString inItemTextMac ;
|
||||||
|
|
||||||
|
if (wxApp::s_macDefaultEncodingIsPC)
|
||||||
|
{
|
||||||
|
inItemTextMac = wxMacMakeMacStringFromPC( inItemText ) ;
|
||||||
|
inItemName = inItemTextMac ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inItemName = inItemText ;
|
||||||
|
}
|
||||||
|
|
||||||
if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
|
if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
|
||||||
useShortcuts = false ;
|
useShortcuts = false ;
|
||||||
@@ -120,6 +132,11 @@ void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , s
|
|||||||
inItemName = inItemName + 5;
|
inItemName = inItemName + 5;
|
||||||
macShortCut = *inItemName;
|
macShortCut = *inItemName;
|
||||||
}
|
}
|
||||||
|
else if (strncmp("Cntrl", inItemName, 5) == 0)
|
||||||
|
{
|
||||||
|
inItemName = inItemName + 6;
|
||||||
|
macShortCut = *inItemName;
|
||||||
|
}
|
||||||
else if (strncmp("Alt", inItemName, 3) == 0)
|
else if (strncmp("Alt", inItemName, 3) == 0)
|
||||||
{
|
{
|
||||||
inItemName = inItemName + 4;
|
inItemName = inItemName + 4;
|
||||||
@@ -876,7 +893,7 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
|
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
|
||||||
|
|
||||||
|
|
||||||
if( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
|
if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
|
||||||
{
|
{
|
||||||
MenuHandle mh = NULL ;
|
MenuHandle mh = NULL ;
|
||||||
if ( HMGetHelpMenuHandle( &mh ) != noErr )
|
if ( HMGetHelpMenuHandle( &mh ) != noErr )
|
||||||
@@ -899,24 +916,32 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Str255 label ;
|
if ( item->IsSeparator() )
|
||||||
wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
|
|
||||||
if ( label[0] == 0 )
|
|
||||||
{
|
|
||||||
// we cannot add empty menus on mac
|
|
||||||
label[0] = 1 ;
|
|
||||||
label[1] = ' ' ;
|
|
||||||
}
|
|
||||||
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
|
|
||||||
{
|
|
||||||
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
|
|
||||||
// ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
|
||||||
::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if ( mh )
|
if ( mh )
|
||||||
::AppendMenu(mh, label );
|
::AppendMenu(mh, "\p-" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Str255 label ;
|
||||||
|
wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
|
||||||
|
if ( label[0] == 0 )
|
||||||
|
{
|
||||||
|
// we cannot add empty menus on mac
|
||||||
|
label[0] = 1 ;
|
||||||
|
label[1] = ' ' ;
|
||||||
|
}
|
||||||
|
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
|
||||||
|
{
|
||||||
|
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
|
||||||
|
// ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
||||||
|
::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mh )
|
||||||
|
::AppendMenu(mh, label );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1094,7 +1119,7 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
|
|||||||
for (int i = 0; i < m_menus.GetCount() ; i++)
|
for (int i = 0; i < m_menus.GetCount() ; i++)
|
||||||
{
|
{
|
||||||
if ( m_menus[i]->MacGetMenuId() == macMenuId ||
|
if ( m_menus[i]->MacGetMenuId() == macMenuId ||
|
||||||
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
|
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||||
|
@@ -70,12 +70,24 @@ int wxMessageDialog::ShowModal()
|
|||||||
Str255 pascalTitle ;
|
Str255 pascalTitle ;
|
||||||
Str255 pascalText ;
|
Str255 pascalText ;
|
||||||
|
|
||||||
strcpy( (char*) pascalTitle , m_caption ) ;
|
|
||||||
|
if (wxApp::s_macDefaultEncodingIsPC)
|
||||||
|
{
|
||||||
|
strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
|
||||||
|
strcpy( (char*) pascalText , wxMacMakeMacStringFromPC( m_message) ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy( (char*) pascalTitle , m_caption ) ;
|
||||||
|
strcpy( (char*) pascalText , m_message ) ;
|
||||||
|
}
|
||||||
|
|
||||||
c2pstr( (char*) pascalTitle ) ;
|
c2pstr( (char*) pascalTitle ) ;
|
||||||
strcpy( (char*) pascalText , m_message ) ;
|
|
||||||
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
|
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
|
||||||
c2pstr( (char*) pascalText ) ;
|
c2pstr( (char*) pascalText ) ;
|
||||||
|
|
||||||
|
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
|
||||||
|
|
||||||
if ( !UMAHasAppearance() )
|
if ( !UMAHasAppearance() )
|
||||||
{
|
{
|
||||||
int resourceID ;
|
int resourceID ;
|
||||||
|
@@ -418,7 +418,7 @@ void wxRadioBox::SetFocus()
|
|||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// Simulates the effect of the user issuing a command to the item
|
// Simulates the effect of the user issuing a command to the item
|
||||||
|
|
||||||
#define RADIO_SIZE 20
|
#define RADIO_SIZE 40
|
||||||
|
|
||||||
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
@@ -429,6 +429,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
int x_current, y_current;
|
int x_current, y_current;
|
||||||
int x_offset,y_offset;
|
int x_offset,y_offset;
|
||||||
|
int widthOld, heightOld;
|
||||||
|
GetSize(&widthOld, &heightOld);
|
||||||
|
|
||||||
x_offset = x;
|
x_offset = x;
|
||||||
y_offset = y;
|
y_offset = y;
|
||||||
@@ -463,7 +465,24 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
|
totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
|
||||||
totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
|
totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
|
||||||
|
|
||||||
wxControl::DoSetSize(x_offset,y_offset,totWidth,totHeight,wxSIZE_AUTO);
|
// only change our width/height if asked for
|
||||||
|
if ( width == -1 )
|
||||||
|
{
|
||||||
|
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||||
|
width = totWidth ;
|
||||||
|
else
|
||||||
|
width = widthOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( height == -1 )
|
||||||
|
{
|
||||||
|
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||||
|
height = totHeight ;
|
||||||
|
else
|
||||||
|
height = heightOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
|
||||||
|
|
||||||
// arrange radiobuttons
|
// arrange radiobuttons
|
||||||
|
|
||||||
|
@@ -73,6 +73,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
|
|||||||
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
||||||
{
|
{
|
||||||
SetValue(true) ;
|
SetValue(true) ;
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
|
||||||
|
event.SetEventObject(this);
|
||||||
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
||||||
|
@@ -22,6 +22,65 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
|
|||||||
|
|
||||||
#include <wx/mac/uma.h>
|
#include <wx/mac/uma.h>
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxStaticText, wxControl)
|
||||||
|
EVT_PAINT(wxStaticText::OnPaint)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
SetName(name);
|
||||||
|
m_backgroundColour = parent->GetBackgroundColour() ;
|
||||||
|
m_foregroundColour = parent->GetForegroundColour() ;
|
||||||
|
|
||||||
|
if ( id == -1 )
|
||||||
|
m_windowId = (int)NewControlId();
|
||||||
|
else
|
||||||
|
m_windowId = id;
|
||||||
|
|
||||||
|
m_windowStyle = style;
|
||||||
|
m_label = label ;
|
||||||
|
|
||||||
|
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
|
||||||
|
SetSizeOrDefault( size ) ;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStaticText::OnPaint( wxPaintEvent &event )
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
PrepareDC(dc);
|
||||||
|
dc.Clear() ;
|
||||||
|
dc.DrawText( m_label , 0 , 0 ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize wxStaticText::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
int x , y ;
|
||||||
|
GetTextExtent( m_label , &x , &y ) ;
|
||||||
|
return wxSize( x , y ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStaticText::SetLabel(const wxString& st , bool resize )
|
||||||
|
{
|
||||||
|
SetTitle( st ) ;
|
||||||
|
m_label = st ;
|
||||||
|
if ( resize )
|
||||||
|
SetSizeOrDefault() ;
|
||||||
|
else
|
||||||
|
Refresh() ;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
|
{
|
||||||
|
wxControl::SetSize( x , y , width , height , sizeFlags ) ;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
@@ -56,4 +115,5 @@ void wxStaticText::SetLabel(const wxString& st , bool resize )
|
|||||||
::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
|
::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@@ -245,10 +245,14 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
ControlHandle m_macToolHandle ;
|
ControlHandle m_macToolHandle ;
|
||||||
|
|
||||||
|
SInt16 behaviour = kControlBehaviorOffsetContents ;
|
||||||
|
if ( tool->CanBeToggled() )
|
||||||
|
behaviour += kControlBehaviorToggles ;
|
||||||
|
|
||||||
if ( icon )
|
if ( icon )
|
||||||
{
|
{
|
||||||
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
||||||
kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
|
|
||||||
info.contentType = kControlContentPictHandle ;
|
info.contentType = kControlContentPictHandle ;
|
||||||
@@ -259,7 +263,7 @@ bool wxToolBar::Realize()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
||||||
kControlBehaviorOffsetContents , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
||||||
}
|
}
|
||||||
m_macToolHandles.Add( m_macToolHandle ) ;
|
m_macToolHandles.Add( m_macToolHandle ) ;
|
||||||
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
|
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
|
||||||
@@ -353,12 +357,29 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
|
|||||||
void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
|
void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)t;
|
wxToolBarTool *tool = (wxToolBarTool *)t;
|
||||||
|
ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
|
||||||
|
if ( UMAHasAppearance() )
|
||||||
|
{
|
||||||
|
if ( enable )
|
||||||
|
::ActivateControl( control ) ;
|
||||||
|
else
|
||||||
|
::DeactivateControl( control ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( enable )
|
||||||
|
::HiliteControl( control , 0 ) ;
|
||||||
|
else
|
||||||
|
::HiliteControl( control , 255 ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
|
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)t;
|
wxToolBarTool *tool = (wxToolBarTool *)t;
|
||||||
// TODO: set toggle state
|
|
||||||
|
ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
|
||||||
|
::SetControlValue( control , toggle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||||
|
@@ -642,11 +642,24 @@ bool wxWindow::Show(bool show)
|
|||||||
UMAHideWindow( m_macWindowData->m_macWindow ) ;
|
UMAHideWindow( m_macWindowData->m_macWindow ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MacSuperShown( show ) ;
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindow::MacSuperShown( bool show )
|
||||||
|
{
|
||||||
|
wxNode *node = GetChildren().First();
|
||||||
|
while ( node )
|
||||||
|
{
|
||||||
|
wxWindow *child = (wxWindow *)node->Data();
|
||||||
|
if ( child->m_isShown )
|
||||||
|
child->MacSuperShown( show ) ;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int wxWindow::GetCharHeight() const
|
int wxWindow::GetCharHeight() const
|
||||||
{
|
{
|
||||||
wxClientDC dc ( (wxWindow*)this ) ;
|
wxClientDC dc ( (wxWindow*)this ) ;
|
||||||
@@ -914,6 +927,43 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindow::MacPaint( wxPaintEvent &event )
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
PrepareDC(dc);
|
||||||
|
|
||||||
|
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
|
||||||
|
{
|
||||||
|
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
|
||||||
|
|
||||||
|
wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
|
||||||
|
wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
|
||||||
|
|
||||||
|
wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
|
||||||
|
wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
|
||||||
|
wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
|
||||||
|
wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
|
||||||
|
|
||||||
|
dc.SetPen(wxPen1);
|
||||||
|
dc.DrawRectangle(0, 0, m_width, m_height); // outer - right and button
|
||||||
|
|
||||||
|
dc.SetPen(wxPen2);
|
||||||
|
dc.DrawRectangle(1, 1, m_width-1, m_height-1); // outer - left and top
|
||||||
|
|
||||||
|
dc.SetPen(wxPen3);
|
||||||
|
dc.DrawRectangle(0, 0, m_width-2, m_height-2); // inner - right and button
|
||||||
|
|
||||||
|
dc.SetPen(wxPen4);
|
||||||
|
dc.DrawLine(0, 0, m_width-3, 0); // inner - left and top
|
||||||
|
dc.DrawLine(0, 0, 0, m_height-3);
|
||||||
|
}
|
||||||
|
else if (HasFlag(wxSIMPLE_BORDER))
|
||||||
|
{
|
||||||
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
|
dc.DrawRectangle(0, 0, m_width, m_height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// New function that will replace some of the above.
|
// New function that will replace some of the above.
|
||||||
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
|
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
|
||||||
int range, bool refresh)
|
int range, bool refresh)
|
||||||
@@ -1433,7 +1483,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
|
|||||||
event.m_timeStamp = time ;
|
event.m_timeStamp = time ;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
|
wxPaintEvent event2( event ) ;
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
MacPaint( event2 ) ;
|
||||||
|
|
||||||
RgnHandle childupdate = NewRgn() ;
|
RgnHandle childupdate = NewRgn() ;
|
||||||
|
|
||||||
|
@@ -59,6 +59,10 @@ void wxCheckBox::Command (wxCommandEvent & event)
|
|||||||
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
||||||
{
|
{
|
||||||
SetValue( !GetValue() ) ;
|
SetValue( !GetValue() ) ;
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
||||||
|
event.SetInt(GetValue());
|
||||||
|
event.SetEventObject(this);
|
||||||
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitmap checkbox
|
// Bitmap checkbox
|
||||||
|
@@ -34,8 +34,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
|
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 ,
|
||||||
kControlPopupButtonProc , (long) this ) ;
|
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
|
||||||
|
|
||||||
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
|
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
|
||||||
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include "wx/tabctrl.h"
|
#include "wx/tabctrl.h"
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxControlBase)
|
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
|
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
|
||||||
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
|
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
|
||||||
@@ -383,7 +383,6 @@ void wxControl::MacSuperEnabled( bool enabled )
|
|||||||
|
|
||||||
void wxControl::MacSuperShown( bool show )
|
void wxControl::MacSuperShown( bool show )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if ( m_macControl )
|
if ( m_macControl )
|
||||||
{
|
{
|
||||||
if ( !show )
|
if ( !show )
|
||||||
@@ -392,13 +391,12 @@ void wxControl::MacSuperShown( bool show )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_macShown )
|
if ( m_isShown )
|
||||||
::UMAShowControl( m_macControl ) ;
|
::UMAShowControl( m_macControl ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow::MacSuperShown( show ) ;
|
wxWindow::MacSuperShown( show ) ;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::DoSetSize(int x, int y,
|
void wxControl::DoSetSize(int x, int y,
|
||||||
|
@@ -92,44 +92,47 @@ wxFont wxNullFont;
|
|||||||
wxColour wxNullColour;
|
wxColour wxNullColour;
|
||||||
|
|
||||||
// Default window names
|
// Default window names
|
||||||
const char *wxButtonNameStr = "button";
|
const wxChar *wxButtonNameStr = wxT("button");
|
||||||
const char *wxCanvasNameStr = "canvas";
|
const wxChar *wxCanvasNameStr = wxT("canvas");
|
||||||
const char *wxCheckBoxNameStr = "check";
|
const wxChar *wxCheckBoxNameStr = wxT("check");
|
||||||
const char *wxChoiceNameStr = "choice";
|
const wxChar *wxChoiceNameStr = wxT("choice");
|
||||||
const char *wxComboBoxNameStr = "comboBox";
|
const wxChar *wxComboBoxNameStr = wxT("comboBox");
|
||||||
const char *wxDialogNameStr = "dialog";
|
const wxChar *wxDialogNameStr = wxT("dialog");
|
||||||
const char *wxFrameNameStr = "frame";
|
const wxChar *wxFrameNameStr = wxT("frame");
|
||||||
const char *wxGaugeNameStr = "gauge";
|
const wxChar *wxGaugeNameStr = wxT("gauge");
|
||||||
const char *wxStaticBoxNameStr = "groupBox";
|
const wxChar *wxStaticBoxNameStr = wxT("groupBox");
|
||||||
const char *wxListBoxNameStr = "listBox";
|
const wxChar *wxListBoxNameStr = wxT("listBox");
|
||||||
const char *wxStaticTextNameStr = "message";
|
const wxChar *wxStaticTextNameStr = wxT("message");
|
||||||
const char *wxStaticBitmapNameStr = "message";
|
const wxChar *wxStaticBitmapNameStr = wxT("message");
|
||||||
const char *wxMultiTextNameStr = "multitext";
|
const wxChar *wxMultiTextNameStr = wxT("multitext");
|
||||||
const char *wxPanelNameStr = "panel";
|
const wxChar *wxPanelNameStr = wxT("panel");
|
||||||
const char *wxRadioBoxNameStr = "radioBox";
|
const wxChar *wxRadioBoxNameStr = wxT("radioBox");
|
||||||
const char *wxRadioButtonNameStr = "radioButton";
|
const wxChar *wxRadioButtonNameStr = wxT("radioButton");
|
||||||
const char *wxBitmapRadioButtonNameStr = "radioButton";
|
const wxChar *wxBitmapRadioButtonNameStr = wxT("radioButton");
|
||||||
const char *wxScrollBarNameStr = "scrollBar";
|
const wxChar *wxScrollBarNameStr = wxT("scrollBar");
|
||||||
const char *wxSliderNameStr = "slider";
|
const wxChar *wxSliderNameStr = wxT("slider");
|
||||||
const char *wxStaticNameStr = "static";
|
const wxChar *wxStaticNameStr = wxT("static");
|
||||||
const char *wxTextCtrlWindowNameStr = "textWindow";
|
const wxChar *wxTextCtrlWindowNameStr = wxT("textWindow");
|
||||||
const char *wxTextCtrlNameStr = "text";
|
const wxChar *wxTextCtrlNameStr = wxT("text");
|
||||||
const char *wxVirtListBoxNameStr = "virtListBox";
|
const wxChar *wxVirtListBoxNameStr = wxT("virtListBox");
|
||||||
const char *wxButtonBarNameStr = "buttonbar";
|
const wxChar *wxButtonBarNameStr = wxT("buttonbar");
|
||||||
const char *wxEnhDialogNameStr = "Shell";
|
const wxChar *wxEnhDialogNameStr = wxT("Shell");
|
||||||
const char *wxToolBarNameStr = "toolbar";
|
const wxChar *wxToolBarNameStr = wxT("toolbar");
|
||||||
const char *wxStatusLineNameStr = "status_line";
|
const wxChar *wxStatusLineNameStr = wxT("status_line");
|
||||||
|
|
||||||
const char *wxGetTextFromUserPromptStr = "Input Text";
|
const wxChar *wxGetTextFromUserPromptStr = wxT("Input Text");
|
||||||
const char *wxMessageBoxCaptionStr = "Message";
|
const wxChar *wxMessageBoxCaptionStr = wxT("Message");
|
||||||
const char *wxFileSelectorPromptStr = "Select a file";
|
const wxChar *wxFileSelectorPromptStr = wxT("Select a file");
|
||||||
const char *wxFileSelectorDefaultWildcardStr = "*.*";
|
const wxChar *wxFileSelectorDefaultWildcardStr = wxT("*.*");
|
||||||
const char *wxInternalErrorStr = "wxWindows Internal Error";
|
const wxChar *wxInternalErrorStr = wxT("wxWindows Internal Error");
|
||||||
const char *wxFatalErrorStr = "wxWindows Fatal Error";
|
const wxChar *wxFatalErrorStr = wxT("wxWindows Fatal Error");
|
||||||
|
const wxChar *wxTreeCtrlNameStr = wxT("treeCtrl");
|
||||||
|
const wxChar *wxDirDialogNameStr = wxT("wxDirCtrl");
|
||||||
|
const wxChar *wxDirDialogDefaultFolderStr = wxT("/");
|
||||||
|
|
||||||
// See wx/utils.h
|
// See wx/utils.h
|
||||||
const char *wxFloatToStringStr = "%.2f";
|
const wxChar *wxFloatToStringStr = wxT("%.2f");
|
||||||
const char *wxDoubleToStringStr = "%.2f";
|
const wxChar *wxDoubleToStringStr = wxT("%.2f");
|
||||||
|
|
||||||
const wxSize wxDefaultSize(-1, -1);
|
const wxSize wxDefaultSize(-1, -1);
|
||||||
const wxPoint wxDefaultPosition(-1, -1);
|
const wxPoint wxDefaultPosition(-1, -1);
|
||||||
|
@@ -84,6 +84,7 @@ wxDC::wxDC(void)
|
|||||||
|
|
||||||
// m_palette = wxAPP_COLOURMAP;
|
// m_palette = wxAPP_COLOURMAP;
|
||||||
m_macPort = NULL ;
|
m_macPort = NULL ;
|
||||||
|
m_macMask = NULL ;
|
||||||
m_ok = FALSE ;
|
m_ok = FALSE ;
|
||||||
|
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
@@ -153,8 +154,6 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
|
|||||||
RGBColor black = { 0,0,0} ;
|
RGBColor black = { 0,0,0} ;
|
||||||
RGBForeColor( &black ) ;
|
RGBForeColor( &black ) ;
|
||||||
RGBBackColor( &white ) ;
|
RGBBackColor( &white ) ;
|
||||||
// RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
|
|
||||||
// RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
|
|
||||||
|
|
||||||
bmappixels = GetGWorldPixMap( bmapworld ) ;
|
bmappixels = GetGWorldPixMap( bmapworld ) ;
|
||||||
if ( LockPixels(bmappixels) )
|
if ( LockPixels(bmappixels) )
|
||||||
@@ -168,21 +167,20 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
|
|||||||
dest.left = XLOG2DEV(x) ;
|
dest.left = XLOG2DEV(x) ;
|
||||||
dest.bottom = YLOG2DEV(y + bmap->m_height ) ;
|
dest.bottom = YLOG2DEV(y + bmap->m_height ) ;
|
||||||
dest.right = XLOG2DEV(x + bmap->m_width ) ;
|
dest.right = XLOG2DEV(x + bmap->m_width ) ;
|
||||||
// ::ClipRect(&m_macClipRect);
|
|
||||||
CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
|
|
||||||
&source, &dest, srcCopy, NULL ) ;
|
|
||||||
/*
|
|
||||||
if ( m_clipping )
|
|
||||||
{
|
|
||||||
long x1 = XLOG2DEV(m_clipX1);
|
|
||||||
long y1 = YLOG2DEV(m_clipY1);
|
|
||||||
long x2 = XLOG2DEV(m_clipX2);
|
|
||||||
long y2 = YLOG2DEV(m_clipY2);
|
|
||||||
|
|
||||||
Rect clip = { y1 , x1 , y2 , x2 } ;
|
if ( useMask && bmp.GetMask() )
|
||||||
::ClipRect(&clip);
|
{
|
||||||
|
if ( LockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) )
|
||||||
|
{
|
||||||
|
CopyMask( &GrafPtr( bmapworld )->portBits , &GrafPtr( bmp.GetMask()->GetMaskBitmap( ) )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
|
&source, &source , &dest ) ;
|
||||||
|
UnlockPixels( GetGWorldPixMap( bmp.GetMask()->GetMaskBitmap( ) ) ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
|
CopyBits( &GrafPtr( bmapworld )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
|
&source, &dest, srcCopy, NULL ) ;
|
||||||
|
|
||||||
UnlockPixels( bmappixels ) ;
|
UnlockPixels( bmappixels ) ;
|
||||||
}
|
}
|
||||||
m_macPenInstalled = false ;
|
m_macPenInstalled = false ;
|
||||||
@@ -1071,8 +1069,6 @@ bool wxDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
|
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
|
||||||
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
|
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
|
||||||
RGBColor black = { 0,0,0} ;
|
RGBColor black = { 0,0,0} ;
|
||||||
// RGBForeColor( &black ) ;
|
|
||||||
// RGBBackColor( &white ) ;
|
|
||||||
RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
|
RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
|
||||||
RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
|
RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
|
||||||
|
|
||||||
@@ -1087,21 +1083,36 @@ bool wxDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
dstrect.left = XLOG2DEV(xdest) ;
|
dstrect.left = XLOG2DEV(xdest) ;
|
||||||
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
||||||
dstrect.right = XLOG2DEV(xdest + width ) ;
|
dstrect.right = XLOG2DEV(xdest + width ) ;
|
||||||
// ::ClipRect(&m_macClipRect);
|
|
||||||
|
short mode = (logical_func == wxCOPY ? srcCopy :
|
||||||
|
// logical_func == wxCLEAR ? WHITENESS :
|
||||||
|
// logical_func == wxSET ? BLACKNESS :
|
||||||
|
logical_func == wxINVERT ? hilite :
|
||||||
|
// logical_func == wxAND ? MERGECOPY :
|
||||||
|
logical_func == wxOR ? srcOr :
|
||||||
|
logical_func == wxSRC_INVERT ? notSrcCopy :
|
||||||
|
logical_func == wxXOR ? srcXor :
|
||||||
|
// logical_func == wxOR_REVERSE ? MERGEPAINT :
|
||||||
|
// logical_func == wxAND_REVERSE ? SRCERASE :
|
||||||
|
logical_func == wxSRC_OR ? srcOr :
|
||||||
|
// logical_func == wxSRC_AND ? SRCAND :
|
||||||
|
srcCopy );
|
||||||
|
|
||||||
|
if ( useMask && source->m_macMask )
|
||||||
|
{
|
||||||
|
wxASSERT( mode == srcCopy ) ;
|
||||||
|
if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
|
||||||
|
{
|
||||||
|
CopyMask( &GrafPtr( sourcePort )->portBits , &GrafPtr( source->m_macMask )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
|
&srcrect, &srcrect , &dstrect ) ;
|
||||||
|
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
|
CopyBits( &GrafPtr( sourcePort )->portBits , &GrafPtr( m_macPort )->portBits ,
|
||||||
&srcrect, &dstrect, srcCopy, NULL ) ;
|
&srcrect, &dstrect, mode, NULL ) ;
|
||||||
/*
|
}
|
||||||
if ( m_clipping )
|
|
||||||
{
|
|
||||||
long x1 = XLOG2DEV(m_clipX1);
|
|
||||||
long y1 = YLOG2DEV(m_clipY1);
|
|
||||||
long x2 = XLOG2DEV(m_clipX2);
|
|
||||||
long y2 = YLOG2DEV(m_clipY2);
|
|
||||||
|
|
||||||
Rect clip = { y1 , x1 , y2 , x2 } ;
|
|
||||||
::ClipRect(&clip);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
UnlockPixels( bmappixels ) ;
|
UnlockPixels( bmappixels ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,6 +44,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
|||||||
if ( bmap->m_hBitmap )
|
if ( bmap->m_hBitmap )
|
||||||
{
|
{
|
||||||
m_macPort = (GrafPtr) bmap->m_hBitmap ;
|
m_macPort = (GrafPtr) bmap->m_hBitmap ;
|
||||||
|
wxMask * mask = bitmap.GetMask() ;
|
||||||
|
if ( mask )
|
||||||
|
{
|
||||||
|
m_macMask = mask->GetMaskBitmap() ;
|
||||||
|
}
|
||||||
MacSetupPort() ;
|
MacSetupPort() ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
|
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
|
||||||
|
@@ -68,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
|
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
|
||||||
|
|
||||||
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
|
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
|
||||||
(**m_macList).selFlags = lOnlyOne ;
|
(**m_macList).selFlags = 0 ;
|
||||||
if ( style & wxLB_MULTIPLE )
|
if ( style & wxLB_MULTIPLE )
|
||||||
{
|
{
|
||||||
(**m_macList).selFlags += lNoExtend ;
|
(**m_macList).selFlags += lNoExtend ;
|
||||||
}
|
}
|
||||||
@@ -77,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
(**m_macList).selFlags += lExtendDrag ;
|
(**m_macList).selFlags += lExtendDrag ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(**m_macList).selFlags = lOnlyOne ;
|
||||||
|
}
|
||||||
Point pt = (**m_macList).cellSize ;
|
Point pt = (**m_macList).cellSize ;
|
||||||
pt.v = 14 ;
|
pt.v = 14 ;
|
||||||
LCellSize( pt , m_macList ) ;
|
LCellSize( pt , m_macList ) ;
|
||||||
@@ -151,6 +155,7 @@ void wxListBox::Delete(int N)
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
||||||
m_stringArray.Remove( N ) ;
|
m_stringArray.Remove( N ) ;
|
||||||
|
m_dataArray.Remove( N ) ;
|
||||||
m_noItems --;
|
m_noItems --;
|
||||||
|
|
||||||
MacDelete( N ) ;
|
MacDelete( N ) ;
|
||||||
@@ -185,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
wxASSERT_MSG(clientData[i] == NULL,
|
wxASSERT_MSG(clientData[i] == NULL,
|
||||||
wxT("Can't use client data with owner-drawn listboxes"));
|
wxT("Can't use client data with owner-drawn listboxes"));
|
||||||
#else // !wxUSE_OWNER_DRAWN
|
#else // !wxUSE_OWNER_DRAWN
|
||||||
Append( choices[i] , clientData[0] ) ;
|
Append( choices[i] , clientData[i] ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -298,7 +303,16 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
|||||||
wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
|
wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
|
||||||
}
|
}
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
m_dataArray[N] = (char*) Client_data ;
|
wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
|
||||||
|
|
||||||
|
if ( m_dataArray.GetCount() > N )
|
||||||
|
{
|
||||||
|
m_dataArray[N] = (char*) Client_data ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dataArray.Add( (char*) Client_data ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
|
void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
|
||||||
|
@@ -55,11 +55,23 @@ void wxMacCtoPString(const char* theCString, Str255 thePString);
|
|||||||
|
|
||||||
// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
|
// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
|
||||||
|
|
||||||
void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemName , bool useShortcuts )
|
void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemText , bool useShortcuts )
|
||||||
{
|
{
|
||||||
char *p = (char *) &outMacItemText[1] ;
|
char *p = (char *) &outMacItemText[1] ;
|
||||||
short macModifiers = 0 ;
|
short macModifiers = 0 ;
|
||||||
char macShortCut = 0 ;
|
char macShortCut = 0 ;
|
||||||
|
const char *inItemName ;
|
||||||
|
wxString inItemTextMac ;
|
||||||
|
|
||||||
|
if (wxApp::s_macDefaultEncodingIsPC)
|
||||||
|
{
|
||||||
|
inItemTextMac = wxMacMakeMacStringFromPC( inItemText ) ;
|
||||||
|
inItemName = inItemTextMac ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inItemName = inItemText ;
|
||||||
|
}
|
||||||
|
|
||||||
if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
|
if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
|
||||||
useShortcuts = false ;
|
useShortcuts = false ;
|
||||||
@@ -120,6 +132,11 @@ void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , s
|
|||||||
inItemName = inItemName + 5;
|
inItemName = inItemName + 5;
|
||||||
macShortCut = *inItemName;
|
macShortCut = *inItemName;
|
||||||
}
|
}
|
||||||
|
else if (strncmp("Cntrl", inItemName, 5) == 0)
|
||||||
|
{
|
||||||
|
inItemName = inItemName + 6;
|
||||||
|
macShortCut = *inItemName;
|
||||||
|
}
|
||||||
else if (strncmp("Alt", inItemName, 3) == 0)
|
else if (strncmp("Alt", inItemName, 3) == 0)
|
||||||
{
|
{
|
||||||
inItemName = inItemName + 4;
|
inItemName = inItemName + 4;
|
||||||
@@ -876,7 +893,7 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
|
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
|
||||||
|
|
||||||
|
|
||||||
if( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
|
if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
|
||||||
{
|
{
|
||||||
MenuHandle mh = NULL ;
|
MenuHandle mh = NULL ;
|
||||||
if ( HMGetHelpMenuHandle( &mh ) != noErr )
|
if ( HMGetHelpMenuHandle( &mh ) != noErr )
|
||||||
@@ -899,24 +916,32 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Str255 label ;
|
if ( item->IsSeparator() )
|
||||||
wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
|
|
||||||
if ( label[0] == 0 )
|
|
||||||
{
|
|
||||||
// we cannot add empty menus on mac
|
|
||||||
label[0] = 1 ;
|
|
||||||
label[1] = ' ' ;
|
|
||||||
}
|
|
||||||
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
|
|
||||||
{
|
|
||||||
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
|
|
||||||
// ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
|
||||||
::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if ( mh )
|
if ( mh )
|
||||||
::AppendMenu(mh, label );
|
::AppendMenu(mh, "\p-" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Str255 label ;
|
||||||
|
wxMacBuildMenuString( label , NULL , NULL , item->GetText(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
|
||||||
|
if ( label[0] == 0 )
|
||||||
|
{
|
||||||
|
// we cannot add empty menus on mac
|
||||||
|
label[0] = 1 ;
|
||||||
|
label[1] = ' ' ;
|
||||||
|
}
|
||||||
|
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
|
||||||
|
{
|
||||||
|
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
|
||||||
|
// ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
||||||
|
::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( mh )
|
||||||
|
::AppendMenu(mh, label );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1094,7 +1119,7 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
|
|||||||
for (int i = 0; i < m_menus.GetCount() ; i++)
|
for (int i = 0; i < m_menus.GetCount() ; i++)
|
||||||
{
|
{
|
||||||
if ( m_menus[i]->MacGetMenuId() == macMenuId ||
|
if ( m_menus[i]->MacGetMenuId() == macMenuId ||
|
||||||
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
|
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||||
|
@@ -70,12 +70,24 @@ int wxMessageDialog::ShowModal()
|
|||||||
Str255 pascalTitle ;
|
Str255 pascalTitle ;
|
||||||
Str255 pascalText ;
|
Str255 pascalText ;
|
||||||
|
|
||||||
strcpy( (char*) pascalTitle , m_caption ) ;
|
|
||||||
|
if (wxApp::s_macDefaultEncodingIsPC)
|
||||||
|
{
|
||||||
|
strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
|
||||||
|
strcpy( (char*) pascalText , wxMacMakeMacStringFromPC( m_message) ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy( (char*) pascalTitle , m_caption ) ;
|
||||||
|
strcpy( (char*) pascalText , m_message ) ;
|
||||||
|
}
|
||||||
|
|
||||||
c2pstr( (char*) pascalTitle ) ;
|
c2pstr( (char*) pascalTitle ) ;
|
||||||
strcpy( (char*) pascalText , m_message ) ;
|
|
||||||
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
|
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
|
||||||
c2pstr( (char*) pascalText ) ;
|
c2pstr( (char*) pascalText ) ;
|
||||||
|
|
||||||
|
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
|
||||||
|
|
||||||
if ( !UMAHasAppearance() )
|
if ( !UMAHasAppearance() )
|
||||||
{
|
{
|
||||||
int resourceID ;
|
int resourceID ;
|
||||||
|
@@ -418,7 +418,7 @@ void wxRadioBox::SetFocus()
|
|||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// Simulates the effect of the user issuing a command to the item
|
// Simulates the effect of the user issuing a command to the item
|
||||||
|
|
||||||
#define RADIO_SIZE 20
|
#define RADIO_SIZE 40
|
||||||
|
|
||||||
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
@@ -429,6 +429,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
int x_current, y_current;
|
int x_current, y_current;
|
||||||
int x_offset,y_offset;
|
int x_offset,y_offset;
|
||||||
|
int widthOld, heightOld;
|
||||||
|
GetSize(&widthOld, &heightOld);
|
||||||
|
|
||||||
x_offset = x;
|
x_offset = x;
|
||||||
y_offset = y;
|
y_offset = y;
|
||||||
@@ -463,7 +465,24 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
|
totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
|
||||||
totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
|
totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
|
||||||
|
|
||||||
wxControl::DoSetSize(x_offset,y_offset,totWidth,totHeight,wxSIZE_AUTO);
|
// only change our width/height if asked for
|
||||||
|
if ( width == -1 )
|
||||||
|
{
|
||||||
|
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
|
||||||
|
width = totWidth ;
|
||||||
|
else
|
||||||
|
width = widthOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( height == -1 )
|
||||||
|
{
|
||||||
|
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
|
||||||
|
height = totHeight ;
|
||||||
|
else
|
||||||
|
height = heightOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
|
||||||
|
|
||||||
// arrange radiobuttons
|
// arrange radiobuttons
|
||||||
|
|
||||||
|
@@ -73,6 +73,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
|
|||||||
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
||||||
{
|
{
|
||||||
SetValue(true) ;
|
SetValue(true) ;
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
|
||||||
|
event.SetEventObject(this);
|
||||||
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
||||||
|
@@ -22,6 +22,65 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
|
|||||||
|
|
||||||
#include <wx/mac/uma.h>
|
#include <wx/mac/uma.h>
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxStaticText, wxControl)
|
||||||
|
EVT_PAINT(wxStaticText::OnPaint)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
SetName(name);
|
||||||
|
m_backgroundColour = parent->GetBackgroundColour() ;
|
||||||
|
m_foregroundColour = parent->GetForegroundColour() ;
|
||||||
|
|
||||||
|
if ( id == -1 )
|
||||||
|
m_windowId = (int)NewControlId();
|
||||||
|
else
|
||||||
|
m_windowId = id;
|
||||||
|
|
||||||
|
m_windowStyle = style;
|
||||||
|
m_label = label ;
|
||||||
|
|
||||||
|
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
|
||||||
|
SetSizeOrDefault( size ) ;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStaticText::OnPaint( wxPaintEvent &event )
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
PrepareDC(dc);
|
||||||
|
dc.Clear() ;
|
||||||
|
dc.DrawText( m_label , 0 , 0 ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize wxStaticText::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
int x , y ;
|
||||||
|
GetTextExtent( m_label , &x , &y ) ;
|
||||||
|
return wxSize( x , y ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStaticText::SetLabel(const wxString& st , bool resize )
|
||||||
|
{
|
||||||
|
SetTitle( st ) ;
|
||||||
|
m_label = st ;
|
||||||
|
if ( resize )
|
||||||
|
SetSizeOrDefault() ;
|
||||||
|
else
|
||||||
|
Refresh() ;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
|
{
|
||||||
|
wxControl::SetSize( x , y , width , height , sizeFlags ) ;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
@@ -56,4 +115,5 @@ void wxStaticText::SetLabel(const wxString& st , bool resize )
|
|||||||
::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
|
::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@@ -245,10 +245,14 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
ControlHandle m_macToolHandle ;
|
ControlHandle m_macToolHandle ;
|
||||||
|
|
||||||
|
SInt16 behaviour = kControlBehaviorOffsetContents ;
|
||||||
|
if ( tool->CanBeToggled() )
|
||||||
|
behaviour += kControlBehaviorToggles ;
|
||||||
|
|
||||||
if ( icon )
|
if ( icon )
|
||||||
{
|
{
|
||||||
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
||||||
kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
|
|
||||||
info.contentType = kControlContentPictHandle ;
|
info.contentType = kControlContentPictHandle ;
|
||||||
@@ -259,7 +263,7 @@ bool wxToolBar::Realize()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
|
||||||
kControlBehaviorOffsetContents , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
||||||
}
|
}
|
||||||
m_macToolHandles.Add( m_macToolHandle ) ;
|
m_macToolHandles.Add( m_macToolHandle ) ;
|
||||||
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
|
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
|
||||||
@@ -353,12 +357,29 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
|
|||||||
void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
|
void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)t;
|
wxToolBarTool *tool = (wxToolBarTool *)t;
|
||||||
|
ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
|
||||||
|
if ( UMAHasAppearance() )
|
||||||
|
{
|
||||||
|
if ( enable )
|
||||||
|
::ActivateControl( control ) ;
|
||||||
|
else
|
||||||
|
::DeactivateControl( control ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( enable )
|
||||||
|
::HiliteControl( control , 0 ) ;
|
||||||
|
else
|
||||||
|
::HiliteControl( control , 255 ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
|
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)t;
|
wxToolBarTool *tool = (wxToolBarTool *)t;
|
||||||
// TODO: set toggle state
|
|
||||||
|
ControlHandle control = (ControlHandle) m_macToolHandles[ tool->m_index ] ;
|
||||||
|
::SetControlValue( control , toggle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||||
|
@@ -642,11 +642,24 @@ bool wxWindow::Show(bool show)
|
|||||||
UMAHideWindow( m_macWindowData->m_macWindow ) ;
|
UMAHideWindow( m_macWindowData->m_macWindow ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MacSuperShown( show ) ;
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindow::MacSuperShown( bool show )
|
||||||
|
{
|
||||||
|
wxNode *node = GetChildren().First();
|
||||||
|
while ( node )
|
||||||
|
{
|
||||||
|
wxWindow *child = (wxWindow *)node->Data();
|
||||||
|
if ( child->m_isShown )
|
||||||
|
child->MacSuperShown( show ) ;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int wxWindow::GetCharHeight() const
|
int wxWindow::GetCharHeight() const
|
||||||
{
|
{
|
||||||
wxClientDC dc ( (wxWindow*)this ) ;
|
wxClientDC dc ( (wxWindow*)this ) ;
|
||||||
@@ -914,6 +927,43 @@ void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindow::MacPaint( wxPaintEvent &event )
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
PrepareDC(dc);
|
||||||
|
|
||||||
|
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
|
||||||
|
{
|
||||||
|
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
|
||||||
|
|
||||||
|
wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
|
||||||
|
wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
|
||||||
|
|
||||||
|
wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
|
||||||
|
wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
|
||||||
|
wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
|
||||||
|
wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
|
||||||
|
|
||||||
|
dc.SetPen(wxPen1);
|
||||||
|
dc.DrawRectangle(0, 0, m_width, m_height); // outer - right and button
|
||||||
|
|
||||||
|
dc.SetPen(wxPen2);
|
||||||
|
dc.DrawRectangle(1, 1, m_width-1, m_height-1); // outer - left and top
|
||||||
|
|
||||||
|
dc.SetPen(wxPen3);
|
||||||
|
dc.DrawRectangle(0, 0, m_width-2, m_height-2); // inner - right and button
|
||||||
|
|
||||||
|
dc.SetPen(wxPen4);
|
||||||
|
dc.DrawLine(0, 0, m_width-3, 0); // inner - left and top
|
||||||
|
dc.DrawLine(0, 0, 0, m_height-3);
|
||||||
|
}
|
||||||
|
else if (HasFlag(wxSIMPLE_BORDER))
|
||||||
|
{
|
||||||
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
|
dc.DrawRectangle(0, 0, m_width, m_height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// New function that will replace some of the above.
|
// New function that will replace some of the above.
|
||||||
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
|
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
|
||||||
int range, bool refresh)
|
int range, bool refresh)
|
||||||
@@ -1433,7 +1483,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
|
|||||||
event.m_timeStamp = time ;
|
event.m_timeStamp = time ;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
|
wxPaintEvent event2( event ) ;
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
MacPaint( event2 ) ;
|
||||||
|
|
||||||
RgnHandle childupdate = NewRgn() ;
|
RgnHandle childupdate = NewRgn() ;
|
||||||
|
|
||||||
|
@@ -600,19 +600,63 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
|
|||||||
if (!bmp.Ok())
|
if (!bmp.Ok())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool needsPixelCopy = false ;
|
||||||
|
bool isPrinter = false ;
|
||||||
|
if (IsKindOf(CLASSINFO(wxPrinterDC)) )
|
||||||
|
{
|
||||||
|
isPrinter = true ;
|
||||||
|
if ( ::GetDeviceCaps((HDC) m_hDC, RASTERCAPS) & RC_STRETCHDIB )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
needsPixelCopy = true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
// If we're not drawing transparently, and not drawing to a printer,
|
// If we're not drawing transparently, and not drawing to a printer,
|
||||||
// optimize this function to use Windows functions.
|
// optimize this function to use Windows functions.
|
||||||
if (!useMask && !IsKindOf(CLASSINFO(wxPrinterDC)))
|
if (!useMask && !needsPixelCopy)
|
||||||
{
|
{
|
||||||
HDC cdc = GetHdc();
|
if ( isPrinter )
|
||||||
HDC memdc = ::CreateCompatibleDC( cdc );
|
{
|
||||||
HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
|
BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) ) ;
|
||||||
|
int iBitsSize = ((bmp.GetWidth() + 3 ) & ~3 ) * bmp.GetHeight() ;
|
||||||
|
|
||||||
|
void* bits = malloc( iBitsSize ) ;
|
||||||
|
|
||||||
|
memset( info , 0 , sizeof( BITMAPINFOHEADER ) ) ;
|
||||||
|
|
||||||
|
info->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ) ;
|
||||||
|
info->bmiHeader.biWidth = bmp.GetWidth() ;
|
||||||
|
info->bmiHeader.biHeight = bmp.GetHeight() ;
|
||||||
|
info->bmiHeader.biPlanes = 1 ;
|
||||||
|
info->bmiHeader.biBitCount = 8 ;
|
||||||
|
info->bmiHeader.biCompression = BI_RGB ;
|
||||||
|
|
||||||
|
HDC display = GetDC( NULL ) ;
|
||||||
|
if ( GetDIBits( display , (HBITMAP) bmp.GetHBITMAP( ) , 0 , bmp.GetHeight() , bits , info , DIB_RGB_COLORS ) )
|
||||||
|
{
|
||||||
|
StretchDIBits( (HDC) m_hDC,
|
||||||
|
x, y, bmp.GetWidth(), bmp.GetHeight() ,
|
||||||
|
0 , 0 ,bmp.GetWidth(), bmp.GetHeight() ,
|
||||||
|
bits , info , DIB_RGB_COLORS , SRCCOPY ) ;
|
||||||
|
}
|
||||||
|
ReleaseDC( NULL , display ) ;
|
||||||
|
free ( bits ) ;
|
||||||
|
free( info ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HDC cdc = GetHdc();
|
||||||
|
HDC memdc = ::CreateCompatibleDC( cdc );
|
||||||
|
HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
|
||||||
|
|
||||||
wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
|
wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
|
||||||
|
|
||||||
::SelectObject( memdc, hbitmap );
|
::SelectObject( memdc, hbitmap );
|
||||||
::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
|
::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
|
||||||
::DeleteDC( memdc );
|
::DeleteDC( memdc );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user