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:
Stefan Csomor 2000-01-13 11:07:58 +00:00
parent d47ebd1e05
commit 8208e181cb
42 changed files with 863 additions and 248 deletions

View File

@ -382,6 +382,7 @@ class WXDLLEXPORT wxDC: public wxObject
//begin wxmac
GrafPtr m_macPort ;
GWorldPtr m_macMask ;
// in order to preserve the const inheritance of the virtual functions, we have to
// use mutable variables starting from CWPro 5

View File

@ -111,6 +111,7 @@ public:
// --------------
bool IsModalShowing() const { return m_modalShowing; }
virtual bool IsTopLevel() const { return TRUE; }
// tooltip management
#if wxUSE_TOOLTIPS

View File

@ -56,6 +56,7 @@ public:
const wxString& name = wxFrameNameStr);
virtual bool Destroy();
virtual bool IsTopLevel() const { return TRUE; }
void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event);

View File

@ -49,6 +49,13 @@ class WXDLLEXPORT wxStaticText: public wxControl
// operations
virtual void Command(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

View File

@ -236,10 +236,12 @@ public :
virtual void MacFireMouseEvent( EventRecord *ev ) ;
virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ;
virtual void MacEraseBackground( Rect *rect ) ;
virtual void MacPaint( wxPaintEvent &event ) ;
WindowRef GetMacRootWindow() const ;
virtual ControlHandle MacGetContainerForEmbedding() ;
virtual void MacSuperChangedPosition() ;
virtual void MacSuperShown( bool show ) ;
bool MacSetupFocusPort() ;
bool MacSetupDrawingPort() ;

View File

@ -117,7 +117,7 @@ public:
virtual ~wxBitmap();
// 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
bool CopyFromIcon(const wxIcon& icon);

View File

@ -140,19 +140,33 @@ bool MyApp::OnInit()
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& 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
SetIcon(wxICON(mondrian));
// create a menu bar
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->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...
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, "&File");
#ifdef __WXMAC__
menuBar->Append(helpMenu, "&Help");
#endif
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);

View File

@ -95,9 +95,9 @@
#ifndef WX_TIMEZONE
#if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
#define WX_TIMEZONE _timezone
#elif defined(__WXMAC__)
long wxmac_timezone = 28800;
#define WX_TIMEZONE wxmac_timezone ;
#elif defined(__MWERKS__)
long wxmw_timezone = 28800;
#define WX_TIMEZONE wxmw_timezone ;
#else // unknown platform - try timezone
#define WX_TIMEZONE timezone
#endif

View File

@ -883,7 +883,12 @@ wxBitmap wxImage::ConvertToBitmap() const
{
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;
@ -1128,6 +1133,12 @@ wxBitmap wxImage::ConvertToBitmap() const
SetGWorld( origPort , origDevice ) ;
if ( HasMask() )
{
wxColour colour( GetMaskRed(), GetMaskGreen(), GetMaskBlue());
wxMask *mask = new wxMask( bitmap, colour );
bitmap.SetMask( mask );
}
return bitmap;
}

View File

@ -446,18 +446,14 @@ wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
wxMask::wxMask()
{
/* TODO
m_maskBitmap = 0;
*/
}
// Construct a mask from a bitmap and a colour indicating
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
{
/* TODO
m_maskBitmap = 0;
*/
Create(bitmap, colour);
}
@ -465,26 +461,24 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
{
/* TODO
m_maskBitmap = 0;
*/
Create(bitmap, paletteIndex);
}
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask::wxMask(const wxBitmap& bitmap)
{
/* TODO
m_maskBitmap = 0;
*/
Create(bitmap);
}
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).
@ -506,8 +500,54 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
// the transparent area
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
{
// TODO
return FALSE;
if ( m_maskBitmap )
{
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;
}
/*

View File

@ -48,8 +48,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
m_macHorizontalBorder = 2 ; // additional pixels around the real control
m_macVerticalBorder = 2 ;
m_macHorizontalBorder = 0 ; // additional pixels around the real control
m_macVerticalBorder = 0 ;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;

View File

@ -446,18 +446,14 @@ wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
wxMask::wxMask()
{
/* TODO
m_maskBitmap = 0;
*/
}
// Construct a mask from a bitmap and a colour indicating
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
{
/* TODO
m_maskBitmap = 0;
*/
Create(bitmap, colour);
}
@ -465,26 +461,24 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
// the transparent area
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
{
/* TODO
m_maskBitmap = 0;
*/
Create(bitmap, paletteIndex);
}
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask::wxMask(const wxBitmap& bitmap)
{
/* TODO
m_maskBitmap = 0;
*/
Create(bitmap);
}
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).
@ -506,8 +500,54 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
// the transparent area
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
{
// TODO
return FALSE;
if ( m_maskBitmap )
{
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;
}
/*

View File

@ -48,8 +48,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
m_macHorizontalBorder = 2 ; // additional pixels around the real control
m_macVerticalBorder = 2 ;
m_macHorizontalBorder = 0 ; // additional pixels around the real control
m_macVerticalBorder = 0 ;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;

View File

@ -59,6 +59,10 @@ void wxCheckBox::Command (wxCommandEvent & event)
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
SetValue( !GetValue() ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
event.SetInt(GetValue());
event.SetEventObject(this);
ProcessCommand(event);
}
// Bitmap checkbox

View File

@ -34,8 +34,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
kControlPopupButtonProc , (long) this ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;

View File

@ -18,7 +18,7 @@
#include "wx/tabctrl.h"
#include "wx/spinbutt.h"
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxControlBase)
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
@ -383,7 +383,6 @@ void wxControl::MacSuperEnabled( bool enabled )
void wxControl::MacSuperShown( bool show )
{
/*
if ( m_macControl )
{
if ( !show )
@ -392,13 +391,12 @@ void wxControl::MacSuperShown( bool show )
}
else
{
if ( m_macShown )
if ( m_isShown )
::UMAShowControl( m_macControl ) ;
}
}
wxWindow::MacSuperShown( show ) ;
*/
}
void wxControl::DoSetSize(int x, int y,

View File

@ -92,44 +92,47 @@ wxFont wxNullFont;
wxColour wxNullColour;
// Default window names
const char *wxButtonNameStr = "button";
const char *wxCanvasNameStr = "canvas";
const char *wxCheckBoxNameStr = "check";
const char *wxChoiceNameStr = "choice";
const char *wxComboBoxNameStr = "comboBox";
const char *wxDialogNameStr = "dialog";
const char *wxFrameNameStr = "frame";
const char *wxGaugeNameStr = "gauge";
const char *wxStaticBoxNameStr = "groupBox";
const char *wxListBoxNameStr = "listBox";
const char *wxStaticTextNameStr = "message";
const char *wxStaticBitmapNameStr = "message";
const char *wxMultiTextNameStr = "multitext";
const char *wxPanelNameStr = "panel";
const char *wxRadioBoxNameStr = "radioBox";
const char *wxRadioButtonNameStr = "radioButton";
const char *wxBitmapRadioButtonNameStr = "radioButton";
const char *wxScrollBarNameStr = "scrollBar";
const char *wxSliderNameStr = "slider";
const char *wxStaticNameStr = "static";
const char *wxTextCtrlWindowNameStr = "textWindow";
const char *wxTextCtrlNameStr = "text";
const char *wxVirtListBoxNameStr = "virtListBox";
const char *wxButtonBarNameStr = "buttonbar";
const char *wxEnhDialogNameStr = "Shell";
const char *wxToolBarNameStr = "toolbar";
const char *wxStatusLineNameStr = "status_line";
const wxChar *wxButtonNameStr = wxT("button");
const wxChar *wxCanvasNameStr = wxT("canvas");
const wxChar *wxCheckBoxNameStr = wxT("check");
const wxChar *wxChoiceNameStr = wxT("choice");
const wxChar *wxComboBoxNameStr = wxT("comboBox");
const wxChar *wxDialogNameStr = wxT("dialog");
const wxChar *wxFrameNameStr = wxT("frame");
const wxChar *wxGaugeNameStr = wxT("gauge");
const wxChar *wxStaticBoxNameStr = wxT("groupBox");
const wxChar *wxListBoxNameStr = wxT("listBox");
const wxChar *wxStaticTextNameStr = wxT("message");
const wxChar *wxStaticBitmapNameStr = wxT("message");
const wxChar *wxMultiTextNameStr = wxT("multitext");
const wxChar *wxPanelNameStr = wxT("panel");
const wxChar *wxRadioBoxNameStr = wxT("radioBox");
const wxChar *wxRadioButtonNameStr = wxT("radioButton");
const wxChar *wxBitmapRadioButtonNameStr = wxT("radioButton");
const wxChar *wxScrollBarNameStr = wxT("scrollBar");
const wxChar *wxSliderNameStr = wxT("slider");
const wxChar *wxStaticNameStr = wxT("static");
const wxChar *wxTextCtrlWindowNameStr = wxT("textWindow");
const wxChar *wxTextCtrlNameStr = wxT("text");
const wxChar *wxVirtListBoxNameStr = wxT("virtListBox");
const wxChar *wxButtonBarNameStr = wxT("buttonbar");
const wxChar *wxEnhDialogNameStr = wxT("Shell");
const wxChar *wxToolBarNameStr = wxT("toolbar");
const wxChar *wxStatusLineNameStr = wxT("status_line");
const char *wxGetTextFromUserPromptStr = "Input Text";
const char *wxMessageBoxCaptionStr = "Message";
const char *wxFileSelectorPromptStr = "Select a file";
const char *wxFileSelectorDefaultWildcardStr = "*.*";
const char *wxInternalErrorStr = "wxWindows Internal Error";
const char *wxFatalErrorStr = "wxWindows Fatal Error";
const wxChar *wxGetTextFromUserPromptStr = wxT("Input Text");
const wxChar *wxMessageBoxCaptionStr = wxT("Message");
const wxChar *wxFileSelectorPromptStr = wxT("Select a file");
const wxChar *wxFileSelectorDefaultWildcardStr = wxT("*.*");
const wxChar *wxInternalErrorStr = wxT("wxWindows Internal 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
const char *wxFloatToStringStr = "%.2f";
const char *wxDoubleToStringStr = "%.2f";
const wxChar *wxFloatToStringStr = wxT("%.2f");
const wxChar *wxDoubleToStringStr = wxT("%.2f");
const wxSize wxDefaultSize(-1, -1);
const wxPoint wxDefaultPosition(-1, -1);

View File

@ -84,6 +84,7 @@ wxDC::wxDC(void)
// m_palette = wxAPP_COLOURMAP;
m_macPort = NULL ;
m_macMask = NULL ;
m_ok = 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} ;
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
// RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
// RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
bmappixels = GetGWorldPixMap( bmapworld ) ;
if ( LockPixels(bmappixels) )
@ -168,21 +167,20 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
dest.left = XLOG2DEV(x) ;
dest.bottom = YLOG2DEV(y + bmap->m_height ) ;
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 } ;
::ClipRect(&clip);
if ( useMask && bmp.GetMask() )
{
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 ) ;
}
m_macPenInstalled = false ;
@ -1071,8 +1069,6 @@ bool wxDC::Blit( long xdest, long ydest, long width, long height,
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
RGBColor black = { 0,0,0} ;
// RGBForeColor( &black ) ;
// RGBBackColor( &white ) ;
RGBForeColor( &m_textForegroundColour.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.bottom = YLOG2DEV(ydest + height ) ;
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 ,
&srcrect, &dstrect, 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 } ;
::ClipRect(&clip);
}
*/
&srcrect, &dstrect, mode, NULL ) ;
}
UnlockPixels( bmappixels ) ;
}

View File

@ -44,6 +44,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
if ( bmap->m_hBitmap )
{
m_macPort = (GrafPtr) bmap->m_hBitmap ;
wxMask * mask = bitmap.GetMask() ;
if ( mask )
{
m_macMask = mask->GetMaskBitmap() ;
}
MacSetupPort() ;
m_ok = TRUE ;
// SetBackground(wxBrush(*wxWHITE, wxSOLID));

View File

@ -68,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
(**m_macList).selFlags = lOnlyOne ;
if ( style & wxLB_MULTIPLE )
(**m_macList).selFlags = 0 ;
if ( style & wxLB_MULTIPLE )
{
(**m_macList).selFlags += lNoExtend ;
}
@ -77,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
{
(**m_macList).selFlags += lExtendDrag ;
}
else
{
(**m_macList).selFlags = lOnlyOne ;
}
Point pt = (**m_macList).cellSize ;
pt.v = 14 ;
LCellSize( pt , m_macList ) ;
@ -151,6 +155,7 @@ void wxListBox::Delete(int N)
}
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
m_stringArray.Remove( N ) ;
m_dataArray.Remove( N ) ;
m_noItems --;
MacDelete( N ) ;
@ -185,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
wxASSERT_MSG(clientData[i] == NULL,
wxT("Can't use client data with owner-drawn listboxes"));
#else // !wxUSE_OWNER_DRAWN
Append( choices[i] , clientData[0] ) ;
Append( choices[i] , clientData[i] ) ;
#endif
}
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"));
}
#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)

View File

@ -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
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] ;
short macModifiers = 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 )
useShortcuts = false ;
@ -120,6 +132,11 @@ void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , s
inItemName = inItemName + 5;
macShortCut = *inItemName;
}
else if (strncmp("Cntrl", inItemName, 5) == 0)
{
inItemName = inItemName + 6;
macShortCut = *inItemName;
}
else if (strncmp("Alt", inItemName, 3) == 0)
{
inItemName = inItemName + 4;
@ -876,7 +893,7 @@ void wxMenuBar::MacInstallMenuBar()
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 ;
if ( HMGetHelpMenuHandle( &mh ) != noErr )
@ -899,24 +916,32 @@ void wxMenuBar::MacInstallMenuBar()
}
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 ( item->IsSeparator() )
{
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++)
{
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 ) )

View File

@ -70,12 +70,24 @@ int wxMessageDialog::ShowModal()
Str255 pascalTitle ;
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 ) ;
strcpy( (char*) pascalText , m_message ) ;
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
c2pstr( (char*) pascalText ) ;
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
if ( !UMAHasAppearance() )
{
int resourceID ;

View File

@ -418,7 +418,7 @@ void wxRadioBox::SetFocus()
//-------------------------------------------------------------------------------------
// 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)
{
@ -429,6 +429,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
int x_current, y_current;
int x_offset,y_offset;
int widthOld, heightOld;
GetSize(&widthOld, &heightOld);
x_offset = x;
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;
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

View File

@ -73,6 +73,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
SetValue(true) ;
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
event.SetEventObject(this);
ProcessCommand(event);
}
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)

View File

@ -22,6 +22,65 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
#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,
const wxString& label,
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 ) ;
Refresh() ;
}
*/

View File

@ -245,10 +245,14 @@ bool wxToolBar::Realize()
ControlHandle m_macToolHandle ;
SInt16 behaviour = kControlBehaviorOffsetContents ;
if ( tool->CanBeToggled() )
behaviour += kControlBehaviorToggles ;
if ( icon )
{
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
ControlButtonContentInfo info ;
info.contentType = kControlContentPictHandle ;
@ -259,7 +263,7 @@ bool wxToolBar::Realize()
else
{
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
kControlBehaviorOffsetContents , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
}
m_macToolHandles.Add( m_macToolHandle ) ;
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
@ -353,12 +357,29 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
{
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)
{
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),

View File

@ -642,11 +642,24 @@ bool wxWindow::Show(bool show)
UMAHideWindow( m_macWindowData->m_macWindow ) ;
}
}
MacSuperShown( show ) ;
Refresh() ;
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
{
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.
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh)
@ -1433,7 +1483,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
event.m_timeStamp = time ;
event.SetEventObject(this);
wxPaintEvent event2( event ) ;
GetEventHandler()->ProcessEvent(event);
MacPaint( event2 ) ;
RgnHandle childupdate = NewRgn() ;

View File

@ -59,6 +59,10 @@ void wxCheckBox::Command (wxCommandEvent & event)
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
SetValue( !GetValue() ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
event.SetInt(GetValue());
event.SetEventObject(this);
ProcessCommand(event);
}
// Bitmap checkbox

View File

@ -34,8 +34,8 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
kControlPopupButtonProc , (long) this ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;

View File

@ -18,7 +18,7 @@
#include "wx/tabctrl.h"
#include "wx/spinbutt.h"
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxControlBase)
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
@ -383,7 +383,6 @@ void wxControl::MacSuperEnabled( bool enabled )
void wxControl::MacSuperShown( bool show )
{
/*
if ( m_macControl )
{
if ( !show )
@ -392,13 +391,12 @@ void wxControl::MacSuperShown( bool show )
}
else
{
if ( m_macShown )
if ( m_isShown )
::UMAShowControl( m_macControl ) ;
}
}
wxWindow::MacSuperShown( show ) ;
*/
}
void wxControl::DoSetSize(int x, int y,

View File

@ -92,44 +92,47 @@ wxFont wxNullFont;
wxColour wxNullColour;
// Default window names
const char *wxButtonNameStr = "button";
const char *wxCanvasNameStr = "canvas";
const char *wxCheckBoxNameStr = "check";
const char *wxChoiceNameStr = "choice";
const char *wxComboBoxNameStr = "comboBox";
const char *wxDialogNameStr = "dialog";
const char *wxFrameNameStr = "frame";
const char *wxGaugeNameStr = "gauge";
const char *wxStaticBoxNameStr = "groupBox";
const char *wxListBoxNameStr = "listBox";
const char *wxStaticTextNameStr = "message";
const char *wxStaticBitmapNameStr = "message";
const char *wxMultiTextNameStr = "multitext";
const char *wxPanelNameStr = "panel";
const char *wxRadioBoxNameStr = "radioBox";
const char *wxRadioButtonNameStr = "radioButton";
const char *wxBitmapRadioButtonNameStr = "radioButton";
const char *wxScrollBarNameStr = "scrollBar";
const char *wxSliderNameStr = "slider";
const char *wxStaticNameStr = "static";
const char *wxTextCtrlWindowNameStr = "textWindow";
const char *wxTextCtrlNameStr = "text";
const char *wxVirtListBoxNameStr = "virtListBox";
const char *wxButtonBarNameStr = "buttonbar";
const char *wxEnhDialogNameStr = "Shell";
const char *wxToolBarNameStr = "toolbar";
const char *wxStatusLineNameStr = "status_line";
const wxChar *wxButtonNameStr = wxT("button");
const wxChar *wxCanvasNameStr = wxT("canvas");
const wxChar *wxCheckBoxNameStr = wxT("check");
const wxChar *wxChoiceNameStr = wxT("choice");
const wxChar *wxComboBoxNameStr = wxT("comboBox");
const wxChar *wxDialogNameStr = wxT("dialog");
const wxChar *wxFrameNameStr = wxT("frame");
const wxChar *wxGaugeNameStr = wxT("gauge");
const wxChar *wxStaticBoxNameStr = wxT("groupBox");
const wxChar *wxListBoxNameStr = wxT("listBox");
const wxChar *wxStaticTextNameStr = wxT("message");
const wxChar *wxStaticBitmapNameStr = wxT("message");
const wxChar *wxMultiTextNameStr = wxT("multitext");
const wxChar *wxPanelNameStr = wxT("panel");
const wxChar *wxRadioBoxNameStr = wxT("radioBox");
const wxChar *wxRadioButtonNameStr = wxT("radioButton");
const wxChar *wxBitmapRadioButtonNameStr = wxT("radioButton");
const wxChar *wxScrollBarNameStr = wxT("scrollBar");
const wxChar *wxSliderNameStr = wxT("slider");
const wxChar *wxStaticNameStr = wxT("static");
const wxChar *wxTextCtrlWindowNameStr = wxT("textWindow");
const wxChar *wxTextCtrlNameStr = wxT("text");
const wxChar *wxVirtListBoxNameStr = wxT("virtListBox");
const wxChar *wxButtonBarNameStr = wxT("buttonbar");
const wxChar *wxEnhDialogNameStr = wxT("Shell");
const wxChar *wxToolBarNameStr = wxT("toolbar");
const wxChar *wxStatusLineNameStr = wxT("status_line");
const char *wxGetTextFromUserPromptStr = "Input Text";
const char *wxMessageBoxCaptionStr = "Message";
const char *wxFileSelectorPromptStr = "Select a file";
const char *wxFileSelectorDefaultWildcardStr = "*.*";
const char *wxInternalErrorStr = "wxWindows Internal Error";
const char *wxFatalErrorStr = "wxWindows Fatal Error";
const wxChar *wxGetTextFromUserPromptStr = wxT("Input Text");
const wxChar *wxMessageBoxCaptionStr = wxT("Message");
const wxChar *wxFileSelectorPromptStr = wxT("Select a file");
const wxChar *wxFileSelectorDefaultWildcardStr = wxT("*.*");
const wxChar *wxInternalErrorStr = wxT("wxWindows Internal 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
const char *wxFloatToStringStr = "%.2f";
const char *wxDoubleToStringStr = "%.2f";
const wxChar *wxFloatToStringStr = wxT("%.2f");
const wxChar *wxDoubleToStringStr = wxT("%.2f");
const wxSize wxDefaultSize(-1, -1);
const wxPoint wxDefaultPosition(-1, -1);

View File

@ -84,6 +84,7 @@ wxDC::wxDC(void)
// m_palette = wxAPP_COLOURMAP;
m_macPort = NULL ;
m_macMask = NULL ;
m_ok = 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} ;
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
// RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
// RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
bmappixels = GetGWorldPixMap( bmapworld ) ;
if ( LockPixels(bmappixels) )
@ -168,21 +167,20 @@ void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
dest.left = XLOG2DEV(x) ;
dest.bottom = YLOG2DEV(y + bmap->m_height ) ;
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 } ;
::ClipRect(&clip);
if ( useMask && bmp.GetMask() )
{
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 ) ;
}
m_macPenInstalled = false ;
@ -1071,8 +1069,6 @@ bool wxDC::Blit( long xdest, long ydest, long width, long height,
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
RGBColor black = { 0,0,0} ;
// RGBForeColor( &black ) ;
// RGBBackColor( &white ) ;
RGBForeColor( &m_textForegroundColour.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.bottom = YLOG2DEV(ydest + height ) ;
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 ,
&srcrect, &dstrect, 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 } ;
::ClipRect(&clip);
}
*/
&srcrect, &dstrect, mode, NULL ) ;
}
UnlockPixels( bmappixels ) ;
}

View File

@ -44,6 +44,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
if ( bmap->m_hBitmap )
{
m_macPort = (GrafPtr) bmap->m_hBitmap ;
wxMask * mask = bitmap.GetMask() ;
if ( mask )
{
m_macMask = mask->GetMaskBitmap() ;
}
MacSetupPort() ;
m_ok = TRUE ;
// SetBackground(wxBrush(*wxWHITE, wxSOLID));

View File

@ -68,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
(**m_macList).selFlags = lOnlyOne ;
if ( style & wxLB_MULTIPLE )
(**m_macList).selFlags = 0 ;
if ( style & wxLB_MULTIPLE )
{
(**m_macList).selFlags += lNoExtend ;
}
@ -77,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
{
(**m_macList).selFlags += lExtendDrag ;
}
else
{
(**m_macList).selFlags = lOnlyOne ;
}
Point pt = (**m_macList).cellSize ;
pt.v = 14 ;
LCellSize( pt , m_macList ) ;
@ -151,6 +155,7 @@ void wxListBox::Delete(int N)
}
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
m_stringArray.Remove( N ) ;
m_dataArray.Remove( N ) ;
m_noItems --;
MacDelete( N ) ;
@ -185,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
wxASSERT_MSG(clientData[i] == NULL,
wxT("Can't use client data with owner-drawn listboxes"));
#else // !wxUSE_OWNER_DRAWN
Append( choices[i] , clientData[0] ) ;
Append( choices[i] , clientData[i] ) ;
#endif
}
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"));
}
#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)

View File

@ -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
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] ;
short macModifiers = 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 )
useShortcuts = false ;
@ -120,6 +132,11 @@ void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , s
inItemName = inItemName + 5;
macShortCut = *inItemName;
}
else if (strncmp("Cntrl", inItemName, 5) == 0)
{
inItemName = inItemName + 6;
macShortCut = *inItemName;
}
else if (strncmp("Alt", inItemName, 3) == 0)
{
inItemName = inItemName + 4;
@ -876,7 +893,7 @@ void wxMenuBar::MacInstallMenuBar()
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 ;
if ( HMGetHelpMenuHandle( &mh ) != noErr )
@ -899,24 +916,32 @@ void wxMenuBar::MacInstallMenuBar()
}
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 ( item->IsSeparator() )
{
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++)
{
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 ) )

View File

@ -70,12 +70,24 @@ int wxMessageDialog::ShowModal()
Str255 pascalTitle ;
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 ) ;
strcpy( (char*) pascalText , m_message ) ;
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
c2pstr( (char*) pascalText ) ;
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
if ( !UMAHasAppearance() )
{
int resourceID ;

View File

@ -418,7 +418,7 @@ void wxRadioBox::SetFocus()
//-------------------------------------------------------------------------------------
// 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)
{
@ -429,6 +429,8 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
int x_current, y_current;
int x_offset,y_offset;
int widthOld, heightOld;
GetSize(&widthOld, &heightOld);
x_offset = x;
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;
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

View File

@ -73,6 +73,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
SetValue(true) ;
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
event.SetEventObject(this);
ProcessCommand(event);
}
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)

View File

@ -22,6 +22,65 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
#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,
const wxString& label,
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 ) ;
Refresh() ;
}
*/

View File

@ -245,10 +245,14 @@ bool wxToolBar::Realize()
ControlHandle m_macToolHandle ;
SInt16 behaviour = kControlBehaviorOffsetContents ;
if ( tool->CanBeToggled() )
behaviour += kControlBehaviorToggles ;
if ( icon )
{
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
behaviour + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
ControlButtonContentInfo info ;
info.contentType = kControlContentPictHandle ;
@ -259,7 +263,7 @@ bool wxToolBar::Realize()
else
{
m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
kControlBehaviorOffsetContents , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
}
m_macToolHandles.Add( m_macToolHandle ) ;
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
@ -353,12 +357,29 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
{
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)
{
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),

View File

@ -642,11 +642,24 @@ bool wxWindow::Show(bool show)
UMAHideWindow( m_macWindowData->m_macWindow ) ;
}
}
MacSuperShown( show ) ;
Refresh() ;
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
{
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.
void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh)
@ -1433,7 +1483,9 @@ void wxWindow::MacRedraw( RgnHandle updatergn , long time)
event.m_timeStamp = time ;
event.SetEventObject(this);
wxPaintEvent event2( event ) ;
GetEventHandler()->ProcessEvent(event);
MacPaint( event2 ) ;
RgnHandle childupdate = NewRgn() ;

View File

@ -600,19 +600,63 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
if (!bmp.Ok())
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,
// optimize this function to use Windows functions.
if (!useMask && !IsKindOf(CLASSINFO(wxPrinterDC)))
if (!useMask && !needsPixelCopy)
{
HDC cdc = GetHdc();
HDC memdc = ::CreateCompatibleDC( cdc );
HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
if ( isPrinter )
{
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 );
::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
::DeleteDC( memdc );
::SelectObject( memdc, hbitmap );
::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
::DeleteDC( memdc );
}
}
else
{