modifications for compilation under Mac OS X

applied patches extracted from submission by Marc Newsam (tested under Mac OS 9)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot
2001-02-15 21:51:14 +00:00
parent f0c5ebdc0d
commit 03e11df547
149 changed files with 1693 additions and 761 deletions

View File

@@ -1,5 +1,5 @@
#include <wx/mac/uma.h>
#include <wx/mac/aga.h>
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
#if !TARGET_CARBON
@@ -13,26 +13,27 @@ pascal SInt32 AGAListControlDefProc (SInt16 procID, ControlHandle theControl, Co
pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param) ;
pascal SInt32 AGAStaticGroupBoxTextDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param) ;
#define B 13
#define W 0
#define B 13
#define W 0
SInt16 kAGARootControlProcID ;
int gAGABackgroundColor = 0 ;
const RGBColor gAGAColorArray[] = { {0xFFFF, 0xFFFF, 0xFFFF}, // W
{0xEEEE, 0xEEEE, 0xEEEE}, // 1
{0xDDDD, 0xDDDD, 0xDDDD}, // 2
{0xCCCC, 0xCCCC, 0xCCCC}, // 3
{0xBBBB, 0xBBBB, 0xBBBB}, // 4
{0xAAAA, 0xAAAA, 0xAAAA}, // 5
{0x9999, 0x9999, 0x9999}, // 6
{0x8888, 0x8888, 0x8888}, // 7
{0x7777, 0x7777, 0x7777}, // 8
{0x6666, 0x6666, 0x6666}, // 9
{0x5555, 0x5555, 0x5555}, // 10
{0x4444, 0x4444, 0x4444}, // 11
{0x2222, 0x2222, 0x2222}, // 12
{0x0000, 0x0000, 0x0000} // B
const RGBColor gAGAColorArray[] = {
{0xFFFF, 0xFFFF, 0xFFFF}, // W
{0xEEEE, 0xEEEE, 0xEEEE}, // 1
{0xDDDD, 0xDDDD, 0xDDDD}, // 2
{0xCCCC, 0xCCCC, 0xCCCC}, // 3
{0xBBBB, 0xBBBB, 0xBBBB}, // 4
{0xAAAA, 0xAAAA, 0xAAAA}, // 5
{0x9999, 0x9999, 0x9999}, // 6
{0x8888, 0x8888, 0x8888}, // 7
{0x7777, 0x7777, 0x7777}, // 8
{0x6666, 0x6666, 0x6666}, // 9
{0x5555, 0x5555, 0x5555}, // 10
{0x4444, 0x4444, 0x4444}, // 11
{0x2222, 0x2222, 0x2222}, // 12
{0x0000, 0x0000, 0x0000} // B
};
char LAGADefaultOutline_mCorners[4][5][5] = {
@@ -2552,7 +2553,8 @@ void AGAApplyThemeBackground(ThemeBackgroundKind inKind,
{
}
#endif
#endif // !TARGET_CARBON
AGAPortHelper::AGAPortHelper( GrafPtr newport)
{
GetPort( &port ) ;

View File

@@ -13,6 +13,7 @@
#pragma implementation "app.h"
#endif
#include "wx/window.h"
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/utils.h"
@@ -29,6 +30,7 @@
#include "wx/module.h"
#include "wx/memory.h"
#include "wx/tooltip.h"
#include "wx/menu.h"
#if wxUSE_WX_RESOURCES
#include "wx/resource.h"
#endif
@@ -37,18 +39,24 @@
// mac
#if __option(profile)
#ifndef __UNIX__
#if __option(profile)
#include <profiler.h>
#endif
#endif
#include "apprsrc.h"
#include <wx/mac/uma.h>
#include <wx/mac/macnotfy.h>
#include "wx/mac/uma.h"
#include "wx/mac/macnotfy.h"
#if wxUSE_SOCKETS
#include <OpenTransport.h>
#include <OpenTptInternet.h>
#ifdef __APPLE__
#include <OT/OpenTransport.h>
#else
#include <OpenTransport.h>
#include <OpenTptInternet.h>
#endif
#endif
extern char *wxBuffer;
@@ -327,10 +335,25 @@ bool wxApp::Initialize()
UMAInitToolbox( 4 ) ;
UMAShowWatchCursor() ;
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , NewAEEventHandlerProc(AEHandleODoc) , (long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) , (long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , (long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , (long) wxTheApp , FALSE ) ;
#ifdef __UNIX__
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , AEHandleODoc ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , AEHandleOApp ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , AEHandlePDoc ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEHandleQuit ,
(long) wxTheApp , FALSE ) ;
#else
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , NewAEEventHandlerProc(AEHandleODoc) ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) ,
(long) wxTheApp , FALSE ) ;
#endif
// test the minimal configuration necessary
@@ -384,13 +407,17 @@ bool wxApp::Initialize()
return FALSE ;
}
#if __option(profile)
#ifndef __UNIX__
#if __option(profile)
ProfilerInit( collectDetailed, bestTimeBase , 20000 , 40 ) ;
#endif
#endif
// now avoid exceptions thrown for new (bad_alloc)
#ifndef __UNIX__
std::__throws_bad_alloc = FALSE ;
#endif
s_macCursorRgn = ::NewRgn() ;
@@ -422,8 +449,9 @@ bool wxApp::Initialize()
wxBitmap::InitStandardHandlers();
wxModule::RegisterModules();
if (!wxModule::InitializeModules())
if (!wxModule::InitializeModules()) {
return FALSE;
}
wxWinMacWindowList = new wxList(wxKEY_INTEGER);
wxWinMacControlList = new wxList(wxKEY_INTEGER);
@@ -483,9 +511,11 @@ void wxApp::CleanUp()
wxClassInfo::CleanUpClasses();
#if __option(profile)
ProfilerDump( "\papp.prof" ) ;
ProfilerTerm() ;
#ifndef __UNIX__
#if __option(profile)
ProfilerDump( "\papp.prof" ) ;
ProfilerTerm() ;
#endif
#endif
delete wxTheApp;
@@ -532,8 +562,9 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
wxDebugContext::SetCheckpoint();
#endif
#endif
if (!wxApp::Initialize())
if (!wxApp::Initialize()) {
return 0;
}
// create the application object or ensure that one already exists
if (!wxTheApp)
{
@@ -601,7 +632,7 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
wxApp::CleanUp();
return retValue;
};
}
// Static member initialization
wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction) NULL;
@@ -1038,6 +1069,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
s_lastMouseDown = 0;
break;
case inGrow:
{
int growResult = GrowWindow(window , ev->where, &screenBits.bounds);
if (growResult != 0)
{
@@ -1057,6 +1089,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
}
}
s_lastMouseDown = 0;
}
break;
case inZoomIn:
case inZoomOut:
@@ -1464,7 +1497,8 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
wxWindow* currentMouseWindow = NULL ;
MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , &currentMouseWindow ) ;
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{

View File

@@ -13,6 +13,7 @@
#pragma implementation "bitmap.h"
#endif
#include "wx/wx.h"
#include "wx/setup.h"
#include "wx/utils.h"
#include "wx/palette.h"
@@ -22,7 +23,11 @@
extern "C"
{
#ifdef __UNIX__
#include "xpm/xpm.h"
#else
#include "xpm.h"
#endif
} ;
#if !USE_SHARED_LIBRARIES
@@ -30,12 +35,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
#include <PictUtils.h>
#ifdef __UNIX__
#include <QD/PictUtils.h>
#else
#include <PictUtils.h>
#endif
CTabHandle wxMacCreateColorTable( int numColors )
{
CTabHandle newColors; /* Handle to the new color table */
short index; /* Index into the table of colors */
/* Allocate memory for the color table */
newColors = (CTabHandle)NewHandleClear( sizeof (ColorTable) +
sizeof (ColorSpec) * (numColors - 1) );
@@ -63,11 +72,11 @@ void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int g
(**newColors).ctTable[index].rgb.blue = 0 ; // someBlueValue;
}
GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
GWorldPtr wxMacCreateGWorld( int width , int height , int depth )
{
OSErr err = noErr ;
GWorldPtr port ;
Rect rect = { 0 , 0 , width , height } ;
Rect rect = { 0 , 0 , height , width } ;
if ( depth < 0 )
{
@@ -80,7 +89,7 @@ GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
return port ;
}
return NULL ;
}
}
void wxMacDestroyGWorld( GWorldPtr gw )
{
@@ -127,7 +136,7 @@ wxBitmapRefData::~wxBitmapRefData()
default :
// unkown type ?
break ;
} ;
}
if (m_bitmapMask)
{
@@ -162,8 +171,8 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
M_BITMAPDATA->m_numColors = 0;
if ( no_bits == 1 )
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( the_width , the_height , no_bits ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( the_width , the_height , no_bits ) ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
CGrafPtr origPort ;
@@ -180,16 +189,16 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
if ( the_width % 16 )
{
linesize += 2 ;
} ;
}
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
{ 0, 0 , 0 }
} ;
for( int y = 0 ; y < the_height ; ++y , linestart += linesize )
for ( int y = 0 ; y < the_height ; ++y , linestart += linesize )
{
for( int x = 0 ; x < the_width ; ++x )
for ( int x = 0 ; x < the_width ; ++x )
{
int index = x / 8 ;
int bit = x % 8 ;
@@ -211,7 +220,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
}
else
{
//multicolor BITMAPs not yet implemented
wxFAIL_MSG(wxT("multicolor BITMAPs not yet implemented"));
}
if ( wxTheBitmapList )
@@ -247,6 +256,11 @@ wxBitmap::wxBitmap(const char **data)
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
wxBitmap::wxBitmap(char **data)
{
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
bool wxBitmap::Create(int w, int h, int d)
{
UnRef();
@@ -596,8 +610,12 @@ bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
{
Str255 theName ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , name ) ;
#else
strcpy( (char *) theName , name ) ;
c2pstr( (char *)theName ) ;
#endif
PicHandle thePict = (PicHandle ) GetNamedResource( 'PICT' , theName ) ;
if ( thePict )

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/button.h"
#include "wx/panel.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
@@ -53,15 +54,33 @@ void wxButton::SetDefault()
btnOldDefault = panel->GetDefaultItem();
panel->SetDefaultItem(this);
}
if ( btnOldDefault && btnOldDefault->m_macControl )
{
UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)0) ) ;
}
if ( m_macControl )
{
UMASetControlData( m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
}
#ifdef __UNIX__
Boolean inData;
if ( btnOldDefault && btnOldDefault->m_macControl )
{
inData = 0;
UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( m_macControl )
{
inData = 1;
UMASetControlData( m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
#else
if ( btnOldDefault && btnOldDefault->m_macControl )
{
UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)0) ) ;
}
if ( m_macControl )
{
UMASetControlData( m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
}
#endif
}
wxSize wxButton::DoGetBestSize() const

View File

@@ -1,5 +1,5 @@
#include <wx/mac/uma.h>
#include <wx/mac/aga.h>
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
#if !TARGET_CARBON
@@ -13,26 +13,27 @@ pascal SInt32 AGAListControlDefProc (SInt16 procID, ControlHandle theControl, Co
pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param) ;
pascal SInt32 AGAStaticGroupBoxTextDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param) ;
#define B 13
#define W 0
#define B 13
#define W 0
SInt16 kAGARootControlProcID ;
int gAGABackgroundColor = 0 ;
const RGBColor gAGAColorArray[] = { {0xFFFF, 0xFFFF, 0xFFFF}, // W
{0xEEEE, 0xEEEE, 0xEEEE}, // 1
{0xDDDD, 0xDDDD, 0xDDDD}, // 2
{0xCCCC, 0xCCCC, 0xCCCC}, // 3
{0xBBBB, 0xBBBB, 0xBBBB}, // 4
{0xAAAA, 0xAAAA, 0xAAAA}, // 5
{0x9999, 0x9999, 0x9999}, // 6
{0x8888, 0x8888, 0x8888}, // 7
{0x7777, 0x7777, 0x7777}, // 8
{0x6666, 0x6666, 0x6666}, // 9
{0x5555, 0x5555, 0x5555}, // 10
{0x4444, 0x4444, 0x4444}, // 11
{0x2222, 0x2222, 0x2222}, // 12
{0x0000, 0x0000, 0x0000} // B
const RGBColor gAGAColorArray[] = {
{0xFFFF, 0xFFFF, 0xFFFF}, // W
{0xEEEE, 0xEEEE, 0xEEEE}, // 1
{0xDDDD, 0xDDDD, 0xDDDD}, // 2
{0xCCCC, 0xCCCC, 0xCCCC}, // 3
{0xBBBB, 0xBBBB, 0xBBBB}, // 4
{0xAAAA, 0xAAAA, 0xAAAA}, // 5
{0x9999, 0x9999, 0x9999}, // 6
{0x8888, 0x8888, 0x8888}, // 7
{0x7777, 0x7777, 0x7777}, // 8
{0x6666, 0x6666, 0x6666}, // 9
{0x5555, 0x5555, 0x5555}, // 10
{0x4444, 0x4444, 0x4444}, // 11
{0x2222, 0x2222, 0x2222}, // 12
{0x0000, 0x0000, 0x0000} // B
};
char LAGADefaultOutline_mCorners[4][5][5] = {
@@ -2552,7 +2553,8 @@ void AGAApplyThemeBackground(ThemeBackgroundKind inKind,
{
}
#endif
#endif // !TARGET_CARBON
AGAPortHelper::AGAPortHelper( GrafPtr newport)
{
GetPort( &port ) ;

View File

@@ -13,6 +13,7 @@
#pragma implementation "app.h"
#endif
#include "wx/window.h"
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/utils.h"
@@ -29,6 +30,7 @@
#include "wx/module.h"
#include "wx/memory.h"
#include "wx/tooltip.h"
#include "wx/menu.h"
#if wxUSE_WX_RESOURCES
#include "wx/resource.h"
#endif
@@ -37,18 +39,24 @@
// mac
#if __option(profile)
#ifndef __UNIX__
#if __option(profile)
#include <profiler.h>
#endif
#endif
#include "apprsrc.h"
#include <wx/mac/uma.h>
#include <wx/mac/macnotfy.h>
#include "wx/mac/uma.h"
#include "wx/mac/macnotfy.h"
#if wxUSE_SOCKETS
#include <OpenTransport.h>
#include <OpenTptInternet.h>
#ifdef __APPLE__
#include <OT/OpenTransport.h>
#else
#include <OpenTransport.h>
#include <OpenTptInternet.h>
#endif
#endif
extern char *wxBuffer;
@@ -327,10 +335,25 @@ bool wxApp::Initialize()
UMAInitToolbox( 4 ) ;
UMAShowWatchCursor() ;
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , NewAEEventHandlerProc(AEHandleODoc) , (long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) , (long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , (long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , (long) wxTheApp , FALSE ) ;
#ifdef __UNIX__
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , AEHandleODoc ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , AEHandleOApp ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , AEHandlePDoc ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEHandleQuit ,
(long) wxTheApp , FALSE ) ;
#else
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , NewAEEventHandlerProc(AEHandleODoc) ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , NewAEEventHandlerProc(AEHandleOApp) ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) ,
(long) wxTheApp , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) ,
(long) wxTheApp , FALSE ) ;
#endif
// test the minimal configuration necessary
@@ -384,13 +407,17 @@ bool wxApp::Initialize()
return FALSE ;
}
#if __option(profile)
#ifndef __UNIX__
#if __option(profile)
ProfilerInit( collectDetailed, bestTimeBase , 20000 , 40 ) ;
#endif
#endif
// now avoid exceptions thrown for new (bad_alloc)
#ifndef __UNIX__
std::__throws_bad_alloc = FALSE ;
#endif
s_macCursorRgn = ::NewRgn() ;
@@ -422,8 +449,9 @@ bool wxApp::Initialize()
wxBitmap::InitStandardHandlers();
wxModule::RegisterModules();
if (!wxModule::InitializeModules())
if (!wxModule::InitializeModules()) {
return FALSE;
}
wxWinMacWindowList = new wxList(wxKEY_INTEGER);
wxWinMacControlList = new wxList(wxKEY_INTEGER);
@@ -483,9 +511,11 @@ void wxApp::CleanUp()
wxClassInfo::CleanUpClasses();
#if __option(profile)
ProfilerDump( "\papp.prof" ) ;
ProfilerTerm() ;
#ifndef __UNIX__
#if __option(profile)
ProfilerDump( "\papp.prof" ) ;
ProfilerTerm() ;
#endif
#endif
delete wxTheApp;
@@ -532,8 +562,9 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
wxDebugContext::SetCheckpoint();
#endif
#endif
if (!wxApp::Initialize())
if (!wxApp::Initialize()) {
return 0;
}
// create the application object or ensure that one already exists
if (!wxTheApp)
{
@@ -601,7 +632,7 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
wxApp::CleanUp();
return retValue;
};
}
// Static member initialization
wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction) NULL;
@@ -1038,6 +1069,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
s_lastMouseDown = 0;
break;
case inGrow:
{
int growResult = GrowWindow(window , ev->where, &screenBits.bounds);
if (growResult != 0)
{
@@ -1057,6 +1089,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
}
}
s_lastMouseDown = 0;
}
break;
case inZoomIn:
case inZoomOut:
@@ -1464,7 +1497,8 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
wxWindow* currentMouseWindow = NULL ;
MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , &currentMouseWindow ) ;
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{

View File

@@ -13,6 +13,7 @@
#pragma implementation "bitmap.h"
#endif
#include "wx/wx.h"
#include "wx/setup.h"
#include "wx/utils.h"
#include "wx/palette.h"
@@ -22,7 +23,11 @@
extern "C"
{
#ifdef __UNIX__
#include "xpm/xpm.h"
#else
#include "xpm.h"
#endif
} ;
#if !USE_SHARED_LIBRARIES
@@ -30,12 +35,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
#include <PictUtils.h>
#ifdef __UNIX__
#include <QD/PictUtils.h>
#else
#include <PictUtils.h>
#endif
CTabHandle wxMacCreateColorTable( int numColors )
{
CTabHandle newColors; /* Handle to the new color table */
short index; /* Index into the table of colors */
/* Allocate memory for the color table */
newColors = (CTabHandle)NewHandleClear( sizeof (ColorTable) +
sizeof (ColorSpec) * (numColors - 1) );
@@ -63,11 +72,11 @@ void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int g
(**newColors).ctTable[index].rgb.blue = 0 ; // someBlueValue;
}
GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
GWorldPtr wxMacCreateGWorld( int width , int height , int depth )
{
OSErr err = noErr ;
GWorldPtr port ;
Rect rect = { 0 , 0 , width , height } ;
Rect rect = { 0 , 0 , height , width } ;
if ( depth < 0 )
{
@@ -80,7 +89,7 @@ GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
return port ;
}
return NULL ;
}
}
void wxMacDestroyGWorld( GWorldPtr gw )
{
@@ -127,7 +136,7 @@ wxBitmapRefData::~wxBitmapRefData()
default :
// unkown type ?
break ;
} ;
}
if (m_bitmapMask)
{
@@ -162,8 +171,8 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
M_BITMAPDATA->m_numColors = 0;
if ( no_bits == 1 )
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( the_width , the_height , no_bits ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( the_width , the_height , no_bits ) ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
CGrafPtr origPort ;
@@ -180,16 +189,16 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
if ( the_width % 16 )
{
linesize += 2 ;
} ;
}
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
{ 0, 0 , 0 }
} ;
for( int y = 0 ; y < the_height ; ++y , linestart += linesize )
for ( int y = 0 ; y < the_height ; ++y , linestart += linesize )
{
for( int x = 0 ; x < the_width ; ++x )
for ( int x = 0 ; x < the_width ; ++x )
{
int index = x / 8 ;
int bit = x % 8 ;
@@ -211,7 +220,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
}
else
{
//multicolor BITMAPs not yet implemented
wxFAIL_MSG(wxT("multicolor BITMAPs not yet implemented"));
}
if ( wxTheBitmapList )
@@ -247,6 +256,11 @@ wxBitmap::wxBitmap(const char **data)
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
wxBitmap::wxBitmap(char **data)
{
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
bool wxBitmap::Create(int w, int h, int d)
{
UnRef();
@@ -596,8 +610,12 @@ bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
{
Str255 theName ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , name ) ;
#else
strcpy( (char *) theName , name ) ;
c2pstr( (char *)theName ) ;
#endif
PicHandle thePict = (PicHandle ) GetNamedResource( 'PICT' , theName ) ;
if ( thePict )

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/button.h"
#include "wx/panel.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
@@ -53,15 +54,33 @@ void wxButton::SetDefault()
btnOldDefault = panel->GetDefaultItem();
panel->SetDefaultItem(this);
}
if ( btnOldDefault && btnOldDefault->m_macControl )
{
UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)0) ) ;
}
if ( m_macControl )
{
UMASetControlData( m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
}
#ifdef __UNIX__
Boolean inData;
if ( btnOldDefault && btnOldDefault->m_macControl )
{
inData = 0;
UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( m_macControl )
{
inData = 1;
UMASetControlData( m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
#else
if ( btnOldDefault && btnOldDefault->m_macControl )
{
UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)0) ) ;
}
if ( m_macControl )
{
UMASetControlData( m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
}
#endif
}
wxSize wxButton::DoGetBestSize() const

View File

@@ -15,6 +15,7 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/choice.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
@@ -32,8 +33,8 @@ wxChoice::~wxChoice()
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
int n, const wxString choices[],
long style,
int n, const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
@@ -75,6 +76,15 @@ void wxChoice::Append(const wxString& item)
SetControlMaximum( m_macControl , Number()) ;
}
void wxChoice::Append(const wxString &item, void *client_data)
{
}
void *wxChoice::GetClientData(int index) const
{
return NULL;
}
void wxChoice::Delete(int n)
{
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/combobox.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
@@ -176,10 +177,16 @@ int wxComboBox::FindString(const wxString& s) const
wxString wxComboBox::GetString(int n) const
{
Str255 text ;
::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ;
p2cstr( text ) ;
return wxString( text );
Str255 p_text ;
char c_text[255];
::GetMenuItemText( m_macPopUpMenuHandle , n+1 , p_text ) ;
#if TARGET_CARBON
p2cstrcpy( c_text, p_text ) ;
#else
p2cstr( p_text ) ;
strcpy( c_text, (char *) p_text ) ;
#endif
return wxString( c_text );
}
wxString wxComboBox::GetStringSelection() const

View File

@@ -14,10 +14,18 @@
#endif
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/app.h"
#include "wx/notebook.h"
#include "wx/tabctrl.h"
#include "wx/radiobox.h"
#include "wx/spinbutt.h"
#include "wx/scrolbar.h"
#include "wx/button.h"
#include "wx/dialog.h"
#include "wx/statbox.h"
#include "wx/sizer.h"
#include "wx/stattext.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
@@ -61,7 +69,11 @@ wxControl::wxControl()
if ( wxMacLiveScrollbarActionUPP == NULL )
{
#ifdef __UNIX__
wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
#else
wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
#endif
}
}
@@ -115,9 +127,12 @@ void wxControl::SetLabel(const wxString& title)
else
label = title ;
strcpy( (char*) maclabel , label ) ;
c2pstr( (char*) maclabel ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) maclabel , label ) ;
#else
strcpy( (char *) maclabel , label ) ;
c2pstr( (char *) maclabel ) ;
#endif
::SetControlTitle( m_macControl , maclabel ) ;
}
}
@@ -209,13 +224,19 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l
outBounds->bottom = outBounds->top + m_height - 2 * m_macVerticalBorder;
outBounds->right = outBounds->left + m_width - 2 * m_macHorizontalBorder ;
strcpy( (char*) maclabel , label ) ;
char c_text[255];
strcpy( c_text , label ) ;
if( wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertFromPCForControls( (char*) maclabel ) ;
wxMacConvertFromPCForControls( c_text ) ;
}
c2pstr( (char*) maclabel ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) maclabel , c_text ) ;
#else
strcpy( (char *) maclabel , c_text ) ;
c2pstr( (char *) maclabel ) ;
#endif
}
void wxControl::MacPostControlCreate()

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/dc.h"
#include "wx/app.h"
#include "wx/mac/uma.h"
#if __MSL__ >= 0x6000
@@ -161,7 +162,7 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
{
if ( bmap->m_bitmapType == kMacBitmapTypePict )
{
Rect bitmaprect = { 0 , 0 , bmap->m_height * scale , bmap->m_width * scale} ;
Rect bitmaprect = { 0 , 0 , int(bmap->m_height * scale) , int(bmap->m_width * scale)} ;
::OffsetRect( &bitmaprect , xx1 , yy1 ) ;
::DrawPicture( bmap->m_hPict , &bitmaprect ) ;
}
@@ -592,19 +593,19 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
if (m_pen.GetStyle() == wxTRANSPARENT)
return;
MacInstallPen() ;
MacInstallPen() ;
int offset = (m_pen.GetWidth() - 1 ) / 2 ;
int offset = (m_pen.GetWidth() - 1 ) / 2 ;
long x1, x2 , y1 , y2 ;
x1 = XLOG2DEV(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1 - offset ,y1 - offset );
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1 - offset ,y1 - offset );
for (int i = 0; i < n-1; i++)
{
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2 - offset , y2 - offset );
x2 = XLOG2DEV(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2 - offset , y2 - offset );
}
}
@@ -619,14 +620,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
PolyHandle polygon = OpenPoly() ;
long x1, x2 , y1 , y2 ;
x1 = XLOG2DEV(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1,y1);
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++)
{
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2, y2);
x2 = XLOG2DEV(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2, y2);
}
ClosePoly() ;
@@ -725,13 +726,13 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
if (m_brush.GetStyle() != wxTRANSPARENT)
{
MacInstallBrush() ;
::PaintRoundRect( &rect , radius * 2 , radius * 2 ) ;
::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
};
if (m_pen.GetStyle() != wxTRANSPARENT)
{
MacInstallPen() ;
::FrameRoundRect( &rect , radius * 2 , radius * 2 ) ;
::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
};
}
@@ -959,10 +960,12 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
RGBColor black = { 0,0,0} ;
RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
RGBColor black = { 0,0,0} ;
RGBColor forecolor = m_textForegroundColour.GetPixel();
RGBColor backcolor = m_textBackgroundColour.GetPixel();
RGBForeColor( &forecolor ) ;
RGBBackColor( &backcolor ) ;
if ( LockPixels(bmappixels) )
{
@@ -1240,15 +1243,17 @@ void wxDC::MacInstallFont() const
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( m_scaleY * font->m_macFontSize ) ;
::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
m_macFontInstalled = true ;
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
::RGBForeColor(&m_textForegroundColour.GetPixel() );
::RGBBackColor(&m_textBackgroundColour.GetPixel() );
RGBColor forecolor = m_textForegroundColour.GetPixel();
RGBColor backcolor = m_textBackgroundColour.GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
}
else
{
@@ -1256,7 +1261,7 @@ void wxDC::MacInstallFont() const
GetFNum( "\pGeneva" , &fontnum ) ;
::TextFont( fontnum ) ;
::TextSize( m_scaleY * 10 ) ;
::TextSize( short(m_scaleY * 10) ) ;
::TextFace( 0 ) ;
// todo reset after spacing changes - or store the current spacing somewhere
@@ -1264,10 +1269,12 @@ void wxDC::MacInstallFont() const
m_macFontInstalled = true ;
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
::RGBForeColor( &(m_textForegroundColour.GetPixel()) );
::RGBBackColor(&m_textBackgroundColour.GetPixel() );
}
RGBColor forecolor = m_textForegroundColour.GetPixel();
RGBColor backcolor = m_textBackgroundColour.GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
}
short mode = patCopy ;
@@ -1354,8 +1361,10 @@ void wxDC::MacInstallPen() const
if ( m_macPenInstalled )
return ;
::RGBForeColor(&m_pen.GetColour().GetPixel() );
::RGBBackColor(&m_backgroundBrush.GetColour().GetPixel() );
RGBColor forecolor = m_pen.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
::PenNormal() ;
int penWidth = m_pen.GetWidth();
@@ -1364,7 +1373,9 @@ void wxDC::MacInstallPen() const
int penStyle = m_pen.GetStyle();
if (penStyle == wxSOLID)
{
::PenPat(GetQDGlobalsBlack(&blackColor));
}
else if (IS_HATCH(penStyle))
{
Pattern pat ;
@@ -1433,8 +1444,10 @@ void wxDC::MacInstallBrush() const
// foreground
::RGBForeColor(&m_brush.GetColour().GetPixel() );
::RGBBackColor(&m_backgroundBrush.GetColour().GetPixel() );
RGBColor forecolor = m_brush.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
int brushStyle = m_brush.GetStyle();
if (brushStyle == wxSOLID)

View File

@@ -16,6 +16,7 @@
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/region.h"
#include "wx/window.h"
#include <math.h>
//-----------------------------------------------------------------------------
@@ -113,7 +114,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
m_macPort = UMAGetWindowPort( windowref ) ;
MacSetupPort() ;
m_ok = TRUE ;
long x , y ,w , h ;
wxCoord x , y ,w , h ;
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
m_minY = m_minX = 0;
wxSize size = window->GetSize() ;

View File

@@ -24,10 +24,10 @@
#endif
#include "wx/dcprint.h"
#include "math.h"
#include "wx/msgdlg.h"
#include <math.h>
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif

View File

@@ -36,14 +36,15 @@
#include "wx/dir.h"
#include "wx/filefn.h" // for wxPathExists()
#include <windows.h>
#ifndef __WXMAC_X__
#include <windows.h>
#endif
#ifdef __WXMAC__
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#if defined(__WXMAC__) && !defined(__UNIX__)
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#endif
// ----------------------------------------------------------------------------
@@ -116,8 +117,12 @@ wxDirData::wxDirData(const wxString& dirname)
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
#ifdef __WXMAC_X__
// TODO: what are we supposed to do for Mac OS X
#else
FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
#endif
}
wxDirData::~wxDirData()
@@ -131,9 +136,12 @@ void wxDirData::Rewind()
bool wxDirData::Read(wxString *filename)
{
if ( !m_isDir )
return FALSE ;
if ( !m_isDir )
return FALSE ;
#if TARGET_CARBON
char c_name[256] ;
#endif
wxString result;
short err = noErr ;
@@ -146,8 +154,13 @@ bool wxDirData::Read(wxString *filename)
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
if ( err != noErr )
break ;
#if TARGET_CARBON
p2cstrcpy( c_name, m_name ) ;
strcpy( (char *)m_name, c_name);
#else
p2cstr( m_name ) ;
#endif
if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) // we have a directory
break ;

View File

@@ -20,7 +20,11 @@
#include "wx/cmndata.h"
#include "Navigation.h"
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#else
#include <Navigation.h>
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
@@ -457,11 +461,18 @@ int wxDirDialog::ShowModal()
Str255 prompt ;
Str255 path ;
#if TARGET_CARBON
c2pstrcpy((StringPtr)prompt, m_message) ;
#else
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)path, m_path ) ;
#else
strcpy((char *)path, m_path ) ;
c2pstr((char *)path ) ;
#endif
StandardFileReply reply ;
FileFilterYDUPP invisiblesExcludedCustomFilterUPP = 0 ;

View File

@@ -133,4 +133,4 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
return wxDragError;
};
#endif
#endif

View File

@@ -19,7 +19,9 @@
#include "wx/filedlg.h"
#include "wx/intl.h"
#include "PLStringFuncs.h"
#if !defined(__UNIX__)
#include "PLStringFuncs.h"
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
@@ -27,13 +29,19 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
// begin wxmac
#include "Navigation.h"
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#else
#include <Navigation.h>
#endif
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#include "PLStringFuncs.h"
#ifndef __UNIX__
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#include "PLStringFuncs.h"
#endif
extern bool gUseNavServices ;
@@ -497,11 +505,19 @@ int wxFileDialog::ShowModal()
Str255 prompt ;
Str255 filename ;
#if TARGET_CARBON
c2pstrcpy((StringPtr)prompt, m_message) ;
#else
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)filename, m_fileName) ;
#else
strcpy((char *)filename, m_fileName) ;
c2pstr((char *)filename ) ;
#endif
#if !TARGET_CARBON
StandardPutFile( prompt , filename , &reply ) ;
@@ -525,11 +541,18 @@ int wxFileDialog::ShowModal()
Str255 prompt ;
Str255 path ;
#if TARGET_CARBON
c2pstrcpy((StringPtr)prompt, m_message) ;
#else
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
strcpy((char *)path, m_dir ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)path, m_dir ) ;
#else
strcpy((char *)path, m_dir ) ;
c2pstr((char *)path ) ;
#endif
StandardFileReply reply ;
FileFilterYDUPP crossPlatformFileFilterUPP = 0 ;
@@ -601,11 +624,18 @@ int wxFileDialog::ShowModal()
}
}
#if TARGET_CARBON
c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
#else
strcpy((char *)mNavOptions.message, m_message) ;
c2pstr((char *)mNavOptions.message ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)mNavOptions.savedFileName, m_fileName) ;
#else
strcpy((char *)mNavOptions.savedFileName, m_fileName) ;
c2pstr((char *)mNavOptions.savedFileName ) ;
#endif
if ( m_dialogStyle & wxSAVE )
{

View File

@@ -18,6 +18,7 @@
#include "wx/font.h"
#include "wx/fontutil.h"
#include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/fontutil.h"
@@ -94,9 +95,13 @@ void wxFontRefData::MacFindFont()
m_macFontNum = ::GetAppFont() ;
else
{
strcpy(wxBuffer, m_faceName);
C2PStr(wxBuffer);
::GetFNum( (unsigned char*) wxBuffer, &m_macFontNum);
#if TARGET_CARBON
c2pstrcpy( (StringPtr) wxBuffer, m_faceName ) ;
#else
strcpy( (char *) wxBuffer, m_faceName ) ;
c2pstr( (char *) wxBuffer ) ;
#endif
::GetFNum( (StringPtr) wxBuffer, &m_macFontNum);
}
}

View File

@@ -102,7 +102,8 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
void wxFontEnumeratorHelper::DoEnumerate()
{
MenuHandle menu ;
Str255 name ;
Str255 p_name ;
char c_name[256] ;
short lines ;
menu = NewMenu( 32000 , "\pFont" ) ;
@@ -111,11 +112,16 @@ void wxFontEnumeratorHelper::DoEnumerate()
for ( int i = 1 ; i < lines+1 ; i ++ )
{
GetMenuItemText( menu , i , name ) ;
p2cstr( name ) ;
/*
if ( m_fixedOnly )
GetMenuItemText( menu , i , p_name ) ;
#if TARGET_CARBON
p2cstrcpy( c_name, p_name ) ;
#else
p2cstr( p_name ) ;
strcpy( c_name, (char *)p_name ) ;
#endif
/*
if ( m_fixedOnly )
{
// check that it's a fixed pitch font (there is *no* error here, the
// flag name is misleading!)
@@ -136,7 +142,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
}
*/
m_fontEnum->OnFacename( name ) ;
m_fontEnum->OnFacename( c_name ) ;
}
DisposeMenu( menu ) ;
}

View File

@@ -14,7 +14,7 @@
#endif
#include "wx/frame.h"
#include "wx/mac/statusbr.h"
#include "wx/statusbr.h"
#include "wx/toolbar.h"
#include "wx/menuitem.h"
#include "wx/menu.h"

View File

@@ -19,6 +19,27 @@
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
#define OTUNIXERRORS 1
#ifdef __UNIX__
#include <CarbonCore/CarbonCore.h>
#include <OT/OpenTransport.h>
#include <OT/OpenTransportProviders.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#else
#include <OpenTransport.h>
#include <OpenTransportProviders.h>
#include <OpenTptInternet.h>
#endif
#if TARGET_CARBON
#define OTAssert( str , cond ) /* does not exists in Carbon */
#endif
#include <assert.h>
#include <errno.h>
#include <string.h>
@@ -27,13 +48,6 @@
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
#define OTUNIXERRORS 1
#include <OpenTransport.h>
#include <OpenTransportProviders.h>
#include <OpenTptInternet.h>
#if TARGET_CARBON
#define OTAssert( str , cond ) /* does not exists in Carbon */
#endif
#include <utime.h>
/*
@@ -68,7 +82,9 @@ void wxCYield() ;
#define qDebug2 1
extern pascal void OTDebugStr(const char* str);
#endif
#include <OTDebug.h>
#ifndef __UNIX__
#include <OTDebug.h>
#endif
InetSvcRef gInetSvcRef = 0 ;
@@ -353,7 +369,6 @@ GSocketError GSocket_SetPeer(GSocket *socket, GAddress *address)
GAddress *GSocket_GetLocal(GSocket *socket)
{
GAddress *address = NULL ;
InetAddress addr;
GSocketError err;
InetAddress loc ;
@@ -1590,4 +1605,13 @@ void _GSocket_Internal_Proc(unsigned long e , void* d )
}
/* Hack added for Mac OS X */
GSocketError GAddress_UNIX_GetPath(GAddress *addr, char *path, size_t buf)
{
}
GSocketError GAddress_UNIX_SetPath(GAddress *addr, const char *path)
{
}
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */

View File

@@ -102,8 +102,13 @@ bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
Str255 theName ;
short theId ;
OSType theType ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , name ) ;
#else
strcpy( (char *) theName , name ) ;
c2pstr( (char *) theName ) ;
#endif
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
if ( resHandle != 0L )
@@ -125,4 +130,4 @@ bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
}
}
return FALSE ;
}
}

View File

@@ -29,17 +29,24 @@ wxImageList::~wxImageList()
// TODO: destroy image list handle, if any
}
// Attributes
////////////////////////////////////////////////////////////////////////////
// Returns the number of images in the image list.
int wxImageList::GetImageCount() const
{
// TODO
return 0;
// TODO
return 0;
}
#if 0
bool wxImageList::GetSize(int index, int &width, int &hieght) const
{
// TODO
return false;
}
#endif
// Operations
////////////////////////////////////////////////////////////////////////////

View File

@@ -13,13 +13,18 @@
#pragma implementation "listbox.h"
#endif
#include "wx/app.h"
#include "wx/listbox.h"
#include "wx/settings.h"
#include "wx/dynarray.h"
#include "wx/log.h"
#include "wx/utils.h"
#include "extldef.h"
#ifdef __UNIX__
#include "ldef/extldef.h"
#else
#include "extldef.h"
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
@@ -246,13 +251,23 @@ int wxListBox::FindString(const wxString& st) const
{
wxString search = s.Left( s.Length() - 1 ) ;
int len = search.Length() ;
Str255 s1 , s2 ;
strcpy( (char*) s2 , search.c_str() ) ;
c2pstr( (char*) s2 ) ;
Str255 s1 , s2 ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
#else
strcpy( (char *) s2 , search.c_str() ) ;
c2pstr( (char *) s2 ) ;
#endif
for ( int i = 0 ; i < m_noItems ; ++ i )
{
strcpy( (char*) s1 , m_stringArray[i].Left( len ).c_str() ) ;
c2pstr( (char*) s1 ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s1 , m_stringArray[i].Left( len ).c_str() ) ;
#else
strcpy( (char *) s1 , m_stringArray[i].Left( len ).c_str() ) ;
c2pstr( (char *) s1 ) ;
#endif
if ( EqualString( s1 , s2 , false , false ) )
return i ;
}
@@ -270,12 +285,22 @@ int wxListBox::FindString(const wxString& st) const
else
{
Str255 s1 , s2 ;
strcpy( (char*) s2 , s.c_str() ) ;
c2pstr( (char*) s2 ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
#else
strcpy( (char *) s2 , s.c_str() ) ;
c2pstr( (char *) s2 ) ;
#endif
for ( int i = 0 ; i < m_noItems ; ++ i )
{
strcpy( (char*) s1 , m_stringArray[i].c_str() ) ;
c2pstr( (char*) s1 ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s1 , m_stringArray[i].c_str() ) ;
#else
strcpy( (char *) s1 , m_stringArray[i].c_str() ) ;
c2pstr( (char *) s1 ) ;
#endif
if ( EqualString( s1 , s2 , false , false ) )
return i ;
}
@@ -480,7 +505,6 @@ void wxListBox::MacDelete( int N )
{
ListHandle list ;
long result ;
Cell cell = { 0 , 0 } ;
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &list , &result ) ;
LDelRow( 1 , N , list ) ;
}

View File

@@ -7,6 +7,7 @@
* -------------------------------------------------------------------------
*/
#include "wx/wx.h"
#include "wx/mac/macnotfy.h"
const short kMaxEvents = 1000 ;

View File

@@ -22,8 +22,10 @@
#pragma implementation "menuitem.h"
#endif
#include "wx/app.h"
#include "wx/menu.h"
#include "wx/menuitem.h"
#include "wx/window.h"
#include "wx/log.h"
#include "wx/utils.h"
@@ -362,7 +364,7 @@ wxWindow *wxMenu::GetWindow() const
if ( m_invokingWindow != NULL )
return m_invokingWindow;
else if ( m_menuBar != NULL)
return m_menuBar->GetFrame();
return (wxWindow *) m_menuBar->GetFrame();
return NULL;
}
@@ -460,6 +462,7 @@ bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, in
return true ;
}
}
#ifndef __WXMAC_X__
else if ( macMenuId == kHMHelpMenuID )
{
int menuItem = formerHelpMenuItems ;
@@ -508,6 +511,7 @@ bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, in
}
}
}
#endif // __WXMAC_X__
for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++)
{
@@ -902,8 +906,11 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
{
for (int i = 0; i < m_menus.GetCount() ; i++)
{
if ( m_menus[i]->MacGetMenuId() == macMenuId ||
if ( m_menus[i]->MacGetMenuId() == macMenuId
#ifndef __WXMAC_X__
||
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
#endif
)
{
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )

View File

@@ -13,6 +13,7 @@
// headers & declarations
// ============================================================================
#include "wx/app.h"
#include "wx/menu.h"
#include "wx/menuitem.h"

View File

@@ -13,6 +13,7 @@
#pragma implementation "msgdlg.h"
#endif
#include "wx/app.h"
#include "wx/msgdlg.h"
#include "wx/mac/uma.h"
@@ -71,21 +72,36 @@ int wxMessageDialog::ShowModal()
short result ;
Str255 pascalTitle ;
Str255 pascalText ;
char cText[256] ;
if (wxApp::s_macDefaultEncodingIsPC)
{
strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
strcpy( (char*) pascalText , wxMacMakeMacStringFromPC( m_message) ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
#else
strcpy( (char *) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
c2pstr( (char *) pascalTitle ) ;
#endif
strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
}
else
{
strcpy( (char*) pascalTitle , m_caption ) ;
strcpy( (char*) pascalText , m_message ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) pascalTitle , m_caption ) ;
#else
strcpy( (char *) pascalTitle , m_caption ) ;
c2pstr( (char *) pascalTitle ) ;
#endif
strcpy( cText , m_message ) ;
}
c2pstr( (char*) pascalTitle ) ;
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
c2pstr( (char*) pascalText ) ;
wxMacConvertNewlines( cText , cText ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) pascalText , cText ) ;
#else
strcpy( (char *) pascalText , cText ) ;
c2pstr( (char *) pascalText ) ;
#endif
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;

View File

@@ -260,8 +260,12 @@ bool wxNotebook::InsertPage(int nPage,
tie.version = 0 ;
tie.iconSuiteID = 0 ;
strcpy( (char*) tie.name , strText ) ;
c2pstr( (char*) tie.name ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) tie.name , strText ) ;
#else
strcpy( (char *) tie.name , strText ) ;
c2pstr( (char *) tie.name ) ;
#endif
SetControlData( m_macControl, nPage + 1, kControlTabInfoTag , sizeof( ControlTabInfoRec) , (char*) &tie ) ;
SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );

View File

@@ -41,6 +41,9 @@ const short kwxMacTabBottomMargin = 16 ;
// event table
// ----------------------------------------------------------------------------
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
@@ -254,8 +257,7 @@ bool wxNotebook::InsertPage(int nPage,
tie.version = 0 ;
tie.iconSuiteID = 0 ;
strcpy( (char*) tie.name , strText ) ;
c2pstr( (char*) tie.name ) ;
c2pstrcpy( (StringPtr) tie.name , strText ) ;
SetControlData( m_macControl, nPage + 1, kControlTabInfoTag , sizeof( ControlTabInfoRec) , (char*) &tie ) ;
SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );

View File

@@ -31,11 +31,14 @@
# include <fstream>
#endif
#include <windows.h>
#include <wx/palette.h>
#include <wx/bitmap.h>
#include <wx/mac/pnghand.h>
#include <wx/mac/pngread.h>
#ifndef __WXMAC_X__
# include <windows.h>
#endif
#include "wx/msgdlg.h"
#include "wx/palette.h"
#include "wx/bitmap.h"
#include "wx/mac/pnghand.h"
#include "wx/mac/pngread.h"
extern "C" {
#include "png.h"
@@ -47,7 +50,7 @@ extern "C" void png_write_init PNGARG((png_structp png_ptr));
extern CTabHandle wxMacCreateColorTable( int numColors ) ;
extern void wxMacDestroyColorTable( CTabHandle colors ) ;
extern void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
extern GWorldPtr wxMacCreateGWorld( int height , int width , int depth ) ;
extern GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
void
@@ -115,7 +118,8 @@ wxPNGReader::Create(int width, int height, int depth, int colortype)
{
wxMacDestroyGWorld( lpbi ) ;
}
if (lpbi = wxMacCreateGWorld( Width , Height , Depth) )
lpbi = wxMacCreateGWorld( Width , Height , Depth);
if (lpbi)
{
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
int bitwidth = width ;

View File

@@ -67,7 +67,7 @@ wxPrintDialog::~wxPrintDialog()
int wxPrintDialog::ShowModal()
{
int result = wxID_CANCEL ;
#if !TARGET_CARBON
#if !TARGET_CARBON
OSErr err ;
wxString message ;
@@ -90,9 +90,13 @@ int wxPrintDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
}
::UMAPrClose() ;
#else
#pragma warning "TODO:Printing for carbon"
#endif
#else
#if __UNIX__
#warning "TODO:Printing for carbon"
#else
#pragma warning "TODO:Printing for carbon"
#endif
#endif
return result ;
}
@@ -158,7 +162,11 @@ int wxPageSetupDialog::ShowModal()
}
::UMAPrClose() ;
#else
#pragma warning "TODO:printing for carbon"
#if __UNIX__
#warning "TODO:Printing for carbon"
#else
#pragma warning "TODO:Printing for carbon"
#endif
#endif
return result ;
}

View File

@@ -18,7 +18,8 @@
#endif
#include "wx/radiobox.h"
#include <wx/mac/uma.h>
#include "wx/radiobut.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/settings.h"
#include "wx/gdicmn.h"
wxColour wxSystemSettings::GetSystemColour(int index)
{

View File

@@ -44,13 +44,70 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator,
const wxString& name)
{
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macMinimumStatic = NULL ;
Rect bounds ;
Str255 title ;
wxSize slsize;
int maxtextwidth, textheight;
// Is control horizontal or vertical (Can be ambigous if user selects
// another style without also specifying horz or vert
if (!(style & wxSL_HORIZONTAL) && !(style & wxSL_VERTICAL)) {
// Default is horizontal so make it so
style |= wxSL_HORIZONTAL;
}
slsize = size;
// Check that size corresponds with users selection of vertical or
// horizontal slider and insert suitable default values
if (style & wxSL_HORIZONTAL)
{
slsize.y = 15; // Slider width
if (slsize.x == -1) {
slsize.x = 150; // Slider default length
}
}
else
{
slsize.x = 15; // Slider width
if (slsize.y == -1) {
slsize.y = 150; // Slider default length
}
}
/* Set the height and width for the slider control region. The actual
* slider is set at 10 pixels across. If the slider has labels then the
* control region must be large enough to contain these labels
*/
if (style & wxSL_LABELS)
{
wxString text;
int ht, wd;
// Get maximum text label width and height
text.Printf("%d", minValue);
parent->GetTextExtent(text, &maxtextwidth, &textheight);
text.Printf("%d", maxValue);
parent->GetTextExtent(text, &wd, &ht);
if(ht > textheight) {
textheight = ht;
}
if (wd > maxtextwidth) {
maxtextwidth = wd;
}
if (style & wxSL_VERTICAL) {
slsize.x = (15 + maxtextwidth + 2); // Slider wd plus mac text width
}
if (style & wxSL_HORIZONTAL) {
slsize.y = (15 + textheight); // Slider ht plus text ht.
}
}
MacPreControlCreate( parent , id , "" , pos , slsize , style,
validator , name , &bounds , title ) ;
m_macMinimumStatic = NULL ;
m_macMaximumStatic = NULL ;
m_macValueStatic = NULL ;
m_lineSize = 1;
m_tickFreq = 0;
@@ -58,78 +115,70 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
m_rangeMin = minValue;
m_pageSize = (int)((maxValue-minValue)/10);
if ( m_width == -1 )
// Must modify bounds to that of the slider dimensions from slider
// dimensions plus text labels.
if (style & wxSL_LABELS)
{
if ( style & wxSL_HORIZONTAL )
{
m_width = 20 ;
if ( style & wxSL_LABELS && style & wxSL_VERTICAL )
m_width += 24 ;
bounds.right = bounds.left + m_width ;
bounds.bottom = bounds.top + 15;
bounds.right -= (5 + maxtextwidth);
}
if ( m_height == -1 )
else // Vertical slider
{
m_height = 20 ;
if ( style & wxSL_LABELS && style & wxSL_HORIZONTAL )
m_height += 24 ;
bounds.bottom = bounds.top + m_height ;
bounds.right = bounds.left + 15;
bounds.bottom -= (5 + textheight);
}
if ( style & wxSL_LABELS && style & wxSL_HORIZONTAL )
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds ,
title , true , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
::SetControlAction( m_macControl , wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate() ;
if ( style & wxSL_LABELS )
{
if ( style & wxSL_HORIZONTAL )
{
bounds.top += 12 ;
bounds.right -= 24 ;
wxPoint leftpos( 0 , 15 ) ;
wxPoint rightpos( m_width - (maxtextwidth + 20) , 15 ) ;
wxPoint valuepos( m_width - maxtextwidth , 0 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , leftpos ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , rightpos ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos ) ;
}
if ( style & wxSL_LABELS && style & wxSL_VERTICAL )
else // Vertical slider
{
bounds.left += 24 ;
bounds.top += 12 ;
wxPoint toppos( 17 , 0 ) ;
wxPoint bottompos( 17 , m_height - (textheight + 15) ) ;
wxPoint valuepos( 0 , m_height - textheight ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , bottompos ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , toppos ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos ) ;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
::SetControlAction( m_macControl , wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate() ;
if ( style & wxSL_LABELS )
{
if ( style & wxSL_HORIZONTAL )
{
wxSize size( 24 , 12 ) ;
wxPoint leftpos( 0 , 0 ) ;
wxPoint rightpos( m_width - 2 * 12 , 0 ) ;
wxPoint valuepos( m_width - 12 , 20 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , leftpos , size ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , rightpos , size ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos , size ) ;
}
else
{
wxSize size( 24 , 12 ) ;
wxPoint toppos( 0 , 12 ) ;
wxPoint bottompos( 0 , m_height - 12 ) ;
wxPoint valuepos( 20 , 0 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , bottompos , size ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , toppos , size ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos , size ) ;
}
}
return TRUE;
}
return true;
}
wxSlider::~wxSlider()
@@ -145,17 +194,31 @@ void wxSlider::SetValue(int value)
{
wxString valuestring ;
valuestring.Printf( "%d" , value ) ;
if ( m_macMinimumStatic )
if ( m_macMinimumStatic )
m_macMinimumStatic->SetLabel( valuestring ) ;
SetControlValue( m_macControl , value ) ;
}
void wxSlider::SetRange(int minValue, int maxValue)
{
m_rangeMin = minValue;
m_rangeMax = maxValue;
wxString value;
// TODO
m_rangeMin = minValue;
m_rangeMax = maxValue;
// TODO
SetControlMinimum(m_macControl, m_rangeMin);
SetControlMaximum(m_macControl, m_rangeMax);
if(m_macMinimumStatic) {
value.Printf("%d", m_rangeMin);
m_macMinimumStatic->SetLabel(value);
}
if(m_macMaximumStatic) {
value.Printf("%d", m_rangeMax);
m_macMaximumStatic->SetLabel(value);
}
SetValue(m_rangeMin);
}
// For trackbars only

View File

@@ -11,6 +11,7 @@
#ifdef __GNUG__
#pragma implementation "spinbutt.h"
#pragma implementation "spinbuttbase.h"
#endif
#include "wx/spinbutt.h"
@@ -29,6 +30,11 @@
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
#endif
wxSpinButton::wxSpinButton()
: wxSpinButtonBase()
{
}
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
@@ -60,6 +66,16 @@ wxSpinButton::~wxSpinButton()
// Attributes
////////////////////////////////////////////////////////////////////////////
int wxSpinButton::GetMin() const
{
return m_min;
}
int wxSpinButton::GetMax() const
{
return m_max;
}
int wxSpinButton::GetValue() const
{
return m_value;
@@ -87,7 +103,7 @@ void wxSpinButton::MacHandleControlClick( ControlHandle control , SInt16 control
return ;
wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc;
int nScrollInc = 0;
switch( controlpart )
{

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/statbmp.h"
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)

View File

@@ -17,7 +17,9 @@
// headers
// ----------------------------------------------------------------------------
#include "wx/mac/statusbr.h"
#include "wx/statusbr.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBarGeneric);
@@ -33,7 +35,7 @@ END_EVENT_TABLE()
// ============================================================================
// ----------------------------------------------------------------------------
// wxStatusBarXX class
// wxStatusBarMac class
// ----------------------------------------------------------------------------
wxStatusBarMac::wxStatusBarMac()
@@ -105,4 +107,4 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
# ifdef __WXMSW__
dc.SetFont(wxNullFont);
# endif // MSW
}
}

View File

@@ -15,6 +15,8 @@
#include "wx/app.h"
#include "wx/stattext.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#include <stdio.h>

View File

@@ -13,27 +13,26 @@
#pragma implementation "textctrl.h"
#endif
#ifndef __WXMAC__
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __UNIX__
#include <sys/types.h>
#include <sys/stat.h>
#else
#include <stat.h>
#include <stat.h>
#endif
#include <fstream.h>
#include "wx/app.h"
#include "wx/button.h"
#include "wx/panel.h"
#include "wx/textctrl.h"
#include "wx/settings.h"
#include "wx/filefn.h"
#include "wx/utils.h"
#if defined(__BORLANDC__) && !defined(__WIN32__)
#include <alloc.h>
#else
#ifndef __MWERKS__
#ifndef __GNUWIN32__
#include <malloc.h>
#endif
#endif
#include <alloc.h>
#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__WXMAC_X__)
#include <malloc.h>
#endif
#include "wx/mac/uma.h"

View File

@@ -72,9 +72,13 @@ bool wxTimer::Start(int milliseconds,bool mode)
wxCHECK_MSG( m_info.m_task.tmAddr == NULL , FALSE, wxT("attempting to restart a timer") );
m_milli = milliseconds;
m_info.m_task.tmAddr = NewTimerProc( MacTimerProc ) ;
m_info.m_task.tmWakeUp = 0 ;
m_info.m_task.tmReserved = 0 ;
#ifdef __UNIX__
m_info.m_task.tmAddr = NewTimerUPP( MacTimerProc ) ;
#else
m_info.m_task.tmAddr = NewTimerProc( MacTimerProc ) ;
#endif
m_info.m_task.tmWakeUp = 0 ;
m_info.m_task.tmReserved = 0 ;
InsXTime((QElemPtr) &m_info.m_task ) ;
PrimeTime( (QElemPtr) &m_info.m_task , m_milli ) ;
return FALSE;

View File

@@ -15,8 +15,10 @@
#if wxUSE_TOOLTIPS
#include "wx/app.h"
#include "wx/window.h"
#include "wx/tooltip.h"
#include "wx/timer.h"
#include "wx/geometry.h"
#include "wx/mac/aga.h"
#include "wx/mac/uma.h"

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/stubs/textctrl.h"
#include "wx/treebase.h"
#include "wx/stubs/treectrl.h"
#if !USE_SHARED_LIBRARY

View File

@@ -1,8 +1,12 @@
#include <wx/mac/uma.h>
#include <wx/mac/aga.h>
#include "wx/defs.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
#include "Navigation.h"
#ifdef __UNIX__
#include <NavigationServices/Navigation.h>
#else
#include <Navigation.h>
#endif
// init
@@ -75,10 +79,12 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
#endif // UMA_USE_WINDOWMGR
#endif
#ifndef __UNIX__
if ( sUMAHasWindowManager )
InitFloatingWindows() ;
else
InitWindows();
#endif
if ( NavServicesAvailable() )
{
@@ -387,13 +393,22 @@ void UMASetWTitleC( WindowRef inWindowRef , const char *title )
Str255 ptitle ;
strncpy( (char*)ptitle , title , 96 ) ;
ptitle[96] = 0 ;
#if TARGET_CARBON
c2pstrcpy( ptitle, (char *)ptitle ) ;
#else
c2pstr( (char*)ptitle ) ;
#endif
SetWTitle( inWindowRef , ptitle ) ;
}
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
{
GetWTitle( inWindowRef , (unsigned char*)title ) ;
#if TARGET_CARBON
p2cstrcpy( title, (unsigned char *)title ) ;
#else
p2cstr( (unsigned char*)title ) ;
#endif
}
void UMAShowWindow( WindowRef inWindowRef )
@@ -1354,18 +1369,18 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
{
#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
::DrawThemePlacard( inRect , inState ) ;
}
else
if ( UMAHasAppearance() )
{
::DrawThemePlacard( inRect , inState ) ;
}
else
#endif
#if !TARGET_CARBON
{
}
{
}
#else
{
}
{
}
#endif
}

View File

@@ -27,6 +27,9 @@
#include <string.h>
#include <stdarg.h>
#ifndef __UNIX__
// defined in unix/utilsunx.cpp for Mac OS X
// get full hostname (with domain name if possible)
bool wxGetFullHostName(wxChar *buf, int maxSize)
{
@@ -123,6 +126,7 @@ void wxFatalError(const wxString& msg, const wxString& title)
{
// TODO
}
#endif // !__UNIX__
// Emit a beeeeeep
void wxBell()
@@ -275,11 +279,13 @@ wxString wxMacFindFolder( short vol,
return strDir ;
}
#ifndef __UNIX__
char *wxGetUserHome (const wxString& user)
{
// TODO
return NULL;
}
#endif
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
@@ -328,13 +334,13 @@ void wxDisplaySize(int *width, int *height)
*width = screenBits.bounds.right - screenBits.bounds.left ;
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
#if TARGET_CARBON
#if TARGET_CARBON
SInt16 mheight ;
GetThemeMenuBarHeight( &mheight ) ;
*height -= mheight ;
#else
*height -= LMGetMBarHeight() ;
#endif
#endif
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)

View File

@@ -15,15 +15,15 @@
#include "wx/object.h"
#include "wx/string.h"
#include "wx/mac/wave.h"
#include "wx/wave.h"
wxWave::wxWave()
: m_hSnd(NULL), m_waveLength(0), m_isResource(true), m_sndChan(0)
: m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true)
{
}
wxWave::wxWave(const wxString& sFileName, bool isResource)
: m_hSnd(NULL), m_waveLength(0), m_isResource(true), m_sndChan(0)
: m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true)
{
Create(sFileName, isResource);
}

View File

@@ -23,6 +23,8 @@
#include "wx/layout.h"
#include "wx/dialog.h"
#include "wx/listbox.h"
#include "wx/scrolbar.h"
#include "wx/statbox.h"
#include "wx/button.h"
#include "wx/settings.h"
#include "wx/msgdlg.h"
@@ -31,7 +33,7 @@
#include "wx/tabctrl.h"
#include "wx/tooltip.h"
// TODO remove the line below, just for lookup-up convenience CS
#include "wx/mac/window.h"
#include "wx/window.h"
#include "wx/menuitem.h"
#include "wx/log.h"
@@ -999,8 +1001,8 @@ void wxWindow::MacCreateRealWindow( const wxString& title,
// translate the window attributes in the appropriate window class and attributes
WindowClass wclass ;
WindowAttributes attr ;
WindowClass wclass = 0;
WindowAttributes attr = kWindowNoAttributes ;
if ( HasFlag(wxTINY_CAPTION_HORIZ) || HasFlag(wxTINY_CAPTION_VERT) )
{
@@ -1037,8 +1039,6 @@ void wxWindow::MacCreateRealWindow( const wxString& title,
wclass = kModalWindowClass ;
}
attr = kWindowNoAttributes ;
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
{
attr |= kWindowFullZoomAttribute ;

Binary file not shown.

View File

@@ -15,6 +15,7 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/choice.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
@@ -32,8 +33,8 @@ wxChoice::~wxChoice()
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
int n, const wxString choices[],
long style,
int n, const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
@@ -75,6 +76,15 @@ void wxChoice::Append(const wxString& item)
SetControlMaximum( m_macControl , Number()) ;
}
void wxChoice::Append(const wxString &item, void *client_data)
{
}
void *wxChoice::GetClientData(int index) const
{
return NULL;
}
void wxChoice::Delete(int n)
{
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/combobox.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
@@ -176,10 +177,16 @@ int wxComboBox::FindString(const wxString& s) const
wxString wxComboBox::GetString(int n) const
{
Str255 text ;
::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ;
p2cstr( text ) ;
return wxString( text );
Str255 p_text ;
char c_text[255];
::GetMenuItemText( m_macPopUpMenuHandle , n+1 , p_text ) ;
#if TARGET_CARBON
p2cstrcpy( c_text, p_text ) ;
#else
p2cstr( p_text ) ;
strcpy( c_text, (char *) p_text ) ;
#endif
return wxString( c_text );
}
wxString wxComboBox::GetStringSelection() const

View File

@@ -14,10 +14,18 @@
#endif
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/app.h"
#include "wx/notebook.h"
#include "wx/tabctrl.h"
#include "wx/radiobox.h"
#include "wx/spinbutt.h"
#include "wx/scrolbar.h"
#include "wx/button.h"
#include "wx/dialog.h"
#include "wx/statbox.h"
#include "wx/sizer.h"
#include "wx/stattext.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
@@ -61,7 +69,11 @@ wxControl::wxControl()
if ( wxMacLiveScrollbarActionUPP == NULL )
{
#ifdef __UNIX__
wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
#else
wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
#endif
}
}
@@ -115,9 +127,12 @@ void wxControl::SetLabel(const wxString& title)
else
label = title ;
strcpy( (char*) maclabel , label ) ;
c2pstr( (char*) maclabel ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) maclabel , label ) ;
#else
strcpy( (char *) maclabel , label ) ;
c2pstr( (char *) maclabel ) ;
#endif
::SetControlTitle( m_macControl , maclabel ) ;
}
}
@@ -209,13 +224,19 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l
outBounds->bottom = outBounds->top + m_height - 2 * m_macVerticalBorder;
outBounds->right = outBounds->left + m_width - 2 * m_macHorizontalBorder ;
strcpy( (char*) maclabel , label ) ;
char c_text[255];
strcpy( c_text , label ) ;
if( wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertFromPCForControls( (char*) maclabel ) ;
wxMacConvertFromPCForControls( c_text ) ;
}
c2pstr( (char*) maclabel ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) maclabel , c_text ) ;
#else
strcpy( (char *) maclabel , c_text ) ;
c2pstr( (char *) maclabel ) ;
#endif
}
void wxControl::MacPostControlCreate()

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/dc.h"
#include "wx/app.h"
#include "wx/mac/uma.h"
#if __MSL__ >= 0x6000
@@ -161,7 +162,7 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
{
if ( bmap->m_bitmapType == kMacBitmapTypePict )
{
Rect bitmaprect = { 0 , 0 , bmap->m_height * scale , bmap->m_width * scale} ;
Rect bitmaprect = { 0 , 0 , int(bmap->m_height * scale) , int(bmap->m_width * scale)} ;
::OffsetRect( &bitmaprect , xx1 , yy1 ) ;
::DrawPicture( bmap->m_hPict , &bitmaprect ) ;
}
@@ -592,19 +593,19 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
if (m_pen.GetStyle() == wxTRANSPARENT)
return;
MacInstallPen() ;
MacInstallPen() ;
int offset = (m_pen.GetWidth() - 1 ) / 2 ;
int offset = (m_pen.GetWidth() - 1 ) / 2 ;
long x1, x2 , y1 , y2 ;
x1 = XLOG2DEV(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1 - offset ,y1 - offset );
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1 - offset ,y1 - offset );
for (int i = 0; i < n-1; i++)
{
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2 - offset , y2 - offset );
x2 = XLOG2DEV(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2 - offset , y2 - offset );
}
}
@@ -619,14 +620,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
PolyHandle polygon = OpenPoly() ;
long x1, x2 , y1 , y2 ;
x1 = XLOG2DEV(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1,y1);
y1 = YLOG2DEV(points[0].y + yoffset);
::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++)
{
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2, y2);
x2 = XLOG2DEV(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset);
::LineTo(x2, y2);
}
ClosePoly() ;
@@ -725,13 +726,13 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
if (m_brush.GetStyle() != wxTRANSPARENT)
{
MacInstallBrush() ;
::PaintRoundRect( &rect , radius * 2 , radius * 2 ) ;
::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
};
if (m_pen.GetStyle() != wxTRANSPARENT)
{
MacInstallPen() ;
::FrameRoundRect( &rect , radius * 2 , radius * 2 ) ;
::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
};
}
@@ -959,10 +960,12 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
RGBColor black = { 0,0,0} ;
RGBForeColor( &m_textForegroundColour.GetPixel() ) ;
RGBBackColor( &m_textBackgroundColour.GetPixel() ) ;
RGBColor white = { 0xFFFF, 0xFFFF,0xFFFF} ;
RGBColor black = { 0,0,0} ;
RGBColor forecolor = m_textForegroundColour.GetPixel();
RGBColor backcolor = m_textBackgroundColour.GetPixel();
RGBForeColor( &forecolor ) ;
RGBBackColor( &backcolor ) ;
if ( LockPixels(bmappixels) )
{
@@ -1240,15 +1243,17 @@ void wxDC::MacInstallFont() const
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( m_scaleY * font->m_macFontSize ) ;
::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
m_macFontInstalled = true ;
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
::RGBForeColor(&m_textForegroundColour.GetPixel() );
::RGBBackColor(&m_textBackgroundColour.GetPixel() );
RGBColor forecolor = m_textForegroundColour.GetPixel();
RGBColor backcolor = m_textBackgroundColour.GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
}
else
{
@@ -1256,7 +1261,7 @@ void wxDC::MacInstallFont() const
GetFNum( "\pGeneva" , &fontnum ) ;
::TextFont( fontnum ) ;
::TextSize( m_scaleY * 10 ) ;
::TextSize( short(m_scaleY * 10) ) ;
::TextFace( 0 ) ;
// todo reset after spacing changes - or store the current spacing somewhere
@@ -1264,10 +1269,12 @@ void wxDC::MacInstallFont() const
m_macFontInstalled = true ;
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
::RGBForeColor( &(m_textForegroundColour.GetPixel()) );
::RGBBackColor(&m_textBackgroundColour.GetPixel() );
}
RGBColor forecolor = m_textForegroundColour.GetPixel();
RGBColor backcolor = m_textBackgroundColour.GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
}
short mode = patCopy ;
@@ -1354,8 +1361,10 @@ void wxDC::MacInstallPen() const
if ( m_macPenInstalled )
return ;
::RGBForeColor(&m_pen.GetColour().GetPixel() );
::RGBBackColor(&m_backgroundBrush.GetColour().GetPixel() );
RGBColor forecolor = m_pen.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
::PenNormal() ;
int penWidth = m_pen.GetWidth();
@@ -1364,7 +1373,9 @@ void wxDC::MacInstallPen() const
int penStyle = m_pen.GetStyle();
if (penStyle == wxSOLID)
{
::PenPat(GetQDGlobalsBlack(&blackColor));
}
else if (IS_HATCH(penStyle))
{
Pattern pat ;
@@ -1433,8 +1444,10 @@ void wxDC::MacInstallBrush() const
// foreground
::RGBForeColor(&m_brush.GetColour().GetPixel() );
::RGBBackColor(&m_backgroundBrush.GetColour().GetPixel() );
RGBColor forecolor = m_brush.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
::RGBForeColor( &forecolor );
::RGBBackColor( &backcolor );
int brushStyle = m_brush.GetStyle();
if (brushStyle == wxSOLID)

View File

@@ -16,6 +16,7 @@
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/region.h"
#include "wx/window.h"
#include <math.h>
//-----------------------------------------------------------------------------
@@ -113,7 +114,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
m_macPort = UMAGetWindowPort( windowref ) ;
MacSetupPort() ;
m_ok = TRUE ;
long x , y ,w , h ;
wxCoord x , y ,w , h ;
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
m_minY = m_minX = 0;
wxSize size = window->GetSize() ;

View File

@@ -24,10 +24,10 @@
#endif
#include "wx/dcprint.h"
#include "math.h"
#include "wx/msgdlg.h"
#include <math.h>
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif

View File

@@ -36,14 +36,15 @@
#include "wx/dir.h"
#include "wx/filefn.h" // for wxPathExists()
#include <windows.h>
#ifndef __WXMAC_X__
#include <windows.h>
#endif
#ifdef __WXMAC__
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#if defined(__WXMAC__) && !defined(__UNIX__)
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#endif
// ----------------------------------------------------------------------------
@@ -116,8 +117,12 @@ wxDirData::wxDirData(const wxString& dirname)
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
#ifdef __WXMAC_X__
// TODO: what are we supposed to do for Mac OS X
#else
FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
#endif
}
wxDirData::~wxDirData()
@@ -131,9 +136,12 @@ void wxDirData::Rewind()
bool wxDirData::Read(wxString *filename)
{
if ( !m_isDir )
return FALSE ;
if ( !m_isDir )
return FALSE ;
#if TARGET_CARBON
char c_name[256] ;
#endif
wxString result;
short err = noErr ;
@@ -146,8 +154,13 @@ bool wxDirData::Read(wxString *filename)
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
if ( err != noErr )
break ;
#if TARGET_CARBON
p2cstrcpy( c_name, m_name ) ;
strcpy( (char *)m_name, c_name);
#else
p2cstr( m_name ) ;
#endif
if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (m_flags & wxDIR_DIRS) ) // we have a directory
break ;

View File

@@ -20,7 +20,11 @@
#include "wx/cmndata.h"
#include "Navigation.h"
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#else
#include <Navigation.h>
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
@@ -457,11 +461,18 @@ int wxDirDialog::ShowModal()
Str255 prompt ;
Str255 path ;
#if TARGET_CARBON
c2pstrcpy((StringPtr)prompt, m_message) ;
#else
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)path, m_path ) ;
#else
strcpy((char *)path, m_path ) ;
c2pstr((char *)path ) ;
#endif
StandardFileReply reply ;
FileFilterYDUPP invisiblesExcludedCustomFilterUPP = 0 ;

View File

@@ -133,4 +133,4 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
return wxDragError;
};
#endif
#endif

View File

@@ -19,7 +19,9 @@
#include "wx/filedlg.h"
#include "wx/intl.h"
#include "PLStringFuncs.h"
#if !defined(__UNIX__)
#include "PLStringFuncs.h"
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
@@ -27,13 +29,19 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
// begin wxmac
#include "Navigation.h"
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#else
#include <Navigation.h>
#endif
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#include "PLStringFuncs.h"
#ifndef __UNIX__
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#include "PLStringFuncs.h"
#endif
extern bool gUseNavServices ;
@@ -497,11 +505,19 @@ int wxFileDialog::ShowModal()
Str255 prompt ;
Str255 filename ;
#if TARGET_CARBON
c2pstrcpy((StringPtr)prompt, m_message) ;
#else
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)filename, m_fileName) ;
#else
strcpy((char *)filename, m_fileName) ;
c2pstr((char *)filename ) ;
#endif
#if !TARGET_CARBON
StandardPutFile( prompt , filename , &reply ) ;
@@ -525,11 +541,18 @@ int wxFileDialog::ShowModal()
Str255 prompt ;
Str255 path ;
#if TARGET_CARBON
c2pstrcpy((StringPtr)prompt, m_message) ;
#else
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
strcpy((char *)path, m_dir ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)path, m_dir ) ;
#else
strcpy((char *)path, m_dir ) ;
c2pstr((char *)path ) ;
#endif
StandardFileReply reply ;
FileFilterYDUPP crossPlatformFileFilterUPP = 0 ;
@@ -601,11 +624,18 @@ int wxFileDialog::ShowModal()
}
}
#if TARGET_CARBON
c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
#else
strcpy((char *)mNavOptions.message, m_message) ;
c2pstr((char *)mNavOptions.message ) ;
#endif
#if TARGET_CARBON
c2pstrcpy((StringPtr)mNavOptions.savedFileName, m_fileName) ;
#else
strcpy((char *)mNavOptions.savedFileName, m_fileName) ;
c2pstr((char *)mNavOptions.savedFileName ) ;
#endif
if ( m_dialogStyle & wxSAVE )
{

View File

@@ -18,6 +18,7 @@
#include "wx/font.h"
#include "wx/fontutil.h"
#include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/fontutil.h"
@@ -94,9 +95,13 @@ void wxFontRefData::MacFindFont()
m_macFontNum = ::GetAppFont() ;
else
{
strcpy(wxBuffer, m_faceName);
C2PStr(wxBuffer);
::GetFNum( (unsigned char*) wxBuffer, &m_macFontNum);
#if TARGET_CARBON
c2pstrcpy( (StringPtr) wxBuffer, m_faceName ) ;
#else
strcpy( (char *) wxBuffer, m_faceName ) ;
c2pstr( (char *) wxBuffer ) ;
#endif
::GetFNum( (StringPtr) wxBuffer, &m_macFontNum);
}
}

View File

@@ -102,7 +102,8 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
void wxFontEnumeratorHelper::DoEnumerate()
{
MenuHandle menu ;
Str255 name ;
Str255 p_name ;
char c_name[256] ;
short lines ;
menu = NewMenu( 32000 , "\pFont" ) ;
@@ -111,11 +112,16 @@ void wxFontEnumeratorHelper::DoEnumerate()
for ( int i = 1 ; i < lines+1 ; i ++ )
{
GetMenuItemText( menu , i , name ) ;
p2cstr( name ) ;
/*
if ( m_fixedOnly )
GetMenuItemText( menu , i , p_name ) ;
#if TARGET_CARBON
p2cstrcpy( c_name, p_name ) ;
#else
p2cstr( p_name ) ;
strcpy( c_name, (char *)p_name ) ;
#endif
/*
if ( m_fixedOnly )
{
// check that it's a fixed pitch font (there is *no* error here, the
// flag name is misleading!)
@@ -136,7 +142,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
}
*/
m_fontEnum->OnFacename( name ) ;
m_fontEnum->OnFacename( c_name ) ;
}
DisposeMenu( menu ) ;
}

View File

@@ -14,7 +14,7 @@
#endif
#include "wx/frame.h"
#include "wx/mac/statusbr.h"
#include "wx/statusbr.h"
#include "wx/toolbar.h"
#include "wx/menuitem.h"
#include "wx/menu.h"

View File

@@ -19,6 +19,27 @@
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
#define OTUNIXERRORS 1
#ifdef __UNIX__
#include <CarbonCore/CarbonCore.h>
#include <OT/OpenTransport.h>
#include <OT/OpenTransportProviders.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#else
#include <OpenTransport.h>
#include <OpenTransportProviders.h>
#include <OpenTptInternet.h>
#endif
#if TARGET_CARBON
#define OTAssert( str , cond ) /* does not exists in Carbon */
#endif
#include <assert.h>
#include <errno.h>
#include <string.h>
@@ -27,13 +48,6 @@
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
#define OTUNIXERRORS 1
#include <OpenTransport.h>
#include <OpenTransportProviders.h>
#include <OpenTptInternet.h>
#if TARGET_CARBON
#define OTAssert( str , cond ) /* does not exists in Carbon */
#endif
#include <utime.h>
/*
@@ -68,7 +82,9 @@ void wxCYield() ;
#define qDebug2 1
extern pascal void OTDebugStr(const char* str);
#endif
#include <OTDebug.h>
#ifndef __UNIX__
#include <OTDebug.h>
#endif
InetSvcRef gInetSvcRef = 0 ;
@@ -353,7 +369,6 @@ GSocketError GSocket_SetPeer(GSocket *socket, GAddress *address)
GAddress *GSocket_GetLocal(GSocket *socket)
{
GAddress *address = NULL ;
InetAddress addr;
GSocketError err;
InetAddress loc ;
@@ -1590,4 +1605,13 @@ void _GSocket_Internal_Proc(unsigned long e , void* d )
}
/* Hack added for Mac OS X */
GSocketError GAddress_UNIX_GetPath(GAddress *addr, char *path, size_t buf)
{
}
GSocketError GAddress_UNIX_SetPath(GAddress *addr, const char *path)
{
}
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */

View File

@@ -102,8 +102,13 @@ bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
Str255 theName ;
short theId ;
OSType theType ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , name ) ;
#else
strcpy( (char *) theName , name ) ;
c2pstr( (char *) theName ) ;
#endif
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
if ( resHandle != 0L )
@@ -125,4 +130,4 @@ bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
}
}
return FALSE ;
}
}

View File

@@ -29,17 +29,24 @@ wxImageList::~wxImageList()
// TODO: destroy image list handle, if any
}
// Attributes
////////////////////////////////////////////////////////////////////////////
// Returns the number of images in the image list.
int wxImageList::GetImageCount() const
{
// TODO
return 0;
// TODO
return 0;
}
#if 0
bool wxImageList::GetSize(int index, int &width, int &hieght) const
{
// TODO
return false;
}
#endif
// Operations
////////////////////////////////////////////////////////////////////////////

View File

@@ -1,6 +1,10 @@
#pragma once
#include <Lists.h>
#if defined(__UNIX__)
#include <HIToolbox/lists.h>
#else
#include <Lists.h>
#endif
#include <stdlib.h>
#define kExtLDEFID 128 // resource id of our LDEF resource

Binary file not shown.

View File

@@ -13,13 +13,18 @@
#pragma implementation "listbox.h"
#endif
#include "wx/app.h"
#include "wx/listbox.h"
#include "wx/settings.h"
#include "wx/dynarray.h"
#include "wx/log.h"
#include "wx/utils.h"
#include "extldef.h"
#ifdef __UNIX__
#include "ldef/extldef.h"
#else
#include "extldef.h"
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
@@ -246,13 +251,23 @@ int wxListBox::FindString(const wxString& st) const
{
wxString search = s.Left( s.Length() - 1 ) ;
int len = search.Length() ;
Str255 s1 , s2 ;
strcpy( (char*) s2 , search.c_str() ) ;
c2pstr( (char*) s2 ) ;
Str255 s1 , s2 ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
#else
strcpy( (char *) s2 , search.c_str() ) ;
c2pstr( (char *) s2 ) ;
#endif
for ( int i = 0 ; i < m_noItems ; ++ i )
{
strcpy( (char*) s1 , m_stringArray[i].Left( len ).c_str() ) ;
c2pstr( (char*) s1 ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s1 , m_stringArray[i].Left( len ).c_str() ) ;
#else
strcpy( (char *) s1 , m_stringArray[i].Left( len ).c_str() ) ;
c2pstr( (char *) s1 ) ;
#endif
if ( EqualString( s1 , s2 , false , false ) )
return i ;
}
@@ -270,12 +285,22 @@ int wxListBox::FindString(const wxString& st) const
else
{
Str255 s1 , s2 ;
strcpy( (char*) s2 , s.c_str() ) ;
c2pstr( (char*) s2 ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
#else
strcpy( (char *) s2 , s.c_str() ) ;
c2pstr( (char *) s2 ) ;
#endif
for ( int i = 0 ; i < m_noItems ; ++ i )
{
strcpy( (char*) s1 , m_stringArray[i].c_str() ) ;
c2pstr( (char*) s1 ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s1 , m_stringArray[i].c_str() ) ;
#else
strcpy( (char *) s1 , m_stringArray[i].c_str() ) ;
c2pstr( (char *) s1 ) ;
#endif
if ( EqualString( s1 , s2 , false , false ) )
return i ;
}
@@ -480,7 +505,6 @@ void wxListBox::MacDelete( int N )
{
ListHandle list ;
long result ;
Cell cell = { 0 , 0 } ;
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &list , &result ) ;
LDelRow( 1 , N , list ) ;
}

View File

@@ -7,6 +7,7 @@
* -------------------------------------------------------------------------
*/
#include "wx/wx.h"
#include "wx/mac/macnotfy.h"
const short kMaxEvents = 1000 ;

View File

@@ -22,8 +22,10 @@
#pragma implementation "menuitem.h"
#endif
#include "wx/app.h"
#include "wx/menu.h"
#include "wx/menuitem.h"
#include "wx/window.h"
#include "wx/log.h"
#include "wx/utils.h"
@@ -362,7 +364,7 @@ wxWindow *wxMenu::GetWindow() const
if ( m_invokingWindow != NULL )
return m_invokingWindow;
else if ( m_menuBar != NULL)
return m_menuBar->GetFrame();
return (wxWindow *) m_menuBar->GetFrame();
return NULL;
}
@@ -460,6 +462,7 @@ bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, in
return true ;
}
}
#ifndef __WXMAC_X__
else if ( macMenuId == kHMHelpMenuID )
{
int menuItem = formerHelpMenuItems ;
@@ -508,6 +511,7 @@ bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, in
}
}
}
#endif // __WXMAC_X__
for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++)
{
@@ -902,8 +906,11 @@ void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId,
{
for (int i = 0; i < m_menus.GetCount() ; i++)
{
if ( m_menus[i]->MacGetMenuId() == macMenuId ||
if ( m_menus[i]->MacGetMenuId() == macMenuId
#ifndef __WXMAC_X__
||
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
#endif
)
{
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )

View File

@@ -13,6 +13,7 @@
// headers & declarations
// ============================================================================
#include "wx/app.h"
#include "wx/menu.h"
#include "wx/menuitem.h"

View File

@@ -13,6 +13,7 @@
#pragma implementation "msgdlg.h"
#endif
#include "wx/app.h"
#include "wx/msgdlg.h"
#include "wx/mac/uma.h"
@@ -71,21 +72,36 @@ int wxMessageDialog::ShowModal()
short result ;
Str255 pascalTitle ;
Str255 pascalText ;
char cText[256] ;
if (wxApp::s_macDefaultEncodingIsPC)
{
strcpy( (char*) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
strcpy( (char*) pascalText , wxMacMakeMacStringFromPC( m_message) ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
#else
strcpy( (char *) pascalTitle , wxMacMakeMacStringFromPC( m_caption ) ) ;
c2pstr( (char *) pascalTitle ) ;
#endif
strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
}
else
{
strcpy( (char*) pascalTitle , m_caption ) ;
strcpy( (char*) pascalText , m_message ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) pascalTitle , m_caption ) ;
#else
strcpy( (char *) pascalTitle , m_caption ) ;
c2pstr( (char *) pascalTitle ) ;
#endif
strcpy( cText , m_message ) ;
}
c2pstr( (char*) pascalTitle ) ;
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
c2pstr( (char*) pascalText ) ;
wxMacConvertNewlines( cText , cText ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) pascalText , cText ) ;
#else
strcpy( (char *) pascalText , cText ) ;
c2pstr( (char *) pascalText ) ;
#endif
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;

View File

@@ -260,8 +260,12 @@ bool wxNotebook::InsertPage(int nPage,
tie.version = 0 ;
tie.iconSuiteID = 0 ;
strcpy( (char*) tie.name , strText ) ;
c2pstr( (char*) tie.name ) ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) tie.name , strText ) ;
#else
strcpy( (char *) tie.name , strText ) ;
c2pstr( (char *) tie.name ) ;
#endif
SetControlData( m_macControl, nPage + 1, kControlTabInfoTag , sizeof( ControlTabInfoRec) , (char*) &tie ) ;
SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );

View File

@@ -41,6 +41,9 @@ const short kwxMacTabBottomMargin = 16 ;
// event table
// ----------------------------------------------------------------------------
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
@@ -254,8 +257,7 @@ bool wxNotebook::InsertPage(int nPage,
tie.version = 0 ;
tie.iconSuiteID = 0 ;
strcpy( (char*) tie.name , strText ) ;
c2pstr( (char*) tie.name ) ;
c2pstrcpy( (StringPtr) tie.name , strText ) ;
SetControlData( m_macControl, nPage + 1, kControlTabInfoTag , sizeof( ControlTabInfoRec) , (char*) &tie ) ;
SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );

View File

@@ -31,11 +31,14 @@
# include <fstream>
#endif
#include <windows.h>
#include <wx/palette.h>
#include <wx/bitmap.h>
#include <wx/mac/pnghand.h>
#include <wx/mac/pngread.h>
#ifndef __WXMAC_X__
# include <windows.h>
#endif
#include "wx/msgdlg.h"
#include "wx/palette.h"
#include "wx/bitmap.h"
#include "wx/mac/pnghand.h"
#include "wx/mac/pngread.h"
extern "C" {
#include "png.h"
@@ -47,7 +50,7 @@ extern "C" void png_write_init PNGARG((png_structp png_ptr));
extern CTabHandle wxMacCreateColorTable( int numColors ) ;
extern void wxMacDestroyColorTable( CTabHandle colors ) ;
extern void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
extern GWorldPtr wxMacCreateGWorld( int height , int width , int depth ) ;
extern GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
void
@@ -115,7 +118,8 @@ wxPNGReader::Create(int width, int height, int depth, int colortype)
{
wxMacDestroyGWorld( lpbi ) ;
}
if (lpbi = wxMacCreateGWorld( Width , Height , Depth) )
lpbi = wxMacCreateGWorld( Width , Height , Depth);
if (lpbi)
{
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
int bitwidth = width ;

View File

@@ -67,7 +67,7 @@ wxPrintDialog::~wxPrintDialog()
int wxPrintDialog::ShowModal()
{
int result = wxID_CANCEL ;
#if !TARGET_CARBON
#if !TARGET_CARBON
OSErr err ;
wxString message ;
@@ -90,9 +90,13 @@ int wxPrintDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
}
::UMAPrClose() ;
#else
#pragma warning "TODO:Printing for carbon"
#endif
#else
#if __UNIX__
#warning "TODO:Printing for carbon"
#else
#pragma warning "TODO:Printing for carbon"
#endif
#endif
return result ;
}
@@ -158,7 +162,11 @@ int wxPageSetupDialog::ShowModal()
}
::UMAPrClose() ;
#else
#pragma warning "TODO:printing for carbon"
#if __UNIX__
#warning "TODO:Printing for carbon"
#else
#pragma warning "TODO:Printing for carbon"
#endif
#endif
return result ;
}

View File

@@ -18,7 +18,8 @@
#endif
#include "wx/radiobox.h"
#include <wx/mac/uma.h>
#include "wx/radiobut.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/settings.h"
#include "wx/gdicmn.h"
wxColour wxSystemSettings::GetSystemColour(int index)
{

View File

@@ -44,13 +44,70 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator,
const wxString& name)
{
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macMinimumStatic = NULL ;
Rect bounds ;
Str255 title ;
wxSize slsize;
int maxtextwidth, textheight;
// Is control horizontal or vertical (Can be ambigous if user selects
// another style without also specifying horz or vert
if (!(style & wxSL_HORIZONTAL) && !(style & wxSL_VERTICAL)) {
// Default is horizontal so make it so
style |= wxSL_HORIZONTAL;
}
slsize = size;
// Check that size corresponds with users selection of vertical or
// horizontal slider and insert suitable default values
if (style & wxSL_HORIZONTAL)
{
slsize.y = 15; // Slider width
if (slsize.x == -1) {
slsize.x = 150; // Slider default length
}
}
else
{
slsize.x = 15; // Slider width
if (slsize.y == -1) {
slsize.y = 150; // Slider default length
}
}
/* Set the height and width for the slider control region. The actual
* slider is set at 10 pixels across. If the slider has labels then the
* control region must be large enough to contain these labels
*/
if (style & wxSL_LABELS)
{
wxString text;
int ht, wd;
// Get maximum text label width and height
text.Printf("%d", minValue);
parent->GetTextExtent(text, &maxtextwidth, &textheight);
text.Printf("%d", maxValue);
parent->GetTextExtent(text, &wd, &ht);
if(ht > textheight) {
textheight = ht;
}
if (wd > maxtextwidth) {
maxtextwidth = wd;
}
if (style & wxSL_VERTICAL) {
slsize.x = (15 + maxtextwidth + 2); // Slider wd plus mac text width
}
if (style & wxSL_HORIZONTAL) {
slsize.y = (15 + textheight); // Slider ht plus text ht.
}
}
MacPreControlCreate( parent , id , "" , pos , slsize , style,
validator , name , &bounds , title ) ;
m_macMinimumStatic = NULL ;
m_macMaximumStatic = NULL ;
m_macValueStatic = NULL ;
m_lineSize = 1;
m_tickFreq = 0;
@@ -58,78 +115,70 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
m_rangeMin = minValue;
m_pageSize = (int)((maxValue-minValue)/10);
if ( m_width == -1 )
// Must modify bounds to that of the slider dimensions from slider
// dimensions plus text labels.
if (style & wxSL_LABELS)
{
if ( style & wxSL_HORIZONTAL )
{
m_width = 20 ;
if ( style & wxSL_LABELS && style & wxSL_VERTICAL )
m_width += 24 ;
bounds.right = bounds.left + m_width ;
bounds.bottom = bounds.top + 15;
bounds.right -= (5 + maxtextwidth);
}
if ( m_height == -1 )
else // Vertical slider
{
m_height = 20 ;
if ( style & wxSL_LABELS && style & wxSL_HORIZONTAL )
m_height += 24 ;
bounds.bottom = bounds.top + m_height ;
bounds.right = bounds.left + 15;
bounds.bottom -= (5 + textheight);
}
if ( style & wxSL_LABELS && style & wxSL_HORIZONTAL )
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds ,
title , true , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
::SetControlAction( m_macControl , wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate() ;
if ( style & wxSL_LABELS )
{
if ( style & wxSL_HORIZONTAL )
{
bounds.top += 12 ;
bounds.right -= 24 ;
wxPoint leftpos( 0 , 15 ) ;
wxPoint rightpos( m_width - (maxtextwidth + 20) , 15 ) ;
wxPoint valuepos( m_width - maxtextwidth , 0 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , leftpos ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , rightpos ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos ) ;
}
if ( style & wxSL_LABELS && style & wxSL_VERTICAL )
else // Vertical slider
{
bounds.left += 24 ;
bounds.top += 12 ;
wxPoint toppos( 17 , 0 ) ;
wxPoint bottompos( 17 , m_height - (textheight + 15) ) ;
wxPoint valuepos( 0 , m_height - textheight ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , bottompos ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , toppos ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos ) ;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
::SetControlAction( m_macControl , wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate() ;
if ( style & wxSL_LABELS )
{
if ( style & wxSL_HORIZONTAL )
{
wxSize size( 24 , 12 ) ;
wxPoint leftpos( 0 , 0 ) ;
wxPoint rightpos( m_width - 2 * 12 , 0 ) ;
wxPoint valuepos( m_width - 12 , 20 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , leftpos , size ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , rightpos , size ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos , size ) ;
}
else
{
wxSize size( 24 , 12 ) ;
wxPoint toppos( 0 , 12 ) ;
wxPoint bottompos( 0 , m_height - 12 ) ;
wxPoint valuepos( 20 , 0 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , bottompos , size ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , toppos , size ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos , size ) ;
}
}
return TRUE;
}
return true;
}
wxSlider::~wxSlider()
@@ -145,17 +194,31 @@ void wxSlider::SetValue(int value)
{
wxString valuestring ;
valuestring.Printf( "%d" , value ) ;
if ( m_macMinimumStatic )
if ( m_macMinimumStatic )
m_macMinimumStatic->SetLabel( valuestring ) ;
SetControlValue( m_macControl , value ) ;
}
void wxSlider::SetRange(int minValue, int maxValue)
{
m_rangeMin = minValue;
m_rangeMax = maxValue;
wxString value;
// TODO
m_rangeMin = minValue;
m_rangeMax = maxValue;
// TODO
SetControlMinimum(m_macControl, m_rangeMin);
SetControlMaximum(m_macControl, m_rangeMax);
if(m_macMinimumStatic) {
value.Printf("%d", m_rangeMin);
m_macMinimumStatic->SetLabel(value);
}
if(m_macMaximumStatic) {
value.Printf("%d", m_rangeMax);
m_macMaximumStatic->SetLabel(value);
}
SetValue(m_rangeMin);
}
// For trackbars only

View File

@@ -11,6 +11,7 @@
#ifdef __GNUG__
#pragma implementation "spinbutt.h"
#pragma implementation "spinbuttbase.h"
#endif
#include "wx/spinbutt.h"
@@ -29,6 +30,11 @@
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
#endif
wxSpinButton::wxSpinButton()
: wxSpinButtonBase()
{
}
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
@@ -60,6 +66,16 @@ wxSpinButton::~wxSpinButton()
// Attributes
////////////////////////////////////////////////////////////////////////////
int wxSpinButton::GetMin() const
{
return m_min;
}
int wxSpinButton::GetMax() const
{
return m_max;
}
int wxSpinButton::GetValue() const
{
return m_value;
@@ -87,7 +103,7 @@ void wxSpinButton::MacHandleControlClick( ControlHandle control , SInt16 control
return ;
wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc;
int nScrollInc = 0;
switch( controlpart )
{

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/statbmp.h"
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)

View File

@@ -17,7 +17,9 @@
// headers
// ----------------------------------------------------------------------------
#include "wx/mac/statusbr.h"
#include "wx/statusbr.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBarGeneric);
@@ -33,7 +35,7 @@ END_EVENT_TABLE()
// ============================================================================
// ----------------------------------------------------------------------------
// wxStatusBarXX class
// wxStatusBarMac class
// ----------------------------------------------------------------------------
wxStatusBarMac::wxStatusBarMac()
@@ -105,4 +107,4 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
# ifdef __WXMSW__
dc.SetFont(wxNullFont);
# endif // MSW
}
}

View File

@@ -15,6 +15,8 @@
#include "wx/app.h"
#include "wx/stattext.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#include <stdio.h>

View File

@@ -13,27 +13,26 @@
#pragma implementation "textctrl.h"
#endif
#ifndef __WXMAC__
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __UNIX__
#include <sys/types.h>
#include <sys/stat.h>
#else
#include <stat.h>
#include <stat.h>
#endif
#include <fstream.h>
#include "wx/app.h"
#include "wx/button.h"
#include "wx/panel.h"
#include "wx/textctrl.h"
#include "wx/settings.h"
#include "wx/filefn.h"
#include "wx/utils.h"
#if defined(__BORLANDC__) && !defined(__WIN32__)
#include <alloc.h>
#else
#ifndef __MWERKS__
#ifndef __GNUWIN32__
#include <malloc.h>
#endif
#endif
#include <alloc.h>
#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__WXMAC_X__)
#include <malloc.h>
#endif
#include "wx/mac/uma.h"

View File

@@ -72,9 +72,13 @@ bool wxTimer::Start(int milliseconds,bool mode)
wxCHECK_MSG( m_info.m_task.tmAddr == NULL , FALSE, wxT("attempting to restart a timer") );
m_milli = milliseconds;
m_info.m_task.tmAddr = NewTimerProc( MacTimerProc ) ;
m_info.m_task.tmWakeUp = 0 ;
m_info.m_task.tmReserved = 0 ;
#ifdef __UNIX__
m_info.m_task.tmAddr = NewTimerUPP( MacTimerProc ) ;
#else
m_info.m_task.tmAddr = NewTimerProc( MacTimerProc ) ;
#endif
m_info.m_task.tmWakeUp = 0 ;
m_info.m_task.tmReserved = 0 ;
InsXTime((QElemPtr) &m_info.m_task ) ;
PrimeTime( (QElemPtr) &m_info.m_task , m_milli ) ;
return FALSE;

View File

@@ -15,8 +15,10 @@
#if wxUSE_TOOLTIPS
#include "wx/app.h"
#include "wx/window.h"
#include "wx/tooltip.h"
#include "wx/timer.h"
#include "wx/geometry.h"
#include "wx/mac/aga.h"
#include "wx/mac/uma.h"

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/stubs/textctrl.h"
#include "wx/treebase.h"
#include "wx/stubs/treectrl.h"
#if !USE_SHARED_LIBRARY

View File

@@ -1,8 +1,12 @@
#include <wx/mac/uma.h>
#include <wx/mac/aga.h>
#include "wx/defs.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
#include "Navigation.h"
#ifdef __UNIX__
#include <NavigationServices/Navigation.h>
#else
#include <Navigation.h>
#endif
// init
@@ -75,10 +79,12 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
#endif // UMA_USE_WINDOWMGR
#endif
#ifndef __UNIX__
if ( sUMAHasWindowManager )
InitFloatingWindows() ;
else
InitWindows();
#endif
if ( NavServicesAvailable() )
{
@@ -387,13 +393,22 @@ void UMASetWTitleC( WindowRef inWindowRef , const char *title )
Str255 ptitle ;
strncpy( (char*)ptitle , title , 96 ) ;
ptitle[96] = 0 ;
#if TARGET_CARBON
c2pstrcpy( ptitle, (char *)ptitle ) ;
#else
c2pstr( (char*)ptitle ) ;
#endif
SetWTitle( inWindowRef , ptitle ) ;
}
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
{
GetWTitle( inWindowRef , (unsigned char*)title ) ;
#if TARGET_CARBON
p2cstrcpy( title, (unsigned char *)title ) ;
#else
p2cstr( (unsigned char*)title ) ;
#endif
}
void UMAShowWindow( WindowRef inWindowRef )
@@ -1354,18 +1369,18 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
{
#if UMA_USE_APPEARANCE
if ( UMAHasAppearance() )
{
::DrawThemePlacard( inRect , inState ) ;
}
else
if ( UMAHasAppearance() )
{
::DrawThemePlacard( inRect , inState ) ;
}
else
#endif
#if !TARGET_CARBON
{
}
{
}
#else
{
}
{
}
#endif
}

View File

@@ -27,6 +27,9 @@
#include <string.h>
#include <stdarg.h>
#ifndef __UNIX__
// defined in unix/utilsunx.cpp for Mac OS X
// get full hostname (with domain name if possible)
bool wxGetFullHostName(wxChar *buf, int maxSize)
{
@@ -123,6 +126,7 @@ void wxFatalError(const wxString& msg, const wxString& title)
{
// TODO
}
#endif // !__UNIX__
// Emit a beeeeeep
void wxBell()
@@ -275,11 +279,13 @@ wxString wxMacFindFolder( short vol,
return strDir ;
}
#ifndef __UNIX__
char *wxGetUserHome (const wxString& user)
{
// TODO
return NULL;
}
#endif
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
@@ -328,13 +334,13 @@ void wxDisplaySize(int *width, int *height)
*width = screenBits.bounds.right - screenBits.bounds.left ;
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
#if TARGET_CARBON
#if TARGET_CARBON
SInt16 mheight ;
GetThemeMenuBarHeight( &mheight ) ;
*height -= mheight ;
#else
*height -= LMGetMBarHeight() ;
#endif
#endif
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)

View File

@@ -15,15 +15,15 @@
#include "wx/object.h"
#include "wx/string.h"
#include "wx/mac/wave.h"
#include "wx/wave.h"
wxWave::wxWave()
: m_hSnd(NULL), m_waveLength(0), m_isResource(true), m_sndChan(0)
: m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true)
{
}
wxWave::wxWave(const wxString& sFileName, bool isResource)
: m_hSnd(NULL), m_waveLength(0), m_isResource(true), m_sndChan(0)
: m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true)
{
Create(sFileName, isResource);
}

View File

@@ -23,6 +23,8 @@
#include "wx/layout.h"
#include "wx/dialog.h"
#include "wx/listbox.h"
#include "wx/scrolbar.h"
#include "wx/statbox.h"
#include "wx/button.h"
#include "wx/settings.h"
#include "wx/msgdlg.h"
@@ -31,7 +33,7 @@
#include "wx/tabctrl.h"
#include "wx/tooltip.h"
// TODO remove the line below, just for lookup-up convenience CS
#include "wx/mac/window.h"
#include "wx/window.h"
#include "wx/menuitem.h"
#include "wx/log.h"
@@ -999,8 +1001,8 @@ void wxWindow::MacCreateRealWindow( const wxString& title,
// translate the window attributes in the appropriate window class and attributes
WindowClass wclass ;
WindowAttributes attr ;
WindowClass wclass = 0;
WindowAttributes attr = kWindowNoAttributes ;
if ( HasFlag(wxTINY_CAPTION_HORIZ) || HasFlag(wxTINY_CAPTION_VERT) )
{
@@ -1037,8 +1039,6 @@ void wxWindow::MacCreateRealWindow( const wxString& title,
wclass = kModalWindowClass ;
}
attr = kWindowNoAttributes ;
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
{
attr |= kWindowFullZoomAttribute ;