From 7c74e7fe1de14f32dcd6f3c9cdd727de540bbd0e Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 11 Nov 1999 16:11:14 +0000 Subject: [PATCH] wxMac completed so far, generic listctrl extension git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/confbase.h | 1 + include/wx/dataobj.h | 2 + include/wx/defs.h | 51 +++++++- include/wx/fileconf.h | 2 + include/wx/generic/listctrl.h | 3 +- include/wx/mac/font.h | 4 +- include/wx/mac/frame.h | 2 +- include/wx/mac/mdi.h | 2 +- include/wx/mac/setup.h | 4 +- include/wx/mac/window.h | 2 + include/wx/object.h | 3 +- include/wx/os2/dataobj2.h | 10 +- include/wx/string.h | 2 +- samples/forty/card.cpp | 2 +- src/common/cmndata.cpp | 19 ++- src/common/config.cpp | 5 + src/common/ffile.cpp | 8 ++ src/common/file.cpp | 41 ++++-- src/common/fileconf.cpp | 43 +++++- src/common/filefn.cpp | 93 ++++++++++++- src/common/image.cpp | 237 ++++++++++++++++++++++++++++++++++ src/common/mimetype.cpp | 168 ++++++++++++++++++++++++ src/common/object.cpp | 2 +- src/common/resourc2.cpp | 4 + src/common/resource.cpp | 4 + src/common/unzip.c | 48 +++++++ src/common/wincmn.cpp | 5 +- src/generic/listctrl.cpp | 72 ++++++++++- src/generic/progdlgg.cpp | 6 + src/generic/scrolwin.cpp | 11 +- src/generic/statusbr.cpp | 5 +- src/mac/button.cpp | 8 ++ src/mac/carbon/button.cpp | 8 ++ src/mac/carbon/clipbrd.cpp | 45 +++---- src/mac/carbon/dc.cpp | 2 +- src/mac/carbon/dcclient.cpp | 5 +- src/mac/carbon/dialog.cpp | 7 + src/mac/carbon/frame.cpp | 4 +- src/mac/carbon/listbox.cpp | 4 +- src/mac/carbon/mdi.cpp | 4 +- src/mac/carbon/scrolbar.cpp | 9 +- src/mac/carbon/window.cpp | 68 ++++++++-- src/mac/clipbrd.cpp | 45 +++---- src/mac/dc.cpp | 2 +- src/mac/dcclient.cpp | 5 +- src/mac/dialog.cpp | 7 + src/mac/frame.cpp | 4 +- src/mac/listbox.cpp | 4 +- src/mac/mdi.cpp | 4 +- src/mac/scrolbar.cpp | 9 +- src/mac/window.cpp | 68 ++++++++-- 51 files changed, 1049 insertions(+), 124 deletions(-) diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 763235df8a..46336d3d65 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -186,6 +186,7 @@ public: // Convenience functions virtual bool Write(const wxString& key, double value); virtual bool Write(const wxString& key, bool value); + virtual bool Write(const wxString& key, const wxChar *text ) ; // permanently writes all changes virtual bool Flush(bool bCurrentOnly = FALSE) = 0; diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index f12dbe67d6..5d80b6f16e 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -446,6 +446,8 @@ private: // #include "wx/motif/dataobj2.h" -- not yet #elif defined(__WXGTK__) #include "wx/gtk/dataobj2.h" +#elif defined(__WXMAC__) + #include "wx/mac/dataobj2.h" #elif defined(__WXPM__) #include "wx/os2/dataobj2.h" #endif diff --git a/include/wx/defs.h b/include/wx/defs.h index 8a546d325d..f567f81f72 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -586,6 +586,25 @@ enum #define wxByte wxUint8 #define wxWord wxUint16 +// base floating point types +// wxFloat32 : 32 bit IEEE float ( 1 sign , 8 exponent bits , 23 fraction bits +// wxFloat64 : 64 bit IEEE float ( 1 sign , 11 exponent bits , 52 fraction bits +// wxDouble : native fastest representation that has at least wxFloat64 +// precision, so use the IEEE types for storage , and this for calculations + +typedef float wxFloat32 ; +#if defined( __WXMAC__ ) && defined (__MWERKS__) + typedef short double wxFloat64; +#else + typedef double wxFloat64; +#endif + +#if defined( __WXMAC__ ) && !defined( __POWERPC__ ) + typedef long double wxDouble; +#else + typedef double wxDouble ; +#endif + // ---------------------------------------------------------------------------- // byte ordering related definition and macros // ---------------------------------------------------------------------------- @@ -604,6 +623,36 @@ enum // byte swapping +#if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh ) +// assembler versions for these +#ifdef __POWERPC__ + inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i ) + {return (__lhbrx( &i , 0 ) ) ;} + inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i ) + {return (__lhbrx( &i , 0 ) ) ;} + inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i ) + {return (__lwbrx( &i , 0 ) ) ;} + inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i ) + {return (__lwbrx( &i , 0 ) ) ;} +#else + #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0) + pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value) + = { 0xE158 }; + + #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) + pascal wxInt16 wxUINT16_SWAP_ALWAYS(wxInt16 value) + = { 0xE158 }; + + #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) + pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value) + = { 0xE158, 0x4840, 0xE158 }; + + #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) + pascal wxInt32 wxUINT32_SWAP_ALWAYS(wxInt32 value) + = { 0xE158, 0x4840, 0xE158 }; + +#endif +#else // !MWERKS #define wxUINT16_SWAP_ALWAYS(val) \ ((wxUint16) ( \ (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ @@ -627,7 +676,7 @@ enum (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) - +#endif // machine specific byte swapping #ifdef WORDS_BIGENDIAN diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h index 42da068138..779dc8d4fa 100644 --- a/include/wx/fileconf.h +++ b/include/wx/fileconf.h @@ -194,6 +194,8 @@ public: { return wxConfigBase::Write(key, value); } bool Write(const wxString& key, bool value) { return wxConfigBase::Write(key, value); } + bool Write(const wxString& key, const wxChar* value) + { return wxConfigBase::Write(key, value); } virtual bool Flush(bool bCurrentOnly = FALSE); diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 48418b1dc9..6d6c2a81c1 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -456,7 +456,8 @@ class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow void OnSetFocus( wxFocusEvent &event ); void OnKillFocus( wxFocusEvent &event ); void OnSize( wxSizeEvent &event ); - + void OnScroll(wxScrollWinEvent& event) ; + void DrawImage( int index, wxDC *dc, int x, int y ); void GetImageSize( int index, int &width, int &height ); int GetIndexOfLine( const wxListLineData *line ); diff --git a/include/wx/mac/font.h b/include/wx/mac/font.h index fb985307b7..6b41fc9c61 100644 --- a/include/wx/mac/font.h +++ b/include/wx/mac/font.h @@ -22,8 +22,8 @@ class WXDLLEXPORT wxFontRefData: public wxGDIRefData public: wxFontRefData() { - Init(12, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE, - "", wxFONTENCODING_DEFAULT); + Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE, + "Geneva", wxFONTENCODING_DEFAULT); } wxFontRefData(const wxFontRefData& data) diff --git a/include/wx/mac/frame.h b/include/wx/mac/frame.h index 5feb46e42f..3d6a52941d 100644 --- a/include/wx/mac/frame.h +++ b/include/wx/mac/frame.h @@ -131,7 +131,7 @@ public: // Checks if there is a toolbar, and returns the first free client position virtual wxPoint GetClientAreaOrigin() const; - virtual void GetClientSize(int *x, int *y) const ; + virtual void DoGetClientSize(int *x, int *y) const ; virtual void DoSetClientSize(int clientwidth, int clientheight) ; // tooltip management diff --git a/include/wx/mac/mdi.h b/include/wx/mac/mdi.h index fc3cf94603..93038739f8 100644 --- a/include/wx/mac/mdi.h +++ b/include/wx/mac/mdi.h @@ -64,7 +64,7 @@ public: // Gets the size available for subwindows after menu size, toolbar size // and status bar size have been subtracted. If you want to manage your own // toolbar(s), don't call SetToolBar. - void GetClientSize(int *width, int *height) const; + void DoGetClientSize(int *width, int *height) const; // Get the active MDI child window (Windows only) wxMDIChildFrame *GetActiveChild() const ; diff --git a/include/wx/mac/setup.h b/include/wx/mac/setup.h index 569e0ee255..0a1df37e9a 100644 --- a/include/wx/mac/setup.h +++ b/include/wx/mac/setup.h @@ -17,6 +17,8 @@ * */ +#define WORDS_BIGENDIAN 1 + #define wxUSE_CONFIG 1 // Use wxConfig, with CreateConfig in wxApp @@ -138,7 +140,7 @@ // since you may well need to output // an error log in a production // version (or non-debugging beta) -#define wxUSE_GLOBAL_MEMORY_OPERATORS 1 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 // In debug mode, cause new and delete to be redefined globally. // If this causes problems (e.g. link errors), set this to 0. diff --git a/include/wx/mac/window.h b/include/wx/mac/window.h index 66eba027a2..3eac7270ce 100644 --- a/include/wx/mac/window.h +++ b/include/wx/mac/window.h @@ -180,6 +180,7 @@ public: // -------------- void OnEraseBackground(wxEraseEvent& event); void OnIdle(wxIdleEvent& event); + void MacOnScroll(wxScrollEvent&event ) ; public: // For implementation purposes - sometimes decorations make the client area @@ -251,6 +252,7 @@ public : virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin) ; MacWindowData* MacGetWindowData() { return m_macWindowData ; } static WindowRef MacGetWindowInUpdate() { return s_macWindowInUpdate ; } + bool MacIsWindowScrollbar( const wxScrollBar* sb ) { return (m_hScrollBar == sb || m_vScrollBar == sb) ; } static wxWindow* s_lastMouseWindow ; private: virtual bool MacGetWindowFromPointSub( const wxPoint &point , wxWindow** outWin ) ; diff --git a/include/wx/object.h b/include/wx/object.h index 0b72a7243a..f444b6786e 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -213,7 +213,8 @@ class WXDLLEXPORT wxObject #endif #ifdef __MWERKS__ - void * operator new[] (size_t size, wxChar * fileName , int lineNum = 0); + void * operator new[] (size_t size, wxChar * fileName , int lineNum = 0); + void * operator new[] (size_t size) { return operator new[] ( size , NULL , 0 ) ; } void operator delete[] (void * buf); #endif diff --git a/include/wx/os2/dataobj2.h b/include/wx/os2/dataobj2.h index a936e226e9..3108a1d37e 100644 --- a/include/wx/os2/dataobj2.h +++ b/include/wx/os2/dataobj2.h @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: os2/dataobj2.h +// Name: mac/dataobj2.h // Purpose: declaration of standard wxDataObjectSimple-derived classes -// Author: David Webster (adapted from Robert Roebling's gtk port +// Author: Stefan Csomor (adapted from Robert Roebling's gtk port // Modified by: // Created: 10/21/99 // RCS-ID: $Id$ @@ -9,8 +9,8 @@ // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// -#ifndef _WX_GTK_DATAOBJ2_H_ -#define _WX_GTK_DATAOBJ2_H_ +#ifndef _WX_MAC_DATAOBJ2_H_ +#define _WX_MAC_DATAOBJ2_H_ #ifdef __GNUG__ #pragma interface "dataobj.h" @@ -86,5 +86,5 @@ private: { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } }; -#endif // _WX_GTK_DATAOBJ2_H_ +#endif // _WX_MAC_DATAOBJ2_H_ diff --git a/include/wx/string.h b/include/wx/string.h index d7cc2549e6..7cd776c85f 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -302,7 +302,7 @@ public: wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN) { InitWith((const char*)psz, 0, nLength); } // from multibyte string - wxString(const char *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN) + wxString(const char *psz, wxMBConv& WXUNUSED(conv) , size_t nLength = wxSTRING_MAXLEN) { InitWith(psz, 0, nLength); } #if wxUSE_WCHAR_T diff --git a/samples/forty/card.cpp b/samples/forty/card.cpp index 37999de3ed..b74fcee834 100644 --- a/samples/forty/card.cpp +++ b/samples/forty/card.cpp @@ -41,7 +41,7 @@ #include "forty.h" #include "card.h" -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) #include "pictures.xpm" #include "symbols.xbm" #endif diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index d6d38e477c..045ff85556 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -203,8 +203,9 @@ wxPrintData::wxPrintData(const wxPrintData& printData) { #ifdef __WXMSW__ m_devMode = NULL; +#elif defined( __WXMAC__ ) + m_macPrintInfo = NULL ; #endif - (*this) = printData; } @@ -692,6 +693,8 @@ wxPrintDialogData::wxPrintDialogData() { #ifdef __WXMSW__ m_printDlgData = NULL; +#elif defined( __WXMAC__ ) + m_macPrintInfo = NULL ; #endif m_printFromPage = 0; m_printToPage = 0; @@ -711,6 +714,11 @@ wxPrintDialogData::wxPrintDialogData() wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData) { +#ifdef __WXMSW__ + m_printDlgData = NULL; +#elif defined( __WXMAC__ ) + m_macPrintInfo = NULL ; +#endif (*this) = dialogData; } @@ -994,6 +1002,11 @@ wxPageSetupDialogData::wxPageSetupDialogData() wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialogData) { +#if defined(__WIN95__) + m_pageSetupData = NULL; +#elif defined( __WXMAC__ ) + m_macPageSetupInfo = NULL ; +#endif (*this) = dialogData; } @@ -1210,7 +1223,7 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win) #endif // Win95 #ifdef __WXMAC__ -void wxPageSetupData::ConvertToNative() +void wxPageSetupDialogData::ConvertToNative() { if ( !m_macPageSetupInfo ) { @@ -1239,7 +1252,7 @@ void wxPageSetupData::ConvertToNative() } } -void wxPageSetupData::ConvertFromNative() +void wxPageSetupDialogData::ConvertFromNative() { if ( m_macPageSetupInfo ) { diff --git a/src/common/config.cpp b/src/common/config.cpp index f93307ed0f..19822e4691 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -196,6 +196,11 @@ bool wxConfigBase::Write(const wxString& key, bool value) return Write(key, l); } +bool wxConfigBase::Write( const wxString &key, const wxChar *text ) +{ + wxString str( text ) ; + return Write( key, str ) ; +} wxString wxConfigBase::ExpandEnvVars(const wxString& str) const { wxString tmp; // Required for BC++ diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index afbd6d14ea..4bca0e0e2e 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -64,12 +64,20 @@ bool wxFFile::Open(const wxChar *filename, const char *mode) tmp_fname = new char[fname_len]; wxWX2MB(tmp_fname, filename, fname_len); +#ifdef __WXMAC__ + m_fp = fopen(wxUnix2MacFilename( tmp_fname ), mode); +#else m_fp = fopen(tmp_fname, mode); +#endif delete tmp_fname; +#else +#ifdef __WXMAC__ + m_fp = fopen(wxUnix2MacFilename( filename ), mode); #else m_fp = fopen(filename, mode); #endif +#endif if ( !m_fp ) diff --git a/src/common/file.cpp b/src/common/file.cpp index 39e03cddf4..89d17ff691 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -141,12 +141,6 @@ #define MAX_PATH 512 #endif -#ifdef __WXMAC__ - char gwxMacFileName[ MAX_PATH ] ; - char gwxMacFileName2[ MAX_PATH ] ; - char gwxMacFileName3[ MAX_PATH ] ; -#endif - // some broken compilers don't have 3rd argument in open() and creat() #ifdef __SALFORDC__ #define ACCESS(access) @@ -168,14 +162,22 @@ bool wxFile::Exists(const wxChar *name) #if wxUSE_UNICODE && wxMBFILES wxCharBuffer fname = wxConvFile.cWC2MB(name); +#ifdef __WXMAC__ + return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG); +#else return !access(fname, 0) && !stat(wxMBSTRINGCAST fname, &st) && (st.st_mode & S_IFREG); +#endif +#else +#ifdef __WXMAC__ + return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG); #else return !access(name, 0) && !stat((wxChar*) name, &st) && (st.st_mode & S_IFREG); #endif +#endif } bool wxFile::Access(const wxChar *name, OpenMode mode) @@ -216,10 +218,13 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode) { // if bOverwrite we create a new file or truncate the existing one, // otherwise we only create the new file and fail if it already exists +#ifdef __WXMAC__ + int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access); +#else int fd = open(wxFNCONV(szFileName), O_WRONLY | O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL) ACCESS(accessMode)); - +#endif if ( fd == -1 ) { wxLogSysError(_("can't create file '%s'"), szFileName); return FALSE; @@ -253,8 +258,11 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) break; } +#ifdef __WXMAC__ + int fd = open(wxUnix2MacFilename( szFileName ), flags, access); +#else int fd = open(wxFNCONV(szFileName), flags ACCESS(accessMode)); - +#endif if ( fd == -1 ) { wxLogSysError(_("can't open file '%s'"), szFileName); return FALSE; @@ -562,6 +570,7 @@ bool wxTempFile::Commit() { m_file.Close(); +#ifndef __WXMAC__ if ( wxFile::Exists(m_strName) && remove(m_strName.fn_str()) != 0 ) { wxLogSysError(_("can't remove file '%s'"), m_strName.c_str()); return FALSE; @@ -571,6 +580,17 @@ bool wxTempFile::Commit() wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str()); return FALSE; } +#else + if ( wxFile::Exists(m_strName) && remove(wxUnix2MacFilename( m_strName )) != 0 ) { + wxLogSysError(_("can't remove file '%s'"), m_strName.c_str()); + return FALSE; + } + + if ( rename(wxUnix2MacFilename( m_strTemp ), wxUnix2MacFilename( m_strName )) != 0 ) { + wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str()); + return FALSE; + } +#endif return TRUE; } @@ -578,8 +598,13 @@ bool wxTempFile::Commit() void wxTempFile::Discard() { m_file.Close(); +#ifndef __WXMAC__ if ( remove(m_strTemp.fn_str()) != 0 ) wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str()); +#else + if ( remove( wxUnix2MacFilename(m_strTemp.fn_str())) != 0 ) + wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str()); +#endif } #endif diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index d26dd662c7..80b528c70e 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -194,7 +194,19 @@ wxString wxFileConfig::GetGlobalDir() #elif defined(__WXSTUBS__) wxASSERT_MSG( FALSE, wxT("TODO") ) ; #elif defined(__WXMAC__) - wxASSERT_MSG( FALSE, wxT("TODO") ) ; + { + short vRefNum ; + long dirID ; + + if ( FindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder, &vRefNum, &dirID) == noErr) + { + FSSpec file ; + if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr ) + { + strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ; + } + } + } #else // Windows wxChar szWinDir[MAX_PATH]; ::GetWindowsDirectory(szWinDir, MAX_PATH); @@ -210,6 +222,7 @@ wxString wxFileConfig::GetLocalDir() { wxString strDir; +#ifndef __WXMAC__ wxGetHomeDir(&strDir); #ifdef __UNIX__ @@ -217,6 +230,10 @@ wxString wxFileConfig::GetLocalDir() #else if (strDir.Last() != wxT('\\')) strDir << wxT('\\'); #endif +#else + // no local dir concept on mac + return GetGlobalDir() ; +#endif return strDir; } @@ -229,6 +246,8 @@ wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile) if ( wxStrchr(szFile, wxT('.')) == NULL ) #ifdef __UNIX__ str << wxT(".conf"); + #elif defined( __WXMAC__ ) + str << " Preferences"; #else // Windows str << wxT(".ini"); #endif // UNIX/Win @@ -251,6 +270,10 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile) str << wxT(".ini"); #endif + + #ifdef __WXMAC__ + str << " Preferences"; + #endif return str; } @@ -749,7 +772,25 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) } } +#ifndef __WXMAC__ return file.Commit(); +#else + bool ret = file.Commit(); + if ( ret ) + { + FSSpec spec ; + + wxUnixFilename2FSSpec( m_strLocalFile , &spec ) ; + FInfo finfo ; + if ( FSpGetFInfo( &spec , &finfo ) == noErr ) + { + finfo.fdType = 'TEXT' ; + finfo.fdCreator = 'ttxt' ; + FSpSetFInfo( &spec , &finfo ) ; + } + } + return ret ; +#endif } // ---------------------------------------------------------------------------- diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 0c2e62e736..eae17729bc 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1337,6 +1337,84 @@ wxString wxFindNextFile() return result; } +#elif defined(__WXMAC__) + +struct MacDirectoryIterator +{ + CInfoPBRec m_CPB ; + wxInt16 m_index ; + long m_dirId ; + Str255 m_name ; +} ; + +static int g_iter_flags ; + +static MacDirectoryIterator g_iter ; + +wxString wxFindFirstFile(const wxChar *spec, int flags) +{ + wxString result; + + g_iter_flags = flags; /* MATTHEW: [5] Remember flags */ + + // Find path only so we can concatenate found file onto path + wxString path(wxPathOnly(spec)); + if ( !path.IsEmpty() ) + result << path << wxT('\\'); + + FSSpec fsspec ; + + wxUnixFilename2FSSpec( result , &fsspec ) ; + g_iter.m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ; + g_iter.m_CPB.hFileInfo.ioNamePtr = g_iter.m_name ; + g_iter.m_index = 0 ; + + Boolean isDir ; + FSpGetDirectoryID( &fsspec , &g_iter.m_dirId , &isDir ) ; + if ( !isDir ) + return wxEmptyString ; + + return wxFindNextFile( ) ; +} + +wxString wxFindNextFile() +{ + wxString result; + + short err = noErr ; + + while ( err == noErr ) + { + g_iter.m_index++ ; + g_iter.m_CPB.dirInfo.ioFDirIndex = g_iter.m_index; + g_iter.m_CPB.dirInfo.ioDrDirID = g_iter.m_dirId; /* we need to do this every time */ + err = PBGetCatInfoSync((CInfoPBPtr)&g_iter.m_CPB); + if ( err != noErr ) + break ; + + if ( ( g_iter.m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (g_iter_flags & wxDIR) ) // we have a directory + break ; + + if ( ( g_iter.m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(g_iter_flags & wxFILE ) ) + continue ; + + // hit ! + break ; + } + if ( err != noErr ) + { + return wxEmptyString ; + } + FSSpec spec ; + + FSMakeFSSpecCompat(g_iter.m_CPB.hFileInfo.ioVRefNum, + g_iter.m_dirId, + g_iter.m_name, + &spec) ; + + return wxMacFSSpec2UnixFilename( &spec ) ; +} + #elif defined(__WXMSW__) #ifdef __WIN32__ @@ -1521,14 +1599,25 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; strcpy( buf , res ) ; - if (0) + if (0) { #else if (getcwd(cbuf, sz) == NULL) { #endif delete [] cbuf; -#else +#else // wxUnicode #ifdef _MSC_VER if (_getcwd(buf, sz) == NULL) { +#elif defined( __WXMAC__) + enum + { + SFSaveDisk = 0x214, CurDirStore = 0x398 + }; + FSSpec cwdSpec ; + + FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; + wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; + strcpy( buf , res ) ; + if (0) { #else if (getcwd(buf, sz) == NULL) { #endif diff --git a/src/common/image.cpp b/src/common/image.cpp index bb9f59afc4..fa17d43fa0 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1034,6 +1034,243 @@ wxImage::wxImage( const wxBitmap &bitmap ) #endif +#ifdef __WXMAC__ + +#include + +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 void wxMacDestroyGWorld( GWorldPtr gw ) ; + +wxBitmap wxImage::ConvertToBitmap() const +{ + // width and height of the device-dependent bitmap + int width = GetWidth(); + int height = GetHeight(); + + // Create picture + + wxBitmap bitmap( width , height , wxDisplayDepth() ) ; + + // Create mask + + if (HasMask()) + { + /* + unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height ); + + mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height ); + + wxMask *mask = new wxMask(); + mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 ); + + bitmap.SetMask( mask ); + */ + } + + // Render + + int r_mask = GetMaskRed(); + int g_mask = GetMaskGreen(); + int b_mask = GetMaskBlue(); + + CGrafPtr origPort ; + GDHandle origDevice ; + + GetGWorld( &origPort , &origDevice ) ; + SetGWorld( bitmap.GetHBITMAP() , NULL ) ; + + register unsigned char* data = GetData(); + + int index = 0; + for (int y = 0; y < height; y++) + { +#if 0 + unsigned char lastr = 0 ; + unsigned char lastg = 0 ; + unsigned char lastb = 0 ; + RGBColor lastcolor ; + + MoveTo( 0 , y ) ; + for (int x = 0; x < width; x++) + { + unsigned char r = data[index++]; + unsigned char g = data[index++]; + unsigned char b = data[index++]; + + if ( r != lastr || g != lastg || b != lastb ) + { + lastcolor.red = ( lastr << 8 ) + lastr ; + lastcolor.green = ( lastg << 8 ) + lastg ; + lastcolor.blue = ( lastb << 8 ) + lastb ; + RGBForeColor( &lastcolor ) ; + LineTo( x , y ) ; + lastr = r ; + lastg = g ; + lastb = b ; + } + } // for width + lastcolor.red = ( lastr << 8 ) + lastr ; + lastcolor.green = ( lastg << 8 ) + lastg ; + lastcolor.blue = ( lastb << 8 ) + lastb ; + RGBForeColor( &lastcolor ) ; + LineTo( width - 1 , y ) ; +#else + for (int x = 0; x < width; x++) + { + unsigned char r = data[index++]; + unsigned char g = data[index++]; + unsigned char b = data[index++]; + RGBColor color ; + color.red = ( r << 8 ) + r ; + color.green = ( g << 8 ) + g ; + color.blue = ( b << 8 ) + b ; + SetCPixel( x , y , &color ) ; + } +#endif + } // for height + + SetGWorld( origPort , origDevice ) ; + + return bitmap; + +} + +wxImage::wxImage( const wxBitmap &bitmap ) +{ + // check the bitmap + if( !bitmap.Ok() ) + { + wxFAIL_MSG( "invalid bitmap" ); + return; + } + + // create an wxImage object + int width = bitmap.GetWidth(); + int height = bitmap.GetHeight(); + Create( width, height ); + /* + unsigned char *data = GetData(); + if( !data ) + { + wxFAIL_MSG( "could not allocate data for image" ); + return; + } + + // calc the number of bytes per scanline and padding in the DIB + int bytePerLine = width*3; + int sizeDWORD = sizeof( DWORD ); + div_t lineBoundary = div( bytePerLine, sizeDWORD ); + int padding = 0; + if( lineBoundary.rem > 0 ) + { + padding = sizeDWORD - lineBoundary.rem; + bytePerLine += padding; + } + + // create a DIB header + int headersize = sizeof(BITMAPINFOHEADER); + LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize ); + if( !lpDIBh ) + { + wxFAIL_MSG( "could not allocate data for DIB header" ); + free( data ); + return; + } + // Fill in the DIB header + lpDIBh->bmiHeader.biSize = headersize; + lpDIBh->bmiHeader.biWidth = width; + lpDIBh->bmiHeader.biHeight = -height; + lpDIBh->bmiHeader.biSizeImage = bytePerLine * height; + lpDIBh->bmiHeader.biPlanes = 1; + lpDIBh->bmiHeader.biBitCount = 24; + lpDIBh->bmiHeader.biCompression = BI_RGB; + lpDIBh->bmiHeader.biClrUsed = 0; + // These seem not really needed for our purpose here. + lpDIBh->bmiHeader.biClrImportant = 0; + lpDIBh->bmiHeader.biXPelsPerMeter = 0; + lpDIBh->bmiHeader.biYPelsPerMeter = 0; + // memory for DIB data + unsigned char *lpBits; + lpBits = (unsigned char *) malloc( lpDIBh->bmiHeader.biSizeImage ); + if( !lpBits ) + { + wxFAIL_MSG( "could not allocate data for DIB" ); + free( data ); + free( lpDIBh ); + return; + } + + // copy data from the device-dependent bitmap to the DIB + HDC hdc = ::GetDC(NULL); + HBITMAP hbitmap; + hbitmap = (HBITMAP) bitmap.GetHBITMAP(); + ::GetDIBits( hdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS ); + + // copy DIB data into the wxImage object + int i, j; + unsigned char *ptdata = data; + unsigned char *ptbits = lpBits; + for( i=0; iGetMaskBitmap() ) + { + hbitmap = (HBITMAP) bitmap.GetMask()->GetMaskBitmap(); + // memory DC created, color set, data copied, and memory DC deleted + HDC memdc = ::CreateCompatibleDC( hdc ); + ::SetTextColor( memdc, RGB( 0, 0, 0 ) ); + ::SetBkColor( memdc, RGB( 255, 255, 255 ) ); + ::GetDIBits( memdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS ); + ::DeleteDC( memdc ); + // background color set to RGB(16,16,16) in consistent with wxGTK + unsigned char r=16, g=16, b=16; + ptdata = data; + ptbits = lpBits; + for( i=0; i 0 ) + { + *mimeType = m_strFileType ; + return TRUE ; + } + else + return FALSE; +} + +bool wxFileTypeImpl::GetIcon(wxIcon *icon) const +{ + // no such file type or no value or incorrect icon entry + return FALSE; +} + +bool wxFileTypeImpl::GetDescription(wxString *desc) const +{ + return FALSE; +} + +// extension -> file type +wxFileType * +wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e) +{ + wxString ext = e ; + ext = ext.Lower() ; + if ( ext == "txt" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("text/text"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "htm" || ext == "html" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("text/html"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "gif" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/gif"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "png" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/png"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "jpg" || ext == "jpeg" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/jpeg"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "bmp" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/bmp"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "tif" || ext == "tiff" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/tiff"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "xpm" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/xpm"); + fileType->m_impl->SetExt(ext); + return fileType; + } + else if ( ext == "xbm" ) + { + wxFileType *fileType = new wxFileType; + fileType->m_impl->SetFileType("image/xbm"); + fileType->m_impl->SetExt(ext); + return fileType; + } + // unknown extension + return NULL; +} + +// MIME type -> extension -> file type +wxFileType * +wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) +{ + return NULL; +} #else // Unix MailCapEntry * diff --git a/src/common/object.cpp b/src/common/object.cpp index 9f7e1913ee..44d3f3f3a6 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -138,7 +138,7 @@ void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum #endif // Cause problems for VC++ - crashes -#if !defined(__VISUALC__) && wxUSE_ARRAY_MEMORY_OPERATORS +#if (!defined(__VISUALC__) && wxUSE_ARRAY_MEMORY_OPERATORS ) || defined(__MWERKS__) void * wxObject::operator new[] (size_t size, wxChar * fileName, int lineNum) { return wxDebugAlloc(size, fileName, lineNum, TRUE, TRUE); diff --git a/src/common/resourc2.cpp b/src/common/resourc2.cpp index 42deac36a0..7774e5a7c5 100644 --- a/src/common/resourc2.cpp +++ b/src/common/resourc2.cpp @@ -1545,6 +1545,10 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, SetClientSize(sz.x, sz.y); wxPoint pt = ConvertDialogToPixels(wxPoint(x, y)); + #ifdef __WXMAC__ + int mbarheight = 2 * LMGetMBarHeight() ; + pt.y += mbarheight ; + #endif Move(pt.x, pt.y); } diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 83def5dbb7..e070a680b4 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -214,7 +214,11 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename) { wxExprDatabase db; +#ifdef __WXMAC__ + FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r"); +#else FILE *fd = fopen(filename.fn_str(), "r"); +#endif if (!fd) return FALSE; bool eof = FALSE; diff --git a/src/common/unzip.c b/src/common/unzip.c index ea45682d96..1cc334155f 100644 --- a/src/common/unzip.c +++ b/src/common/unzip.c @@ -351,6 +351,48 @@ local uLong unzlocal_SearchCentralDir(fin) return uPosFound; } +#ifdef __WXMAC__ +void wxUnix2MacFilename (char *s) ; +void +wxUnix2MacFilename (char *s) +{ + if (s) + { + if ( *s == '.' ) + { + // relative path , since it goes on with slash which is translated to a : + memmove( s , s+1 ,strlen( s ) ) ; + } + else if ( *s == '/' ) + { + // absolute path -> on mac just start with the drive name + memmove( s , s+1 ,strlen( s ) ) ; + } + else + { +// wxASSERT_MSG( 1 , "unkown path beginning" ) ; + } + while (*s) + { + if (*s == '/' || *s == '\\') + { + // convert any back-directory situations + if ( *(s+1) == '.' && *(s+2) == '.' && ( (*(s+3) == '/' || *(s+3) == '\\') ) ) + { + *s = ':'; + memmove( s+1 , s+3 ,strlen( s+3 ) + 1 ) ; + } + else + *s = ':'; + } + + s++ ; + } + } +} +extern char * wxBuffer ; +#endif + /* Open a Zip file. path contain the full pathname (by example, on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer @@ -381,7 +423,13 @@ extern unzFile ZEXPORT unzOpen (path) if (unz_copyright[0]!=' ') return NULL; +#ifdef __WXMAC__ + strcpy( wxBuffer , path ) ; + wxUnix2MacFilename( wxBuffer ) ; + fin=fopen(wxBuffer,"rb"); +#else fin=fopen(path,"rb"); +#endif if (fin==NULL) return NULL; diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 26181e21b2..a9f702acfd 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -119,8 +119,11 @@ void wxWindowBase::InitBase() m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_BTNFACE); m_foregroundColour = *wxBLACK; // TODO take this from sys settings too? +#ifndef __WXMAC__ m_font = *wxSWISS_FONT; // and this? - +#else + m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT); +#endif // no style bits m_windowStyle = 0; diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 0e6d33926f..7c52982517 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -23,6 +23,10 @@ #include "wx/listctrl.h" #include "wx/generic/imaglist.h" +#ifndef wxUSE_GENERIC_LIST_EXTENSIONS +#define wxUSE_GENERIC_LIST_EXTENSIONS 0 +#endif + //----------------------------------------------------------------------------- // wxListItemData //----------------------------------------------------------------------------- @@ -324,9 +328,10 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) wxString s; item->GetText( s ); if (s.IsNull()) s = "H"; - long lh; - dc->GetTextExtent( s, (long*) NULL, &lh ); + long lw,lh; + dc->GetTextExtent( s, &lw, &lh ); item->SetSize( item->GetWidth(), lh ); + m_bound_all.width += lw; m_bound_all.height = lh; node = node->Next(); } @@ -781,7 +786,17 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); PrepareDC( dc ); - +#if wxUSE_GENERIC_LIST_EXTENSIONS + if ( m_owner->GetMode() & wxLC_REPORT ) + { + int x , y ; + int xpix , ypix ; + + m_owner->GetScrollPixelsPerUnit( &xpix , &ypix ) ; + m_owner->ViewStart( &x, &y ) ; + dc.SetDeviceOrigin( -x * xpix, 0 ); + } +#endif dc.BeginDrawing(); dc.SetFont( GetFont() ); @@ -804,7 +819,12 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { m_owner->GetColumn( i, item ); int cw = item.m_width-2; +#if wxUSE_GENERIC_LIST_EXTENSIONS + if ((i+1 == numColumns) || ( dc.LogicalToDeviceX(x+item.m_width) > w-5)) + cw = dc.DeviceToLogicalX(w)-x-1; +#else if ((i+1 == numColumns) || (x+item.m_width > w-5)) cw = w-x-1; +#endif dc.SetPen( *wxWHITE_PEN ); DoDrawRect( &dc, x, y, cw, h-2 ); @@ -812,7 +832,11 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.DrawText( item.m_text, x+4, y+3 ); dc.DestroyClippingRegion(); x += item.m_width; +#if wxUSE_GENERIC_LIST_EXTENSIONS + if (dc.LogicalToDeviceX(x) > w+5) break; +#else if (x > w+5) break; +#endif } dc.EndDrawing(); } @@ -1016,6 +1040,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow) EVT_KEY_DOWN (wxListMainWindow::OnKeyDown) EVT_SET_FOCUS (wxListMainWindow::OnSetFocus) EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus) + EVT_SCROLLWIN (wxListMainWindow::OnScroll) END_EVENT_TABLE() wxListMainWindow::wxListMainWindow() @@ -1065,7 +1090,11 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id, if (m_mode & wxLC_REPORT) { +#if wxUSE_GENERIC_LIST_EXTENSIONS + m_xScroll = 15; +#else m_xScroll = 0; +#endif m_yScroll = 15; } else @@ -2082,7 +2111,11 @@ void wxListMainWindow::SetMode( long mode ) if (m_mode & wxLC_REPORT) { +#if wxUSE_GENERIC_LIST_EXTENSIONS + m_xScroll = 15; +#else m_xScroll = 0; +#endif m_yScroll = 15; } else @@ -2131,10 +2164,15 @@ void wxListMainWindow::CalculatePositions() int y = 1; int entireHeight = m_lines.Number() * lineSpacing + 2; int scroll_pos = GetScrollPos( wxVERTICAL ); + int x_scroll_pos = GetScrollPos( wxHORIZONTAL ); +#if wxUSE_GENERIC_LIST_EXTENSIONS +#else SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+15) / m_yScroll, 0, scroll_pos, TRUE ); +#endif GetClientSize( &clientWidth, &clientHeight ); wxNode* node = m_lines.First(); + int entireWidth = 0 ; while (node) { wxListLineData *line = (wxListLineData*)node->Data(); @@ -2146,10 +2184,17 @@ void wxListMainWindow::CalculatePositions() line->SetColumnPosition( i, col_x ); col_x += GetColumnWidth( i ); } + entireWidth = wxMax( entireWidth , col_x ) ; +#if wxUSE_GENERIC_LIST_EXTENSIONS + line->SetPosition( &dc, x, y, col_x ); +#endif y += lineSpacing; // one pixel blank line between items node = node->Next(); } - m_visibleLines = clientHeight / lineSpacing; + m_visibleLines = clientHeight / lineSpacing; +#if wxUSE_GENERIC_LIST_EXTENSIONS + SetScrollbars( m_xScroll, m_yScroll, entireWidth / m_xScroll , (entireHeight+15) / m_yScroll, x_scroll_pos , scroll_pos, TRUE ); +#endif } else { @@ -2439,6 +2484,25 @@ void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data ) m_lines.Sort( list_ctrl_compare_func_1 ); } +void wxListMainWindow::OnScroll(wxScrollWinEvent& event) +{ + wxScrolledWindow::OnScroll( event ) ; +#if wxUSE_GENERIC_LIST_EXTENSIONS + + if (event.GetOrientation() == wxHORIZONTAL && ( m_mode & wxLC_REPORT )) + { + wxListCtrl* lc = wxDynamicCast( GetParent() , wxListCtrl ) ; + if ( lc ) + { + lc->m_headerWin->Refresh() ; +#ifdef __WXMAC__ + lc->m_headerWin->MacUpdateImmediately() ; +#endif + } + } +#endif +} + // ------------------------------------------------------------------------------------- // wxListItem // ------------------------------------------------------------------------------------- diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index c6d34316e1..46f42696d9 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -227,6 +227,9 @@ wxProgressDialog::wxProgressDialog(wxString const &title, // Update the display (especially on X, GTK) wxYield(); + #ifdef __WXMAC__ + MacUpdateImmediately() ; + #endif } wxStaticText *wxProgressDialog::CreateLabel(const wxString& text, @@ -313,6 +316,9 @@ wxProgressDialog::Update(int value, const wxString& newmsg) // update the display wxYield(); } + #ifdef __WXMAC__ + MacUpdateImmediately() ; + #endif return m_state != Canceled; } diff --git a/src/generic/scrolwin.cpp b/src/generic/scrolwin.cpp index b3646bef6a..56eaf96415 100644 --- a/src/generic/scrolwin.cpp +++ b/src/generic/scrolwin.cpp @@ -153,7 +153,10 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, #ifdef __WXMSW__ // Necessary? - UpdateWindow ((HWND) GetHWND()); + UpdateWindow ((HWND) m_targetWindow->GetHWND()); +#endif +#ifdef __WXMAC__ + m_targetWindow->MacUpdateImmediately() ; #endif } @@ -213,6 +216,9 @@ void wxScrolledWindow::OnScroll(wxScrollWinEvent& event) else m_targetWindow->Refresh(); } +#ifdef __WXMAC__ + m_targetWindow->MacUpdateImmediately() ; +#endif } int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event) @@ -518,6 +524,9 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos ) #else // Refresh(); #endif +#ifdef __WXMAC__ + m_targetWindow->MacUpdateImmediately() ; +#endif } void wxScrolledWindow::EnableScrolling (bool x_scroll, bool y_scroll) diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index 00940d7e0e..98dc359b26 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -83,8 +83,9 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id, bool success = wxWindow::Create(parent, id, pos, size, style | wxTAB_TRAVERSAL, name); // Don't wish this to be found as a child +#ifndef __WXMAC__ parent->GetChildren().DeleteObject(this); - +#endif InitColours(); SetFont(m_defaultStatusBarFont); @@ -196,7 +197,7 @@ void wxStatusBar::DrawFieldText(wxDC& dc, int i) int xpos = rect.x + leftMargin; int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ; -#ifdef __WXGTK__ +#if defined( __WXGTK__ ) || defined(__WXMAC__) xpos++; ypos++; #endif diff --git a/src/mac/button.cpp b/src/mac/button.cpp index 826a7756d8..c2fad06673 100644 --- a/src/mac/button.cpp +++ b/src/mac/button.cpp @@ -74,6 +74,14 @@ wxSize wxButton::DoGetBestSize() return wxSize(wBtn, hBtn); } +wxSize wxButton::GetDefaultSize() +{ + int wBtn = 15 * 8 + 12 + 2 * 2; + int hBtn = 13 + 2 * 2; + + return wxSize(wBtn, hBtn); +} + void wxButton::Command (wxCommandEvent & event) { ProcessCommand (event); diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 826a7756d8..c2fad06673 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -74,6 +74,14 @@ wxSize wxButton::DoGetBestSize() return wxSize(wBtn, hBtn); } +wxSize wxButton::GetDefaultSize() +{ + int wBtn = 15 * 8 + 12 + 2 * 2; + int hBtn = 13 + 2 * 2; + + return wxSize(wBtn, hBtn); +} + void wxButton::Command (wxCommandEvent & event) { ProcessCommand (event); diff --git a/src/mac/carbon/clipbrd.cpp b/src/mac/carbon/clipbrd.cpp index 828b8984fc..36f4c0f4d9 100644 --- a/src/mac/carbon/clipbrd.cpp +++ b/src/mac/carbon/clipbrd.cpp @@ -23,6 +23,7 @@ #include +// open/close bool wxOpenClipboard() { return TRUE; @@ -30,54 +31,52 @@ bool wxOpenClipboard() bool wxCloseClipboard() { - return FALSE; + return TRUE; } -bool wxEmptyClipboard() +bool wxIsClipboardOpened() { - ZeroScrap() ; - return FALSE; + return TRUE; } -bool wxClipboardOpen() +// get/set data + +bool wxEmptyClipboard() { - // TODO - return FALSE; + ZeroScrap() ; + return TRUE; } -bool wxIsClipboardFormatAvailable(int dataFormat) +bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height) { - // TODO return FALSE; } -bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height) +void *wxGetClipboardData(wxDataFormat dataFormat, long *len) { - // TODO - return FALSE; + return NULL; } -wxObject *wxGetClipboardData(int dataFormat, long *len) + +// clipboard formats + +bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) { - // TODO - return NULL; + return FALSE; } -int wxEnumClipboardFormats(int dataFormat) +wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) { - // TODO - return 0; + return wxDataFormat(); } -int wxRegisterClipboardFormat(char *formatName) +int wxRegisterClipboardFormat(wxChar *formatName) { - // TODO return 0; } -bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount) +bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int maxCount) { - // TODO return FALSE; } @@ -85,6 +84,8 @@ bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount) * Generalized clipboard implementation by Matthew Flatt */ +IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) + wxClipboard::wxClipboard() { m_clearOnExit = FALSE; diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index e021274157..fe34b61a97 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -300,7 +300,7 @@ void wxDC::SetClippingRegion( long x, long y, long width, long height ) long x1 = XLOG2DEV(m_clipX1); long y1 = YLOG2DEV(m_clipY1); long x2 = XLOG2DEV(m_clipX2); - long y2 = XLOG2DEV(m_clipY2); + long y2 = YLOG2DEV(m_clipY2); Rect clip = { y1 , x1 , y2 , x2 } ; diff --git a/src/mac/carbon/dcclient.cpp b/src/mac/carbon/dcclient.cpp index 08aeff0504..b4155b572d 100644 --- a/src/mac/carbon/dcclient.cpp +++ b/src/mac/carbon/dcclient.cpp @@ -78,8 +78,8 @@ wxClientDC::wxClientDC(wxWindow *window) m_macPort = UMAGetWindowPort( windowref ) ; MacSetupPort() ; m_ok = TRUE ; - SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); - + SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); + SetFont( window->GetFont() ) ; } wxClientDC::~wxClientDC(void) @@ -108,6 +108,7 @@ wxPaintDC::wxPaintDC(wxWindow *window) window->GetUpdateRegion().GetBox( x , y , w , h ) ; SetClippingRegion( x , y , w , h ) ; SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); + SetFont(window->GetFont() ) ; } wxPaintDC::~wxPaintDC() diff --git a/src/mac/carbon/dialog.cpp b/src/mac/carbon/dialog.cpp index 304fbb915b..d0068bc451 100644 --- a/src/mac/carbon/dialog.cpp +++ b/src/mac/carbon/dialog.cpp @@ -369,6 +369,13 @@ void wxDialog::OnCancel(wxCommandEvent& event) } } +void wxDialog::OnPaint(wxPaintEvent& event) +{ + // No: if you call the default procedure, it makes + // the following painting code not work. +// wxWindow::OnPaint(event); +} + void wxDialog::OnCloseWindow(wxCloseEvent& event) { // We'll send a Cancel message by default, diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index 59b57e6cb5..6e98062322 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -490,9 +490,9 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } -void wxFrame::GetClientSize(int *x, int *y) const +void wxFrame::DoGetClientSize(int *x, int *y) const { - wxWindow::GetClientSize( x , y ) ; + wxWindow::DoGetClientSize( x , y ) ; if ( GetStatusBar() ) { diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 9d1220bc90..19b16e5fe7 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -562,8 +562,8 @@ void wxListBox::MacDoClick() int n, count = GetSelections(aSelections); if ( count > 0 ) { - event.m_commandInt = aSelections[0] ; - if ( HasClientObjectData() ) + n = aSelections[0]; + if ( HasClientObjectData() ) event.SetClientObject( GetClientObject(n) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(n) ); diff --git a/src/mac/carbon/mdi.cpp b/src/mac/carbon/mdi.cpp index de142a0e29..57862a20ff 100644 --- a/src/mac/carbon/mdi.cpp +++ b/src/mac/carbon/mdi.cpp @@ -75,9 +75,9 @@ wxMDIParentFrame::~wxMDIParentFrame() } // Get size *available for subwindows* i.e. excluding menu bar. -void wxMDIParentFrame::GetClientSize(int *x, int *y) const +void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const { - // TODO + wxFrame::DoGetClientSize( x , y ) ; } void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar) diff --git a/src/mac/carbon/scrolbar.cpp b/src/mac/carbon/scrolbar.cpp index a432b3e9b1..92d6dd1faf 100644 --- a/src/mac/carbon/scrolbar.cpp +++ b/src/mac/carbon/scrolbar.cpp @@ -152,6 +152,13 @@ void wxScrollBar::MacHandleControlClick( ControlHandle control , SInt16 controlp } event.SetPosition(new_pos); event.SetEventObject( this ); - GetEventHandler()->ProcessEvent(event); + wxWindow* window = GetParent() ; + if (window && window->MacIsWindowScrollbar(this) ) + { + // this is hardcoded + window->MacOnScroll(event); + } + else + GetEventHandler()->ProcessEvent(event); } diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index dbfb493a09..a9aec9174f 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) EVT_INIT_DIALOG(wxWindow::OnInitDialog) EVT_IDLE(wxWindow::OnIdle) +// EVT_SCROLL(wxWindow::OnScroll) END_EVENT_TABLE() #endif @@ -651,17 +652,14 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y, const wxFont *fontToUse = theFont; if ( !fontToUse ) fontToUse = &m_font; -/* - if ( x ) - *x = sizeRect.cx; - if ( y ) - *y = sizeRect.cy; - if ( descent ) - *descent = tm.tmDescent; - if ( externalLeading ) - *externalLeading = tm.tmExternalLeading; -*/ - + + wxClientDC dc( this ) ; + long lx,ly,ld,le ; + dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ; + *externalLeading = le ; + *descent = ld ; + *x = lx ; + *y = ly ; } void wxWindow::MacEraseBackground( Rect *rect ) @@ -968,6 +966,51 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) } } +void wxWindow::MacOnScroll(wxScrollEvent &event ) +{ + if ( event.m_eventObject == m_vScrollBar || event.m_eventObject == m_hScrollBar ) + { + wxScrollWinEvent wevent; + wevent.SetPosition(event.GetPosition()); + wevent.SetOrientation(event.GetOrientation()); + wevent.m_eventObject = this; + + switch ( event.m_eventType ) + { + case wxEVT_SCROLL_TOP: + wevent.m_eventType = wxEVT_SCROLLWIN_TOP; + break; + + case wxEVT_SCROLL_BOTTOM: + wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM; + break; + + case wxEVT_SCROLL_LINEUP: + wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP; + break; + + case wxEVT_SCROLL_LINEDOWN: + wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN; + break; + + case wxEVT_SCROLL_PAGEUP: + wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP; + break; + + case wxEVT_SCROLL_PAGEDOWN: + wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN; + break; + + case wxEVT_SCROLL_THUMBTRACK: + wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK; + break; + + } + + GetEventHandler()->ProcessEvent(wevent); + } +} + bool wxWindow::SetFont(const wxFont& font) { if ( !wxWindowBase::SetFont(font) ) @@ -1478,12 +1521,15 @@ void wxWindow::MacCreateScrollBars( long style ) { m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, wxPoint(m_width-MAC_SCROLLBAR_SIZE, 0), wxSize(MAC_SCROLLBAR_SIZE, m_height - adjust), wxVERTICAL); +// m_vScrollBar->PushEventHandler( this ) ; } if ( style & wxHSCROLL ) { m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, wxPoint(0 , m_height-MAC_SCROLLBAR_SIZE ), wxSize( m_width - adjust, MAC_SCROLLBAR_SIZE), wxHORIZONTAL); +// m_hScrollBar->PushEventHandler( this ) ; } + // because the create does not take into account the client area origin MacRepositionScrollBars() ; // we might have a real position shift } diff --git a/src/mac/clipbrd.cpp b/src/mac/clipbrd.cpp index 828b8984fc..36f4c0f4d9 100644 --- a/src/mac/clipbrd.cpp +++ b/src/mac/clipbrd.cpp @@ -23,6 +23,7 @@ #include +// open/close bool wxOpenClipboard() { return TRUE; @@ -30,54 +31,52 @@ bool wxOpenClipboard() bool wxCloseClipboard() { - return FALSE; + return TRUE; } -bool wxEmptyClipboard() +bool wxIsClipboardOpened() { - ZeroScrap() ; - return FALSE; + return TRUE; } -bool wxClipboardOpen() +// get/set data + +bool wxEmptyClipboard() { - // TODO - return FALSE; + ZeroScrap() ; + return TRUE; } -bool wxIsClipboardFormatAvailable(int dataFormat) +bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height) { - // TODO return FALSE; } -bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height) +void *wxGetClipboardData(wxDataFormat dataFormat, long *len) { - // TODO - return FALSE; + return NULL; } -wxObject *wxGetClipboardData(int dataFormat, long *len) + +// clipboard formats + +bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) { - // TODO - return NULL; + return FALSE; } -int wxEnumClipboardFormats(int dataFormat) +wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) { - // TODO - return 0; + return wxDataFormat(); } -int wxRegisterClipboardFormat(char *formatName) +int wxRegisterClipboardFormat(wxChar *formatName) { - // TODO return 0; } -bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount) +bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int maxCount) { - // TODO return FALSE; } @@ -85,6 +84,8 @@ bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount) * Generalized clipboard implementation by Matthew Flatt */ +IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) + wxClipboard::wxClipboard() { m_clearOnExit = FALSE; diff --git a/src/mac/dc.cpp b/src/mac/dc.cpp index e021274157..fe34b61a97 100644 --- a/src/mac/dc.cpp +++ b/src/mac/dc.cpp @@ -300,7 +300,7 @@ void wxDC::SetClippingRegion( long x, long y, long width, long height ) long x1 = XLOG2DEV(m_clipX1); long y1 = YLOG2DEV(m_clipY1); long x2 = XLOG2DEV(m_clipX2); - long y2 = XLOG2DEV(m_clipY2); + long y2 = YLOG2DEV(m_clipY2); Rect clip = { y1 , x1 , y2 , x2 } ; diff --git a/src/mac/dcclient.cpp b/src/mac/dcclient.cpp index 08aeff0504..b4155b572d 100644 --- a/src/mac/dcclient.cpp +++ b/src/mac/dcclient.cpp @@ -78,8 +78,8 @@ wxClientDC::wxClientDC(wxWindow *window) m_macPort = UMAGetWindowPort( windowref ) ; MacSetupPort() ; m_ok = TRUE ; - SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); - + SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); + SetFont( window->GetFont() ) ; } wxClientDC::~wxClientDC(void) @@ -108,6 +108,7 @@ wxPaintDC::wxPaintDC(wxWindow *window) window->GetUpdateRegion().GetBox( x , y , w , h ) ; SetClippingRegion( x , y , w , h ) ; SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); + SetFont(window->GetFont() ) ; } wxPaintDC::~wxPaintDC() diff --git a/src/mac/dialog.cpp b/src/mac/dialog.cpp index 304fbb915b..d0068bc451 100644 --- a/src/mac/dialog.cpp +++ b/src/mac/dialog.cpp @@ -369,6 +369,13 @@ void wxDialog::OnCancel(wxCommandEvent& event) } } +void wxDialog::OnPaint(wxPaintEvent& event) +{ + // No: if you call the default procedure, it makes + // the following painting code not work. +// wxWindow::OnPaint(event); +} + void wxDialog::OnCloseWindow(wxCloseEvent& event) { // We'll send a Cancel message by default, diff --git a/src/mac/frame.cpp b/src/mac/frame.cpp index 59b57e6cb5..6e98062322 100644 --- a/src/mac/frame.cpp +++ b/src/mac/frame.cpp @@ -490,9 +490,9 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } -void wxFrame::GetClientSize(int *x, int *y) const +void wxFrame::DoGetClientSize(int *x, int *y) const { - wxWindow::GetClientSize( x , y ) ; + wxWindow::DoGetClientSize( x , y ) ; if ( GetStatusBar() ) { diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index 9d1220bc90..19b16e5fe7 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -562,8 +562,8 @@ void wxListBox::MacDoClick() int n, count = GetSelections(aSelections); if ( count > 0 ) { - event.m_commandInt = aSelections[0] ; - if ( HasClientObjectData() ) + n = aSelections[0]; + if ( HasClientObjectData() ) event.SetClientObject( GetClientObject(n) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(n) ); diff --git a/src/mac/mdi.cpp b/src/mac/mdi.cpp index de142a0e29..57862a20ff 100644 --- a/src/mac/mdi.cpp +++ b/src/mac/mdi.cpp @@ -75,9 +75,9 @@ wxMDIParentFrame::~wxMDIParentFrame() } // Get size *available for subwindows* i.e. excluding menu bar. -void wxMDIParentFrame::GetClientSize(int *x, int *y) const +void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const { - // TODO + wxFrame::DoGetClientSize( x , y ) ; } void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar) diff --git a/src/mac/scrolbar.cpp b/src/mac/scrolbar.cpp index a432b3e9b1..92d6dd1faf 100644 --- a/src/mac/scrolbar.cpp +++ b/src/mac/scrolbar.cpp @@ -152,6 +152,13 @@ void wxScrollBar::MacHandleControlClick( ControlHandle control , SInt16 controlp } event.SetPosition(new_pos); event.SetEventObject( this ); - GetEventHandler()->ProcessEvent(event); + wxWindow* window = GetParent() ; + if (window && window->MacIsWindowScrollbar(this) ) + { + // this is hardcoded + window->MacOnScroll(event); + } + else + GetEventHandler()->ProcessEvent(event); } diff --git a/src/mac/window.cpp b/src/mac/window.cpp index dbfb493a09..a9aec9174f 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) EVT_INIT_DIALOG(wxWindow::OnInitDialog) EVT_IDLE(wxWindow::OnIdle) +// EVT_SCROLL(wxWindow::OnScroll) END_EVENT_TABLE() #endif @@ -651,17 +652,14 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y, const wxFont *fontToUse = theFont; if ( !fontToUse ) fontToUse = &m_font; -/* - if ( x ) - *x = sizeRect.cx; - if ( y ) - *y = sizeRect.cy; - if ( descent ) - *descent = tm.tmDescent; - if ( externalLeading ) - *externalLeading = tm.tmExternalLeading; -*/ - + + wxClientDC dc( this ) ; + long lx,ly,ld,le ; + dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ; + *externalLeading = le ; + *descent = ld ; + *x = lx ; + *y = ly ; } void wxWindow::MacEraseBackground( Rect *rect ) @@ -968,6 +966,51 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) } } +void wxWindow::MacOnScroll(wxScrollEvent &event ) +{ + if ( event.m_eventObject == m_vScrollBar || event.m_eventObject == m_hScrollBar ) + { + wxScrollWinEvent wevent; + wevent.SetPosition(event.GetPosition()); + wevent.SetOrientation(event.GetOrientation()); + wevent.m_eventObject = this; + + switch ( event.m_eventType ) + { + case wxEVT_SCROLL_TOP: + wevent.m_eventType = wxEVT_SCROLLWIN_TOP; + break; + + case wxEVT_SCROLL_BOTTOM: + wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM; + break; + + case wxEVT_SCROLL_LINEUP: + wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP; + break; + + case wxEVT_SCROLL_LINEDOWN: + wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN; + break; + + case wxEVT_SCROLL_PAGEUP: + wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP; + break; + + case wxEVT_SCROLL_PAGEDOWN: + wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN; + break; + + case wxEVT_SCROLL_THUMBTRACK: + wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK; + break; + + } + + GetEventHandler()->ProcessEvent(wevent); + } +} + bool wxWindow::SetFont(const wxFont& font) { if ( !wxWindowBase::SetFont(font) ) @@ -1478,12 +1521,15 @@ void wxWindow::MacCreateScrollBars( long style ) { m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, wxPoint(m_width-MAC_SCROLLBAR_SIZE, 0), wxSize(MAC_SCROLLBAR_SIZE, m_height - adjust), wxVERTICAL); +// m_vScrollBar->PushEventHandler( this ) ; } if ( style & wxHSCROLL ) { m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, wxPoint(0 , m_height-MAC_SCROLLBAR_SIZE ), wxSize( m_width - adjust, MAC_SCROLLBAR_SIZE), wxHORIZONTAL); +// m_hScrollBar->PushEventHandler( this ) ; } + // because the create does not take into account the client area origin MacRepositionScrollBars() ; // we might have a real position shift } -- 2.45.2