]> git.saurik.com Git - wxWidgets.git/commitdiff
wxMac completed so far, generic listctrl extension
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 11 Nov 1999 16:11:14 +0000 (16:11 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 11 Nov 1999 16:11:14 +0000 (16:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

51 files changed:
include/wx/confbase.h
include/wx/dataobj.h
include/wx/defs.h
include/wx/fileconf.h
include/wx/generic/listctrl.h
include/wx/mac/font.h
include/wx/mac/frame.h
include/wx/mac/mdi.h
include/wx/mac/setup.h
include/wx/mac/window.h
include/wx/object.h
include/wx/os2/dataobj2.h
include/wx/string.h
samples/forty/card.cpp
src/common/cmndata.cpp
src/common/config.cpp
src/common/ffile.cpp
src/common/file.cpp
src/common/fileconf.cpp
src/common/filefn.cpp
src/common/image.cpp
src/common/mimetype.cpp
src/common/object.cpp
src/common/resourc2.cpp
src/common/resource.cpp
src/common/unzip.c
src/common/wincmn.cpp
src/generic/listctrl.cpp
src/generic/progdlgg.cpp
src/generic/scrolwin.cpp
src/generic/statusbr.cpp
src/mac/button.cpp
src/mac/carbon/button.cpp
src/mac/carbon/clipbrd.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcclient.cpp
src/mac/carbon/dialog.cpp
src/mac/carbon/frame.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/mdi.cpp
src/mac/carbon/scrolbar.cpp
src/mac/carbon/window.cpp
src/mac/clipbrd.cpp
src/mac/dc.cpp
src/mac/dcclient.cpp
src/mac/dialog.cpp
src/mac/frame.cpp
src/mac/listbox.cpp
src/mac/mdi.cpp
src/mac/scrolbar.cpp
src/mac/window.cpp

index 763235df8ae0c42e30fbe03b765631fa4eb3fe03..46336d3d6551188246001bc04f4d3c1e5fe0d6c5 100644 (file)
@@ -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;
index f12dbe67d6be8daca5147c3ab5fd8f5c56045f22..5d80b6f16e83da95bd84b8016dcff699789b2df4 100644 (file)
@@ -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
index 8a546d325d97562053ffc98d2dc27180611bb709..f567f81f72f5ba81a529eabe7d08413ab600e79d 100644 (file)
@@ -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
index 42da068138840637528803d9540bbea33c684be0..779dc8d4fa899bf7106ec36a31925ebfc9d00855 100644 (file)
@@ -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);
 
index 48418b1dc9935c90411f2dd46e58c00cceaf2d61..6d6c2a81c1f0a064161955c4743829daf1da5036 100644 (file)
@@ -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 );
index fb985307b717b1e5dbe52cb492d0a4ab6edbe68e..6b41fc9c61545ea0594bc5a2085fa5219210262d 100644 (file)
@@ -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)
index 5feb46e42f2c4cd9e9721d8064a48c8b7f655ba8..3d6a52941d6c7ed0c212feb152df462f52762e3f 100644 (file)
@@ -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
index fc3cf946034e707beace39fe5a71887b8ec1db3e..93038739f828047b7d5e7fb643c761ab19efad20 100644 (file)
@@ -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 ;
index 569e0ee255fd19eb67e4ddecf9fc874ec0256622..0a1df37e9a419ad9c2116e9ceb45d6cc6ffb322e 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
  
+#define WORDS_BIGENDIAN 1
+
 #define wxUSE_CONFIG           1
                                 // Use wxConfig, with CreateConfig in wxApp
 
                                   // 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.
 
index 66eba027a23125b3a1d85a2b1a0f8747c878e20b..3eac7270ce0774da4c916d133643780565a4908e 100644 (file)
@@ -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 ) ;
index 0b72a7243ac6070c6a22c02880efec4a61b8114d..f444b6786e79284b0d6c7de8ac8c77d4b89c65d5 100644 (file)
@@ -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
 
index a936e226e920d3485d589cc330d6bcda85a8cf0e..3108a1d37e8a3a9e00b0f67df529ce2551077628 100644 (file)
@@ -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_
 
index d7cc2549e67a642d6086256b07bc741ec87d04ed..7cd776c85fa0f4b7f1374564fc19cbffdc484c20 100644 (file)
@@ -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
index 37999de3ed26f478e7dda87a6c0a61a21d3c5f79..b74fcee8344224ef626dee11d4062a4059af853e 100644 (file)
@@ -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
index d6d38e477c9da956268a18ceb5043c0ab297cf31..045ff855563939604da7eddafbc42da3e97e7683 100644 (file)
@@ -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 )
        {
index f93307ed0f113c7934dbd2c58c9ce961c5b4ed9e..19822e46912a335c1d6efe3e886a9e76118683b5 100644 (file)
@@ -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++
index afbd6d14ea09967062081e1ce0bd193925a88709..4bca0e0e2e398f5eb68eefd12dc12caf747afa4b 100644 (file)
@@ -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 )
index 39e03cddf423a7f7a4476a8fecf305ca3fbecb51..89d17ff691b73ca7ba76ae720da8237a520f449c 100644 (file)
     #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
index d26dd662c746f1d7357cdd560ed17d5fd6cfd239..80b528c70e5ba51b1618a24886e3411b6e3b6ad4 100644 (file)
@@ -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
 }
 
 // ----------------------------------------------------------------------------
index 0c2e62e73636196debacb752ac7813fd9176d9ac..eae17729bc3dbc9d230ba283121a3433f911fdb2 100644 (file)
@@ -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
index bb9f59afc4ee33ef85dfec8eaec03734c08d2254..fa17d43fa05e272e5b04f799ca2af4a10cd5b51d 100644 (file)
@@ -1034,6 +1034,243 @@ wxImage::wxImage( const wxBitmap &bitmap )
 
 #endif
 
+#ifdef __WXMAC__
+
+#include <PictUtils.h>
+
+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; i<height; i++ )
+    {
+        for( j=0; j<width; j++ )
+        {
+            *(ptdata++) = *(ptbits+2);
+            *(ptdata++) = *(ptbits+1);
+            *(ptdata++) = *(ptbits  );
+            ptbits += 3;
+        }
+        ptbits += padding;
+    }  
+    
+    // similarly, set data according to the possible mask bitmap
+    if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
+    {
+        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<height; i++ )
+        {
+            for( j=0; j<width; j++ )
+            {
+                if( *ptbits != 0 )
+                    ptdata += 3;
+                else
+                {
+                    *(ptdata++)  = r;
+                    *(ptdata++)  = g;
+                    *(ptdata++)  = b;
+                }
+                ptbits += 3;
+            }
+            ptbits += padding;
+        }       
+        SetMaskColour( r, g, b );
+        SetMask( TRUE );
+    }  
+    else
+    {
+        SetMask( FALSE );
+    }  
+    // free allocated resources      
+    ::ReleaseDC(NULL, hdc);   
+    free(lpDIBh);
+    free(lpBits);
+    */
+}
+
+#endif
+
 //-----------------------------------------------------------------------------
 // GTK conversion routines
 //-----------------------------------------------------------------------------
index ca93f9561711329bbf866807396b6595e38ecc7c..796a19f06214f7ae9477693a4b7fe8af14540031 100644 (file)
@@ -146,6 +146,59 @@ private:
     wxArrayFileTypeInfo m_fallbacks;
 };
 
+#elif defined( __WXMAC__ )
+
+WX_DECLARE_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo);
+#include "wx/arrimpl.cpp"
+WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo);
+
+class wxMimeTypesManagerImpl
+{
+public :
+    wxMimeTypesManagerImpl() { }
+
+    // implement containing class functions
+    wxFileType *GetFileTypeFromExtension(const wxString& ext);
+    wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
+
+    // this are NOPs under MacOS
+    bool ReadMailcap(const wxString& filename, bool fallback = TRUE) { return TRUE; }
+    bool ReadMimeTypes(const wxString& filename) { return TRUE; }
+
+    void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
+
+private:
+    wxArrayFileTypeInfo m_fallbacks;
+};
+
+class wxFileTypeImpl
+{
+public:
+    // initialize us with our file type name
+    void SetFileType(const wxString& strFileType)
+        { m_strFileType = strFileType; }
+    void SetExt(const wxString& ext)
+        { m_ext = ext; }
+
+    // implement accessor functions
+    bool GetExtensions(wxArrayString& extensions);
+    bool GetMimeType(wxString *mimeType) const;
+    bool GetIcon(wxIcon *icon) const;
+    bool GetDescription(wxString *desc) const;
+    bool GetOpenCommand(wxString *openCmd,
+                        const wxFileType::MessageParameters&) const
+        { return GetCommand(openCmd, "open"); }
+    bool GetPrintCommand(wxString *printCmd,
+                         const wxFileType::MessageParameters&) const
+        { return GetCommand(printCmd, "print"); }
+
+private:
+    // helper function
+    bool GetCommand(wxString *command, const char *verb) const;
+
+    wxString m_strFileType, m_ext;
+};
+
 #else  // Unix
 
 // this class uses both mailcap and mime.types to gather information about file
@@ -876,6 +929,121 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
     return NULL;
 }
 
+#elif defined ( __WXMAC__ )
+
+
+bool wxFileTypeImpl::GetCommand(wxString *command, const char *verb) const
+{
+    return FALSE;
+}
+
+// @@ this function is half implemented
+bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
+{
+    return FALSE;
+}
+
+bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
+{
+       if ( m_strFileType.Length() > 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 *
index 9f7e1913ee85f2e3c83aa8bc7f12d9821c8a9878..44d3f3f3a6932f4658bc0837b797fce5a0851811 100644 (file)
@@ -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);
index 42deac36a0895214f6018e0287678195ce49ac4a..7774e5a7c51a6d61dbfab18caa03ceb5ad276e43 100644 (file)
@@ -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);
   }
 
index 83def5dbb7ed5a3f2df6aa74dd1b22c6e67d23ee..e070a680b4e8514dcd9ba0be1c96aefab3967cf9 100644 (file)
@@ -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;
index ea45682d966f2eabe5ce5b08c93b9adf3e9e98f8..1cc334155f2ca44c676984d23750e71abb5bb919 100644 (file)
@@ -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;
 
index 26181e21b21c92728be9f5e1a50e669c9a113acd..a9f702acfd5302368338b0a670741d31e061be9d 100644 (file)
@@ -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;
 
index 0e6d33926faa1c9bf5add05e23501eda97b8e18c..7c52982517302ed485959a9ca0dea417a5084102 100644 (file)
 #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
 // -------------------------------------------------------------------------------------
index c6d34316e1a84895cacb7b0a9da8449f8a414f5c..46f42696d98a7d58f1abe2e1641cf3365eef3346 100644 (file)
@@ -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;
 }
index b3646bef6a281ff495b364863716fdd3b0805e7f..56eaf96415720e27165e82a0aca27e898b410395 100644 (file)
@@ -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)
index 00940d7e0e7044eb4444d53b8f80c7e8e5370fdb..98dc359b260f7c2f59ec70d14f740dcdc3c56251 100644 (file)
@@ -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
index 826a7756d86cb156261f399a7c394f9ed0d3ba8d..c2fad066737765aa9bc4fca095c13e22cbb0ad15 100644 (file)
@@ -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);
index 826a7756d86cb156261f399a7c394f9ed0d3ba8d..c2fad066737765aa9bc4fca095c13e22cbb0ad15 100644 (file)
@@ -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);
index 828b8984fc19c28f31c0f6bb2368f19318918320..36f4c0f4d9e72a4450050f5a0a9877009d768a43 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+// 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;
index e021274157dd889050aae4946cd8a80b0fd1a2a3..fe34b61a97cd4adeb0fcaf30f15616bd93f630d5 100644 (file)
@@ -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 } ;
        
index 08aeff0504b08756924ad120d8b3b94c8ace8340..b4155b572dd7d7439d34543614805206476e5d39 100644 (file)
@@ -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()
index 304fbb915b46e17f0ea31e8395121483a879c0cf..d0068bc4516506fb96484f2aa1310485957b888f 100644 (file)
@@ -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,
index 59b57e6cb5e38ee1fb0fe618e6ee4aa373f541f8..6e980623227a8a9dff1ef80b47f26d6a7e8805c6 100644 (file)
@@ -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() )
   {
index 9d1220bc90afc1cefc3b4e3508156dbfdaca30b1..19b16e5fe79502249bd82cb45877222d63b6160f 100644 (file)
@@ -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) );
index de142a0e29cfdae69398bcc3ab27423e150066db..57862a20ffd9f937fdc7ec29c21921cc079add33 100644 (file)
@@ -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)
index a432b3e9b122d7542304fc72e50333712a16c4c8..92d6dd1fafe7b9b1f1c27a2b6774ab810d21420f 100644 (file)
@@ -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);
 }
 
index dbfb493a09f09f1dd0110640515febab404d4836..a9aec9174fab614bf0dc654801523bec21634285 100644 (file)
@@ -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
 }
index 828b8984fc19c28f31c0f6bb2368f19318918320..36f4c0f4d9e72a4450050f5a0a9877009d768a43 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+// 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;
index e021274157dd889050aae4946cd8a80b0fd1a2a3..fe34b61a97cd4adeb0fcaf30f15616bd93f630d5 100644 (file)
@@ -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 } ;
        
index 08aeff0504b08756924ad120d8b3b94c8ace8340..b4155b572dd7d7439d34543614805206476e5d39 100644 (file)
@@ -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()
index 304fbb915b46e17f0ea31e8395121483a879c0cf..d0068bc4516506fb96484f2aa1310485957b888f 100644 (file)
@@ -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,
index 59b57e6cb5e38ee1fb0fe618e6ee4aa373f541f8..6e980623227a8a9dff1ef80b47f26d6a7e8805c6 100644 (file)
@@ -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() )
   {
index 9d1220bc90afc1cefc3b4e3508156dbfdaca30b1..19b16e5fe79502249bd82cb45877222d63b6160f 100644 (file)
@@ -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) );
index de142a0e29cfdae69398bcc3ab27423e150066db..57862a20ffd9f937fdc7ec29c21921cc079add33 100644 (file)
@@ -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)
index a432b3e9b122d7542304fc72e50333712a16c4c8..92d6dd1fafe7b9b1f1c27a2b6774ab810d21420f 100644 (file)
@@ -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);
 }
 
index dbfb493a09f09f1dd0110640515febab404d4836..a9aec9174fab614bf0dc654801523bec21634285 100644 (file)
@@ -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
 }