wxMac completed so far, generic listctrl extension
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8c651ab787
commit
7c74e7fe1d
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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 ;
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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 ) ;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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_
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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++
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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 *
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 wxIsClipboardOpened()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// get/set data
|
||||
|
||||
bool wxEmptyClipboard()
|
||||
{
|
||||
ZeroScrap() ;
|
||||
ZeroScrap() ;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxClipboardOpen()
|
||||
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxIsClipboardFormatAvailable(int dataFormat)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxObject *wxGetClipboardData(int dataFormat, long *len)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int wxEnumClipboardFormats(int dataFormat)
|
||||
|
||||
// clipboard formats
|
||||
|
||||
bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
|
||||
{
|
||||
return wxDataFormat();
|
||||
}
|
||||
|
||||
int wxRegisterClipboardFormat(wxChar *formatName)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxRegisterClipboardFormat(char *formatName)
|
||||
bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int maxCount)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxGetClipboardFormatName(int dataFormat, char *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;
|
||||
|
@ -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 } ;
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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,
|
||||
|
@ -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() )
|
||||
{
|
||||
|
@ -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) );
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 wxIsClipboardOpened()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// get/set data
|
||||
|
||||
bool wxEmptyClipboard()
|
||||
{
|
||||
ZeroScrap() ;
|
||||
ZeroScrap() ;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxSetClipboardData(wxDataFormat dataFormat,const void *data,int width , int height)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxClipboardOpen()
|
||||
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxIsClipboardFormatAvailable(int dataFormat)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxObject *wxGetClipboardData(int dataFormat, long *len)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int wxEnumClipboardFormats(int dataFormat)
|
||||
|
||||
// clipboard formats
|
||||
|
||||
bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
|
||||
{
|
||||
return wxDataFormat();
|
||||
}
|
||||
|
||||
int wxRegisterClipboardFormat(wxChar *formatName)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxRegisterClipboardFormat(char *formatName)
|
||||
bool wxGetClipboardFormatName(wxDataFormat dataFormat, wxChar *formatName, int maxCount)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxGetClipboardFormatName(int dataFormat, char *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;
|
||||
|
@ -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 } ;
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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,
|
||||
|
@ -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() )
|
||||
{
|
||||
|
@ -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) );
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user