diff --git a/include/wx/app.h b/include/wx/app.h index 0ff464639c..6f4ddd3265 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -61,7 +61,9 @@ class WXDLLEXPORT wxAppBase : public wxEvtHandler public: // the virtual functions which may/must be overridden in the derived class // ----------------------------------------------------------------------- - +#ifdef __WXMAC_X__ + virtual ~wxAppBase() {} // Added min for Mac X +#endif // called during the program initialization, returning FALSE from here // prevents the program from continuing - it's a good place to create // the top level program window and return TRUE. @@ -370,7 +372,7 @@ public: // be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this // code if required. -#if !wxUSE_GUI || defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || (defined(__DARWIN__) && defined(__WXMAC__)) +#if !wxUSE_GUI || defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || (defined(__WXMAC__) && defined(__UNIX__)) #define IMPLEMENT_WXWIN_MAIN \ extern int wxEntry( int argc, char *argv[] ); \ int main(int argc, char *argv[]) { return wxEntry(argc, argv); } diff --git a/include/wx/cmndata.h b/include/wx/cmndata.h index 49afce9415..03b46f0604 100644 --- a/include/wx/cmndata.h +++ b/include/wx/cmndata.h @@ -21,11 +21,13 @@ #include "wx/colour.h" #include "wx/gdicmn.h" -#if defined( __WXMAC__ ) && defined( TARGET_CARBON ) -#include +#if defined(__WXMAC__) && defined(TARGET_CARBON) + #if !defined(__UNIX__) + #include + #endif #endif -#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT +#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT class WXDLLEXPORT wxPrintSetupData; #endif @@ -169,7 +171,7 @@ class WXDLLEXPORT wxPrintData: public wxObject void operator=(const wxPrintData& data); // For compatibility -#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT +#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT void operator=(const wxPrintSetupData& setupData); #endif @@ -181,7 +183,7 @@ class WXDLLEXPORT wxPrintData: public wxObject void SetNativeData(void* data) { m_devMode = data; } void* GetNativeDataDevNames() const { return m_devNames; } void SetNativeDataDevNames(void* data) { m_devNames = data; } -#elif defined( __WXMAC__) +#elif defined(__WXMAC__) void ConvertToNative(); void ConvertFromNative(); #endif @@ -286,7 +288,7 @@ class WXDLLEXPORT wxPrintDialogData: public wxObject void ConvertFromNative(); void SetOwnerWindow(wxWindow* win); void* GetNativeData() const { return m_printDlgData; } -#elif defined( __WXMAC__) +#elif defined(__WXMAC__) void ConvertToNative(); void ConvertFromNative(); #endif @@ -375,7 +377,7 @@ public: void ConvertFromNative(); void SetOwnerWindow(wxWindow* win); void* GetNativeData() const { return m_pageSetupData; } -#elif defined( __WXMAC__) +#elif defined(__WXMAC__) void ConvertToNative(); void ConvertFromNative(); #endif diff --git a/include/wx/control.h b/include/wx/control.h index 7b1d491309..c50fe6c033 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -29,6 +29,9 @@ class WXDLLEXPORT wxControlBase : public wxWindow { public: +#ifdef __WXMAC_X__ + virtual ~wxControlBase() {} // Added min for Mac X +#endif // simulates the event of given type (i.e. wxButton::Command() is just as // if the button was clicked) virtual void Command(wxCommandEvent &event); diff --git a/include/wx/ctrlsub.h b/include/wx/ctrlsub.h index b785bea964..42fd7349c8 100644 --- a/include/wx/ctrlsub.h +++ b/include/wx/ctrlsub.h @@ -29,6 +29,9 @@ class WXDLLEXPORT wxControlWithItems : public wxControl { public: wxControlWithItems() { m_clientDataItemsType = ClientData_None; } +#ifdef __WXMAC_X__ + virtual ~wxControlWithItems() {} // Added min for Mac X +#endif // adding items // ------------ diff --git a/include/wx/defs.h b/include/wx/defs.h index 34972041b4..352820024a 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -52,8 +52,33 @@ #define OS2EMX_PLAIN_CHAR #endif -#elif defined(applec) || defined(THINK_C) || ( defined( __MWERKS__ ) && !defined(__INTEL__) ) + #if defined(__APPLE__) + // MacOS X + #ifndef __WXMAC__ + #define __WXMAC__ + #endif + #ifndef __WXMAC_X__ + #define __WXMAC_X__ + #endif + + #define PM_USE_SESSION_APIS 0 + #include + #endif +#elif defined(applec) || defined(THINK_C) || (defined(__MWERKS__) && !defined(__INTEL__)) // MacOS +#elif defined(__WXMAC__) && defined(__APPLE__) + // MacOS X + #define __UNIX_LIKE__ + + #ifndef __WXMAC__ + #define __WXMAC__ + #endif + #ifndef __WXMAC_X__ + #define __WXMAC_X__ + #endif + + #define PM_USE_SESSION_APIS 0 + #include #elif defined(__OS2__) #if defined(__IBMCPP__) #define __VISAGEAVER__ __IBMCPP__ diff --git a/include/wx/dialog.h b/include/wx/dialog.h index 78e89ce307..a693f638ae 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -22,6 +22,9 @@ class WXDLLEXPORT wxDialogBase : public wxPanel { public: +#ifdef __WXMAC_X__ + ~wxDialogBase() {} // Added min for Mac X +#endif // the modal dialogs have a return code - usually the id of the last // pressed button void SetReturnCode(int returnCode) { m_returnCode = returnCode; } diff --git a/include/wx/dirdlg.h b/include/wx/dirdlg.h index 96ee554d3f..4e93c93c65 100644 --- a/include/wx/dirdlg.h +++ b/include/wx/dirdlg.h @@ -22,7 +22,11 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; #elif defined(__WXQT__) #include "wx/qt/dirdlg.h" #elif defined(__WXMAC__) +#ifdef __WXMAC_X__ +#include "wx/generic/dirdlgg.h" +#else #include "wx/mac/dirdlg.h" +#endif #elif defined(__WXPM__) #include "wx/os2/dirdlg.h" #elif defined(__WXSTUBS__) diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 702df0bad0..c72a62f636 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -164,6 +164,7 @@ private: // { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); // so using a temporary variable instead. // ---------------------------------------------------------------------------- +// __MAC_X__ added min ~name() below for compiling Mac X #define _WX_DEFINE_ARRAY(T, name, classexp) \ typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ classexp name : public wxBaseArray \ @@ -176,6 +177,7 @@ public: \ if ( type > sizelong ) \ { wxFAIL_MSG( _WX_ERROR_SIZEOF ); } \ } \ + ~name() {} \ \ name& operator=(const name& src) \ { wxBaseArray* temp = (wxBaseArray*) this; \ diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index b13587e3e5..067dea6d3a 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -48,6 +48,8 @@ #elif defined(__WINDOWS__) # include // needed to get HMODULE typedef HMODULE wxDllType; +#elif defined(__APPLE__) && defined(__UNIX__) + typedef void *wxDllType; #elif defined(__WXMAC__) typedef CFragConnectionID wxDllType; #else diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h index 9fb43982bc..a2b386dd0f 100644 --- a/include/wx/filedlg.h +++ b/include/wx/filedlg.h @@ -21,7 +21,11 @@ enum #elif defined(__WXQT__) #include "wx/qt/filedlg.h" #elif defined(__WXMAC__) +#ifdef __WXMAC_X__ +#include "wx/generic/filedlgg.h" +#else #include "wx/mac/filedlg.h" +#endif #elif defined(__WXPM__) #include "wx/os2/filedlg.h" #elif defined(__WXSTUBS__) diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 2502dc1a06..daa793f129 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -25,8 +25,7 @@ // ---------------------------------------------------------------------------- // define off_t - -#if !defined(__WXMAC__) || defined(__DARWIN__) +#if !defined(__WXMAC__) || defined(__UNIX__) #include #else typedef long off_t; @@ -256,16 +255,18 @@ WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0); #define wxFILE_SEP_PATH_MAC wxT(':') // separator in the path list (as in PATH environment variable) +// there is no PATH variable in Classic Mac OS so just use the +// semicolon (it must be different from the file name separator) // NB: these are strings and not characters on purpose! #define wxPATH_SEP_DOS wxT(";") #define wxPATH_SEP_UNIX wxT(":") +#define wxPATH_SEP_MAC wxT(";") // platform independent versions #ifdef __UNIX__ #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX #define wxPATH_SEP wxPATH_SEP_UNIX #elif defined(__MAC__) - // TODO find out whether we can really switch back to native file names // previously this mac was emulating unix/win filename structures // #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC diff --git a/include/wx/font.h b/include/wx/font.h index b5d1650c3b..d38bd307f3 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -78,6 +78,9 @@ class WXDLLEXPORT wxFontBase : public wxGDIObject { public: // creator function +#ifdef __WXMAC_X__ + virtual ~wxFontBase() {} // Added min for Mac X +#endif // from the font components static wxFont *New( diff --git a/include/wx/frame.h b/include/wx/frame.h index 6f5ca2de91..de126f6a57 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -58,6 +58,9 @@ class WXDLLEXPORT wxFrameBase : public wxWindow public: // construction wxFrameBase(); +#ifdef __WXMAC_X__ + virtual ~wxFrameBase() {} // Added min for Mac X +#endif wxFrame *New(wxWindow *parent, wxWindowID id, diff --git a/include/wx/geometry.h b/include/wx/geometry.h index 2a8a8fb396..151f87aad6 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -31,7 +31,11 @@ #ifdef __WXMSW__ #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) #elif defined( __WXMAC__ ) + #ifdef __WXMAC_X__ + #include + #else #include "Math64.h" + #endif #define wxMulDivInt32( a , b , c ) S32Set( S64Div( S64Multiply( S64Set(a) , S64Set(b) ) , S64Set(c) ) ) #else #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) diff --git a/include/wx/list.h b/include/wx/list.h index 23ab3e1ff8..f5bf5336cc 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -484,6 +484,9 @@ class WXDLLEXPORT wxList : public wxObjectList { public: wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { } +#ifdef __WXMAC_X__ + ~wxList() {} // Added min for Mac X +#endif wxList& operator=(const wxList& list) { return (wxList&)wxListBase::operator=(list); } diff --git a/include/wx/listbox.h b/include/wx/listbox.h index 92c7bf7c08..ce7fa14079 100644 --- a/include/wx/listbox.h +++ b/include/wx/listbox.h @@ -45,6 +45,9 @@ class WXDLLEXPORT wxListBoxBase : public wxControlWithItems public: // all generic methods are in wxControlWithItems, except for the following // ones which are not yet implemented by wxChoice/wxCombobox +#ifdef __WXMAC_X__ + virtual ~wxListBoxBase() {} // Added min for Mac X +#endif void Insert(const wxString& item, int pos) { DoInsert(item, pos); } diff --git a/include/wx/mac/bitmap.h b/include/wx/mac/bitmap.h index 92eda5882d..a696eb125a 100644 --- a/include/wx/mac/bitmap.h +++ b/include/wx/mac/bitmap.h @@ -28,10 +28,10 @@ class WXDLLEXPORT wxBitmapHandler; class WXDLLEXPORT wxIcon; class WXDLLEXPORT wxCursor; -GWorldPtr wxMacCreateGWorld( int height , int widtdh , int depth ) ; -void wxMacDestroyGWorld( GWorldPtr gw ) ; +GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ; +void wxMacDestroyGWorld( GWorldPtr gw ) ; PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ; -void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ; +void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ; CTabHandle wxMacCreateColorTable( int numColors ) ; // A mask is a mono bitmap used for drawing bitmaps @@ -100,6 +100,9 @@ class WXDLLEXPORT wxBitmapHandler: public wxObject DECLARE_DYNAMIC_CLASS(wxBitmapHandler) public: wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; }; +#ifdef __WXMAC_X__ + virtual ~wxBitmapHandler() {} // Added min for Mac X +#endif virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, @@ -138,6 +141,7 @@ public: // Initialize with XPM data wxBitmap(const char **data); + wxBitmap(char **data); // Load a file or resource wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_PICT_RESOURCE); @@ -193,6 +197,7 @@ protected: public: void SetHBITMAP(WXHBITMAP bmp); inline WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); } + bool FreeResource(bool force = FALSE); }; #endif diff --git a/include/wx/mac/checklst.h b/include/wx/mac/checklst.h index 64514452fe..e957f61a74 100644 --- a/include/wx/mac/checklst.h +++ b/include/wx/mac/checklst.h @@ -19,7 +19,7 @@ #include "wx/listbox.h" -#if !defined(__MWERKS__) && !defined(__MACH__) +#if !defined(__MWERKS__) && !defined(__UNIX__) typedef unsigned int size_t; #endif diff --git a/include/wx/mac/choice.h b/include/wx/mac/choice.h index f641fad419..231f351122 100644 --- a/include/wx/mac/choice.h +++ b/include/wx/mac/choice.h @@ -49,6 +49,9 @@ class WXDLLEXPORT wxChoice: public wxControl const wxString& name = wxChoiceNameStr); virtual void Append(const wxString& item); + // Added min Append and GetClientData + virtual void Append(const wxString& item, void *client_data); + virtual void *GetClientData(int index) const; virtual void Delete(int n); virtual void Clear(); virtual int GetSelection() const ; diff --git a/include/wx/mac/control.h b/include/wx/mac/control.h index 441d823d20..fb05068161 100644 --- a/include/wx/mac/control.h +++ b/include/wx/mac/control.h @@ -52,33 +52,35 @@ public: virtual void SetLabel(const wxString& title) ; wxList& GetSubcontrols() { return m_subControls; } - + void OnEraseBackground(wxEraseEvent& event); - - virtual bool Enable(bool enabled) ; - virtual bool Show(bool show) ; - - virtual void MacRedrawControl () ; - virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; - virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label , - const wxPoint& pos, - const wxSize& size, long style, - const wxValidator& validator, - const wxString& name , Rect *outBounds , StringPtr maclabel ) ; - virtual void MacPostControlCreate() ; - virtual void MacAdjustControlRect() ; - virtual ControlHandle MacGetContainerForEmbedding() ; - virtual void MacSuperChangedPosition() ; - virtual void MacSuperEnabled( bool enabled ) ; - virtual void MacSuperShown( bool show ) ; - virtual bool MacCanFocus() const ; - - virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags ) ; - virtual void OnKeyDown( wxKeyEvent &event ) ; - virtual void OnMouseEvent( wxMouseEvent &event ) ; - virtual void OnPaint(wxPaintEvent& event) ; - virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ; - ControlHandle GetMacControl() { return m_macControl ;} + + virtual bool Enable(bool enabled) ; + virtual bool Show(bool show = TRUE) ; + + virtual void MacRedrawControl () ; + virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; + virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label , + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& validator, + const wxString& name , + Rect *outBounds , + StringPtr maclabel ) ; + virtual void MacPostControlCreate() ; + virtual void MacAdjustControlRect() ; + virtual ControlHandle MacGetContainerForEmbedding() ; + virtual void MacSuperChangedPosition() ; + virtual void MacSuperEnabled( bool enabled ) ; + virtual void MacSuperShown( bool show ) ; + virtual bool MacCanFocus() const ; + + virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags ) ; + virtual void OnKeyDown( wxKeyEvent &event ) ; + virtual void OnMouseEvent( wxMouseEvent &event ) ; + virtual void OnPaint(wxPaintEvent& event) ; + virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ; + ControlHandle GetMacControl() { return m_macControl ;} #if WXWIN_COMPATIBILITY virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } diff --git a/include/wx/mac/dataobj.h b/include/wx/mac/dataobj.h index 74cbb9215f..9539c95e8f 100644 --- a/include/wx/mac/dataobj.h +++ b/include/wx/mac/dataobj.h @@ -24,6 +24,9 @@ class wxDataObject : public wxDataObjectBase { public: wxDataObject(); +#ifdef __WXMAC_X__ + ~wxDataObject() {} // Added min for Mac X +#endif virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; }; diff --git a/include/wx/mac/dc.h b/include/wx/mac/dc.h index 719fe2df2e..6ce701621c 100644 --- a/include/wx/mac/dc.h +++ b/include/wx/mac/dc.h @@ -297,65 +297,65 @@ class WXDLLEXPORT wxDC: public wxDCBase public: - long XDEV2LOG(long x) const + wxCoord XDEV2LOG(wxCoord x) const { long new_x = x - m_deviceOriginX; if (new_x > 0) - return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; + return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; else - return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; + return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; } - long XDEV2LOGREL(long x) const + wxCoord XDEV2LOGREL(wxCoord x) const { if (x > 0) - return (long)((double)(x) / m_scaleX + 0.5); + return (wxCoord)((double)(x) / m_scaleX + 0.5); else - return (long)((double)(x) / m_scaleX - 0.5); + return (wxCoord)((double)(x) / m_scaleX - 0.5); } - long YDEV2LOG(long y) const + wxCoord YDEV2LOG(wxCoord y) const { long new_y = y - m_deviceOriginY; if (new_y > 0) - return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; + return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; else - return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; + return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; } - long YDEV2LOGREL(long y) const + wxCoord YDEV2LOGREL(wxCoord y) const { if (y > 0) - return (long)((double)(y) / m_scaleY + 0.5); + return (wxCoord)((double)(y) / m_scaleY + 0.5); else - return (long)((double)(y) / m_scaleY - 0.5); + return (wxCoord)((double)(y) / m_scaleY - 0.5); } - long XLOG2DEV(long x) const + wxCoord XLOG2DEV(wxCoord x) const { long new_x = x - m_logicalOriginX; if (new_x > 0) - return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; + return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; else - return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; + return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; } - long XLOG2DEVREL(long x) const + wxCoord XLOG2DEVREL(wxCoord x) const { if (x > 0) - return (long)((double)(x) * m_scaleX + 0.5); + return (wxCoord)((double)(x) * m_scaleX + 0.5); else - return (long)((double)(x) * m_scaleX - 0.5); + return (wxCoord)((double)(x) * m_scaleX - 0.5); } - long YLOG2DEV(long y) const + wxCoord YLOG2DEV(wxCoord y) const { long new_y = y - m_logicalOriginY; if (new_y > 0) - return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; + return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; else - return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; + return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; } - long YLOG2DEVREL(long y) const + wxCoord YLOG2DEVREL(wxCoord y) const { if (y > 0) - return (long)((double)(y) * m_scaleY + 0.5); + return (wxCoord)((double)(y) * m_scaleY + 0.5); else - return (long)((double)(y) * m_scaleY - 0.5); + return (wxCoord)((double)(y) * m_scaleY - 0.5); } // @@ -495,7 +495,7 @@ protected: GrafPtr m_macOrigPort ; Rect m_macClipRect ; Point m_macLocalOrigin ; - AGAPortHelper m_macPortHelper ; + mutable AGAPortHelper m_macPortHelper ; void MacSetupPort() const ; void MacVerifySetup() const { if ( m_macPortId != m_macCurrentPortId ) MacSetupPort() ; } diff --git a/include/wx/mac/dcprint.h b/include/wx/mac/dcprint.h index e2e11819a3..cd3722edee 100644 --- a/include/wx/mac/dcprint.h +++ b/include/wx/mac/dcprint.h @@ -24,6 +24,7 @@ class WXDLLEXPORT wxPrinterDC: public wxDC public: DECLARE_CLASS(wxPrinterDC) +#if wxUSE_PRINTING_ARCHITECTURE // Create a printer DC wxPrinterDC(const wxPrintData& printdata ); ~wxPrinterDC(); @@ -39,6 +40,7 @@ class WXDLLEXPORT wxPrinterDC: public wxDC TPPrPort m_macPrintPort ; #endif wxPrintData m_printData ; +#endif // wxUSE_PRINTING_ARCHITECTURE }; #endif diff --git a/include/wx/mac/dnd.h b/include/wx/mac/dnd.h index e3a149ed85..4a1295fd1e 100644 --- a/include/wx/mac/dnd.h +++ b/include/wx/mac/dnd.h @@ -25,9 +25,11 @@ class WXDLLEXPORT wxWindow; +#ifndef __WXMAC_X__ class WXDLLEXPORT wxDataObject; class WXDLLEXPORT wxTextDataObject; class WXDLLEXPORT wxFileDataObject; +#endif class WXDLLEXPORT wxDropTarget; class WXDLLEXPORT wxTextDropTarget; @@ -35,11 +37,12 @@ class WXDLLEXPORT wxFileDropTarget; class WXDLLEXPORT wxDropSource; +#ifndef __WXMAC_X__ //------------------------------------------------------------------------- // wxDataObject //------------------------------------------------------------------------- -class WXDLLEXPORT wxDataObject: public wxObject +class WXDLLEXPORT wxDataObject : public wxObject { public: // all data formats (values are the same as in windows.h, do not change!) @@ -138,6 +141,8 @@ private: wxString m_files; }; +#endif + //------------------------------------------------------------------------- // wxDropTarget //------------------------------------------------------------------------- @@ -163,6 +168,7 @@ class WXDLLEXPORT wxDropTarget: public wxObject virtual wxDataFormat GetFormat(size_t n) const = 0; }; +#ifndef __WXMAC_X__ //------------------------------------------------------------------------- // wxTextDropTarget //------------------------------------------------------------------------- @@ -200,20 +206,12 @@ class WXDLLEXPORT wxFileDropTarget: public wxDropTarget virtual size_t GetFormatCount() const; virtual wxDataFormat GetFormat(size_t n) const; }; +#endif //------------------------------------------------------------------------- // wxDropSource //------------------------------------------------------------------------- -enum wxDragResult - { - wxDragError, // error prevented the d&d operation from completing - wxDragNone, // drag target didn't accept the data - wxDragCopy, // the data was successfully copied - wxDragMove, // the data was successfully moved - wxDragCancel // the operation was cancelled by user (not an error) - }; - class WXDLLEXPORT wxDropSource: public wxObject { public: diff --git a/include/wx/mac/imaglist.h b/include/wx/mac/imaglist.h index 7e66ffb36a..8f305419fe 100644 --- a/include/wx/mac/imaglist.h +++ b/include/wx/mac/imaglist.h @@ -72,6 +72,8 @@ class WXDLLEXPORT wxImageList: public wxObject // Returns the number of images in the image list. int GetImageCount() const; + + bool GetSize(int index, int&width, int &height) const; // Operations //////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/mac/mimetype.h b/include/wx/mac/mimetype.h index 3eaebfdf3b..b59e436a24 100644 --- a/include/wx/mac/mimetype.h +++ b/include/wx/mac/mimetype.h @@ -25,6 +25,7 @@ public : // implement containing class functions wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ; wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); size_t EnumAllFileTypes(wxArrayString& mimetypes); @@ -35,6 +36,12 @@ public : void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + + // create a new filetype with the given name and extension + wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); + private: wxArrayFileTypeInfo m_fallbacks; }; @@ -61,6 +68,11 @@ public: const wxFileType::MessageParameters&) const { return GetCommand(printCmd, "print"); } + size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, + const wxFileType::MessageParameters& params) const; + + bool Unassociate(); + private: // helper function bool GetCommand(wxString *command, const char *verb) const; diff --git a/include/wx/mac/palette.h b/include/wx/mac/palette.h index c359654e79..8925c53d4e 100644 --- a/include/wx/mac/palette.h +++ b/include/wx/mac/palette.h @@ -16,6 +16,7 @@ #pragma interface "palette.h" #endif +#include "wx/colour.h" #include "wx/gdiobj.h" class WXDLLEXPORT wxPalette; diff --git a/include/wx/mac/pngread.h b/include/wx/mac/pngread.h index f6d1d707ec..83ef95baf5 100644 --- a/include/wx/mac/pngread.h +++ b/include/wx/mac/pngread.h @@ -40,15 +40,15 @@ class wxPNGReader protected: int filetype; char filename[255]; - ImagePointerType RawImage; // Image data + ImagePointerType RawImage; // Image data - int Width, Height; // Dimensions - int Depth; // (bits x pixel) - int ColorType; // Bit 1 = Palette used - // Bit 2 = Color used - // Bit 3 = Alpha used + int Width, Height; // Dimensions + int Depth; // (bits x pixel) + int ColorType; // Bit 1 = Palette used + // Bit 2 = Color used + // Bit 3 = Alpha used - long EfeWidth; // Efective Width + long EfeWidth; // Efective Width GWorldPtr lpbi; int bgindex; @@ -58,7 +58,7 @@ friend class wxPNGReaderIter; public: wxPNGReader(void); wxPNGReader (char* ImageFileName); // Read an image file - ~wxPNGReader (); + virtual ~wxPNGReader (); void Create(int width, int height, int deep, int colortype=-1); diff --git a/include/wx/mac/slider.h b/include/wx/mac/slider.h index e71b62fdb1..ff45a5790d 100644 --- a/include/wx/mac/slider.h +++ b/include/wx/mac/slider.h @@ -17,6 +17,8 @@ #endif #include "wx/control.h" +#include "wx/slider.h" +#include "wx/stattext.h" WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; diff --git a/include/wx/mac/spinbutt.h b/include/wx/mac/spinbutt.h index 9909adfea9..934888ee06 100644 --- a/include/wx/mac/spinbutt.h +++ b/include/wx/mac/spinbutt.h @@ -33,7 +33,7 @@ class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase { public: // construction - wxSpinButton() { } + wxSpinButton(); wxSpinButton(wxWindow *parent, wxWindowID id = -1, @@ -56,6 +56,8 @@ public: // accessors + virtual int GetMin() const; + virtual int GetMax() const; virtual int GetValue() const; virtual void SetValue(int val); virtual void SetRange(int minVal, int maxVal); diff --git a/include/wx/mac/uma.h b/include/wx/mac/uma.h index 85ad8863b1..0898dc057a 100644 --- a/include/wx/mac/uma.h +++ b/include/wx/mac/uma.h @@ -21,12 +21,15 @@ #define UMA_USE_8_6 1 #endif -#if defined(__POWERPC__) || defined(__MACH__) -#define UMA_USE_APPEARANCE 1 -#define UMA_USE_WINDOWMGR 1 +#if defined(__POWERPC__) || defined(__APPLE__) + #define UMA_USE_APPEARANCE 1 + #define UMA_USE_WINDOWMGR 1 + #if defined(__APPLE__) + #include + #endif #else -#define UMA_USE_APPEARANCE 0 -#define UMA_USE_WINDOWMGR 0 + #define UMA_USE_APPEARANCE 0 + #define UMA_USE_WINDOWMGR 0 #endif #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR @@ -242,4 +245,4 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ; OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ; -#endif \ No newline at end of file +#endif diff --git a/include/wx/sckaddr.h b/include/wx/sckaddr.h index 6e2a0ae012..17a9477905 100644 --- a/include/wx/sckaddr.h +++ b/include/wx/sckaddr.h @@ -86,7 +86,7 @@ public: }; #endif -#ifdef __UNIX__ +#if defined(__UNIX__) && !defined(__APPLE__) #include #ifndef __VMS__ # include diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h index 6857a95259..ac33321b0c 100644 --- a/include/wx/statusbr.h +++ b/include/wx/statusbr.h @@ -54,7 +54,7 @@ protected: #include "wx/msw/statbr95.h" typedef wxStatusBar95 wxStatusBarReal; -#elif defined(__WXMAC__) +#elif defined(__WXMAC__) && !defined(__UNIX__) #include "wx/mac/statusbr.h" typedef wxStatusBarMac wxStatusBarReal; diff --git a/include/wx/stubs/treectrl.h b/include/wx/stubs/treectrl.h index cb307ec0e9..000bc1824a 100644 --- a/include/wx/stubs/treectrl.h +++ b/include/wx/stubs/treectrl.h @@ -276,20 +276,5 @@ class WXDLLEXPORT wxTreeEvent: public wxCommandEvent typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); -#define EVT_TREE_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_COMMAND_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_GET_INFO(id, fn) { wxEVT_COMMAND_TREE_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_SET_INFO(id, fn) { wxEVT_COMMAND_TREE_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_ITEM_EXPANDED(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_ITEM_EXPANDING(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_ITEM_COLLAPSED(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_ITEM_COLLAPSING(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, -#define EVT_TREE_KEY_DOWN(id, fn) { wxEVT_COMMAND_TREE_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, - #endif // _WX_TREECTRL_H_ diff --git a/include/wx/time.h b/include/wx/time.h index d2c87ec77a..af2e71a502 100644 --- a/include/wx/time.h +++ b/include/wx/time.h @@ -123,17 +123,16 @@ public: { _T("%H:%M:%S"), _T("%H:%M") } // wx24h }; - static wxChar s_bufTime[128]; + wxStrncpy(ms_bufTime, m_time.Format(formats[ms_Format][ms_Precision]), + WXSIZEOF(ms_bufTime)); - wxStrncpy(s_bufTime, m_time.Format(formats[ms_Format][ms_Precision]), - WXSIZEOF(s_bufTime)); - - return s_bufTime; + return ms_bufTime; } private: static tFormat ms_Format; static tPrecision ms_Precision; + static wxChar ms_bufTime[128]; #if 0 // old wxTime members unused any more clockTy sec; /* seconds since 1/1/1901 */ diff --git a/include/wx/timer.h b/include/wx/timer.h index 7593cfd406..51432d1610 100644 --- a/include/wx/timer.h +++ b/include/wx/timer.h @@ -49,6 +49,10 @@ public: void SetOwner(wxEvtHandler *owner, int id = -1) { m_owner = owner; m_idTimer = id; } +#ifdef __WXMAC_X__ + virtual ~wxTimerBase() {} // Added min for Mac X +#endif + // working with the timer // ---------------------- diff --git a/include/wx/wave.h b/include/wx/wave.h index c5b7d0ef30..8a31835ed4 100644 --- a/include/wx/wave.h +++ b/include/wx/wave.h @@ -7,6 +7,8 @@ #include "wx/gtk/wave.h" #elif defined(__WXQT__) #include "wx/qt/wave.h" +#elif defined(__WXMAC__) +#include "wx/mac/wave.h" #elif defined(__WXPM__) #include "wx/os2/wave.h" #elif defined(__WXMAC__) diff --git a/include/wx/wx_cw_cm.h b/include/wx/wx_cw_cm.h index a565d4a3f6..b9871724b9 100644 --- a/include/wx/wx_cw_cm.h +++ b/include/wx/wx_cw_cm.h @@ -25,7 +25,7 @@ #endif */ #else - #define USE_PRECOMPILED_MAC_HEADERS 1 /*Set to 0 if you don't want to use precompiled MacHeaders*/ + #define USE_PRECOMPILED_MAC_HEADERS 1 /*Set to 0 if you don't want to use precompiled MacHeaders*/ #endif // automatically includes MacHeaders #elif (__MWERKS__ >= 0x0900) && __INTEL__ diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index 0ab57e3987..2bd6a65114 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -366,7 +366,7 @@ typedef unsigned __WCHAR_TYPE__ wxUChar; # define wxUChar unsigned char # endif -# if defined(__FreeBSD__) || defined(__MACH__) +# if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__UNIX__)) # undef _T # endif @@ -419,7 +419,7 @@ typedef unsigned __WCHAR_TYPE__ wxUChar; # elif defined(__SC__) || defined(__VISUALC__) || (defined(__MWERKS__) && defined(__INTEL__)) # define wxStricmp _stricmp # define wxStrnicmp _strnicmp -# elif defined(__UNIX__) || defined(__GNUWIN32__) || defined(__MACH__) +# elif defined(__UNIX__) || defined(__GNUWIN32__) # define wxStricmp strcasecmp # define wxStrnicmp strncasecmp # elif defined(__MWERKS__) && !defined(__INTEL__) diff --git a/include/wx_cw.pch b/include/wx_cw.pch index 2544b89085..09201f7d31 100644 --- a/include/wx_cw.pch +++ b/include/wx_cw.pch @@ -24,6 +24,7 @@ #undef WX_PRECOMP #define wxUSE_GUI 1 #define OLDP2C 1 +#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 #include "wx/wx_cw_cm.h" #ifdef __WXMSW__ #include diff --git a/include/wx_cw.pch++ b/include/wx_cw.pch++ index 6d0f7a586f..7cbd045a8e 100644 --- a/include/wx_cw.pch++ +++ b/include/wx_cw.pch++ @@ -24,6 +24,7 @@ #define WX_PRECOMP #define wxUSE_GUI 1 #define OLDP2C 1 +#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 #include "wx/wx_cw_cm.h" #ifdef WX_PRECOMP #include "wx/wxprec.h" diff --git a/include/wx_cw_d.pch b/include/wx_cw_d.pch index 6ecbb9b5f4..5882fa657f 100644 --- a/include/wx_cw_d.pch +++ b/include/wx_cw_d.pch @@ -17,6 +17,7 @@ #define __WXDEBUG__ 1 #define wxUSE_GUI 1 #define OLDP2C 1 +#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 #include "wx/wx_cw_cm.h" #ifdef __WXMSW__ #include diff --git a/include/wx_cw_d.pch++ b/include/wx_cw_d.pch++ index b10644099d..e3d2ae2824 100644 --- a/include/wx_cw_d.pch++ +++ b/include/wx_cw_d.pch++ @@ -17,6 +17,7 @@ #define __WXDEBUG__ 1 #define wxUSE_GUI 1 #define OLDP2C 1 +#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 #include "wx/wx_cw_cm.h" #ifdef WX_PRECOMP #include "wx/wxprec.h" diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 5976df793d..6830ec2265 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -76,6 +76,15 @@ else return (void *)0; } +#elif defined(__APPLE__) && defined(__UNIX__) +char *dlopen(char *path, int mode /* mode is ignored */); +void *dlsym(void *handle, char *symbol); +int dlclose(void *handle); +char *dlerror(); + +# define wxDllOpen(lib) dlopen(lib.fn_str(), 0) +# define wxDllGetSymbol(handle, name) dlsym(handle, name) +# define wxDllClose dlclose #elif defined(__WINDOWS__) // using LoadLibraryEx under Win32 to avoid name clash with LoadLibrary # ifdef __WIN32__ @@ -221,7 +230,7 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success) { wxDllType handle; -#if defined(__WXMAC__) +#if defined(__WXMAC__) && !defined(__UNIX__) FSSpec myFSSpec ; Ptr myMainAddr ; Str255 myErrName ; @@ -294,13 +303,17 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name) { void *symbol = NULL; // return value -#if defined( __WXMAC__ ) +#if defined(__WXMAC__) && !defined(__UNIX__) Ptr symAddress ; CFragSymbolClass symClass ; Str255 symName ; - strcpy( (char*) symName , name ) ; - c2pstr( (char*) symName ) ; +#if TARGET_CARBON + c2pstrcpy( (StringPtr) symName , name ) ; +#else + strcpy( (char *) symName , name ) ; + c2pstr( (char *) symName ) ; +#endif if ( FindSymbol( dllHandle , symName , &symAddress , &symClass ) == noErr ) symbol = (void *)symAddress ; diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 6d2afb1a79..def73f29d7 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -114,11 +114,11 @@ extern wxChar *wxBuffer; -#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 IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxStringList) @@ -817,7 +817,7 @@ wxString wxPathOnly (const wxString& path) // and back again - or we get nasty problems with delimiters. // Also, convert to lower case, since case is significant in UNIX. -#ifdef __WXMAC__ +#if defined(__WXMAC__) && !defined(__UNIX__) static char sMacFileNameConversion[ 1000 ] ; @@ -1058,7 +1058,7 @@ wxCopyFile (const wxString& file1, const wxString& file2) return FALSE; } -#ifndef __VISAGECPP__ +#if !defined(__VISAGECPP__) && !defined(__WXMAC__) // no chmod in VA. SHould be some permission API for HPFS386 partitions however if ( chmod(file2, fbuf.st_mode) != 0 ) { diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 23aad6bf51..57857abc7a 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -50,7 +50,7 @@ #include "wx/protocol/ftp.h" #if defined(__WXMAC__) - #include "/wx/mac/macsock.h" + #include "wx/mac/macsock.h" #endif #ifndef __MWERKS__ diff --git a/src/common/image.cpp b/src/common/image.cpp index 893eed643f..430bf440d0 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1398,12 +1398,16 @@ wxImage::wxImage( const wxBitmap &bitmap ) #ifdef __WXMAC__ -#include +#ifdef __UNIX__ + #include +#else + #include +#endif 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 ) ; wxBitmap wxImage::ConvertToBitmap() const diff --git a/src/common/log.cpp b/src/common/log.cpp index 7268dddc04..97f406c81f 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -398,7 +398,7 @@ wxLogStderr::wxLogStderr(FILE *fp) m_fp = fp; } -#if defined(__WXMAC__) +#if defined(__WXMAC__) && !defined(__UNIX__) #define kDebuggerSignature 'MWDB' static Boolean FindProcessBySignature(OSType signature, ProcessInfoRec* info) @@ -494,7 +494,7 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) str += wxT("\r\n") ; OutputDebugString(str.c_str()); #endif // MSW -#if defined(__WXMAC__) && wxUSE_GUI +#if defined(__WXMAC__) && !defined(__WXMAC_X__) && wxUSE_GUI Str255 pstr ; strcpy( (char*) pstr , str.c_str() ) ; strcat( (char*) pstr , ";g" ) ; @@ -525,7 +525,7 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) DebugStr(pstr); #endif } -#endif // MSW +#endif // Mac } // ---------------------------------------------------------------------------- diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 7924cee54f..d3d0d06484 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -42,7 +42,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxSockAddress) #ifdef ENABLE_IPV6 IMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxSockAddress) #endif -#ifdef __UNIX__ +#if defined(__UNIX__) && !defined(__WXMAC_X__) IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) #endif @@ -201,7 +201,7 @@ unsigned short wxIPV6address::Service() #endif -#ifdef __UNIX__ +#if defined(__UNIX__) && !defined(__WXMAC_X__) // --------------------------------------------------------------------------- // wxUNIXaddress // --------------------------------------------------------------------------- diff --git a/src/common/string.cpp b/src/common/string.cpp index f94a551e4f..4fd4c02a14 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -116,6 +116,8 @@ extern const wxChar WXDLLEXPORT *wxEmptyString = &g_strEmpty.dummy; #if defined(__VISUALC__) || (defined(__MINGW32__) && wxUSE_NORLANDER_HEADERS) #define wxVsnprintfA _vsnprintf #endif +#elif defined(__WXMAC__) + #define wxVsnprintfA vsnprintf #else // !Windows #ifdef HAVE_VSNPRINTF #define wxVsnprintfA vsnprintf @@ -130,9 +132,7 @@ extern const wxChar WXDLLEXPORT *wxEmptyString = &g_strEmpty.dummy; #if defined(__VISUALC__) #pragma message("Using sprintf() because no snprintf()-like function defined") - #elif defined(__GNUG__) && !defined(__UNIX__) - #warning "Using sprintf() because no snprintf()-like function defined" - #elif defined(__MWERKS__) + #elif defined(__GNUG__) #warning "Using sprintf() because no snprintf()-like function defined" #endif //compiler #endif // no vsnprintf @@ -1410,7 +1410,7 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) // NB: wxVsnprintf() may return either less than the buffer size or -1 if // there is not enough place depending on implementation - int iLen = wxVsnprintfA(szScratch, WXSIZEOF(szScratch), pszFormat, argptr); + int iLen = wxVsnprintfA(szScratch, WXSIZEOF(szScratch), (char *)pszFormat, argptr); if ( iLen != -1 ) { // the whole string is in szScratch *this = szScratch; diff --git a/src/common/variant.cpp b/src/common/variant.cpp index 26e623c1b5..a0c5b4bdab 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -44,6 +44,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject) wxTime::tFormat wxTime::ms_Format = wxTime::wx12h; wxTime::tPrecision wxTime::ms_Precision = wxTime::wxStdMinSec; +wxChar wxTime::ms_bufTime[128]; #endif IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject) diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index e0285c9db1..13a2fd3521 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -33,6 +33,8 @@ // the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path here #if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) #include "../zlib/zlib.h" +#elif defined(__WXMAC__) && defined(__UNIX__) + #include #else #include #endif diff --git a/src/generic/tipwin.cpp b/src/generic/tipwin.cpp index 26f83781ba..2520a1b2a8 100644 --- a/src/generic/tipwin.cpp +++ b/src/generic/tipwin.cpp @@ -72,7 +72,7 @@ wxTipWindow::wxTipWindow(wxWindow *parent, { // set colours SetForegroundColour(*wxBLACK); -#if !defined(__WXPM__) +#if !defined(__WXPM__) && !defined(__WXMAC__) SetBackgroundColour(wxColour(0xc3ffff)); #else // What is 0xc3ffff, try some legable documentation for those of us who don't memorize hex codes?? diff --git a/src/jpeg/makemac.mcp b/src/jpeg/makemac.mcp index 3b1244db1b..252275147e 100644 Binary files a/src/jpeg/makemac.mcp and b/src/jpeg/makemac.mcp differ diff --git a/src/mac/aga.cpp b/src/mac/aga.cpp index 5808402832..0185303bd1 100644 --- a/src/mac/aga.cpp +++ b/src/mac/aga.cpp @@ -1,5 +1,5 @@ -#include -#include +#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 ) ; diff --git a/src/mac/app.cpp b/src/mac/app.cpp index d904e133cb..e238e4f740 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -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 + #endif #endif #include "apprsrc.h" -#include -#include +#include "wx/mac/uma.h" +#include "wx/mac/macnotfy.h" #if wxUSE_SOCKETS -#include -#include + #ifdef __APPLE__ + #include + #else + #include + #include + #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 ) , ¤tMouseWindow ) ; + wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , + ¤tMouseWindow ) ; if ( currentMouseWindow != wxWindow::s_lastMouseWindow ) { diff --git a/src/mac/bitmap.cpp b/src/mac/bitmap.cpp index 65eb2eeb50..5c1aec6c5f 100644 --- a/src/mac/bitmap.cpp +++ b/src/mac/bitmap.cpp @@ -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 +#ifdef __UNIX__ + #include +#else + #include +#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 ) diff --git a/src/mac/button.cpp b/src/mac/button.cpp index 47f66425e2..72e1af8e5d 100644 --- a/src/mac/button.cpp +++ b/src/mac/button.cpp @@ -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 diff --git a/src/mac/carbon/aga.cpp b/src/mac/carbon/aga.cpp index 5808402832..0185303bd1 100644 --- a/src/mac/carbon/aga.cpp +++ b/src/mac/carbon/aga.cpp @@ -1,5 +1,5 @@ -#include -#include +#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 ) ; diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index d904e133cb..e238e4f740 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -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 + #endif #endif #include "apprsrc.h" -#include -#include +#include "wx/mac/uma.h" +#include "wx/mac/macnotfy.h" #if wxUSE_SOCKETS -#include -#include + #ifdef __APPLE__ + #include + #else + #include + #include + #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 ) , ¤tMouseWindow ) ; + wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , + ¤tMouseWindow ) ; if ( currentMouseWindow != wxWindow::s_lastMouseWindow ) { diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 65eb2eeb50..5c1aec6c5f 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -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 +#ifdef __UNIX__ + #include +#else + #include +#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 ) diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 47f66425e2..72e1af8e5d 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -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 diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index 2b1cf2daae..6c8444fc8a 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -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) ; diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 1689c15490..a2841c7996 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -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 diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index ab62f4034d..3e5679a826 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -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() diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index fe13b3f6b2..cbce6e301a 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -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) diff --git a/src/mac/carbon/dcclient.cpp b/src/mac/carbon/dcclient.cpp index 6f3a6b3517..92cb39201b 100644 --- a/src/mac/carbon/dcclient.cpp +++ b/src/mac/carbon/dcclient.cpp @@ -16,6 +16,7 @@ #include "wx/dcclient.h" #include "wx/dcmemory.h" #include "wx/region.h" +#include "wx/window.h" #include //----------------------------------------------------------------------------- @@ -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() ; diff --git a/src/mac/carbon/dcprint.cpp b/src/mac/carbon/dcprint.cpp index b21fe548a2..9b9fee2e97 100644 --- a/src/mac/carbon/dcprint.cpp +++ b/src/mac/carbon/dcprint.cpp @@ -24,10 +24,10 @@ #endif #include "wx/dcprint.h" -#include "math.h" +#include "wx/msgdlg.h" +#include #include "wx/mac/uma.h" - #if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxPrinterDC, wxDC) #endif diff --git a/src/mac/carbon/dir.cpp b/src/mac/carbon/dir.cpp index f0b6664010..e37f079382 100644 --- a/src/mac/carbon/dir.cpp +++ b/src/mac/carbon/dir.cpp @@ -36,14 +36,15 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxPathExists() -#include +#ifndef __WXMAC_X__ + #include +#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 ; diff --git a/src/mac/carbon/dirdlg.cpp b/src/mac/carbon/dirdlg.cpp index 51f4df142e..e1255db7e1 100644 --- a/src/mac/carbon/dirdlg.cpp +++ b/src/mac/carbon/dirdlg.cpp @@ -20,7 +20,11 @@ #include "wx/cmndata.h" -#include "Navigation.h" +#if defined(__UNIX__) + #include +#else + #include +#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 ; diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index cebcd3aab0..aa19db3d01 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -133,4 +133,4 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) return wxDragError; }; -#endif \ No newline at end of file +#endif diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index dc4f90e22c..118ec1a6a8 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -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 +#else + #include +#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 ) { diff --git a/src/mac/carbon/font.cpp b/src/mac/carbon/font.cpp index 79d93657fb..d425b3cf95 100644 --- a/src/mac/carbon/font.cpp +++ b/src/mac/carbon/font.cpp @@ -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); } } diff --git a/src/mac/carbon/fontenum.cpp b/src/mac/carbon/fontenum.cpp index f06fd5baaa..14491d79e9 100644 --- a/src/mac/carbon/fontenum.cpp +++ b/src/mac/carbon/fontenum.cpp @@ -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 ) ; } diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index 2a4ee0b968..16aee93377 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -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" diff --git a/src/mac/carbon/gsocket.c b/src/mac/carbon/gsocket.c index 5b36717505..9a6a0596b1 100644 --- a/src/mac/carbon/gsocket.c +++ b/src/mac/carbon/gsocket.c @@ -19,6 +19,27 @@ #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) +#define OTUNIXERRORS 1 +#ifdef __UNIX__ + #include + #include + #include + + #ifndef FALSE + #define FALSE 0 + #endif + #ifndef TRUE + #define TRUE 1 + #endif +#else + #include + #include + #include +#endif +#if TARGET_CARBON + #define OTAssert( str , cond ) /* does not exists in Carbon */ +#endif + #include #include #include @@ -27,13 +48,6 @@ #include #include #include -#define OTUNIXERRORS 1 -#include -#include -#include -#if TARGET_CARBON - #define OTAssert( str , cond ) /* does not exists in Carbon */ -#endif #include /* @@ -68,7 +82,9 @@ void wxCYield() ; #define qDebug2 1 extern pascal void OTDebugStr(const char* str); #endif -#include +#ifndef __UNIX__ + #include +#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__) */ diff --git a/src/mac/carbon/icon.cpp b/src/mac/carbon/icon.cpp index 4ec1f1b5e9..7f666da534 100644 --- a/src/mac/carbon/icon.cpp +++ b/src/mac/carbon/icon.cpp @@ -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 ; -} \ No newline at end of file +} diff --git a/src/mac/carbon/imaglist.cpp b/src/mac/carbon/imaglist.cpp index 4cb47b4e69..4b8ffc372e 100644 --- a/src/mac/carbon/imaglist.cpp +++ b/src/mac/carbon/imaglist.cpp @@ -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 //////////////////////////////////////////////////////////////////////////// diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 03ae6e0572..1ed703e186 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -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 ) ; } diff --git a/src/mac/carbon/macnotfy.cpp b/src/mac/carbon/macnotfy.cpp index a260697da0..db406cdc63 100644 --- a/src/mac/carbon/macnotfy.cpp +++ b/src/mac/carbon/macnotfy.cpp @@ -7,6 +7,7 @@ * ------------------------------------------------------------------------- */ +#include "wx/wx.h" #include "wx/mac/macnotfy.h" const short kMaxEvents = 1000 ; diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index 099f196f34..9d308de120 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -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 ) ) diff --git a/src/mac/carbon/menuitem.cpp b/src/mac/carbon/menuitem.cpp index 5ffdf54955..6db2d12561 100644 --- a/src/mac/carbon/menuitem.cpp +++ b/src/mac/carbon/menuitem.cpp @@ -13,6 +13,7 @@ // headers & declarations // ============================================================================ +#include "wx/app.h" #include "wx/menu.h" #include "wx/menuitem.h" diff --git a/src/mac/carbon/msgdlg.cpp b/src/mac/carbon/msgdlg.cpp index bbdea6abf8..064d9bbba6 100644 --- a/src/mac/carbon/msgdlg.cpp +++ b/src/mac/carbon/msgdlg.cpp @@ -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" ) ; diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index d2e9660896..ca975252fe 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -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 ); diff --git a/src/mac/carbon/notebook.cpp b/src/mac/carbon/notebook.cpp index 3cb269c3cc..862bbb205c 100644 --- a/src/mac/carbon/notebook.cpp +++ b/src/mac/carbon/notebook.cpp @@ -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 ); diff --git a/src/mac/carbon/pnghand.cpp b/src/mac/carbon/pnghand.cpp index 8d6d6544f5..6134439271 100644 --- a/src/mac/carbon/pnghand.cpp +++ b/src/mac/carbon/pnghand.cpp @@ -31,11 +31,14 @@ # include #endif -#include -#include -#include -#include -#include +#ifndef __WXMAC_X__ +# include +#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 ; diff --git a/src/mac/carbon/printdlg.cpp b/src/mac/carbon/printdlg.cpp index a5c41e0737..88f6d70b58 100644 --- a/src/mac/carbon/printdlg.cpp +++ b/src/mac/carbon/printdlg.cpp @@ -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 ; } diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index 1f74fae6d2..877ba66899 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -18,7 +18,8 @@ #endif #include "wx/radiobox.h" -#include +#include "wx/radiobut.h" +#include "wx/mac/uma.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) diff --git a/src/mac/carbon/settings.cpp b/src/mac/carbon/settings.cpp index b13b5733cc..fc3943c02b 100644 --- a/src/mac/carbon/settings.cpp +++ b/src/mac/carbon/settings.cpp @@ -14,6 +14,7 @@ #endif #include "wx/settings.h" +#include "wx/gdicmn.h" wxColour wxSystemSettings::GetSystemColour(int index) { diff --git a/src/mac/carbon/slider.cpp b/src/mac/carbon/slider.cpp index 936ccddb47..05b29b696a 100644 --- a/src/mac/carbon/slider.cpp +++ b/src/mac/carbon/slider.cpp @@ -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 diff --git a/src/mac/carbon/spinbutt.cpp b/src/mac/carbon/spinbutt.cpp index f5ac7bc9bb..fc9954f9e5 100644 --- a/src/mac/carbon/spinbutt.cpp +++ b/src/mac/carbon/spinbutt.cpp @@ -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 ) { diff --git a/src/mac/carbon/statbmp.cpp b/src/mac/carbon/statbmp.cpp index fa75e68fd5..47aa296e1c 100644 --- a/src/mac/carbon/statbmp.cpp +++ b/src/mac/carbon/statbmp.cpp @@ -14,6 +14,7 @@ #endif #include "wx/statbmp.h" +#include "wx/dcclient.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) diff --git a/src/mac/carbon/statbrma.cpp b/src/mac/carbon/statbrma.cpp index d3c0e102dd..a73cfcaecf 100644 --- a/src/mac/carbon/statbrma.cpp +++ b/src/mac/carbon/statbrma.cpp @@ -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 -} \ No newline at end of file +} diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index 06d6fe9c3c..5ce406a67a 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -15,6 +15,8 @@ #include "wx/app.h" #include "wx/stattext.h" +#include "wx/dc.h" +#include "wx/dcclient.h" #include diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index dd35860824..811f5d86f4 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -13,27 +13,26 @@ #pragma implementation "textctrl.h" #endif -#ifndef __WXMAC__ -#include -#include +#ifdef __UNIX__ + #include + #include #else -#include + #include #endif #include +#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 -#else -#ifndef __MWERKS__ -#ifndef __GNUWIN32__ -#include -#endif -#endif + #include +#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__WXMAC_X__) + #include #endif #include "wx/mac/uma.h" diff --git a/src/mac/carbon/timer.cpp b/src/mac/carbon/timer.cpp index 4135235791..a958d21f1f 100644 --- a/src/mac/carbon/timer.cpp +++ b/src/mac/carbon/timer.cpp @@ -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; diff --git a/src/mac/carbon/tooltip.cpp b/src/mac/carbon/tooltip.cpp index 583bd9b892..ada78751e7 100644 --- a/src/mac/carbon/tooltip.cpp +++ b/src/mac/carbon/tooltip.cpp @@ -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" diff --git a/src/mac/carbon/treectrl.cpp b/src/mac/carbon/treectrl.cpp index 137a885dbf..67ccc4f022 100644 --- a/src/mac/carbon/treectrl.cpp +++ b/src/mac/carbon/treectrl.cpp @@ -14,6 +14,7 @@ #endif #include "wx/stubs/textctrl.h" +#include "wx/treebase.h" #include "wx/stubs/treectrl.h" #if !USE_SHARED_LIBRARY diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index f95b4c52bd..6eea3bd062 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -1,8 +1,12 @@ -#include -#include +#include "wx/defs.h" +#include "wx/mac/uma.h" +#include "wx/mac/aga.h" - -#include "Navigation.h" +#ifdef __UNIX__ + #include +#else + #include +#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 } diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 6d4fa1b5da..5d1e9faf41 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -27,6 +27,9 @@ #include #include +#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) diff --git a/src/mac/carbon/wave.cpp b/src/mac/carbon/wave.cpp index 5df346f825..ac2dcac7e0 100644 --- a/src/mac/carbon/wave.cpp +++ b/src/mac/carbon/wave.cpp @@ -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); } diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 9d98f35302..6c4f516f71 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -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 ; diff --git a/src/mac/cdef/extcdef.mcp b/src/mac/cdef/extcdef.mcp index be38f065b4..94663fa379 100644 Binary files a/src/mac/cdef/extcdef.mcp and b/src/mac/cdef/extcdef.mcp differ diff --git a/src/mac/choice.cpp b/src/mac/choice.cpp index 2b1cf2daae..6c8444fc8a 100644 --- a/src/mac/choice.cpp +++ b/src/mac/choice.cpp @@ -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) ; diff --git a/src/mac/combobox.cpp b/src/mac/combobox.cpp index 1689c15490..a2841c7996 100644 --- a/src/mac/combobox.cpp +++ b/src/mac/combobox.cpp @@ -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 diff --git a/src/mac/control.cpp b/src/mac/control.cpp index ab62f4034d..3e5679a826 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -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() diff --git a/src/mac/dc.cpp b/src/mac/dc.cpp index fe13b3f6b2..cbce6e301a 100644 --- a/src/mac/dc.cpp +++ b/src/mac/dc.cpp @@ -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) diff --git a/src/mac/dcclient.cpp b/src/mac/dcclient.cpp index 6f3a6b3517..92cb39201b 100644 --- a/src/mac/dcclient.cpp +++ b/src/mac/dcclient.cpp @@ -16,6 +16,7 @@ #include "wx/dcclient.h" #include "wx/dcmemory.h" #include "wx/region.h" +#include "wx/window.h" #include //----------------------------------------------------------------------------- @@ -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() ; diff --git a/src/mac/dcprint.cpp b/src/mac/dcprint.cpp index b21fe548a2..9b9fee2e97 100644 --- a/src/mac/dcprint.cpp +++ b/src/mac/dcprint.cpp @@ -24,10 +24,10 @@ #endif #include "wx/dcprint.h" -#include "math.h" +#include "wx/msgdlg.h" +#include #include "wx/mac/uma.h" - #if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxPrinterDC, wxDC) #endif diff --git a/src/mac/dir.cpp b/src/mac/dir.cpp index f0b6664010..e37f079382 100644 --- a/src/mac/dir.cpp +++ b/src/mac/dir.cpp @@ -36,14 +36,15 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxPathExists() -#include +#ifndef __WXMAC_X__ + #include +#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 ; diff --git a/src/mac/dirdlg.cpp b/src/mac/dirdlg.cpp index 51f4df142e..e1255db7e1 100644 --- a/src/mac/dirdlg.cpp +++ b/src/mac/dirdlg.cpp @@ -20,7 +20,11 @@ #include "wx/cmndata.h" -#include "Navigation.h" +#if defined(__UNIX__) + #include +#else + #include +#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 ; diff --git a/src/mac/dnd.cpp b/src/mac/dnd.cpp index cebcd3aab0..aa19db3d01 100644 --- a/src/mac/dnd.cpp +++ b/src/mac/dnd.cpp @@ -133,4 +133,4 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) return wxDragError; }; -#endif \ No newline at end of file +#endif diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index dc4f90e22c..118ec1a6a8 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -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 +#else + #include +#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 ) { diff --git a/src/mac/font.cpp b/src/mac/font.cpp index 79d93657fb..d425b3cf95 100644 --- a/src/mac/font.cpp +++ b/src/mac/font.cpp @@ -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); } } diff --git a/src/mac/fontenum.cpp b/src/mac/fontenum.cpp index f06fd5baaa..14491d79e9 100644 --- a/src/mac/fontenum.cpp +++ b/src/mac/fontenum.cpp @@ -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 ) ; } diff --git a/src/mac/frame.cpp b/src/mac/frame.cpp index 2a4ee0b968..16aee93377 100644 --- a/src/mac/frame.cpp +++ b/src/mac/frame.cpp @@ -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" diff --git a/src/mac/gsocket.c b/src/mac/gsocket.c index 5b36717505..9a6a0596b1 100644 --- a/src/mac/gsocket.c +++ b/src/mac/gsocket.c @@ -19,6 +19,27 @@ #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) +#define OTUNIXERRORS 1 +#ifdef __UNIX__ + #include + #include + #include + + #ifndef FALSE + #define FALSE 0 + #endif + #ifndef TRUE + #define TRUE 1 + #endif +#else + #include + #include + #include +#endif +#if TARGET_CARBON + #define OTAssert( str , cond ) /* does not exists in Carbon */ +#endif + #include #include #include @@ -27,13 +48,6 @@ #include #include #include -#define OTUNIXERRORS 1 -#include -#include -#include -#if TARGET_CARBON - #define OTAssert( str , cond ) /* does not exists in Carbon */ -#endif #include /* @@ -68,7 +82,9 @@ void wxCYield() ; #define qDebug2 1 extern pascal void OTDebugStr(const char* str); #endif -#include +#ifndef __UNIX__ + #include +#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__) */ diff --git a/src/mac/icon.cpp b/src/mac/icon.cpp index 4ec1f1b5e9..7f666da534 100644 --- a/src/mac/icon.cpp +++ b/src/mac/icon.cpp @@ -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 ; -} \ No newline at end of file +} diff --git a/src/mac/imaglist.cpp b/src/mac/imaglist.cpp index 4cb47b4e69..4b8ffc372e 100644 --- a/src/mac/imaglist.cpp +++ b/src/mac/imaglist.cpp @@ -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 //////////////////////////////////////////////////////////////////////////// diff --git a/src/mac/ldef/extldef.h b/src/mac/ldef/extldef.h index 8daa77eb88..a583d872c0 100644 --- a/src/mac/ldef/extldef.h +++ b/src/mac/ldef/extldef.h @@ -1,6 +1,10 @@ #pragma once -#include +#if defined(__UNIX__) + #include +#else + #include +#endif #include #define kExtLDEFID 128 // resource id of our LDEF resource diff --git a/src/mac/ldef/extldef.mcp b/src/mac/ldef/extldef.mcp index b8973350a8..c3b002d3c2 100644 Binary files a/src/mac/ldef/extldef.mcp and b/src/mac/ldef/extldef.mcp differ diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index 03ae6e0572..1ed703e186 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -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 ) ; } diff --git a/src/mac/macnotfy.cpp b/src/mac/macnotfy.cpp index a260697da0..db406cdc63 100644 --- a/src/mac/macnotfy.cpp +++ b/src/mac/macnotfy.cpp @@ -7,6 +7,7 @@ * ------------------------------------------------------------------------- */ +#include "wx/wx.h" #include "wx/mac/macnotfy.h" const short kMaxEvents = 1000 ; diff --git a/src/mac/menu.cpp b/src/mac/menu.cpp index 099f196f34..9d308de120 100644 --- a/src/mac/menu.cpp +++ b/src/mac/menu.cpp @@ -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 ) ) diff --git a/src/mac/menuitem.cpp b/src/mac/menuitem.cpp index 5ffdf54955..6db2d12561 100644 --- a/src/mac/menuitem.cpp +++ b/src/mac/menuitem.cpp @@ -13,6 +13,7 @@ // headers & declarations // ============================================================================ +#include "wx/app.h" #include "wx/menu.h" #include "wx/menuitem.h" diff --git a/src/mac/msgdlg.cpp b/src/mac/msgdlg.cpp index bbdea6abf8..064d9bbba6 100644 --- a/src/mac/msgdlg.cpp +++ b/src/mac/msgdlg.cpp @@ -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" ) ; diff --git a/src/mac/notebmac.cpp b/src/mac/notebmac.cpp index d2e9660896..ca975252fe 100644 --- a/src/mac/notebmac.cpp +++ b/src/mac/notebmac.cpp @@ -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 ); diff --git a/src/mac/notebook.cpp b/src/mac/notebook.cpp index 3cb269c3cc..862bbb205c 100644 --- a/src/mac/notebook.cpp +++ b/src/mac/notebook.cpp @@ -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 ); diff --git a/src/mac/pnghand.cpp b/src/mac/pnghand.cpp index 8d6d6544f5..6134439271 100644 --- a/src/mac/pnghand.cpp +++ b/src/mac/pnghand.cpp @@ -31,11 +31,14 @@ # include #endif -#include -#include -#include -#include -#include +#ifndef __WXMAC_X__ +# include +#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 ; diff --git a/src/mac/printdlg.cpp b/src/mac/printdlg.cpp index a5c41e0737..88f6d70b58 100644 --- a/src/mac/printdlg.cpp +++ b/src/mac/printdlg.cpp @@ -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 ; } diff --git a/src/mac/radiobox.cpp b/src/mac/radiobox.cpp index 1f74fae6d2..877ba66899 100644 --- a/src/mac/radiobox.cpp +++ b/src/mac/radiobox.cpp @@ -18,7 +18,8 @@ #endif #include "wx/radiobox.h" -#include +#include "wx/radiobut.h" +#include "wx/mac/uma.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) diff --git a/src/mac/settings.cpp b/src/mac/settings.cpp index b13b5733cc..fc3943c02b 100644 --- a/src/mac/settings.cpp +++ b/src/mac/settings.cpp @@ -14,6 +14,7 @@ #endif #include "wx/settings.h" +#include "wx/gdicmn.h" wxColour wxSystemSettings::GetSystemColour(int index) { diff --git a/src/mac/slider.cpp b/src/mac/slider.cpp index 936ccddb47..05b29b696a 100644 --- a/src/mac/slider.cpp +++ b/src/mac/slider.cpp @@ -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 diff --git a/src/mac/spinbutt.cpp b/src/mac/spinbutt.cpp index f5ac7bc9bb..fc9954f9e5 100644 --- a/src/mac/spinbutt.cpp +++ b/src/mac/spinbutt.cpp @@ -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 ) { diff --git a/src/mac/statbmp.cpp b/src/mac/statbmp.cpp index fa75e68fd5..47aa296e1c 100644 --- a/src/mac/statbmp.cpp +++ b/src/mac/statbmp.cpp @@ -14,6 +14,7 @@ #endif #include "wx/statbmp.h" +#include "wx/dcclient.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) diff --git a/src/mac/statbrma.cpp b/src/mac/statbrma.cpp index d3c0e102dd..a73cfcaecf 100644 --- a/src/mac/statbrma.cpp +++ b/src/mac/statbrma.cpp @@ -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 -} \ No newline at end of file +} diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 06d6fe9c3c..5ce406a67a 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -15,6 +15,8 @@ #include "wx/app.h" #include "wx/stattext.h" +#include "wx/dc.h" +#include "wx/dcclient.h" #include diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index dd35860824..811f5d86f4 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -13,27 +13,26 @@ #pragma implementation "textctrl.h" #endif -#ifndef __WXMAC__ -#include -#include +#ifdef __UNIX__ + #include + #include #else -#include + #include #endif #include +#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 -#else -#ifndef __MWERKS__ -#ifndef __GNUWIN32__ -#include -#endif -#endif + #include +#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__WXMAC_X__) + #include #endif #include "wx/mac/uma.h" diff --git a/src/mac/timer.cpp b/src/mac/timer.cpp index 4135235791..a958d21f1f 100644 --- a/src/mac/timer.cpp +++ b/src/mac/timer.cpp @@ -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; diff --git a/src/mac/tooltip.cpp b/src/mac/tooltip.cpp index 583bd9b892..ada78751e7 100644 --- a/src/mac/tooltip.cpp +++ b/src/mac/tooltip.cpp @@ -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" diff --git a/src/mac/treectrl.cpp b/src/mac/treectrl.cpp index 137a885dbf..67ccc4f022 100644 --- a/src/mac/treectrl.cpp +++ b/src/mac/treectrl.cpp @@ -14,6 +14,7 @@ #endif #include "wx/stubs/textctrl.h" +#include "wx/treebase.h" #include "wx/stubs/treectrl.h" #if !USE_SHARED_LIBRARY diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp index f95b4c52bd..6eea3bd062 100644 --- a/src/mac/uma.cpp +++ b/src/mac/uma.cpp @@ -1,8 +1,12 @@ -#include -#include +#include "wx/defs.h" +#include "wx/mac/uma.h" +#include "wx/mac/aga.h" - -#include "Navigation.h" +#ifdef __UNIX__ + #include +#else + #include +#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 } diff --git a/src/mac/utils.cpp b/src/mac/utils.cpp index 6d4fa1b5da..5d1e9faf41 100644 --- a/src/mac/utils.cpp +++ b/src/mac/utils.cpp @@ -27,6 +27,9 @@ #include #include +#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) diff --git a/src/mac/wave.cpp b/src/mac/wave.cpp index 5df346f825..ac2dcac7e0 100644 --- a/src/mac/wave.cpp +++ b/src/mac/wave.cpp @@ -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); } diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 9d98f35302..6c4f516f71 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -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 ; diff --git a/src/makemac.mcp b/src/makemac.mcp index 06b11d6021..856007af01 100644 Binary files a/src/makemac.mcp and b/src/makemac.mcp differ diff --git a/src/png/makemac.mcp b/src/png/makemac.mcp index 83009b1647..5d841bccfc 100644 Binary files a/src/png/makemac.mcp and b/src/png/makemac.mcp differ diff --git a/src/tiff/makemac.mcp b/src/tiff/makemac.mcp index 6b7f2ef158..54d532698a 100644 Binary files a/src/tiff/makemac.mcp and b/src/tiff/makemac.mcp differ diff --git a/src/zlib/makemac.mcp b/src/zlib/makemac.mcp index 576ae208bc..99a1766456 100644 Binary files a/src/zlib/makemac.mcp and b/src/zlib/makemac.mcp differ